[Koha-patches] [PATCH] Fix :Fatal Errors occurs when date is not a regular date

henridamien.laurent at biblibre.com henridamien.laurent at biblibre.com
Fri Mar 6 12:03:21 CET 2009


From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>

When the start date or the "current date" is not a regular date
the transformation and checkdate fails because there is no
Year/Month/Date
This patch makes it fail more 'silenty' for the users and raises an
error that could be coped with.
---
 C4/Serials.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index f14a855..ace2421 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -1804,7 +1804,7 @@ sub HasSubscriptionExpired {
       my ($res) = $sth->fetchrow  ;
       my @res=split (/-/,$res);
       my @endofsubscriptiondate=split(/-/,$expirationdate);
-      return 2 if (not check_date(@res) || not check_date(@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));
-- 
1.5.6.3




More information about the Koha-patches mailing list