Bug 14553: Silencing warn triggered when clearing item rating on OPAC
authorAleisha <aleishaamohia@hotmail.com>
Tue, 21 Jul 2015 18:38:58 +0000 (18:38 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 11 Nov 2015 14:08:50 +0000 (11:08 -0300)
To test:

1) Go to any item and clear the star rating (don't have to set a rating first)
2) Notice the warn
3) Apply patch and reload page
4) Clear star rating
5) Notice no warn
6) Click a star to add a rating
7) Make sure your rating, the average rating and amount of votes are all
   correct
8) Could be beneficial to log in as another user and try to add a rating on the
   same item from their account. Check the average rating is
   cacalculated and amount of votes increases
9) Confirm still no warns

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  Can see the warning in logs, and its disappearance with this patch.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
opac/opac-ratings-ajax.pl

index 1b91caf..2d6c706 100755 (executable)
@@ -67,10 +67,9 @@ else {
 }
 
 my $rating;
+$rating_value //= '';
 
-undef $rating_value if $rating_value eq '';
-
-if ( !$rating_value ) {
+if ( $rating_value eq '' ) {
 #### delete
     $rating = DelRating( $biblionumber, $loggedinuser );
 }