Change caseType activityAsgmtGrps to store group name instead of id
authorColeman Watts <coleman@civicrm.org>
Mon, 21 Oct 2019 21:54:44 +0000 (17:54 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 11 Jan 2020 17:36:09 +0000 (12:36 -0500)
CRM/Case/BAO/CaseType.php
ang/crmCaseType/caseTypeDetails.html

index e8466a7f59bbccc9fcc7f20a9770a2623bf3dcc8..415a079a142001624fde6cecc5b764a84a3f5667 100644 (file)
@@ -234,6 +234,12 @@ class CRM_Case_BAO_CaseType extends CRM_Case_DAO_CaseType {
 
     if (isset($xml->ActivityAsgmtGrps)) {
       $definition['activityAsgmtGrps'] = (array) $xml->ActivityAsgmtGrps->Group;
+      // Backwards compat - convert group ids to group names if ids are supplied
+      if (array_filter($definition['activityAsgmtGrps'], ['\CRM_Utils_Rule', 'integer']) === $definition['activityAsgmtGrps']) {
+        foreach ($definition['activityAsgmtGrps'] as $idx => $group) {
+          $definition['activityAsgmtGrps'][$idx] = CRM_Core_DAO::getFieldValue('CRM_Contact_BAO_Group', $group);
+        }
+      }
     }
 
     // set activity types
index d11cc913c30604811727284dab98e429f6f77114..2bc30182eaaf90bee1692a2df4debd560850c017 100644 (file)
@@ -48,7 +48,7 @@ The original form used table layout; don't know if we have an alternative, CSS-b
           <input
             name="activityAsgmtGrps"
             crm-ui-id="caseTypeDetailForm.activityAsgmtGrps"
-            crm-entityref="{entity: 'Group', api: {params: {is_hidden: 0, is_active: 1}}, select: {allowClear: true, multiple: true, placeholder: ts('Select Group')}}"
+            crm-entityref="{entity: 'Group', api: {id_field: 'name', params: {is_hidden: 0, is_active: 1}}, select: {allowClear: true, multiple: true, placeholder: ts('Select Group')}}"
             ng-model="caseType.definition.activityAsgmtGrps"
           />
         </div>