ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / opac-serial-issues.pl
index 5b807ea..b94935f 100755 (executable)
@@ -18,8 +18,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Auth;
@@ -62,9 +61,9 @@ if ( $selectview eq "full" ) {
     # now, check is there is an alert subscription for one of the subscriptions
     if ($loggedinuser) {
         foreach (@$subscriptions) {
-            if (getalert($loggedinuser,'issue',$_->{subscriptionid})) {
-                $_->{hasalert} = 1;
-            }
+            my $subscription = Koha::Subscriptions->find( $_->{subscriptionid} );
+            my $subscriber = $subscription->subscribers->find( $loggedinuser );
+            $_->{hasalert} = 1 if $subscriber;
         }
     }
 
@@ -99,12 +98,11 @@ else {
 
     my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber);
     # now, check is there is an alert subscription for one of the subscriptions
-    if ($loggedinuser){
+    if ($loggedinuser) {
         foreach (@$subscriptions) {
-            my $subscription = getalert($loggedinuser,'issue',$_->{subscriptionid});
-            if (@$subscription[0]) {
-                $_->{hasalert} = 1;
-            }
+            my $subscription = Koha::Subscriptions->find( $_->{subscriptionid} );
+            my $subscriber = $subscription->subscribers->find( $loggedinuser );
+            $_->{hasalert} = 1 if $subscriber;
         }
     }