From 72a477c43f2ea8936a9fc977033494eef87e7a88 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 23 Dec 2021 16:16:58 -0300 Subject: [PATCH] Bug 29771: Remove trivial cases I squashed the patches because they are too trivial to have a test plan. Or it is too much work to write the test plan for such trivial cases. I leave the original commit messages just in case. Generally, this are all cases in which CGI::param is being called in a trivially identifiable _list context_. i.e. they are assigned to a @variable. I left one case out on purpose: admin/auth_subfields_structure.pl Paul introduced this: my @kohafield = ''.$input->param('kohafield'); and then: my $kohafield = $kohafield[$i]; My intuition says it is forcing scalar context on the first assignment so the list contains a single element and then inside the loop some $kohafield assignments should lead to undef, and even warnings. I leave it for a separate patch because it is not that easy testable and is a sensible area. Bug 29771: Remove warning from acqui/finishreceive.pl This patch removes a warning that shows when receiving. To test: 1. Do the acq workflow up to the receive step. 2. Once you choose the items and click on Finish => FAIL: There's a warning in the logs 3. Revert receipt 4. Apply this patch 5. Receive => SUCCESS: No more warnings 6. Sign off :-D Bug 29771: Remove warning from svc/members/add_to_list To test: 1. Run: $ tail -f /var/log/koha/kohadev/*-error.log 2. Generate a patron list 3. Perform a patron search that gives you a few 4. Select some, and choose to add them to the list => FAIL: The logs show the infamous warn: CGI::param called in list context from /kohadevbox/koha/svc/members/add_to_list 5. Apply this patch 6. Restart plack and repeat 4 => SUCCESS: No warn! 7. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 1cfa7e38458b0e644ba7a34ae81520987071eca1) Signed-off-by: Andrew Fuerste-Henry --- acqui/finishreceive.pl | 2 +- svc/cover_images | 2 +- svc/members/add_to_list | 6 +++--- tools/stockrotation.pl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index fd0880b858..f016bd39a6 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -79,7 +79,7 @@ my $basket = $order_obj->basket; if ($quantityrec > $origquantityrec ) { my @received_items = (); if ($basket->effective_create_items eq 'ordering') { - @received_items = $input->param('items_to_receive'); + @received_items = $input->multi_param('items_to_receive'); my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived"); if ( @affects ) { my $frameworkcode = GetFrameworkCode($biblionumber); diff --git a/svc/cover_images b/svc/cover_images index 82e68f2ee5..dad68baabb 100755 --- a/svc/cover_images +++ b/svc/cover_images @@ -37,7 +37,7 @@ if ( $auth_status ne "ok" ) { } my $action = $input->param('action'); -my @imagenumbers = $input->param('imagenumber'); +my @imagenumbers = $input->multi_param('imagenumber'); # Array to store the reponse JSON my $response = []; diff --git a/svc/members/add_to_list b/svc/members/add_to_list index 62bcfced9e..b90171d392 100755 --- a/svc/members/add_to_list +++ b/svc/members/add_to_list @@ -32,9 +32,9 @@ my ( $auth_status, $sessionID ) = check_cookie_auth( ); exit 0 if $auth_status ne "ok"; -my $add_to_patron_list = $input->param('add_to_patron_list'); -my $new_patron_list = $input->param('new_patron_list'); -my @borrowernumbers = $input->param('borrowernumbers[]'); +my $add_to_patron_list = $input->param('add_to_patron_list'); +my $new_patron_list = $input->param('new_patron_list'); +my @borrowernumbers = $input->multi_param('borrowernumbers[]'); my $response; if ($add_to_patron_list) { diff --git a/tools/stockrotation.pl b/tools/stockrotation.pl index 79425adbbb..d95c41ca4a 100755 --- a/tools/stockrotation.pl +++ b/tools/stockrotation.pl @@ -376,7 +376,7 @@ if (!defined $op) { } elsif ($op eq 'move_items_to_rota') { # The barcodes of the items we're moving - my @move = $input->param('move_item'); + my @move = $input->multi_param('move_item'); foreach my $item(@move) { -- 2.39.5