Bug 42571: Sending EDI order results in variable not available warnings

The warnings look like:

[2026/05/08 15:02:42] [32918] [WARN] Variable "@messages" is not available at /usr/share/koha/intranet/cgi-bin/acqui/basket.pl line 698.
[2026/05/08 15:02:42] [32918] [WARN] Variable "$op" is not available at /usr/share/koha/intranet/cgi-bin/acqui/basket.pl line 704.

Note in the fix, we are switching to the "our" keyword. When we declare
things with "our", and we run this under plack, those variables and
values persist across multiple requests! Due to this behavior we always
need to reinitialize anything that uses "our" unless we specifically
want that behavior ( like caching ).

Test plan:
1) Send an EDI order, note the warnings in the logs
2) Apply this patch
3) Restart all the things!
4) Send another EDI order, note the warnings are gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2026-05-08 15:55:15 -04:00 committed by Lucas Gass
parent 270136ea70
commit be571d1b50
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 2 additions and 2 deletions

View File

@ -235,12 +235,12 @@ unless ( CanUserManageBasket( $loggedinuser, $basket, $userflags ) ) {
# FIXME : the query->param('booksellerid') below is probably useless. The bookseller is always known from the basket
# if no booksellerid in parameter, get it from basket
# warn "=>".$basket->{booksellerid};
my $op = $query->param('op') // 'list';
our $op = $query->param('op') // 'list';
our $confirm_pref = C4::Context->preference("BasketConfirmations") || '1';
$template->param( skip_confirm_reopen => 1 ) if $confirm_pref eq '2';
my @messages;
our @messages = ();
if ( $op eq 'cud-delete-order' ) {
output_and_exit( $query, $cookie, $template, 'insufficient_permission' )