From 4829da8c5ad114f38295044efb45cf51a4ab9ab3 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Sun, 1 Feb 2015 17:05:29 -0500 Subject: [PATCH] LP#1402797 Attempt to implement disabling tests for orgs in the magic dropdown Signed-off-by: Mike Rylander Signed-off-by: Bill Erickson --- .../staff/circ/share/t_hold_edit_pickup_lib.tt2 | 2 +- Open-ILS/web/js/ui/default/staff/circ/services/holds.js | 3 ++- Open-ILS/web/js/ui/default/staff/services/org.js | 16 ++++++++++++++++ Open-ILS/web/js/ui/default/staff/services/ui.js | 9 +++++++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 index 895cda0a57..b70b9ce16e 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 @@ -10,7 +10,7 @@
[% l('Select Library:') %]
- +
diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index 1ea2dc5484..af255b2541 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -198,7 +198,8 @@ function($modal , $q , egCore , egConfirmDialog , egAlertDialog) { controller : ['$scope', '$modalInstance', function($scope, $modalInstance) { - $scope.args = {} + $scope.can_be_pickup = egCore.org.CanHaveUsers; + $scope.args = {}; $scope.ok = function() { var vals = hold_ids.map(function(hold_id) { return { diff --git a/Open-ILS/web/js/ui/default/staff/services/org.js b/Open-ILS/web/js/ui/default/staff/services/org.js index 8ff71373f6..dd89d825b5 100644 --- a/Open-ILS/web/js/ui/default/staff/services/org.js +++ b/Open-ILS/web/js/ui/default/staff/services/org.js @@ -41,6 +41,22 @@ function($q, egEnv, egAuth, egNet) { return nodes; }; + // tests that a node can have users + service.CanHaveUsers = function(node_or_id) { + return Boolean(service + .get(node_or_id) + .ou_type() + .can_have_users()); + } + + // tests that a node can have volumes + service.CanHaveVolumes = function(node_or_id) { + return Boolean(service + .get(node_or_id) + .ou_type() + .can_have_vols()); + } + // list of org_unit objects or IDs for me + descendants service.descendants = function(node_or_id, as_id) { var node = service.get(node_or_id); diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 35e688738a..ca79115ef6 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -196,7 +196,12 @@ function($modal, $interpolate) { // Each org unit is passed into this function and, for // any org units where the response value is true, the // org unit will not be added to the selector. - hiddenTest : '=', + hiddenTest : '&', + + // Each org unit is passed into this function and, for + // any org units where the response value is true, the + // org unit will not be available for selection. + disableTest : '&', // Caller can either $watch(selected, ..) or register an // onchange handler. @@ -215,7 +220,7 @@ function($modal, $interpolate) { + '' + '