Bugzilla – Attachment 54209 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 AddRating
Bug-17089-KohaRatings---Remove-AddRating.patch (text/plain), 3.29 KB, created by
Jonathan Druart
on 2016-08-09 14:13:59 UTC
(
hide
)
Description:
Bug 17089: Koha::Ratings - Remove AddRating
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-08-09 14:13:59 UTC
Size:
3.29 KB
patch
obsolete
>From d2576bdc32c09ce0b9302a9331030b7b5a8d1c1d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Jul 2016 11:04:41 +0100 >Subject: [PATCH] Bug 17089: Koha::Ratings - Remove AddRating > >--- > C4/Ratings.pm | 30 ------------------------------ > opac/opac-ratings-ajax.pl | 6 ++++-- > opac/opac-ratings.pl | 4 +++- > 3 files changed, 7 insertions(+), 33 deletions(-) > >diff --git a/C4/Ratings.pm b/C4/Ratings.pm >index 7cbc06c..8291727 100644 >--- a/C4/Ratings.pm >+++ b/C4/Ratings.pm >@@ -35,7 +35,6 @@ BEGIN { > > @EXPORT = qw( > &GetRating >- &AddRating > &ModRating > &DelRating > ); >@@ -59,9 +58,6 @@ Get a rating for a bib > my $rating_hashref = GetRating( $biblionumber, undef ); > my $rating_hashref = GetRating( $biblionumber, $borrowernumber ); > >-Add a rating for a bib >- my $rating_hashref = AddRating( $biblionumber, $borrowernumber, $rating_value ); >- > Mod a rating for a bib > my $rating_hashref = ModRating( $biblionumber, $borrowernumber, $rating_value ); > >@@ -192,32 +188,6 @@ sub GetRating { > return \%rating_hash; > } > >-=head2 AddRating >- >- my $rating_hashref = AddRating( $biblionumber, $borrowernumber, $rating_value ); >- >-Add a rating for a bib >- >-This adds or updates a rating for a particular user on a biblio. If the value >-is 0, then the rating will be deleted. If the value is out of the range of >-0-5, nothing will happen. >- >-=cut >- >-sub AddRating { >- my ( $biblionumber, $borrowernumber, $rating_value ) = @_; >- >- my $rating = Koha::Database->new()->schema->resultset('Rating')->create( >- { >- biblionumber => $biblionumber, >- borrowernumber => $borrowernumber, >- rating_value => $rating_value >- } >- ); >- >- return GetRating( $biblionumber, $borrowernumber ); >-} >- > =head2 ModRating > > my $rating_hashref = ModRating( $biblionumber, $borrowernumber, $rating_value ); >diff --git a/opac/opac-ratings-ajax.pl b/opac/opac-ratings-ajax.pl >index 2d6c706..1e69650 100755 >--- a/opac/opac-ratings-ajax.pl >+++ b/opac/opac-ratings-ajax.pl >@@ -34,6 +34,9 @@ use C4::Context; > use C4::Debug; > use C4::Output qw(:html :ajax pagination_bar); > use C4::Ratings; >+ >+use Koha::Ratings; >+ > use JSON; > > my $is_ajax = is_ajax(); >@@ -75,8 +78,7 @@ if ( $rating_value eq '' ) { > } > > elsif ( $rating_value and !$rating_old_value ) { >-#### insert >- $rating = AddRating( $biblionumber, $loggedinuser, $rating_value ); >+ $rating = Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store; > } > > elsif ( $rating_value ne $rating_old_value ) { >diff --git a/opac/opac-ratings.pl b/opac/opac-ratings.pl >index 23e73da..7ce681c 100755 >--- a/opac/opac-ratings.pl >+++ b/opac/opac-ratings.pl >@@ -34,6 +34,8 @@ use C4::Context; > use C4::Ratings; > use C4::Debug; > >+use Koha::Ratings; >+ > my $query = CGI->new(); > > # auth required to add ratings >@@ -53,7 +55,7 @@ unless ( $biblionumber and $rating_value ) { > } > > if ( !$rating_old_value ) { >- $rating = AddRating( $biblionumber, $loggedinuser, $rating_value ); >+ Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store; > } > else { > $rating = ModRating( $biblionumber, $loggedinuser, $rating_value ); >-- >2.8.1
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