Bug Fix : Adding Some error proofs to HaveSubscriptionExpired
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Mon, 6 Oct 2008 14:53:40 +0000 (16:53 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Mon, 24 Nov 2008 17:07:50 +0000 (18:07 +0100)
Date::Calc::CalcDays was throwing error 500 when one serial had an undefined date.

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
C4/Serials.pm

index 4ca0312..ad12dda 100644 (file)
@@ -1797,8 +1797,10 @@ sub HasSubscriptionExpired {
       $sth->execute($subscriptionid);
       my ($res) = $sth->fetchrow  ;
       my @res=split (/-/,$res);
-# warn "date expiration :$expirationdate";
       my @endofsubscriptiondate=split(/-/,$expirationdate);
+      map{
+        return 2 unless $_ ;
+      } (@res,@endofsubscriptiondate);     
       return 1 if ( (@endofsubscriptiondate && Delta_Days($res[0],$res[1],$res[2],
                   $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) <= 0)
                   || (!$res));