Bug 18607: Fix date calculations for monthly frequencies in Serials
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 16 May 2017 12:46:55 +0000 (14:46 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 29 Jun 2017 07:10:25 +0000 (09:10 +0200)
commita5370edb9b90150f7aa4000c42ec523b9c0cbea8
treea1bc1b88020b5249b0bc7162f223f8d33397c005
parent07672a77c666354578467c2a35c0f2ea7e512c73
Bug 18607: Fix date calculations for monthly frequencies in Serials

Similarly to the solution of bug 18356, this patch fixes the date
calculation for monthly frequencies.

The calculation in GetFictiveIssueNumber now makes use of the new
_delta_units sub introduced on bug 18356.

The calculation in _get_next_date_month is also very similar to the one
in _get_next_date_year. I do not merge them here, but this could still
be considered later on. At least consistency is achieved now between
both routines. The connection with firstacquidate has been cut thru
just like for year units.

Test plan:
[1] Without this patch, look at the prediction pattern for a
    subscription with first issue on Feb 21 and 5 per month. The first
    issues will be 21, 22, 23, 24, 25. Then jumping to 21, 23, 25, etc.
[2] Apply the patch. Look at the same prediction pattern. You will now
    see 6 day intervals and a new cycle starting on the 21st.
    So Feb 21, 27, Mar 5, 11, 17 and Mar 21, 27, etc.
[3] Edit an subscription. Try a few other monthly frequencies.
[4] The next patch adjusts related unit tests.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit adfcd8d79c6691fb1062a2a5874a736b7792d303)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Serials.pm