CRM-15097 - crmCaseType - If a case-type isn't forkable, then don't allow editing...
authorTim Otten <totten@civicrm.org>
Tue, 12 Aug 2014 07:07:49 +0000 (00:07 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 12 Aug 2014 08:17:21 +0000 (01:17 -0700)
js/angular-crmCaseType.js
partials/crmCaseType/edit.html

index 8f579356b1ea7bde5d2e85f080814a62b97918c9..3238260a7a27261faf0698636ceb62b76f76a5a4 100644 (file)
       }
     };
 
+    $scope.isForkable = function() {
+      return !$scope.caseType.id || $scope.caseType.is_forkable
+    };
+
     $scope.isNewActivitySetAllowed = function(workflow) {
       switch (workflow) {
         case 'timeline':
     };
     $scope.$watch('locks.caseTypeName', updateCaseTypeName);
     $scope.$watch('caseType.title', updateCaseTypeName);
+
+    if (!$scope.isForkable()) {
+      CRM.alert(ts('The CiviCase XML file for this case-type prohibits editing the definition.'));
+    }
   });
 
   crmCaseType.controller('CaseTypeListCtrl', function($scope, crmApi, caseTypes) {
index 8fed0ebed48746d3c72b960e6ea35ef4e196ce1d..987223201c2a5a3c5c30ad0c4d7d36990c56a849 100644 (file)
@@ -15,13 +15,13 @@ Required vars: caseType
 
   <div ng-include="partialUrl('caseTypeDetails.html')"></div>
 
-  <h2>Roles</h2>
+  <h2 ng-show="isForkable()">Roles</h2>
 
-  <div ng-include="partialUrl('rolesTable.html')"></div>
+  <div ng-show="isForkable()" ng-include="partialUrl('rolesTable.html')"></div>
 
-  <h2>Activities</h2>
+  <h2 ng-show="isForkable()">Activities</h2>
 
-  <div class="crmCaseType-acttab" ui-jq="tabs" ui-options="{show: true, hide: true}">
+  <div ng-show="isForkable()" class="crmCaseType-acttab" ui-jq="tabs" ui-options="{show: true, hide: true}">
     <ul>
       <li><a href="#acttab-actType">Activity Types</a></li>
       <li ng-repeat="activitySet in caseType.definition.activitySets">