Bugzilla – Attachment 69853 Details for
Bug 19808
Reviews from deleted patrons make few scripts to explode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19808: Handle deleted reviewers gracefully - opac-detail
Bug-19808-Handle-deleted-reviewers-gracefully---op.patch (text/plain), 6.95 KB, created by
Jonathan Druart
on 2017-12-18 16:36:39 UTC
(
hide
)
Description:
Bug 19808: Handle deleted reviewers gracefully - opac-detail
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-12-18 16:36:39 UTC
Size:
6.95 KB
patch
obsolete
>From cf90c599880d3034a0e63b682ae69246b0d581f5 Mon Sep 17 00:00:00 2001 >From: Victor Grousset <victor.grousset@biblibre.com> >Date: Fri, 15 Dec 2017 15:22:24 +0100 >Subject: [PATCH] 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> >--- > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 20 +++++++++++--------- > opac/opac-detail.pl | 14 +++++--------- > 2 files changed, 16 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index eb857ecffb..9eaccdb3cc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -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 %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 819e42692f..745c49cd62 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -844,17 +844,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; > } > } >@@ -1102,13 +1097,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 > ); > } > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19808
:
69824
|
69828
|
69853
|
69854
|
69855
|
69856
|
69926
|
69934
|
69935
|
69936
|
69937
|
69938
|
69989
|
69990
|
69991
|
69992
|
69993