From d1d45fdd57479f4ad5ca47040d4df86794e2759d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 3 Nov 2022 12:35:29 -0400 Subject: [PATCH] LP1995623 Ang checkout prevents due dates in the past Prevent previous date selection in due date selector. Additionally warn when a time in the past on the current day selected and prevent checkout submission. Signed-off-by: Bill Erickson Signed-off-by: Susan Morrison Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html | 5 ++++- Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html index 170562a281..491be2922c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html @@ -67,9 +67,12 @@ - + + Due Date is Invalid + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts index 7d4079083b..839b0b62e2 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts @@ -43,6 +43,7 @@ export class CheckoutComponent implements OnInit, AfterViewInit { cellTextGenerator: GridCellTextGenerator; dueDate: string; dueDateOptions: 0 | 1 | 2 = 0; // auto date; specific date; session date + dueDateInvalid = false; printOnComplete = true; strictBarcode = false; @@ -155,6 +156,10 @@ export class CheckoutComponent implements OnInit, AfterViewInit { checkout(params?: CheckoutParams, override?: boolean): Promise { + if (this.dueDateInvalid) { + return Promise.resolve(null); + } + let barcode; const promise = params ? Promise.resolve(params) : this.collectParams(); @@ -256,6 +261,8 @@ export class CheckoutComponent implements OnInit, AfterViewInit { } setDueDate(iso: string) { + const date = new Date(Date.parse(iso)); + this.dueDateInvalid = (date < new Date()); this.dueDate = iso; this.store.setSessionItem('eg.circ.checkout.due_date', this.dueDate); } -- 2.11.0