CRM-15166 - crmCaseType/timelineTable.html - Don't allow removal of the standard...
authorTim Otten <totten@civicrm.org>
Thu, 21 Aug 2014 21:21:10 +0000 (14:21 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 22 Aug 2014 01:44:38 +0000 (18:44 -0700)
Note: If (for some bizarre/erroneous reason) an admin added the "Open Case" activity to another
timeline, then it would be reasonable to delete it.

js/angular-crmCaseType.js
partials/crmCaseType/timelineTable.html

index 78847f6bcf63195174cae41fcd8958cf57b0e1aa..bc329bcd5b5ba0495697048ebbb4411e5f3868dd 100644 (file)
       }
     };
 
+    $scope.isActivityRemovable = function(activitySet, activity) {
+      if (activitySet.name == 'standard_timeline' && activity.name == 'Open Case') {
+        return false;
+      } else {
+        return true;
+      }
+    };
+
     $scope.isValidName = function(name) {
       return !name || name.match(/^[a-zA-Z0-9_]+$/);
     };
index 621b9da12ba4e9d55906a58787f91765646a1daf..824629527f4376f44899d0fee2ca4f8540dfcac0 100644 (file)
@@ -63,7 +63,9 @@ Required vars: activitySet
       </select>
     </td>
     <td>
-      <a class="crm-hover-button" ng-click="removeItem(activitySet.activityTypes, activity)">
+      <a class="crm-hover-button"
+         ng-show="isActivityRemovable(activitySet, activity)"
+         ng-click="removeItem(activitySet.activityTypes, activity)">
         <span class="icon delete-icon" title="Remove"></span>
       </a>
     </td>