Lines 2291-2299
sub GetFictiveIssueNumber {
Link Here
|
2291 |
if($unit eq 'day') { |
2291 |
if($unit eq 'day') { |
2292 |
$delta = Delta_Days($fa_year, $fa_month, $fa_day, $year, $month, $day); |
2292 |
$delta = Delta_Days($fa_year, $fa_month, $fa_day, $year, $month, $day); |
2293 |
} elsif($unit eq 'week') { |
2293 |
} elsif($unit eq 'week') { |
2294 |
($wkno, $year) = Week_of_Year($year, $month, $day); |
2294 |
$delta = int( Delta_Days($fa_year, $fa_month, $fa_day, $year, $month, $day) / 7); |
2295 |
my ($fa_wkno, $fa_yr) = Week_of_Year($fa_year, $fa_month, $fa_day); |
|
|
2296 |
$delta = ($fa_yr == $year) ? ($wkno - $fa_wkno) : ( ($year-$fa_yr-1)*52 + (52-$fa_wkno+$wkno) ); |
2297 |
} elsif( $unit eq 'month' || $unit eq 'year' ) { |
2295 |
} elsif( $unit eq 'month' || $unit eq 'year' ) { |
2298 |
$delta = _delta_units( [$fa_year, $fa_month, $fa_day], [$year, $month, $day], $unit ); |
2296 |
$delta = _delta_units( [$fa_year, $fa_month, $fa_day], [$year, $month, $day], $unit ); |
2299 |
} |
2297 |
} |
Lines 2344-2369
sub _get_next_date_day {
Link Here
|
2344 |
sub _get_next_date_week { |
2342 |
sub _get_next_date_week { |
2345 |
my ($subscription, $freqdata, $year, $month, $day) = @_; |
2343 |
my ($subscription, $freqdata, $year, $month, $day) = @_; |
2346 |
|
2344 |
|
2347 |
my ($wkno, $yr) = Week_of_Year($year, $month, $day); |
2345 |
my @newissue; # ( yy, mm, dd ) |
2348 |
my $fa_dow = Day_of_Week(split /-/, $subscription->{firstacquidate}); |
2346 |
my $delta_days = int( 7 / $freqdata->{issuesperunit} ); |
2349 |
|
2347 |
|
2350 |
if ($subscription->{countissuesperunit} + 1 > $freqdata->{issuesperunit}){ |
2348 |
if( $freqdata->{issuesperunit} == 1 ) { |
2351 |
$subscription->{countissuesperunit} = 1; |
2349 |
# Add full weeks (of 7 days) |
2352 |
$wkno += $freqdata->{unitsperissue}; |
2350 |
@newissue = Add_Delta_Days( |
2353 |
if($wkno > 52){ |
2351 |
$year, $month, $day, 7 * $freqdata->{"unitsperissue"} ); |
2354 |
$wkno = $wkno % 52; |
2352 |
} elsif ( $subscription->{countissuesperunit} < $freqdata->{issuesperunit} ) { |
2355 |
$yr++; |
2353 |
# Add rounded number of days based on frequency. |
2356 |
} |
2354 |
@newissue = Add_Delta_Days( $year, $month, $day, $delta_days ); |
2357 |
($year,$month,$day) = Monday_of_Week($wkno, $yr); |
|
|
2358 |
($year,$month,$day) = Add_Delta_Days($year, $month, $day, $fa_dow - 1); |
2359 |
} else { |
2360 |
# Try to guess the next day of week |
2361 |
my $delta_days = int((7 - ($fa_dow - 1)) / $freqdata->{issuesperunit}); |
2362 |
($year,$month,$day) = Add_Delta_Days($year, $month, $day, $delta_days); |
2363 |
$subscription->{countissuesperunit}++; |
2355 |
$subscription->{countissuesperunit}++; |
|
|
2356 |
} else { |
2357 |
# We finished a cycle of issues within a unit. |
2358 |
# Subtract delta * (issues - 1), add 1 week |
2359 |
@newissue = Add_Delta_Days( $year, $month, $day, |
2360 |
-$delta_days * ($freqdata->{issuesperunit} - 1) ); |
2361 |
@newissue = Add_Delta_Days( @newissue, 7 ); |
2362 |
$subscription->{countissuesperunit} = 1; |
2364 |
} |
2363 |
} |
2365 |
|
2364 |
return @newissue; |
2366 |
return ($year, $month, $day); |
|
|
2367 |
} |
2365 |
} |
2368 |
|
2366 |
|
2369 |
sub _get_next_date_month { |
2367 |
sub _get_next_date_month { |
2370 |
- |
|
|