View | Details | Raw Unified | Return to bug 13109
Collapse All | Expand All

(-)a/C4/Serials.pm (-6 / +15 lines)
Lines 1023-1029 sub GetExpirationDate { Link Here
1023
    # we don't do the same test if the subscription is based on X numbers or on X weeks/months
1023
    # we don't do the same test if the subscription is based on X numbers or on X weeks/months
1024
    $enddate = $startdate || $subscription->{startdate};
1024
    $enddate = $startdate || $subscription->{startdate};
1025
    my @date = split( /-/, $enddate );
1025
    my @date = split( /-/, $enddate );
1026
1026
    return if ( scalar(@date) != 3 || not check_date(@date) );
1027
    return if ( scalar(@date) != 3 || not check_date(@date) );
1028
1027
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
1029
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
1028
    if ( $frequency and $frequency->{unit} ) {
1030
    if ( $frequency and $frequency->{unit} ) {
1029
1031
Lines 2319-2336 sub abouttoexpire { Link Here
2319
    my $per = $subscription->{'periodicity'};
2321
    my $per = $subscription->{'periodicity'};
2320
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($per);
2322
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($per);
2321
    if ($frequency and $frequency->{unit}){
2323
    if ($frequency and $frequency->{unit}){
2324
2322
        my $expirationdate = GetExpirationDate($subscriptionid);
2325
        my $expirationdate = GetExpirationDate($subscriptionid);
2326
2323
        my ($res) = $dbh->selectrow_array('select max(planneddate) from serial where subscriptionid = ?', undef, $subscriptionid);
2327
        my ($res) = $dbh->selectrow_array('select max(planneddate) from serial where subscriptionid = ?', undef, $subscriptionid);
2324
        my $nextdate = GetNextDate($subscription, $res);
2328
        my $nextdate = GetNextDate($subscription, $res);
2325
        if(Date::Calc::Delta_Days(
2329
2326
            split( /-/, $nextdate ),
2330
        # BZ 13109, only compare dates if both dates exist.
2327
            split( /-/, $expirationdate )
2331
        if ($nextdate and $expirationdate) { 
2328
        ) <= 0) {
2332
            if(Date::Calc::Delta_Days(
2329
            return 1;
2333
                split( /-/, $nextdate ),
2334
                split( /-/, $expirationdate )
2335
            ) <= 0) {
2336
                return 1;
2337
            }
2330
        }
2338
        }
2339
2331
    } elsif ($subscription->{numberlength}>0) {
2340
    } elsif ($subscription->{numberlength}>0) {
2332
        return (countissuesfrom($subscriptionid,$subscription->{'startdate'}) >=$subscription->{numberlength}-1);
2341
        return (countissuesfrom($subscriptionid,$subscription->{'startdate'}) >=$subscription->{numberlength}-1);
2333
    }
2342
    }
2343
2334
    return 0;
2344
    return 0;
2335
}
2345
}
2336
2346
2337
- 

Return to bug 13109