Bug Fix : Adding Some error proofs to HaveSubscriptionExpired

Date::Calc::CalcDays was throwing error 500 when one serial had an undefined date.

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
This commit is contained in:
Henri-Damien LAURENT 2008-10-06 16:53:40 +02:00
parent ebe04d8446
commit 3747a599f9
1 changed files with 3 additions and 1 deletions

View 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));