Ensure masterAddress is always assigned
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 14 Nov 2021 18:31:16 +0000 (07:31 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 14 Nov 2021 18:31:16 +0000 (07:31 +1300)
CRM/Contact/Form/Edit/Address.php
templates/CRM/Contact/Form/Edit/Address.tpl

index 105ef33ce3ccd1939294d3fdb1a05e3ed3444c16..6931364f86946e164eb46baf6b40134d3d52f9e1 100644 (file)
@@ -231,6 +231,9 @@ class CRM_Contact_Form_Edit_Address {
    */
   public static function setDefaultValues(&$defaults, &$form) {
     $addressValues = [];
+    // Actual values will be assigned to these below if there are some.
+    $form->assign('masterAddress');
+    $form->assign('sharedAddresses', []);
     if (isset($defaults['address']) && is_array($defaults['address']) &&
       !CRM_Utils_System::isNull($defaults['address'])
     ) {
index 3c4fc4df1c5d222b48a0773d90228a2cd0eb8975..ebb535da76fc61c324b6b998c1d7cea3cedc4c34 100644 (file)
@@ -22,7 +22,7 @@
  <div id="Address_Block_{$blockId}" {if $className eq 'CRM_Contact_Form_Contact'} class="boxBlock crm-edit-address-block crm-address_{$blockId}"{/if}>
   {if $blockId gt 1}<fieldset><legend>{ts}Supplemental Address{/ts}</legend>{/if}
   <table class="form-layout-compressed crm-edit-address-form">
-     {if isset($masterAddress) && $masterAddress.$blockId gt 0 }
+     {if $masterAddress && $masterAddress.$blockId gt 0 }
         <tr><td><div class="message status">{icon icon="fa-info-circle"}{/icon} {ts 1=$masterAddress.$blockId}This address is shared with %1 contact record(s). Modifying this address will automatically update the shared address for these contacts.{/ts}</div></td></tr>
      {/if}