From bea247ee23a1e075e1c20003f39b3c30a12c0771 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 --- circ/circulation.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index b98f1205031..1471f3d1600 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.25.1