Lines 2270-2275
depending on how many rows are in serial table.
Link Here
|
2270 |
The issue number calculation is based on subscription frequency, first acquisition |
2270 |
The issue number calculation is based on subscription frequency, first acquisition |
2271 |
date, and $publisheddate. |
2271 |
date, and $publisheddate. |
2272 |
|
2272 |
|
|
|
2273 |
Returns undef when called for irregular frequencies. |
2274 |
|
2273 |
The routine is used to skip irregularities when calculating the next issue |
2275 |
The routine is used to skip irregularities when calculating the next issue |
2274 |
date (in GetNextDate) or the next issue number (in GetNextSeq). |
2276 |
date (in GetNextDate) or the next issue number (in GetNextSeq). |
2275 |
|
2277 |
|
Lines 2280-2305
sub GetFictiveIssueNumber {
Link Here
|
2280 |
|
2282 |
|
2281 |
my $frequency = GetSubscriptionFrequency($subscription->{'periodicity'}); |
2283 |
my $frequency = GetSubscriptionFrequency($subscription->{'periodicity'}); |
2282 |
my $unit = $frequency->{unit} ? lc $frequency->{'unit'} : undef; |
2284 |
my $unit = $frequency->{unit} ? lc $frequency->{'unit'} : undef; |
2283 |
my $issueno = 0; |
2285 |
return if !$unit; |
|
|
2286 |
my $issueno; |
2284 |
|
2287 |
|
2285 |
if($unit) { |
2288 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2286 |
my ($year, $month, $day) = split /-/, $publisheddate; |
2289 |
my ( $fa_year, $fa_month, $fa_day ) = split /-/, $subscription->{'firstacquidate'}; |
2287 |
my ($fa_year, $fa_month, $fa_day) = split /-/, $subscription->{'firstacquidate'}; |
2290 |
my $delta = _delta_units( [$fa_year, $fa_month, $fa_day], [$year, $month, $day], $unit ); |
2288 |
my $wkno; |
|
|
2289 |
my $delta = _delta_units( [$fa_year, $fa_month, $fa_day], [$year, $month, $day], $unit ); |
2290 |
|
2291 |
|
2291 |
if($frequency->{'unitsperissue'} == 1) { |
2292 |
if( $frequency->{'unitsperissue'} == 1 ) { |
2292 |
$issueno = $delta * $frequency->{'issuesperunit'} + $subscription->{'countissuesperunit'}; |
2293 |
$issueno = $delta * $frequency->{'issuesperunit'} + $subscription->{'countissuesperunit'}; |
2293 |
} else { |
2294 |
} else { # issuesperunit == 1 |
2294 |
# Assuming issuesperunit == 1 |
2295 |
$issueno = 1 + int( $delta / $frequency->{'unitsperissue'} ); |
2295 |
$issueno = int( ($delta + $frequency->{'unitsperissue'}) / $frequency->{'unitsperissue'} ); |
|
|
2296 |
} |
2297 |
} |
2296 |
} |
2298 |
return $issueno; |
2297 |
return $issueno; |
2299 |
} |
2298 |
} |
2300 |
|
2299 |
|
2301 |
sub _delta_units { |
2300 |
sub _delta_units { |
2302 |
my ( $date1, $date2, $unit ) = @_; |
2301 |
my ( $date1, $date2, $unit ) = @_; |
|
|
2302 |
# date1 and date2 are array refs in the form [ yy, mm, dd ] |
2303 |
|
2303 |
|
2304 |
if( $unit eq 'day' ) { |
2304 |
if( $unit eq 'day' ) { |
2305 |
return Delta_Days( @$date1, @$date2 ); |
2305 |
return Delta_Days( @$date1, @$date2 ); |