From 01c3c5aeb2d3a84d4bf6b9f72c77d3f14f1bb063 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 26 Sep 2023 08:41:41 +1300 Subject: [PATCH] Ensure no hard fail if field not defined #66 --- CRM/Csvimport/Import/Parser/Api.php | 6 +++--- csvimport.civix.php | 4 ++-- info.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CRM/Csvimport/Import/Parser/Api.php b/CRM/Csvimport/Import/Parser/Api.php index 2914017..e75772a 100644 --- a/CRM/Csvimport/Import/Parser/Api.php +++ b/CRM/Csvimport/Import/Parser/Api.php @@ -126,14 +126,14 @@ protected function getReferenceFields(): array { if (count($fieldsInUniqueIndex) === 1) { $indexFieldName = $fieldsInUniqueIndex[0]; - + // skip special case fields (such as the address.external_identifier) if (empty($entityFieldMetadata[$indexFieldName])) { continue; } - + $indexFieldMetadata = array_merge( - $entityFieldMetadata[$indexFieldName], [ + (array) $entityFieldMetadata[$indexFieldName], [ 'referenced_field' => $referenceField, 'entity_name' => $entityName, 'entity_field_name' => $indexFieldName, diff --git a/csvimport.civix.php b/csvimport.civix.php index 7a75f67..2ae8ebe 100644 --- a/csvimport.civix.php +++ b/csvimport.civix.php @@ -133,8 +133,8 @@ function _csvimport_civix_insert_navigation_menu(&$menu, $path, $item) { if (empty($path)) { $menu[] = [ 'attributes' => array_merge([ - 'label' => CRM_Utils_Array::value('name', $item), - 'active' => 1, + 'label' => $item['name'] ?? NULL, + 'active' => 1, ], $item), ]; return TRUE; diff --git a/info.xml b/info.xml index bb77767..762839b 100644 --- a/info.xml +++ b/info.xml @@ -28,7 +28,7 @@ CRM/Csvimport - 23.02.0 + 23.02.1 menu-xml@1.0.0