Bug 19808: Handle deleted reviewers gracefully - reviews/reviewswaiting.pl

Test plan:
- Create reviews
- Delete some reviewers
- Go to Home › Tools › Comments › Comments awaiting moderation

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-12-18 13:32:19 -03:00 committed by Nick Clemens
parent 66fb31413e
commit 224d6df080
1 changed files with 10 additions and 7 deletions

View File

@ -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";