Bug 19808: Handle deleted reviewers gracefully - opac-detail
And other display issues when the patron was NULL. Which allows to keep the review even if it has no patron. Because it might be useful. For example when disconnected, the borrowernumber is null. So the comments from deleted patrons were displayed as if the disconnected user wrote them. So it had the edit button... And fix borrowernumber not being passed to the template when OpacStarRatings was false. Test plan 1. Log in as a patron 2. Leave a comment/review on a record 3. Librarian: approve this comment 4. Delete the borrower 5. See the record (opac:/cgi-bin/koha/opac-detail.pl?biblionumber=RELEVANT_BIB_NUMBER) 6. Then you should see an error 7. Apply this patch 8. Refresh the page 9. Then you should see the record page with the comment Signed-off-by: Mark Tompsett <mtompset@hotmail.com> 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:
parent
71e3928b7b
commit
2a26ca7a4d
|
|
@ -905,7 +905,7 @@
|
|||
<div id="newcomment"></div>
|
||||
[% IF ( reviews ) %]
|
||||
[% FOREACH review IN reviews %]
|
||||
[% IF review.borrowernumber == borrowernumber %]
|
||||
[% IF borrowernumber && review.borrowernumber == borrowernumber %]
|
||||
<div class="commentline yours" id="c[% review.reviewid %]">
|
||||
[% IF ( review.avatarurl ) %]
|
||||
<img class="avatar" src="[% review.avatarurl %]" height="80" width="80" alt="" />
|
||||
|
|
@ -925,26 +925,28 @@
|
|||
</div>
|
||||
[% ELSE %]
|
||||
<div class="commentline">
|
||||
[% IF ( ShowReviewer != "none" ) %]
|
||||
[% IF ( ShowReviewer != "none" && review.patron) %]
|
||||
|
||||
[% IF ( review.avatarurl ) %]
|
||||
<img class="avatar" src="[% review.avatarurl %]" height="80" width="80" alt="" />
|
||||
[% END %]
|
||||
[% SWITCH ShowReviewer %]
|
||||
[% CASE 'full' %]
|
||||
<h5>Comment by [% review.title %] [% review.firstname %] [% review.surname %]</h5>
|
||||
<h5>Comment by [% review.patron.title %] [% review.patron.firstname %] [% review.patron.surname %]</h5>
|
||||
[% CASE 'first' %]
|
||||
<h5>Comment by [% review.firstname %]</h5>
|
||||
<h5>Comment by [% review.patron.firstname %]</h5>
|
||||
[% CASE 'surname' %]
|
||||
<h5>Comment by [% review.surname %]</h5>
|
||||
<h5>Comment by [% review.patron.surname %]</h5>
|
||||
[% CASE 'firstandinitial' %]
|
||||
<h5>Comment by [% review.firstname %] [% review.surname|truncate(2,'.') %]</h5>
|
||||
<h5>Comment by [% review.patron.firstname %] [% review.patron.surname|truncate(2,'.') %]</h5>
|
||||
[% CASE 'username' %]
|
||||
<h5>Comment by [% review.userid %]</h5>
|
||||
<h5>Comment by [% review.patron.userid %]</h5>
|
||||
[% END %]
|
||||
|
||||
<small>[% review.datereviewed | $KohaDates %]</small>
|
||||
[% ELSIF ( ShowReviewer == "none") %]
|
||||
[% ELSE %]
|
||||
<h5>Patron comment on [% review.datereviewed | $KohaDates %]</h5>
|
||||
[% END # / IF ShowReviewer != "none"%]
|
||||
[% END # / IF ShowReviewer != "none" && review.patron %]
|
||||
<p>
|
||||
[% FILTER html_break %]
|
||||
[% review.review |html %]
|
||||
|
|
|
|||
|
|
@ -845,17 +845,12 @@ if ( C4::Context->preference('reviewson') ) {
|
|||
my $patron = Koha::Patrons->find( $review->{borrowernumber} );
|
||||
|
||||
# setting some borrower info into this hash
|
||||
$review->{title} = $patron->title;
|
||||
$review->{surname} = $patron->surname;
|
||||
$review->{firstname} = $patron->firstname;
|
||||
if ( $libravatar_enabled and $patron->email ) {
|
||||
$review->{patron} = $patron;
|
||||
if ( $libravatar_enabled and $patron and $patron->email ) {
|
||||
$review->{avatarurl} = libravatar_url( email => $patron->email, https => $ENV{HTTPS} );
|
||||
}
|
||||
$review->{userid} = $patron->userid;
|
||||
$review->{cardnumber} = $patron->cardnumber;
|
||||
|
||||
if ( $patron->borrowernumber eq $borrowernumber ) {
|
||||
$review->{your_comment} = 1;
|
||||
if ( $patron and $patron->borrowernumber eq $borrowernumber ) {
|
||||
$loggedincommenter = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1103,13 +1098,14 @@ if (C4::Context->preference("OPACURLOpenInNewWindow")) {
|
|||
$template->param(covernewwindow => 'false');
|
||||
}
|
||||
|
||||
$template->param(borrowernumber => $borrowernumber);
|
||||
|
||||
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
|
||||
my $ratings = Koha::Ratings->search({ biblionumber => $biblionumber });
|
||||
my $my_rating = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef;
|
||||
$template->param(
|
||||
ratings => $ratings,
|
||||
my_rating => $my_rating,
|
||||
borrowernumber => $borrowernumber
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue