From e2125d00e15bca6c60d0e46b0f16e06e7813a227 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 23 Feb 2024 09:18:54 +0000 Subject: [PATCH] Bug 34478: (follow-up) patron-cards/edit-batch: op cud-remove, cud-dedup This is about the links for Remove selected patrons, and Remove duplicates. Signed-off-by: Jonathan Druart --- .../prog/en/modules/patroncards/edit-batch.tt | 34 +++++++++++++------ patroncards/edit-batch.pl | 2 +- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index 9ecab9e6dc..9e3a2c7264 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -85,13 +85,15 @@ [% IF ( table_loop ) %]
@@ -139,9 +141,9 @@
-
+ [% INCLUDE 'csrf-token.inc' %] - +
@@ -185,7 +187,7 @@ if(document.items.action.length > 0) { for (var i=0; i < document.items.action.length; i++) { if (document.items.action[i].checked) { - items.push("label_id=" + document.items.action[i].value); + items.push( document.items.action[i].value ); } } getstr = items.join("&"); @@ -199,7 +201,13 @@ } var answer = confirm(msg); if (answer) { - window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr; + $('#patron_form input[name="op"]').val('cud-remove'); + $('#patron_form input[name="batch_id"]').val( [% batch_id | html %] ); + $('#patron_form input[name="label_id"]').remove(); + items.forEach( (item_id) => { + $('#patron_form').append( '' ); + }); + $('#patron_form').submit(); } else { return; // abort delete } @@ -221,8 +229,11 @@ } function DeDuplicate() { - window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]"; - }; + $('#patron_form input[name="op"]').val('cud-dedup'); + $('#patron_form input[name="batch_id"]').val('[% batch_id | html %]'); + $('#patron_form').submit(); + } + function Xport(mode) { if (mode == 'label') { patroncards= new Array; @@ -323,9 +334,10 @@ }); $(".delete").on("click", function(){ if( confirmDelete( _("Are you sure you want to delete this patron from the card batch?") ) ) { - $('#remove_patron_form input[name="batch_id"]').val($(this).data('batch-id')); - $('#remove_patron_form input[name="label_id"]').val($(this).data('label-id')); - $('#remove_patron_form').submit(); + $('#patron_form input[name="op"]').val('cud-remove'); + $('#patron_form input[name="batch_id"]').val($(this).data('batch-id')); + $('#patron_form input[name="label_id"]').val($(this).data('label-id')); + $('#patron_form').submit(); } }); $(".export").on("click", function(e){ diff --git a/patroncards/edit-batch.pl b/patroncards/edit-batch.pl index 17e1a96279..f3c183e9b0 100755 --- a/patroncards/edit-batch.pl +++ b/patroncards/edit-batch.pl @@ -114,7 +114,7 @@ if ($bor_num_list) { exit; } } -elsif ($op eq 'de_duplicate') { +elsif ( $op eq 'cud-dedup' ) { $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); $duplicate_count = $batch->remove_duplicates(); $duplicate_message = 1 if $duplicate_count != -1; -- 2.39.5