From f5681518f02d7582688a33be62662eb7c5609a4f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 Feb 2024 14:42:08 +0100 Subject: [PATCH] Bug 34478: Fix delallitems for additem Signed-off-by: Jonathan Druart --- cataloguing/additem.pl | 2 +- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 10 +++++++++- koha-tmpl/intranet-tmpl/prog/js/catalog.js | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index affbf89ee5..b930565ce4 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -521,7 +521,7 @@ if ($op eq "cud-additem") { $nextop = "cud-additem"; } #------------------------------------------------------------------------------- -} elsif ($op eq "delallitems") { +} elsif ($op eq "cud-delallitems") { #------------------------------------------------------------------------------- my $items = Koha::Items->search({ biblionumber => $biblionumber }); while ( my $item = $items->next ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index f786961e35..8c4972f1d3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -92,7 +92,15 @@ [% IF CAN_user_editcatalogue_delete_all_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] [% IF ( count ) %] -
  • Delete all items
  • +
  • +
    + [% INCLUDE 'csrf-token.inc' %] + + + +
    + Delete all items +
  • [% ELSE %]
  • Delete all items
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/catalog.js b/koha-tmpl/intranet-tmpl/prog/js/catalog.js index 8a3694fb8d..3972077a32 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/catalog.js +++ b/koha-tmpl/intranet-tmpl/prog/js/catalog.js @@ -62,12 +62,12 @@ function confirm_deletion(link) { /* IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */ -function confirm_items_deletion() { +function confirm_items_deletion(link) { if ( holdcount > 0 ) { alert(__("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount)); } else if ( count > 0 ) { if (confirm(__("Are you sure you want to delete the %s attached items?").format(count))) { - window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : ""); + return $(link).siblings('form').submit(); } else { return false; } @@ -88,7 +88,7 @@ $(document).ready(function() { return false; }); $("#deleteallitems").click(function(){ - confirm_items_deletion(); + confirm_items_deletion(this); return false; }); $("#printbiblio").click(function(){ -- 2.39.5