From d6f9aa3001863188fcdc3901dfa112209207e9b7 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Sun, 17 Dec 2017 08:53:18 +0000 Subject: [PATCH] Bug 19771: Fix crashing in pending offline circulation actions list 0) Do not apply the patch 1) Add some checkout / checkin actions on existing barcodes, you can use standalone application, Firefox add-on or built-in offline circulation client 2) Go to Circulation -> Pending offline circulation actions and you will see you actions in the table 3) Add some actions with non-exitent barcodes or a payment 4) Go to Circulation -> Pending offline circulation actions - the page crashes 5) Apply the patch 6) Go to Circulation -> Pending offline circulation actions - the page is working again --- offline_circ/list.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/offline_circ/list.pl b/offline_circ/list.pl index 5981f35..0641629 100755 --- a/offline_circ/list.pl +++ b/offline_circ/list.pl @@ -46,10 +46,12 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ my $operations = GetOfflineOperations; for (@$operations) { - my $item = Koha::Items->find({ barcode => $_->{barcode} }); - my $biblio = $item->biblio; - $_->{'bibliotitle'} = $biblio->title; - $_->{'biblionumber'} = $biblio->biblionumber; + my $item = $_->{barcode} ? Koha::Items->find({ barcode => $_->{barcode} }) : undef; + if ($item) { + my $biblio = $item->biblio; + $_->{'bibliotitle'} = $biblio->title; + $_->{'biblionumber'} = $biblio->biblionumber; + } my $patron = $_->{cardnumber} ? Koha::Patrons->find( { cardnumber => $_->{cardnumber} } ) : undef; if ($patron) { $_->{'borrowernumber'} = $patron->borrowernumber; -- 2.1.4