From 1544e6b7c105997c0166624549a26683089dbaa4 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 19 Aug 2019 21:55:13 +0000 Subject: [PATCH] Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials This follow-up addresses the issue in Comment 21. To test: 1) Save a subscription with a regular number pattern and receive a few issues 2) Edit the subscription to use publication date and save 3) Receive an issue 4) Notice the issue number under the 'Numbered' column has not updated to reflect the publication date number pattern 5) Apply patch and refresh page 6) The issue number in the 'Numbered' column should now use the publication date --- C4/Serials.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/C4/Serials.pm b/C4/Serials.pm index 2945c233c4..f1e9a03940 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -234,6 +234,21 @@ sub GetSerialInformation { $data->{'subscriptionexpired'} = HasSubscriptionExpired( $data->{'subscriptionid'} ) && $data->{'status'} == 1; $data->{'abouttoexpire'} = abouttoexpire( $data->{'subscriptionid'} ); $data->{cannotedit} = not can_edit_subscription( $data ); + + # dealing with number pattern that uses publication date + if ( !defined($data->{numberpattern}) && defined($data->{pubdatepatternformat}) ){ + my $pubdatepatternformat = $data->{pubdatepatternformat}; + if ( $pubdatepatternformat eq 'dmy' ){ + $data->{serialseq} = dt_from_string( $data->{publisheddate} )->strftime('%d %B %Y'); + } elsif ( $pubdatepatternformat eq 'mdy' ){ + $data->{serialseq} = dt_from_string( $data->{publisheddate} )->strftime('%B %d %Y'); + } elsif ( $pubdatepatternformat eq 'ydm' ){ + $data->{serialseq} = dt_from_string( $data->{publisheddate} )->strftime('%Y %d %B'); + } else { + $data->{serialseq} = dt_from_string( $data->{publisheddate} )->strftime('%Y %B %d'); + } + } + return $data; } -- 2.30.2