From 47f5b849685eb9af0996fd5d772606552b0b6201 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 14 Feb 2022 10:35:53 -1000 Subject: [PATCH] Bug 30099: Fix error when accessing circulation.pl without patron parameter If I access circulation.pl directly, with no patron cardnumber or borrowernumber submitted, I get an error: Can't call method "messages" on an undefined value at /kohadevbox/koha/circ/circulation.pl line 525 This is caused by Bug 29230 which calls $patron outside a "if ($aptron)". Test plan : 1) In staff interface, click in 'check out' search box 2) Hit enter (without a search text) => Without patch you get an error => With patch you see a blank page /cgi-bin/koha/circ/circulation.pl Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall --- circ/circulation.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 4aedccb24c..b5f94eb85b 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -520,16 +520,18 @@ if ( $patron ) { forceallow => $force_allow_issue, ); } -} -my $patron_messages = $patron->messages->search( - {}, - { - join => 'manager', - '+select' => ['manager.surname', 'manager.firstname' ], - '+as' => ['manager_surname', 'manager_firstname'], - } -); + my $patron_messages = $patron->messages->search( + {}, + { + join => 'manager', + '+select' => ['manager.surname', 'manager.firstname' ], + '+as' => ['manager_surname', 'manager_firstname'], + } + ); + $template->param( patron_messages => $patron_messages ); + +} my $fast_cataloging = 0; if ( Koha::BiblioFrameworks->find('FA') ) { @@ -576,7 +578,6 @@ if ($restoreduedatespec || $stickyduedate) { } $template->param( - patron_messages => $patron_messages, borrowernumber => $borrowernumber, branch => $branch, was_renewed => scalar $query->param('was_renewed') ? 1 : 0, -- 2.39.5