[Koha-patches] [PATCH] Bug Fix : Adding Some error proofs to HaveSubscriptionExpired

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Wed Nov 19 14:58:18 CET 2008


Date::Calc::CalcDays was throwing error 500 when one serial had an undefined date.
---
 C4/Serials.pm |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index 4ca0312..ad12dda 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -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, at endofsubscriptiondate);     
       return 1 if ( (@endofsubscriptiondate && Delta_Days($res[0],$res[1],$res[2],
                   $endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]) <= 0)
                   || (!$res));
-- 
1.6.0.2




More information about the Koha-patches mailing list