dev/core#1319 UI - different label for household and employer
authorSamuel Vanhove <samuel@symbiotic.coop>
Fri, 31 Jan 2020 16:33:29 +0000 (11:33 -0500)
committerSamuel Vanhove <samuel@symbiotic.coop>
Fri, 31 Jan 2020 16:33:29 +0000 (11:33 -0500)
CRM/Contact/Form/Edit/Address.php
templates/CRM/Contact/Form/ShareAddress.tpl

index 8d83f06a873811f60f5861f8dfecefc4ca8dd1e7..a1075f973fb7d501945ba1b5a4da9f37fef3892b 100644 (file)
@@ -170,7 +170,9 @@ class CRM_Contact_Form_Edit_Address {
       $form->addEntityRef("address[$blockId][master_contact_id]", ts('Share With'), ['create' => $profileLinks, 'api' => ['extra' => ['contact_type']]]);
 
       // do we want to update employer for shared address
-      $form->addElement('checkbox', "address[$blockId][add_relationship]", NULL, ts('Create a relationship with this contact'));
+      $employer_label = '<span class="addrel-employer">' . ts('Set this organization as current employer') . '</span>';
+      $household_label = '<span class="addrel-household">' . ts('Create a household member relationship with this contact') . '</span>';
+      $form->addElement('checkbox', "address[$blockId][add_relationship]", NULL, $employer_label . $household_label);
     }
   }
 
index c94e97353bbbae167669f948f56eb76a97178dd2..988923fd1a3aae02cbd3650b5c2261038409f74a 100644 (file)
@@ -57,6 +57,8 @@
       contactType = {/literal}{$contactType|@json_encode}{literal},
       $addRelationshipSection = $('#shared-address-' + blockNo + ' .shared-address-add-relationship'),
       $employerSection = $('#shared-address-' + blockNo + ' .shared-address-add-relationship .employer'),
+      $employerLabel = $('#shared-address-' + blockNo + ' .shared-address-add-relationship label .addrel-employer'),
+      $householdLabel = $('#shared-address-' + blockNo + ' .shared-address-add-relationship label .addrel-household'),
       $contentArea = $('#shared-address-' + blockNo + ' .shared-address-list'),
       $masterElement = $('input[name="address[' + blockNo + '][master_id]"]');
 
@@ -86,6 +88,8 @@
       if (!sharedContactId || isNaN(sharedContactId)) {
         $employerSection.hide();
         $addRelationshipSection.hide();
+        $employerLabel.hide();
+        $householdLabel.hide();
         return;
       }
 
       $addRelationshipSection.toggle(contactType === 'Individual' && (otherContactType === 'Organization' || otherContactType === 'Household'));
       $employerSection.toggle(contactType === 'Individual' && otherContactType === 'Organization');
 
+      // use the appropriate label
+      $employerLabel.toggle(contactType === 'Individual' && otherContactType === 'Organization');
+      $householdLabel.toggle(contactType === 'Individual' && otherContactType === 'Household');
+
+
       $.post(CRM.url('civicrm/ajax/inline'), {
           'contact_id': sharedContactId,
           'type': 'method',