Bugzilla – Attachment 54238 Details for
Bug 17089
Move the star ratings related code to Koha::Ratings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17089: Improve errors handling
SIGNED-OFF-Bug-17089-Improve-errors-handling.patch (text/plain), 2.71 KB, created by
Owen Leonard
on 2016-08-09 16:41:08 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17089: Improve errors handling
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-08-09 16:41:08 UTC
Size:
2.71 KB
patch
obsolete
>From e6246ea878b3f406f6cc65e8363eef635e003436 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Aug 2016 17:06:56 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 17089: Improve errors handling >Content-Type: text/plain; charset="utf-8" > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > opac/opac-ratings-ajax.pl | 8 +++++--- > opac/opac-ratings.pl | 6 ++++-- > 2 files changed, 9 insertions(+), 5 deletions(-) > >diff --git a/opac/opac-ratings-ajax.pl b/opac/opac-ratings-ajax.pl >index 672e7f3..25675ad 100755 >--- a/opac/opac-ratings-ajax.pl >+++ b/opac/opac-ratings-ajax.pl >@@ -72,7 +72,8 @@ my $rating; > $rating_value //= ''; > > if ( $rating_value eq '' ) { >- Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser } )->delete; >+ my $rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser } ); >+ $rating->delete if $rating; > } > > elsif ( $rating_value and !$rating_old_value ) { >@@ -80,7 +81,8 @@ elsif ( $rating_value and !$rating_old_value ) { > } > > elsif ( $rating_value ne $rating_old_value ) { >- Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store; >+ my $rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser }); >+ $rating->rating_value($rating_value)->store if $rating > } > > my $ratings = Koha::Ratings->search({ biblionumber => $biblionumber }); >@@ -91,7 +93,7 @@ my %js_reply = ( > rating_total => $ratings->count, > rating_avg => $avg, > rating_avg_int => sprintf("%.0f", $avg), >- rating_value => $my_rating->rating_value, >+ rating_value => $my_rating ? $my_rating->rating_value : undef, > auth_status => $auth_status, > > ); >diff --git a/opac/opac-ratings.pl b/opac/opac-ratings.pl >index d936b13..1951a2d 100755 >--- a/opac/opac-ratings.pl >+++ b/opac/opac-ratings.pl >@@ -53,10 +53,12 @@ unless ( $biblionumber and $rating_value ) { > } > > if ( !$rating_old_value ) { >- Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store; >+ my $rating = Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, }); >+ $rating->store if $rating; > } > else { >- Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store; >+ my $rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser }); >+ $rating->rating_value($rating_value)->store if $rating; > } > print $query->redirect( > "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber"); >-- >2.1.4
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 17089
:
54207
|
54208
|
54209
|
54210
|
54211
|
54212
|
54213
|
54214
|
54225
|
54230
|
54231
|
54232
|
54233
|
54234
|
54235
|
54236
|
54237
|
54238
|
54332
|
54333
|
54334
|
54335
|
54336
|
54337
|
54338
|
54339
|
54340
|
54341