Bug 17089: Koha::Ratings - Remove DelRating

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:28:57 +01:00 committed by Kyle M Hall
parent a7f831404e
commit 6f67992ffa
2 changed files with 2 additions and 29 deletions

View file

@ -35,7 +35,6 @@ BEGIN {
@EXPORT = qw(
&GetRating
&DelRating
);
}
@ -57,9 +56,6 @@ Get a rating for a bib
my $rating_hashref = GetRating( $biblionumber, undef );
my $rating_hashref = GetRating( $biblionumber, $borrowernumber );
Delete a rating for a bib
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
All subroutines in Ratings.pm return a hashref which contain 4 keys
@ -184,28 +180,5 @@ sub GetRating {
return \%rating_hash;
}
=head2 DelRating
my $rating_hashref = DelRating( $biblionumber, $borrowernumber );
Delete a rating for a bib
=cut
sub DelRating {
my ( $biblionumber, $borrowernumber ) = @_;
my $rating = Koha::Database->new()->schema->resultset('Rating')->find(
{
borrowernumber => $borrowernumber,
biblionumber => $biblionumber
}
);
$rating->delete() if $rating;
return GetRating($biblionumber);
}
1;
__END__

View file

@ -73,8 +73,8 @@ my $rating;
$rating_value //= '';
if ( $rating_value eq '' ) {
#### delete
$rating = DelRating( $biblionumber, $loggedinuser );
Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser } )->delete;
$rating = Koha::Ratings->search({ biblionumber => $biblionumber })->get_rating;
}
elsif ( $rating_value and !$rating_old_value ) {