Bugzilla – Attachment 190214 Details for
Bug 41387
Add option for 2 digit month to serial patterns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41387: Add option for 2 digit month to serials
Bug-41387-Add-option-for-2-digit-month-to-serials.patch (text/plain), 3.21 KB, created by
Nick Clemens (kidclamp)
on 2025-12-05 14:28:41 UTC
(
hide
)
Description:
Bug 41387: Add option for 2 digit month to serials
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-12-05 14:28:41 UTC
Size:
3.21 KB
patch
obsolete
>From fdb4498fd6220691086536443d061d6368eea6ae Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 5 Dec 2025 14:19:04 +0000 >Subject: [PATCH] Bug 41387: Add option for 2 digit month to serials > >To test: >0 - Apply patch >1 - Setup a new numbering pattern > Serials->Manage numbering patterns + New numbering pattern >2 - In the numbering formula enter: {X} {Y} {Z} {Year} {Month} {Month2} {Day} {MonthName} {DayName} >3 - Populate X/Y/Z in the table as you wish, these should be unaffected by patch >4 - Set a Frequency / First issue plublication date / Subscription length >5 - Click 'Test pattern' >6 - Confirm the dates in the Number match the publication date values >7 - Try with different frequencies to confirm they match >8 - Save the pattern >9 - Create a new subscription and use the new pattern >10 - Confirm it works as expected >--- > C4/Serials.pm | 2 ++ > t/db_dependent/Serials.t | 18 +++++++++++++++++- > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index b8f6b392166..02adb238197 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -917,6 +917,7 @@ sub GetNextSeq { > > my $dt = dt_from_string($planneddate); > $calculated =~ s/\{Month\}/$dt->month/eg; >+ $calculated =~ s/\{Month2\}/sprintf("%02d", $dt->month())/eg; > $calculated =~ s/\{MonthName\}/$dt->month_name/eg; > $calculated =~ s/\{Year\}/$dt->year/eg; > $calculated =~ s/\{Day\}/$dt->day/eg; >@@ -968,6 +969,7 @@ sub GetSeq { > > my $dt = dt_from_string( $subscription->{firstacquidate} ); > $calculated =~ s/\{Month\}/$dt->month/eg; >+ $calculated =~ s/\{Month2\}/sprintf("%02d", $dt->month())/eg; > $calculated =~ s/\{MonthName\}/$dt->month_name/eg; > $calculated =~ s/\{Year\}/$dt->year/eg; > $calculated =~ s/\{Day\}/$dt->day/eg; >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index 75921f6910b..2fcaf8ef248 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -704,7 +704,7 @@ subtest "NewSubscription|ModSubscription" => sub { > }; > > subtest "test numbering pattern with dates in GetSeq GetNextSeq" => sub { >- plan tests => 4; >+ plan tests => 6; > $subscription = { > lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, > innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >@@ -737,6 +737,22 @@ subtest "test numbering pattern with dates in GetSeq GetNextSeq" => sub { > 'GetNextSeq correctly calculates numbering from planned date, leap year' > ); > >+ $pattern = { >+ numberingmethod => '{Year} {Day} {DayName} {Month2} {MonthName}', >+ }; >+ $subscription->{firstacquidate} = '2024-02-29'; >+ $planneddate = '2024-02-29'; >+ $numbering = GetSeq( $subscription, $pattern ); >+ is( >+ $numbering, '2024 29 Thursday 02 February', >+ 'GetSeq correctly calculates 2 digit month numbering from first aqui date, leap year' >+ ); >+ ($numbering) = GetNextSeq( $subscription, $pattern, undef, $planneddate ); >+ is( >+ $numbering, '2024 29 Thursday 02 February', >+ 'GetNextSeq correctly calculates 2 digit month numbering from planned date, leap year' >+ ); >+ > }; > > subtest "DelSubscription" => sub { >-- >2.39.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 41387
:
190214
|
190215
|
190274
|
190275