From d705d616ef0f6e07c803a8d16e30a8f9ba9f24c4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 14 Sep 2017 18:09:08 -0400 Subject: [PATCH] LP#1712637 Patron edit hold pickup location repairs 1. Allow setting the hold pickup location independant of the home library. 2. Disable org units in the pickup lib selector that are not viable hold pickup locations (can_have_vols=f) 3. Consistent w/ the XUL client, allow a patron to be created without selecting a default pickup location. To test: [1] Register a new patron and confirm pickup location is initialy unset. [2] Confirm pickup lib options are viable pickup locations. [3] Apply a pickup location different from the home library and confirm the home library selector remains unchanged. [4] Confirm saving the patron applies the expected pickup location value. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 | 8 +++++--- .../web/js/ui/default/staff/circ/patron/regctl.js | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index 3aeb43aff4..0ac72181b4 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -581,9 +581,11 @@ within the "form" by name for validation.
- + +
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 91e606770b..728f1764a8 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -1157,7 +1157,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , } $scope.hold_notify_type.phone = true; $scope.hold_notify_type.email = true; - $scope.hold_notify_type.sms = false; + $scope.hold_notify_type.sms = false; // staged users may be loaded w/ a profile. $scope.set_expire_date(); @@ -1228,6 +1228,13 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , $scope.user_settings = prs.user_settings; prs.user_settings = {}; + // If a default pickup lib is applied to the patron, apply it + // to the UI at page load time. Otherwise, leave the value unset. + if ($scope.user_settings['opac.default_pickup_location']) { + $scope.patron._pickup_lib = egCore.org.get( + $scope.user_settings['opac.default_pickup_location']); + } + extract_hold_notify(); if ($scope.patron.isnew) set_new_patron_defaults(prs); @@ -1653,6 +1660,11 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , }); } + $scope.handle_pulib_changed = function(org) { + if (!$scope.user_settings) return; // still rendering + $scope.user_settings['opac.default_pickup_location'] = org.id(); + } + // This is called with every character typed in a form field, // since that's the only way to gaurantee something has changed. // See handle_field_changed for ng-change vs. ng-blur. @@ -1784,6 +1796,12 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , ); } + // returns true (disable) for orgs that cannot have vols (for holds pickup) + $scope.disable_pulib = function(org_id) { + if (!org_id) return; + return !egCore.org.CanHaveVolumes(org_id); + } + // Returns true if the Save and Save & Clone buttons should be disabled. $scope.edit_passthru.hide_save_actions = function() { return $scope.patron.isnew ? -- 2.11.0