LP#1720345: ensure egEditFmRecord's customFieldTemplates is optional
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 29 Sep 2017 13:33:33 +0000 (09:33 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 29 Sep 2017 13:44:32 +0000 (09:44 -0400)
This patch ensures that the custom-field-templates attribute of
the eg-edit-fm-record directive is strictly optional, fixing a
regression for instances of that directive that don't need that
attribute.

To test
-------
[1] Apply the patch.
[2] Verify that the Server Administration | Copy Tag Types and
    and Local Administration | Copy Tags admin interfaces
    allow you to create and edit values.
[3] Verify that the Serials Administration | Prediction
    Pattern Templates interface continues to work.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/services/fm_record_editor.js

index 2e08c07..4cb38e5 100644 (file)
@@ -22,7 +22,7 @@ angular.module('egFmRecordEditorMod',
             //              field value using rec_flat[field.name]
             //   handlers - any functions you want to pass
             //              in to the custom template
-            customFieldTemplates : '=',
+            customFieldTemplates : '=?',
 
             // comma-separated list of fields that should not be
             // displayed
@@ -191,7 +191,7 @@ angular.module('egFmRecordEditorMod',
                         }
                         field.org_default_allowed = (field.name in $scope.org_default_allowed);
                     }
-                    if (field.name in $scope.customFieldTemplates) {
+                    if (angular.isObject($scope.customFieldTemplates) && (field.name in $scope.customFieldTemplates)) {
                         field.use_custom_template = true;
                         field.custom_template = $scope.customFieldTemplates[field.name].template;
                         field.handlers = $scope.customFieldTemplates[field.name].handlers;