Merge pull request #22152 from eileenmcnaughton/n1
[civicrm-core.git] / CRM / Utils / Address.php
index 6e1eb1c61bde0394580a293bad3897a55946e6f0..5b8331ec6029ba27b00689eb25bc6237adca9e33 100644 (file)
@@ -59,7 +59,7 @@ class CRM_Utils_Address {
 
     $formatted = $format;
 
-    $fullPostalCode = CRM_Utils_Array::value('postal_code', $fields);
+    $fullPostalCode = $fields['postal_code'] ?? NULL;
     if (!empty($fields['postal_code_suffix'])) {
       $fullPostalCode .= "-$fields[postal_code_suffix]";
     }
@@ -141,8 +141,8 @@ class CRM_Utils_Address {
         'contact.contact_source' => $fields['contact_source'] ?? NULL,
         'contact.external_identifier' => $fields['external_identifier'] ?? NULL,
         'contact.contact_id' => $fields['id'] ?? NULL,
-        'contact.household_name' => $fields['display_name'] ?? NULL,
-        'contact.organization_name' => $fields['display_name'] ?? NULL,
+        'contact.household_name' => $fields['household_name'] ?? NULL,
+        'contact.organization_name' => $fields['organization_name'] ?? NULL,
         'contact.legal_name' => $fields['legal_name'] ?? NULL,
         'contact.preferred_communication_method' => $fields['preferred_communication_method'] ?? NULL,
         'contact.communication_style' => $fields['communication_style'] ?? NULL,
@@ -194,7 +194,7 @@ class CRM_Utils_Address {
     // also sub all token fields
     if ($tokenFields) {
       foreach ($tokenFields as $token) {
-        $replacements["{$token}"] = CRM_Utils_Array::value("{$token}", $fields);
+        $replacements["{$token}"] = $fields["{$token}"] ?? NULL;
       }
     }
 
@@ -320,7 +320,7 @@ class CRM_Utils_Address {
 
     $addressFields = [];
     foreach ($addressParts as $name => $field) {
-      $value = CRM_Utils_Array::value($field, $params);
+      $value = $params[$field] ?? NULL;
       $alternateName = 'billing_' . $name . '_id-' . $billingLocationTypeID;
       $alternate2 = 'billing_' . $name . '-' . $billingLocationTypeID;
       if (isset($params[$alternate2]) && !isset($params[$alternateName])) {