Bugzilla – Attachment 54335 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]
Bug 17089: Koha::Ratings - Remove ModRating
Bug-17089-KohaRatings---Remove-ModRating.patch (text/plain), 3.34 KB, created by
Marcel de Rooy
on 2016-08-12 08:18:52 UTC
(
hide
)
Description:
Bug 17089: Koha::Ratings - Remove ModRating
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-08-12 08:18:52 UTC
Size:
3.34 KB
patch
obsolete
>From c2fc26ebdd496cacf7e60708ad0de0472a050945 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Jul 2016 11:06:07 +0100 >Subject: [PATCH] Bug 17089: Koha::Ratings - Remove ModRating >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Ratings.pm | 27 --------------------------- > opac/opac-ratings-ajax.pl | 3 +-- > opac/opac-ratings.pl | 3 +-- > 3 files changed, 2 insertions(+), 31 deletions(-) > >diff --git a/C4/Ratings.pm b/C4/Ratings.pm >index 8291727..0ec6e03 100644 >--- a/C4/Ratings.pm >+++ b/C4/Ratings.pm >@@ -35,7 +35,6 @@ BEGIN { > > @EXPORT = qw( > &GetRating >- &ModRating > &DelRating > ); > } >@@ -58,9 +57,6 @@ Get a rating for a bib > my $rating_hashref = GetRating( $biblionumber, undef ); > my $rating_hashref = GetRating( $biblionumber, $borrowernumber ); > >-Mod a rating for a bib >- my $rating_hashref = ModRating( $biblionumber, $borrowernumber, $rating_value ); >- > Delete a rating for a bib > my $rating_hashref = DelRating( $biblionumber, $borrowernumber ); > >@@ -188,29 +184,6 @@ sub GetRating { > return \%rating_hash; > } > >-=head2 ModRating >- >- my $rating_hashref = ModRating( $biblionumber, $borrowernumber, $rating_value ); >- >-Mod a rating for a bib >- >-=cut >- >-sub ModRating { >- my ( $biblionumber, $borrowernumber, $rating_value ) = @_; >- >- my $rating = Koha::Database->new()->schema->resultset('Rating')->find( >- { >- borrowernumber => $borrowernumber, >- biblionumber => $biblionumber >- } >- ); >- >- $rating->update( { rating_value => $rating_value } ); >- >- return GetRating( $biblionumber, $borrowernumber ); >-} >- > =head2 DelRating > > my $rating_hashref = DelRating( $biblionumber, $borrowernumber ); >diff --git a/opac/opac-ratings-ajax.pl b/opac/opac-ratings-ajax.pl >index 1e69650..63e2ebc 100755 >--- a/opac/opac-ratings-ajax.pl >+++ b/opac/opac-ratings-ajax.pl >@@ -82,8 +82,7 @@ elsif ( $rating_value and !$rating_old_value ) { > } > > elsif ( $rating_value ne $rating_old_value ) { >-#### mod >- $rating = ModRating( $biblionumber, $loggedinuser, $rating_value ); >+ $rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store; > } > > my %js_reply = ( >diff --git a/opac/opac-ratings.pl b/opac/opac-ratings.pl >index 7ce681c..33d4aee 100755 >--- a/opac/opac-ratings.pl >+++ b/opac/opac-ratings.pl >@@ -45,7 +45,6 @@ my $loggedinuser = C4::Context->userenv->{'number'}; > my $biblionumber = $query->param('biblionumber'); > my $rating_old_value = $query->param('rating_value'); > my $rating_value = $query->param('rating'); >-my $rating; > > # If JS is disabled and a user click on "Rate me" without selecting a rate > unless ( $biblionumber and $rating_value ) { >@@ -58,7 +57,7 @@ if ( !$rating_old_value ) { > Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store; > } > else { >- $rating = ModRating( $biblionumber, $loggedinuser, $rating_value ); >+ Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store; > } > print $query->redirect( > "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber"); >-- >1.7.10.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