Lines 947-953
sub GetExpirationDate {
Link Here
|
947 |
# we don't do the same test if the subscription is based on X numbers or on X weeks/months |
947 |
# we don't do the same test if the subscription is based on X numbers or on X weeks/months |
948 |
$enddate = $startdate || $subscription->{startdate}; |
948 |
$enddate = $startdate || $subscription->{startdate}; |
949 |
my @date = split( /-/, $enddate ); |
949 |
my @date = split( /-/, $enddate ); |
|
|
950 |
|
950 |
return if ( scalar(@date) != 3 || not check_date(@date) ); |
951 |
return if ( scalar(@date) != 3 || not check_date(@date) ); |
|
|
952 |
|
951 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
953 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
952 |
if ( $frequency and $frequency->{unit} ) { |
954 |
if ( $frequency and $frequency->{unit} ) { |
953 |
|
955 |
|
Lines 2243-2260
sub abouttoexpire {
Link Here
|
2243 |
my $per = $subscription->{'periodicity'}; |
2245 |
my $per = $subscription->{'periodicity'}; |
2244 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($per); |
2246 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($per); |
2245 |
if ($frequency and $frequency->{unit}){ |
2247 |
if ($frequency and $frequency->{unit}){ |
|
|
2248 |
|
2246 |
my $expirationdate = GetExpirationDate($subscriptionid); |
2249 |
my $expirationdate = GetExpirationDate($subscriptionid); |
|
|
2250 |
|
2247 |
my ($res) = $dbh->selectrow_array('select max(planneddate) from serial where subscriptionid = ?', undef, $subscriptionid); |
2251 |
my ($res) = $dbh->selectrow_array('select max(planneddate) from serial where subscriptionid = ?', undef, $subscriptionid); |
2248 |
my $nextdate = GetNextDate($subscription, $res); |
2252 |
my $nextdate = GetNextDate($subscription, $res); |
2249 |
if(Date::Calc::Delta_Days( |
2253 |
|
2250 |
split( /-/, $nextdate ), |
2254 |
# only compare dates if both dates exist. |
2251 |
split( /-/, $expirationdate ) |
2255 |
if ($nextdate and $expirationdate) { |
2252 |
) <= 0) { |
2256 |
if(Date::Calc::Delta_Days( |
2253 |
return 1; |
2257 |
split( /-/, $nextdate ), |
|
|
2258 |
split( /-/, $expirationdate ) |
2259 |
) <= 0) { |
2260 |
return 1; |
2261 |
} |
2254 |
} |
2262 |
} |
|
|
2263 |
|
2255 |
} elsif ($subscription->{numberlength}>0) { |
2264 |
} elsif ($subscription->{numberlength}>0) { |
2256 |
return (countissuesfrom($subscriptionid,$subscription->{'startdate'}) >=$subscription->{numberlength}-1); |
2265 |
return (countissuesfrom($subscriptionid,$subscription->{'startdate'}) >=$subscription->{numberlength}-1); |
2257 |
} |
2266 |
} |
|
|
2267 |
|
2258 |
return 0; |
2268 |
return 0; |
2259 |
} |
2269 |
} |
2260 |
|
2270 |
|
2261 |
- |
|
|