From 8177b69a63cf7c881e56d1f276e4c8b16b89c3fa Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Tue, 25 Jun 2024 20:20:51 -0700 Subject: [PATCH] Bug 37192: Make label printing from the item editor work by accepting the op add Some parts of the UI for adding items to a label batch (and there's lots of different UI to do it) want to POST items to add to a batch, so CSRF protection switched the op to add an item to cud-add. However, the item editor needs to create a batch of one from its Actions menu by just opening a popup, so it wants to GET ?op=add. Accepting both ops will keep all the variety of UIs happy. Test plan: 1. Search the catalog for something that will return results, like Perl 2. On any bib that has at least one item, click Edit items 3. In the Actions menu to the left of any item, choose Print label 4. That opened a popup with a 500 error rather than a label batch editor 5. Apply patch, restart_all 6. Repeat step 3, but this time you'll get a label batch editor with your item in it. --- labels/label-edit-batch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl index 23bd9e77d4..fc1cfded08 100755 --- a/labels/label-edit-batch.pl +++ b/labels/label-edit-batch.pl @@ -81,7 +81,7 @@ elsif ($op eq 'cud-delete') { $err = C4::Labels::Batch::delete(batch_id => $batch_id, branch_code => $branch_code); $errtype = 'BATCH_NOT_DELETED' if $err; } -elsif ($op eq 'cud-add') { +elsif ($op eq 'cud-add' || $op eq 'add') { if ($number_list) { my @numbers_list = split /\n/, $number_list; # Entries are effectively passed in as a separated list foreach my $number (@numbers_list) { -- 2.44.0