Bug Fix : Adding Some error proofs to HaveSubscriptionExpired
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 19 Nov 2008 13:58:18 +0000 (14:58 +0100)
committerGalen Charlton <galen.charlton@liblime.com>
Sat, 25 Apr 2009 03:26:41 +0000 (22:26 -0500)
Date::Calc::CalcDays was throwing error 500 when one serial had an undefined date.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/Serials.pm

index 443c361..90db643 100644 (file)
@@ -1805,8 +1805,10 @@ sub HasSubscriptionExpired {
       my ($res) = $sth->fetchrow  ;
          return 0 unless $res;
       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));