Bugzilla – Attachment 37342 Details for
Bug 12671
Guess next serial date when there are several issues per unit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts.
PASSED-QA-Bug-12671-Guess-next-serial-date-when-th.patch (text/plain), 3.41 KB, created by
Kyle M Hall (khall)
on 2015-03-27 18:37:29 UTC
(
hide
)
Description:
[PASSED QA] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts.
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-03-27 18:37:29 UTC
Size:
3.41 KB
patch
obsolete
>From 9e2a84ee32efa2a0900071e9fcf7a237ec59a53b Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Tue, 23 Dec 2014 09:55:06 +0200 >Subject: [PATCH] [PASSED QA] Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts. > >When getting the next frequency number, use the real number of days for each month and each year. > >Unit tests updated. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Serials.pm | 6 ++++-- > t/db_dependent/Serials/GetNextDate.t | 10 +++++----- > 2 files changed, 9 insertions(+), 7 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index fd75374..ad1df03 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2482,7 +2482,8 @@ sub _get_next_date_month { > $day = $fa_day <= $days_in_month ? $fa_day : $days_in_month; > } else { > # Try to guess the next day in month >- my $delta_days = int((28 - ($fa_day - 1)) / $freqdata->{issuesperunit}); >+ my $days_in_month = Days_in_Month($year, $month); >+ my $delta_days = int(($days_in_month - ($fa_day - 1)) / $freqdata->{issuesperunit}); > ($year,$month,$day) = Add_Delta_Days($year, $month, $day, $delta_days); > $subscription->{countissuesperunit}++; > } >@@ -2503,7 +2504,8 @@ sub _get_next_date_year { > $day = $fa_day <= $days_in_month ? $fa_day : $days_in_month; > } else { > # Try to guess the next day in year >- my $delta_days = int((365 - ($fa_day - 1)) / $freqdata->{issuesperunit}); >+ 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}); > ($year,$month,$day) = Add_Delta_Days($year, $month, $day, $delta_days); > $subscription->{countissuesperunit}++; > } >diff --git a/t/db_dependent/Serials/GetNextDate.t b/t/db_dependent/Serials/GetNextDate.t >index c9fe98c..fe6059f 100644 >--- a/t/db_dependent/Serials/GetNextDate.t >+++ b/t/db_dependent/Serials/GetNextDate.t >@@ -371,11 +371,11 @@ $subscription = { > }; > $publisheddate = $subscription->{firstacquidate}; > $publisheddate = GetNextDate($subscription, $publisheddate); >-is($publisheddate, '1970-01-15'); >+is($publisheddate, '1970-01-16', 'January has 31 days'); > $publisheddate = GetNextDate($subscription, $publisheddate); > is($publisheddate, '1970-02-01'); > $publisheddate = GetNextDate($subscription, $publisheddate); >-is($publisheddate, '1970-02-15'); >+is($publisheddate, '1970-02-15', 'February has only 28 days'); > $publisheddate = GetNextDate($subscription, $publisheddate); > is($publisheddate, '1970-03-01'); > >@@ -388,13 +388,13 @@ $subscription = { > }; > $publisheddate = $subscription->{firstacquidate}; > $publisheddate = GetNextDate($subscription, $publisheddate); >-is($publisheddate, '1970-01-15'); >+is($publisheddate, '1970-01-16', 'January has 31 days'); > $publisheddate = GetNextDate($subscription, $publisheddate); >-is($publisheddate, '1970-02-15'); >+is($publisheddate, '1970-02-15', 'February has only 28 days'); > $publisheddate = GetNextDate($subscription, $publisheddate); > is($publisheddate, '1970-04-01'); > $publisheddate = GetNextDate($subscription, $publisheddate); >-is($publisheddate, '1970-04-15'); >+is($publisheddate, '1970-04-16', 'April has 30 days'); > $publisheddate = GetNextDate($subscription, $publisheddate); > is($publisheddate, '1970-05-01'); > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12671
:
30291
|
30292
|
34658
|
34659
|
34660
|
36924
|
36925
|
36926
|
37340
|
37341
| 37342