From bcccbf03c9631558c050372507d3560fee3009c9 Mon Sep 17 00:00:00 2001 From: Josh Stompro Date: Tue, 28 Jan 2020 10:04:02 -0600 Subject: [PATCH] LP#1783793 - Suspend holds when activation date set in web client angularjs 1. Modify Dates popup changed to not allow picking dates in the past for hold activation date both in the date picker, and if typed in manually. If a date in the past is typed in, it is changed to today's date and an alert message is displayed. The date picker just won't allow past days to be selected. The alert message remains until a date in the future is selected. 2. Suspend holds when the activation date is set and saved. 3. Adds a note about the fact that the hold will be suspended when the hold activation date is selected for editing. This makes the behavior clear so staff don't have to figure it out by trial and error. 4. Updates several sr-only (Screen Reader Only) labels in the holds date popup template that were set to the wrong values. The file was copied from the hold notification popup and the screen reader descriptions were left unchanged from those values. Signed-off-by: Josh Stompro Signed-off-by: Terran McCanna Signed-off-by: Galen Charlton --- .../src/templates/staff/circ/share/t_hold_dates.tt2 | 13 +++++++++---- .../web/js/ui/default/staff/circ/services/holds.js | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 index 3c25872f56..9aea27fb0a 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 @@ -15,7 +15,7 @@
- +
@@ -23,13 +23,18 @@
+ ng-disabled="!args.modify_thaw_date" ng-model="args.thaw_date" min-date="minDate"> +

[% l('Setting an activation date will also suspend hold.') %] +

+

+ [% l('Activation dates in the past not allowed, resetting to today!') %] +

- +
@@ -57,7 +62,7 @@
- +
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 dcc1d11e6c..0ae837aef7 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 @@ -305,8 +305,13 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) { angular.forEach( ['thaw_date', 'request_time', 'expire_time', 'shelf_expire_time'], function(field) { - if (modal_scope.args['modify_' + field]) + if (modal_scope.args['modify_' + field]) { val[field] = modal_scope.args[field].toISOString(); + if (field === 'thaw_date') { + //If we are setting the thaw_date, freeze the hold. + val['frozen'] = true; + } + } } ); @@ -335,6 +340,17 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) { relay_to_update($scope).then($uibModalInstance.close); } $scope.cancel = function() { $uibModalInstance.dismiss() } + $scope.minDate = new Date(); + //watch for changes to the hold dates, and perform validations + $scope.$watch('args', function(newValue,oldValue,scope) { + if (newValue['thaw_date'] && newValue['thaw_date'] < today) { + $scope.args['thaw_date'] = today; + $scope.args.thaw_date_error = true; + } + if (newValue['thaw_date'] && newValue['thaw_date'] > today) { + $scope.args.thaw_date_error = false; + } + }, true); } ], }).result; -- 2.11.0