From cce833d88239fd5f2ad9c13aff38c7ac7b418c40 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 13 Apr 2022 14:07:53 +0000 Subject: [PATCH] Bug 30525: Items batch modification broken This patch modifies instances in the code which try to get cookies using: my %cookies = parse CGI::Cookie($cookie); In some cases the relevant lines can be removed because they are unused. In others it can be replaced with: my %cookies = CGI::Cookie->fetch(); To test, apply the patch and restart_all. Test the following pages to confirm they load without errors: - Circulation -> Offline circulation file upload - Circulation -> Offline circulation -> Add to queue - Tools -> Batch item modification - Tools -> Stage MARC for import - Tools -> Staged MARC management - Tools -> Batch patron modification - Tools -> Upload local cover image Signed-off-by: Nick Clemens --- offline_circ/enqueue_koc.pl | 4 +--- offline_circ/process_koc.pl | 2 +- tools/batchMod.pl | 3 --- tools/manage-marc-import.pl | 2 +- tools/modborrowers.pl | 2 -- tools/stage-marc-import.pl | 2 +- tools/upload-cover-image.pl | 2 -- 7 files changed, 4 insertions(+), 13 deletions(-) diff --git a/offline_circ/enqueue_koc.pl b/offline_circ/enqueue_koc.pl index 1162d70645..e10df9545d 100755 --- a/offline_circ/enqueue_koc.pl +++ b/offline_circ/enqueue_koc.pl @@ -46,10 +46,8 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ flagsrequired => { circulate => "circulate_remaining_permissions" }, }); - my $fileID=$query->param('uploadedfileid'); -my %cookies = parse CGI::Cookie($cookie); -my $sessionID = $cookies{'CGISESSID'}->value; + ## 'Local' globals. our $dbh = C4::Context->dbh(); diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl index 2ca602238e..b3dc48a54c 100755 --- a/offline_circ/process_koc.pl +++ b/offline_circ/process_koc.pl @@ -56,7 +56,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ my $fileID=$query->param('uploadedfileid'); my $runinbackground = $query->param('runinbackground'); my $completedJobID = $query->param('completedJobID'); -my %cookies = parse CGI::Cookie($cookie); +my %cookies = CGI::Cookie->fetch(); my $sessionID = $cookies{'CGISESSID'}->value; ## 'Local' globals. our $dbh = C4::Context->dbh(); diff --git a/tools/batchMod.pl b/tools/batchMod.pl index ef6dec19b8..e24db19104 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -83,9 +83,6 @@ $restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrar my $nextop=""; my $display_items; -my %cookies = parse CGI::Cookie($cookie); -my $sessionID = $cookies{'CGISESSID'}->value; - my @messages; if ( $op eq "action" ) { diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index ef0bd36d33..87aae2afd9 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -54,7 +54,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {tools => 'manage_staged_marc'}, }); -my %cookies = parse CGI::Cookie($cookie); +my %cookies = CGI::Cookie->fetch(); our $sessionID = $cookies{'CGISESSID'}->value; our $dbh = C4::Context->dbh; diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 9b2a4e1a88..8aed3f4b4b 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -51,8 +51,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $logged_in_user = Koha::Patrons->find( $loggedinuser ); -my %cookies = parse CGI::Cookie($cookie); -my $sessionID = $cookies{'CGISESSID'}->value; my $dbh = C4::Context->dbh; # Show borrower informations diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index 7653bc6893..72ae9f7c40 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -79,7 +79,7 @@ $template->param( booksellerid => $booksellerid, ); -my %cookies = parse CGI::Cookie($cookie); +my %cookies = CGI::Cookie->fetch(); my $sessionID = $cookies{'CGISESSID'}->value; if ($completedJobID) { my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); diff --git a/tools/upload-cover-image.pl b/tools/upload-cover-image.pl index cf82352abb..e533b8362d 100755 --- a/tools/upload-cover-image.pl +++ b/tools/upload-cover-image.pl @@ -70,8 +70,6 @@ my $itemnumber = $input->param('itemnumber'); my $replace = !C4::Context->preference("AllowMultipleCovers") || $input->param('replace'); my $op = $input->param('op'); -my %cookies = parse CGI::Cookie($cookie); -my $sessionID = $cookies{'CGISESSID'}->value; my $error; -- 2.30.2