From 7e55d7dbe112519c62ff35dd0318d58689558414 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 9e60f44..f84eaad 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -217,6 +217,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.1.4