From db6a5a5ad4cc11f2271bee504048bc35eac41342 Mon Sep 17 00:00:00 2001 From: Katlyn Beck Date: Mon, 26 Nov 2018 21:23:48 +0000 Subject: [PATCH] lp1712644 Prevent check out due date in past - Prevents selecting past due date when checking out an item Signed-off-by: Katlyn Beck Changes to be committed: modified: Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 modified: Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js modified: Open-ILS/web/js/ui/default/staff/services/ui.js --- Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 | 8 ++++++-- Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js | 5 ++++- Open-ILS/web/js/ui/default/staff/services/ui.js | 12 +++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index d4fce7c391..92946df2ae 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -30,7 +30,8 @@ id="patron-checkout-barcode" type="text"/> + ng-disabled="disable_checkout()" + value="[% l('Submit') %]"/> @@ -75,8 +76,11 @@ [% l('Specific Due Date') %] --> +
- + +
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 1cbb05e220..9c079f963e 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -19,6 +19,8 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , due_date : new Date() }; + $scope.minDate = new Date(); + $scope.gridDataProvider = egGridDataProvider.instance({ get : function(offset, count) { return this.arrayNotifier($scope.checkouts, offset, count); @@ -31,7 +33,8 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , patronSvc.current.active() == 'f' || patronSvc.current.deleted() == 't' || patronSvc.current.card().active() == 'f' || - patronSvc.fetchedWithInactiveCard() + patronSvc.fetchedWithInactiveCard() || + $scope.outOfRange == true ); } 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 59ff1c8414..250105a195 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -1350,6 +1350,11 @@ https://stackoverflow.com/questions/24764802/angular-js-automatically-focus-inpu minDate : $scope.minDate, maxDate : $scope.maxDate }; + + $scope.outOfRange = false; + + $scope.minDate = new Date(); + $scope.outOfRange = false; var maxDateObj = $scope.maxDate ? new Date($scope.maxDate) : null; var minDateObj = $scope.minDate ? new Date($scope.minDate) : null; @@ -1360,7 +1365,12 @@ https://stackoverflow.com/questions/24764802/angular-js-automatically-focus-inpu var bad = false; var newdate = new Date(n); if (maxDateObj && newdate.getTime() > maxDateObj.getTime()) bad = true; - if (minDateObj && newdate.getTime() < minDateObj.getTime()) bad = true; + if (minDateObj && newdate.getTime() < minDateObj.getTime()) { + if ((newdate.getMonth() != minDateObj.getMonth()) || + (newdate.getDate() != minDateObj.getDate())) { + bad = true; + } + } $scope.outOfRange = bad; } }); -- 2.11.0