From ff83ed982355101360e7c77ad509ce32b9a40d2b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 16 Aug 2022 10:36:56 +1200 Subject: [PATCH] Remove last usage of _fields --- CRM/Import/Parser.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index f862d8715b..07134ad07a 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -496,11 +496,9 @@ abstract class CRM_Import_Parser implements UserJobInterface { public function getSelectTypes() { $values = []; // This is only called from the MapField form in isolation now, - // so we need to set the metadata. - $this->init(); - foreach ($this->_fields as $name => $field) { - if (isset($field->_hasLocationType)) { - $values[$name] = $field->_hasLocationType; + foreach ($this->getFieldsMetadata() as $name => $field) { + if (isset($field['hasLocationType'])) { + $values[$name] = TRUE; } } return $values; @@ -1801,6 +1799,19 @@ abstract class CRM_Import_Parser implements UserJobInterface { $this->setFieldMetadata(); } + /** + * Get metadata for all importable fields. + * + * @return array + */ + protected function getFieldsMetadata() : array { + if (empty($this->importableFieldsMetadata)) { + unset($this->userJob); + $this->setFieldMetadata(); + } + return $this->importableFieldsMetadata; + } + /** * @param array $mappedField * Field detail as would be saved in field_mapping table -- 2.25.1