From: Eileen McNaughton Date: Mon, 9 Jan 2023 20:42:27 +0000 (+1300) Subject: Remove usages of dataValues, + unused function that calls it X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3310b2168303a7c73f373d3b14f639d9997ce45e;p=civicrm-core.git Remove usages of dataValues, + unused function that calls it --- diff --git a/CRM/Import/Form/MapField.php b/CRM/Import/Form/MapField.php index 6ac7669e24..3ab882d2d1 100644 --- a/CRM/Import/Form/MapField.php +++ b/CRM/Import/Form/MapField.php @@ -24,13 +24,6 @@ use Civi\Api4\MappingField; */ abstract class CRM_Import_Form_MapField extends CRM_Import_Forms { - /** - * Cache of preview data values - * - * @var array - */ - protected $_dataValues; - /** * Mapper fields * @@ -134,46 +127,6 @@ abstract class CRM_Import_Form_MapField extends CRM_Import_Forms { return ''; } - /** - * Guess at the field names given the data and patterns from the schema. - * - * @param array $patterns - * @param string $index - * - * @return string - */ - public function defaultFromData($patterns, $index) { - $best = ''; - $bestHits = 0; - $n = count($this->_dataValues); - - foreach ($patterns as $key => $re) { - // Skip empty key/patterns - if (!$key || !$re || strlen("$re") < 5) { - continue; - } - - /* Take a vote over the preview data set */ - $hits = 0; - for ($i = 0; $i < $n; $i++) { - if (isset($this->_dataValues[$i][$index])) { - if (preg_match($re, $this->_dataValues[$i][$index])) { - $hits++; - } - } - } - if ($hits > $bestHits) { - $bestHits = $hits; - $best = $key; - } - } - - if ($best != '') { - $this->_fieldUsed[$best] = TRUE; - } - return $best; - } - /** * Add the saved mapping fields to the form. * diff --git a/CRM/Import/Forms.php b/CRM/Import/Forms.php index 8a72c3eae2..4c024ba234 100644 --- a/CRM/Import/Forms.php +++ b/CRM/Import/Forms.php @@ -678,11 +678,10 @@ class CRM_Import_Forms extends CRM_Core_Form { */ protected function assignMapFieldVariables(): void { $this->addExpectedSmartyVariables(['highlightedRelFields', 'initHideBoxes']); - $this->_dataValues = array_values($this->getDataRows([], 2)); $this->assign('columnNames', $this->getColumnHeaders()); $this->assign('showColumnNames', $this->getSubmittedValue('skipColumnHeader') || $this->getSubmittedValue('dataSource') !== 'CRM_Import_DataSource'); $this->assign('highlightedFields', $this->getHighlightedFields()); - $this->assign('dataValues', $this->_dataValues); + $this->assign('dataValues', array_values($this->getDataRows([], 2))); } /**