X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-ratings.pl;h=7e1bca61cb33d5b47f65be48b5bc6a125ef532d5;hb=a9743888e506ded02200ce2aad842c038810e49f;hp=d936b13b65711ae423a3b4e2cbbbeeef45de9e64;hpb=70a31874a73fdfaf83371ecd0c80359301dbd45c;p=koha-ffzg.git diff --git a/opac/opac-ratings.pl b/opac/opac-ratings.pl index d936b13b65..7e1bca61cb 100755 --- a/opac/opac-ratings.pl +++ b/opac/opac-ratings.pl @@ -25,13 +25,11 @@ note: there is currently no 'delete rating' functionality in this script =cut -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); -use C4::Auth; +use C4::Auth qw( checkauth ); use C4::Context; -use C4::Debug; use Koha::Ratings; @@ -53,10 +51,12 @@ unless ( $biblionumber and $rating_value ) { } if ( !$rating_old_value ) { - Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, })->store; + my $rating = Koha::Rating->new( { biblionumber => $biblionumber, borrowernumber => $loggedinuser, rating_value => $rating_value, }); + $rating->store if $rating; } else { - Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser })->rating_value($rating_value)->store; + my $rating = Koha::Ratings->find( { biblionumber => $biblionumber, borrowernumber => $loggedinuser }); + $rating->rating_value($rating_value)->store if $rating; } print $query->redirect( "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");