Bugzilla – Attachment 160297 Details for
Bug 35646
Allow using the publication date parts for serial numbering
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35646: Allow use of publication date fields in serial numbering pattern
Bug-35646-Allow-use-of-publication-date-fields-in-.patch (text/plain), 3.55 KB, created by
Lucas Gass (lukeg)
on 2023-12-26 15:41:48 UTC
(
hide
)
Description:
Bug 35646: Allow use of publication date fields in serial numbering pattern
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-12-26 15:41:48 UTC
Size:
3.55 KB
patch
obsolete
>From 15994735fc58d8eaee2b50ecd916668abce9de00 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 22 Dec 2023 18:20:09 +0000 >Subject: [PATCH] Bug 35646: Allow use of publication date fields in serial > numbering pattern > >This patch extends the numbering pattern field to accept subsitituations for: >{Year} {Day} {DayName} {Month} {MonthName} > >These fields are based on the publication date for the serial issue. > >To test: >0 - Apply patch >1 - Setup a enw numbering pattern > Serials->Manage numbering patterns + New numbering pattern >2 - In the numbering formula enter: {X} {Y} {Z} {Year} {Month} {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 > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > C4/Serials.pm | 16 ++++++++++++++++ > serials/showpredictionpattern.pl | 2 +- > 2 files changed, 17 insertions(+), 1 deletion(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index ec88b0f3e6..6211779d43 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -42,6 +42,7 @@ use C4::Serials::Frequency qw( GetSubscriptionFrequency ); > use C4::Serials::Numberpattern; > use Koha::AdditionalFieldValues; > use Koha::Biblios; >+use Koha::DateUtils qw( dt_from_string ); > use Koha::Serial; > use Koha::SharedContent; > use Koha::Subscription::Histories; >@@ -909,6 +910,13 @@ sub GetNextSeq { > $calculated =~ s/\{Z\}/$newlastvalue3string/g; > } > >+ my $dt = dt_from_string($planneddate); >+ $calculated =~ s/\{Month\}/$dt->month/eg; >+ $calculated =~ s/\{MonthName\}/$dt->month_name/eg; >+ $calculated =~ s/\{Year\}/$dt->year/eg; >+ $calculated =~ s/\{Day\}/$dt->day/eg; >+ $calculated =~ s/\{DayName\}/$dt->day_name/eg; >+ > } > > return ($calculated, >@@ -947,6 +955,14 @@ sub GetSeq { > my $newlastvalue3 = $subscription->{'lastvalue3'} || 0; > $newlastvalue3 = _numeration($newlastvalue3, $pattern->{numbering3}, $locale) if ($pattern->{numbering3}); # reset counter if needed. > $calculated =~ s/\{Z\}/$newlastvalue3/g; >+ >+ my $dt = dt_from_string( $subscription->{firstaquidate} ); >+ $calculated =~ s/\{Month\}/$dt->month/eg; >+ $calculated =~ s/\{MonthName\}/$dt->month_name/eg; >+ $calculated =~ s/\{Year\}/$dt->year/eg; >+ $calculated =~ s/\{Day\}/$dt->day/eg; >+ $calculated =~ s/\{DayName\}/$dt->day_name/eg; >+ > return $calculated; > } > >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index 9fc801102b..ae5e958ef3 100755 >--- a/serials/showpredictionpattern.pl >+++ b/serials/showpredictionpattern.pl >@@ -163,7 +163,7 @@ while( $i < 1000 ) { > last; > } > >- ($calculated, $subscription{'lastvalue1'}, $subscription{'lastvalue2'}, $subscription{'lastvalue3'}, $subscription{'innerloop1'}, $subscription{'innerloop2'}, $subscription{'innerloop3'}) = GetNextSeq(\%subscription, \%pattern, $frequency); >+ ($calculated, $subscription{'lastvalue1'}, $subscription{'lastvalue2'}, $subscription{'lastvalue3'}, $subscription{'innerloop1'}, $subscription{'innerloop2'}, $subscription{'innerloop3'}) = GetNextSeq(\%subscription, \%pattern, $frequency, $date); > $issuenumber++; > $line{'number'} = $calculated; > $line{'issuenumber'} = $issuenumber; >-- >2.30.2
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 35646
:
160275
|
160276
|
160277
|
160297
|
160298
|
165088
|
165089
|
165090
|
165093
|
165094
|
165095