From: Galen Charlton Date: Fri, 7 Jul 2017 21:01:43 +0000 (-0400) Subject: webstaff: teach egEditFmRecord when to allow OU to default to WS OU X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a13c6c7177cda2667da319b302eb0a63aea0c240;p=working%2FEvergreen.git webstaff: teach egEditFmRecord when to allow OU to default to WS OU Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/share/t_fm_record_editor.tt2 b/Open-ILS/src/templates/staff/share/t_fm_record_editor.tt2 index 38f3ea81d4..cd103c9b66 100644 --- a/Open-ILS/src/templates/staff/share/t_fm_record_editor.tt2 +++ b/Open-ILS/src/templates/staff/share/t_fm_record_editor.tt2 @@ -52,10 +52,14 @@ ng-model-options="{ getterSetter : true }"> - + + diff --git a/Open-ILS/web/js/ui/default/staff/services/fm_record_editor.js b/Open-ILS/web/js/ui/default/staff/services/fm_record_editor.js index 5c62eb3fca..7d16e1d5cd 100644 --- a/Open-ILS/web/js/ui/default/staff/services/fm_record_editor.js +++ b/Open-ILS/web/js/ui/default/staff/services/fm_record_editor.js @@ -36,6 +36,10 @@ angular.module('egFmRecordEditorMod', // supplements what the IDL considers required requiredFields : '@', + // comma-separated list of org_unit fields where + // the selector should default to the workstation OU + orgDefaultAllowed : '@', + // hash, keyed by field name, of functions to invoke // to check whether a field is required. Each // callback is passed the field name and the record @@ -79,6 +83,7 @@ angular.module('egFmRecordEditorMod', $scope.required = list_to_hash($scope.requiredFields); $scope.readonly = list_to_hash($scope.readonlyFields); $scope.hidden = list_to_hash($scope.hiddenFields); + $scope.org_default_allowed = list_to_hash($scope.orgDefaultAllowed); $scope.record_label = egCore.idl.classes[$scope.idlClass].label; $scope.rec_orgs = {}; @@ -180,6 +185,7 @@ angular.module('egFmRecordEditorMod', if ($scope.rec[field.name]()) { $scope.rec_org_values[field.name] = $scope.rec_orgs[field.name](); } + field.org_default_allowed = (field.name in $scope.org_default_allowed); } if (field.name in $scope.customFieldTemplates) { field.use_custom_template = true;