From 85a35f41bc092a73a3a5325c55ad41ca1648e947 Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Fri, 8 Apr 2016 16:58:18 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 16116 - Fix problem change of issue publication date doesn't reflect on the next issue generated Test plan : 1. In Cataloging > New with Z39.50, look for issn = 1536-6596 (National Geographic) into the LCC z39.60 server. Add the record. 2. Add a new subscription for National Geographic. Fill-in the form. - use the default values of the first page - for the second page : First issue publication date = 10/01/2016 Frequency = 1/month Subscription lenght = 12 issues Subscription start date = 01/01/2016 Numbering pattern = Number Begins with = 1 - Save 3. Receive the first issue. Change the status to "received". Note that the "Published on" date = 10/01/2016. This date goes to the "Date published" column in the serial collection page. 4. The second issue is generated. Edit serial to receive the issue. 5. Change the "Published on" date to 14/02/2016. Change the status to "received". Save. 6. "Date published" for the next issue generated is : 14/03/2016. Signed-off-by: Josef Moravec --- C4/Serials.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index c1316f2..6a8015e 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -2325,7 +2325,7 @@ sub _get_next_date_week { my ($subscription, $freqdata, $year, $month, $day) = @_; my ($wkno, $yr) = Week_of_Year($year, $month, $day); - my $fa_dow = Day_of_Week(split /-/, $subscription->{firstacquidate}); + my $fa_dow = Day_of_Week($year, $month, $day); if ($subscription->{countissuesperunit} + 1 > $freqdata->{issuesperunit}){ $subscription->{countissuesperunit} = 1; @@ -2350,18 +2350,17 @@ sub _get_next_date_month { my ($subscription, $freqdata, $year, $month, $day) = @_; my $fa_day; - (undef, undef, $fa_day) = split /-/, $subscription->{firstacquidate}; if ($subscription->{countissuesperunit} + 1 > $freqdata->{issuesperunit}){ $subscription->{countissuesperunit} = 1; ($year,$month,$day) = Add_Delta_YM($year,$month,$day, 0, $freqdata->{unitsperissue}); my $days_in_month = Days_in_Month($year, $month); - $day = $fa_day <= $days_in_month ? $fa_day : $days_in_month; + $day = $day <= $days_in_month ? $day : $days_in_month; } else { # Try to guess the next day in month my $days_in_month = Days_in_Month($year, $month); - my $delta_days = int(($days_in_month - ($fa_day - 1)) / $freqdata->{issuesperunit}); + my $delta_days = int(($days_in_month - ($day - 1)) / $freqdata->{issuesperunit}); ($year,$month,$day) = Add_Delta_Days($year, $month, $day, $delta_days); $subscription->{countissuesperunit}++; } @@ -2377,13 +2376,12 @@ sub _get_next_date_year { if ($subscription->{countissuesperunit} + 1 > $freqdata->{issuesperunit}){ $subscription->{countissuesperunit} = 1; ($year) = Add_Delta_YM($year,$month,$day, $freqdata->{"unitsperissue"},0); - $month = $fa_month; my $days_in_month = Days_in_Month($year, $month); - $day = $fa_day <= $days_in_month ? $fa_day : $days_in_month; + $day = $day <= $days_in_month ? $day : $days_in_month; } else { # Try to guess the next day in year my $days_in_year = Days_in_Year($year,12); #Sum the days of all the months of this year - my $delta_days = int(($days_in_year - ($fa_day - 1)) / $freqdata->{issuesperunit}); + my $delta_days = int(($days_in_year - ($day - 1)) / $freqdata->{issuesperunit}); ($year,$month,$day) = Add_Delta_Days($year, $month, $day, $delta_days); $subscription->{countissuesperunit}++; } -- 2.1.4