CRM-14798 - Allow editing case-type names even if malformed
authorTim Otten <totten@civicrm.org>
Tue, 12 Aug 2014 09:22:19 +0000 (02:22 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 12 Aug 2014 09:22:19 +0000 (02:22 -0700)
This is a follow-up to #3820

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

index 8f579356b1ea7bde5d2e85f080814a62b97918c9..fa68c64bf63003dc45ed5b4f9d4807718e765b58 100644 (file)
       }
     };
 
+    $scope.isValidName = function(name) {
+      return !name || name.match(/^[a-zA-Z0-9_]+$/);
+    };
+
     $scope.getWorkflowName = function(activitySet) {
       var result = 'Unknown';
       _.each($scope.workflows, function(value, key) {
index 8e84a394523c854e168b7318313d686a299a2330..3a24b86ee88380e9abdb557cb3844efb07fbdc92 100644 (file)
@@ -34,12 +34,14 @@ The original form used table layout; don't know if we have an alternative, CSS-b
         name="caseTypeName"
         ng-model="caseType.name"
         ng-disabled="locks.caseTypeName"
-        ng-pattern="/^[a-zA-Z0-9_]+$/"
         required
         class="big crm-form-text"/>
 
       <a crm-ui-lock binding="locks.caseTypeName"></a>
 
+      <div ng-show="!isValidName(caseType.name)">
+        <em>WARNING: The case type name includes deprecated characters.</em>
+      </div>
       <div ng-show="caseType.id && !locks.caseTypeName">
         <em>WARNING: If any external files or programs reference the old "Name", then they must be updated manually.</em>
       </div>