Bug 17089: Koha::Ratings - Remove ModRating

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-07-12 11:06:07 +01:00 committed by Kyle M Hall
parent d9af985de6
commit a7f831404e
3 changed files with 2 additions and 31 deletions

View file

@ -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 );

View file

@ -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 = (

View file

@ -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");