Bugzilla – Attachment 120925 Details for
Bug 28273
Multi-holds allow invalid pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28273: Add form validation for pickup locations
Bug-28273-Add-form-validation-for-pickup-locations.patch (text/plain), 2.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-05-13 12:14:10 UTC
(
hide
)
Description:
Bug 28273: Add form validation for pickup locations
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-05-13 12:14:10 UTC
Size:
2.90 KB
patch
obsolete
>From 72a49c73bcc9252968248473643491e6e44e8d31 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 13 May 2021 09:03:52 -0300 >Subject: [PATCH] Bug 28273: Add form validation for pickup locations > >This patch introduces validation on the new pickup locations column. >This way, if a selected title doesn't have a pickup location set, it >will prevent form submission and a suitable error message will pop-up. > >To test: >1. Apply this patch >2. Attempt to place multi-title level holds >3. Make sure some selected titles don't have the pickup location set >4. Submit >=> SUCCESS: Form submission halts, an idiomatic error message shows. >5. Unselect all biblios and repeat 4 >=> SUCCESS: You are not allowed to proceed, a message is displayed. >6. Have all selected titles set a pickup location, submit >=> SUCCESS: Holds are placed as they should. >7. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../prog/en/modules/reserve/request.tt | 33 ++++++++++++++----- > 1 file changed, 24 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 73b50fc0bb5..f0541f5f038 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1403,17 +1403,32 @@ > } > > function checkMultiHold() { >- var spans = $(".multi_hold_item_checkbox:checked"); >- if ($(spans).size() == 0) { >- alert(MSG_NO_ITEMS_AVAILABLE); >- return false; >- } > > var biblionumbers = ""; >- $(spans).each(function() { >- var bibnum = $(this).attr("title"); >- biblionumbers += bibnum + "/"; >- }); >+ var selected_bibs = $(".multi_hold_item_checkbox:checked"); >+ if ( selected_bibs.length > 0 ) { >+ // there are biblios selected in the form! >+ // verify they have a pickup location selected >+ >+ var pickup_not_set = 0; >+ selected_bibs.each(function() { >+ if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) { >+ pickup_not_set++; >+ } >+ else { >+ var bibnum = $(this).attr("title"); >+ biblionumbers += bibnum + "/"; >+ } >+ }); >+ if ( pickup_not_set > 0 ) { >+ alert( _("Please make sure all selected titles have a pickup location set" + "\n") ); >+ return false; >+ } >+ } >+ else { >+ alert( _("Please select at least one title" + "\n") ); >+ return false; >+ } > > var badSpans = $(".not_holdable"); > var badBibs = ""; >-- >2.31.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28273
:
120407
|
120408
|
120923
|
120924
|
120925
|
120926
|
120933
|
120934
|
120935
|
120936
|
120957
|
120958
|
120959
|
120960
|
120961