From af88ad4170095cf67a9b168046eeabf3a75aa143 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 23 Aug 2019 15:24:37 +1200 Subject: [PATCH] Fix fatal when saving import mapping with a relationship but 'Primary' relationship type This occurs because the correct value to save for location_type_id of Primary is '' but the current code winds up casting to 0 which won't save as it there is a foreign key involved. Handling was previously added but only to the (duplicate) code that deals with non-relationship fields https://github.com/eileenmcnaughton/civicrm-core/blob/cd41fa5b5599b329bd6f54acf0a79dda85477804/CRM/Contact/Import/Form/MapField.php#L724 --- CRM/Contact/Import/Form/MapField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 8c0ef827ac..809b8837ff 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -700,7 +700,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { elseif (CRM_Utils_Array::value('1', $mapperKeys[$i]) == 'im') { $updateMappingFields->im_provider_id = isset($mapperKeys[$i][3]) ? $mapperKeys[$i][3] : NULL; } - $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; + $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) && is_numeric($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; } } else { -- 2.25.1