From 18ff2959231de9923875cfdcdc662129a23aad04 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 23 Feb 2024 08:36:37 +0000 Subject: [PATCH] Bug 34478: patroncards/edit-batch: Fix for removing patrons Added a form for delete link from patron table. Signed-off-by: Jonathan Druart --- .../prog/en/modules/patroncards/edit-batch.tt | 14 ++++++++++++-- patroncards/edit-batch.pl | 6 +++--- 2 files changed, 15 insertions(+), 5 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 fe657fa18a..9ecab9e6dc 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 @@ -124,7 +124,7 @@ [% FOREACH text_field IN table_loo.text_fields %] [% IF ( text_field.select_field ) %] - Delete + Delete Export @@ -139,6 +139,12 @@ +
+ [% INCLUDE 'csrf-token.inc' %] + + + +
[% ELSE %]
  1. @@ -316,7 +322,11 @@ return false; }); $(".delete").on("click", function(){ - return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") ); + 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(); + } }); $(".export").on("click", function(e){ e.preventDefault(); diff --git a/patroncards/edit-batch.pl b/patroncards/edit-batch.pl index 0ebd821507..17e1a96279 100755 --- a/patroncards/edit-batch.pl +++ b/patroncards/edit-batch.pl @@ -68,10 +68,10 @@ foreach my $param (@errors) { if $error; } -if ($op eq 'remove') { +if ( $op eq 'cud-remove' ) { $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); foreach my $label_id (@label_ids) { - $err = $batch->remove_item($label_id); + $err = $batch->remove_item($label_id); } if ($err) { print $cgi->redirect("edit-batch.pl?op=edit&batch_id=$batch_id&error=403"); # this allows us to avoid problems with the user hitting their refresh button @@ -123,7 +123,7 @@ elsif ($op eq 'de_duplicate') { exit; } } -elsif ($op eq 'cud-edit') { +elsif ($op eq 'edit') { #FIXME edit_form actually $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); $template->param( description => $batch->{'description'} ); } -- 2.39.5