dev/core#670 - Fix saving of tags in case activity
authorDebarshi Bhaumik <deb1990@gmail.com>
Fri, 18 Jan 2019 06:36:23 +0000 (12:06 +0530)
committerDebarshi Bhaumik <deb1990@gmail.com>
Mon, 21 Jan 2019 07:30:04 +0000 (13:00 +0530)
CRM/Activity/Form/Activity.php
CRM/Case/Form/Activity.php

index 08c19283886b3a209809251eb0114882c30c0e88..3148c1ce7d2ebd49d327490f3efe67ecfee00863 100644 (file)
@@ -1066,9 +1066,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       if (!is_array($params['tag'])) {
         $params['tag'] = explode(',', $params['tag']);
       }
-      foreach ($params['tag'] as $tag) {
-        $tagParams[$tag] = 1;
-      }
+
+      $tagParams = array_fill_keys($params['tag'], 1);
     }
 
     // Save static tags.
index a1f6809ec3b5a2a15ae131ce5a84fd92be6e75db..6e602a3975ffab5a65760f5b986a19cfd15f0189 100644 (file)
@@ -543,9 +543,11 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
         // add tags if exists
         $tagParams = array();
         if (!empty($params['tag'])) {
-          foreach ($params['tag'] as $tag) {
-            $tagParams[$tag] = 1;
+          if (!is_array($params['tag'])) {
+            $params['tag'] = explode(',', $params['tag']);
           }
+
+          $tagParams = array_fill_keys($params['tag'], 1);
         }
 
         //save static tags