(bug #4491) fix weird code in search scripts
[koha.git] / C4 / Serials.pm
index 5655859..2f5f27f 100644 (file)
@@ -1011,7 +1011,9 @@ sub GetExpirationDate {
     my $dbh              = C4::Context->dbh;
     my $subscription     = GetSubscription($subscriptionid);
     my $enddate          = $subscription->{startdate};
-
+    
+    return if not $subscription->{startdate};
+    
 # we don't do the same test if the subscription is based on X numbers or on X weeks/months
     if (($subscription->{periodicity} % 16) >0){
       if ( $subscription->{numberlength} ) {
@@ -2386,6 +2388,7 @@ sub GetNextDate(@) {
     #date supposed to be in ISO.
     
     my ( $year, $month, $day ) = split(/-/, $planneddate);
+    return undef if not check_date($year, $month, $day);
     $month=1 unless ($month);
     $day=1 unless ($day);
     my @resultdate;