From 8dc35c14b11e0849d5442a2895bf07f7d4c71018 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 14 Feb 2024 11:58:36 -0500 Subject: [PATCH] Bug 34478: Manual fix - change links to JS form submission - change action to op - request.pl/.tt Bug 34478: [TO SQUASH] Manual fix - change links to JS form submission - cleanup comments and unused routine - request.pl/.tt Bug 34478: [TO SQUASH] Manual fix - link to js post and add op to form - request.tt Signed-off-by: Jonathan Druart --- .../prog/en/includes/holds_table.inc | 16 +-- .../prog/en/modules/reserve/request.tt | 114 ++++++++++++++---- koha-tmpl/intranet-tmpl/prog/js/holds.js | 27 ++++- reserve/modrequest.pl | 16 +-- reserve/request.pl | 18 +-- 5 files changed, 137 insertions(+), 54 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 27c080009e..f6da101a4d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -95,19 +95,19 @@ [%- SET prev_priority = loop.prev.priority -%] [%- SET next_priority = loop.next.priority -%] - + - + - + - + @@ -225,10 +225,10 @@ [%- UNLESS hold.found -%] [% IF ( hold.lowestPriority ) %] - + [% ELSE %] - + [% END %] @@ -238,7 +238,7 @@ [%- END -%] [%- END -%] - + @@ -262,7 +262,7 @@ [%- END -%] [%- END # IF SuspendHoldsIntranet -%] [%- IF ( hold.found ) -%] - + [%- END -%] [% IF ( hold.intransit || hold.atdestination ) %] 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 aaf02c0046..51df3b0200 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -866,7 +866,7 @@ On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] [% END %] [% END %] - Cancel hold + Cancel hold [% END # /IF itemloo.nocancel %] [% ELSE %] Not on hold @@ -1066,6 +1066,7 @@

Existing holds

+
@@ -1256,6 +1257,11 @@

Confirm deletion

+
+ [% INCLUDE 'csrf-token.inc' %] +
+
+ + +
+
+
+
+ [% INCLUDE 'csrf-token.inc' %] +
+
[% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] @@ -1640,25 +1654,13 @@ $(".cancel-hold").on("click",function(e) { e.preventDefault; cancel_link = $(this); - $('#cancelModal').modal(); - return false; - }); - $("#cancelModalConfirmBtn").on("click",function(e) { - let link; - if(cancel_link.data('bulk')) { - [% SET data_url = 'biblionumber=' _ biblionumbers.join('&biblionumber=') %] - link = `request.pl?[% data_url | url %]&action=cancelBulk&ids=${$('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(',')}`; - } else { - let borrowernumber = cancel_link.data('borrowernumber'); - let biblionumber = cancel_link.data('biblionumber'); + $("#cancel_modal_form #inputs").empty(); let reserve_id = cancel_link.data('id'); - link = `request.pl?action=cancel&borrowernumber=${ borrowernumber }&biblionumber=${ biblionumber }&reserve_id=${ reserve_id }`; - } - let reason = $("#modal-cancellation-reason").val(); - if ( reason ) { - link += "&cancellation-reason=" + reason - } - window.location.href = link; + let biblionumber = cancel_link.data('biblionumber'); + $("#cancel_modal_form #inputs").append(''); + $("#cancel_modal_form #inputs").append(''); + $("#cancel_modal_form #inputs").append(''); + $('#cancelModal').modal(); return false; }); @@ -1723,13 +1725,81 @@ e.preventDefault(); if($('.holds_table .select_hold:checked').length) { cancel_link = $(this); + $("#cancel_modal_form #inputs").empty; + biblionumbers.forEach( function(biblionumber){ + $("#cancel_modal_form #inputs").append(''); + }); + $("#cancel_modal_form #inputs").append(''); + let hold_ids= $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(','); + $("#cancel_modal_form #inputs").append(''); delete localStorage.selectedHolds; $('#cancelModal').modal(); } return false; }); + + $(".hold-arrow").click(function(e) { + e.preventDefault(); + let arrowForm = $("#hold-actions-form").attr({ + action: 'request.pl', + method: 'post' + }); + let arrow_op = $("").attr({ + name: 'op', + type: 'hidden', + value: $(this).data('op') + }); + let arrow_where = $("").attr({ + name: 'where', + type: 'hidden', + value: $(this).data('where') + }); + let arrow_fp = $("").attr({ + name: 'first_priority', + type: 'hidden', + value: $(this).data('first_priority') + }); + let arrow_lp = $("").attr({ + name: 'last_priority', + type: 'hidden', + value: $(this).data('last_priority') + }); + let arrow_pp = $("").attr({ + name: 'prev_priority', + type: 'hidden', + value: $(this).data('prev_priority') + }); + let arrow_np = $("").attr({ + name: 'next_priority', + type: 'hidden', + value: $(this).data('next_priority') + }); + let arrow_bn = $("").attr({ + name: 'borrowernumber', + type: 'hidden', + value: $(this).data('borrowernumber') + }); + let arrow_bb = $("").attr({ + name: 'biblionumber', + type: 'hidden', + value: $(this).data('biblionumber') + }); + let arrow_ri = $("").attr({ + name: 'reserve_id', + type: 'hidden', + value: $(this).data('reserve_id') + }); + let arrow_date = $("").attr({ + name: 'date', + type: 'hidden', + value: $(this).data('date') + }); + arrowForm.append(arrow_op,arrow_where,arrow_fp,arrow_lp,arrow_pp,arrow_np,arrow_bn,arrow_bb,arrow_ri,arrow_date); + $("#hold-actions-form").submit(); + return true; + }) }); - +