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:
parent
d9af985de6
commit
a7f831404e
3 changed files with 2 additions and 31 deletions
|
@ -35,7 +35,6 @@ BEGIN {
|
||||||
|
|
||||||
@EXPORT = qw(
|
@EXPORT = qw(
|
||||||
&GetRating
|
&GetRating
|
||||||
&ModRating
|
|
||||||
&DelRating
|
&DelRating
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -58,9 +57,6 @@ Get a rating for a bib
|
||||||
my $rating_hashref = GetRating( $biblionumber, undef );
|
my $rating_hashref = GetRating( $biblionumber, undef );
|
||||||
my $rating_hashref = GetRating( $biblionumber, $borrowernumber );
|
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
|
Delete a rating for a bib
|
||||||
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
|
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
|
||||||
|
|
||||||
|
@ -188,29 +184,6 @@ sub GetRating {
|
||||||
return \%rating_hash;
|
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
|
=head2 DelRating
|
||||||
|
|
||||||
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
|
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
|
||||||
|
|
|
@ -82,8 +82,7 @@ elsif ( $rating_value and !$rating_old_value ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ( $rating_value ne $rating_old_value ) {
|
elsif ( $rating_value ne $rating_old_value ) {
|
||||||
#### mod
|
$rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store;
|
||||||
$rating = ModRating( $biblionumber, $loggedinuser, $rating_value );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my %js_reply = (
|
my %js_reply = (
|
||||||
|
|
|
@ -45,7 +45,6 @@ my $loggedinuser = C4::Context->userenv->{'number'};
|
||||||
my $biblionumber = $query->param('biblionumber');
|
my $biblionumber = $query->param('biblionumber');
|
||||||
my $rating_old_value = $query->param('rating_value');
|
my $rating_old_value = $query->param('rating_value');
|
||||||
my $rating_value = $query->param('rating');
|
my $rating_value = $query->param('rating');
|
||||||
my $rating;
|
|
||||||
|
|
||||||
# If JS is disabled and a user click on "Rate me" without selecting a rate
|
# If JS is disabled and a user click on "Rate me" without selecting a rate
|
||||||
unless ( $biblionumber and $rating_value ) {
|
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;
|
Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$rating = ModRating( $biblionumber, $loggedinuser, $rating_value );
|
Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store;
|
||||||
}
|
}
|
||||||
print $query->redirect(
|
print $query->redirect(
|
||||||
"/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");
|
"/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");
|
||||||
|
|
Loading…
Reference in a new issue