From 224d6df08071b3176a37cb660141edf97b3efb80 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 18 Dec 2017 13:32:19 -0300 Subject: [PATCH] Bug 19808: Handle deleted reviewers gracefully - reviews/reviewswaiting.pl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test plan: - Create reviews - Delete some reviewers - Go to Home › Tools › Comments › Comments awaiting moderation Signed-off-by: Jon Knight Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- reviews/reviewswaiting.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl index 528425290d..82b1234807 100755 --- a/reviews/reviewswaiting.pl +++ b/reviews/reviewswaiting.pl @@ -67,14 +67,17 @@ my $reviews = Koha::Reviews->search( } )->unblessed; -foreach ( @$reviews ) { - my $borrowernumber = $_->{borrowernumber}; - my $patron = Koha::Patrons->find( $borrowernumber); - my $biblio = Koha::Biblios->find( $_->{biblionumber} ); +for my $review ( @$reviews ) { + my $biblio = Koha::Biblios->find( $review->{biblionumber} ); # setting some borrower info into this hash - $_->{bibliotitle} = $biblio->title; - $_->{surname} = $patron->surname; - $_->{firstname} = $patron->firstname; + $review->{bibliotitle} = $biblio->title; + + my $borrowernumber = $review->{borrowernumber}; + my $patron = Koha::Patrons->find( $borrowernumber); + if ( $patron ) { + $review->{surname} = $patron->surname; + $review->{firstname} = $patron->firstname; + } } my $url = "/cgi-bin/koha/reviews/reviewswaiting.pl?status=$status"; -- 2.39.5