Bug 30525

Summary: Items batch modification broken
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: critical    
Priority: P5 - low CC: andrewfh, kyle, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.05
Bug Depends on: 29957    
Bug Blocks:    
Attachments: Bug 30525: Items batch modification broken
Bug 30525: Items batch modification broken
Bug 30525: Items batch modification broken

Description Fridolin Somers 2022-04-13 13:44:34 UTC
Items batch modification is broken looks like it is since Bug 29957

I get the error :

Can't call method "value" on an undefined value at /kohadevbox/koha/tools/batchMod.pl line 87
       86: my %cookies = parse CGI::Cookie($cookie);
       87: my $sessionID = $cookies{'CGISESSID'}->value;
Comment 1 Fridolin Somers 2022-04-13 14:06:31 UTC
We see 2 ways :

 > git grep 'CGI::Cookie->fetch'
admin/import_export_authtype.pl:my %cookies = CGI::Cookie->fetch();
admin/import_export_framework.pl:my %cookies = CGI::Cookie->fetch();
authorities/merge_ajax.pl:my %cookies = CGI::Cookie->fetch;
cataloguing/merge_ajax.pl:my %cookies = CGI::Cookie->fetch;
opac/opac-ratings-ajax.pl:    my %cookies      = CGI::Cookie->fetch;
opac/opac-tags.pl:    my %cookies = CGI::Cookie->fetch;
tags/review.pl:    my %cookies = CGI::Cookie->fetch;
tools/background-job-progress.pl:my %cookies = CGI::Cookie->fetch;
tools/upload-file.pl:my %cookies = CGI::Cookie->fetch;
16:05:46 ~/git/koha-master [ master | v21.11.00 p+1076 | u= ]
 > git grep 'parse CGI::Cookie'
offline_circ/enqueue_koc.pl:my %cookies = parse CGI::Cookie($cookie);
offline_circ/process_koc.pl:my %cookies = parse CGI::Cookie($cookie);
tools/batchMod.pl:my %cookies = parse CGI::Cookie($cookie);
tools/manage-marc-import.pl:my %cookies = parse CGI::Cookie($cookie);
tools/modborrowers.pl:my %cookies   = parse CGI::Cookie($cookie);
tools/stage-marc-import.pl:my %cookies = parse CGI::Cookie($cookie);
tools/upload-cover-image.pl:my %cookies   = parse CGI::Cookie($cookie);
Comment 2 Owen Leonard 2022-04-13 15:54:56 UTC
Created attachment 133273 [details] [review]
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
Comment 3 Nick Clemens 2022-04-19 17:41:49 UTC
Created attachment 133411 [details] [review]
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 <nick@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2022-04-21 16:56:55 UTC
Created attachment 133594 [details] [review]
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 <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Fridolin Somers 2022-04-21 23:42:19 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 6 Kyle M Hall 2022-04-22 18:29:54 UTC
Pushed to 21.11.x for 21.11.05
Comment 7 Andrew Fuerste-Henry 2022-05-03 19:42:29 UTC
Missing dependency, not backported to 21.05