bug 3222: moved messaging preference editing
[koha.git] / C4 / Serials.pm
index 90db643..aedc9c5 100644 (file)
@@ -1778,12 +1778,14 @@ sub ItemizeSerials {
 
 =over 4
 
-1 or 0 = HasSubscriptionExpired($subscriptionid)
+$has_expired = HasSubscriptionExpired($subscriptionid)
 
 the subscription has expired when the next issue to arrive is out of subscription limit.
 
 return :
-1 if true, 0 if false.
+0 if the subscription has not expired
+1 if the subscription has expired
+2 if has subscription does not have a valid expiration date set
 
 =back
 
@@ -1806,9 +1808,7 @@ sub HasSubscriptionExpired {
          return 0 unless $res;
       my @res=split (/-/,$res);
       my @endofsubscriptiondate=split(/-/,$expirationdate);
-      map{
-        return 2 unless $_ ;
-      } (@res,@endofsubscriptiondate);     
+      return 2 if (scalar(@res)!=3 || scalar(@endofsubscriptiondate)!=3||not check_date(@res) || not check_date(@endofsubscriptiondate));
       return 1 if ( (@endofsubscriptiondate && Delta_Days($res[0],$res[1],$res[2],
                   $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) <= 0)
                   || (!$res));