From ebf7f0cad0148e3ab859fd8bd572794a19f40361 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 16 Jul 2010 12:55:19 +0100 Subject: [PATCH] Bug 5021 Formatting of undefined serials dates Routine was checking undefinedness but such dates were normalized on retrieval to 0000-00-00 Also planned/received date should also be checked Signed-off-by: Galen Charlton --- C4/Serials.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 35cc5be846..032246c4e8 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -405,14 +405,17 @@ sub PrepareSerialsData { my $first; my $previousnote = ""; - foreach my $subs (@$lines) { - $subs->{'publisheddate'} = ( - $subs->{'publisheddate'} - ? format_date( $subs->{'publisheddate'} ) - : "XXX" - ); + foreach my $subs (@{$lines}) { + for my $datefield ( qw(publisheddate planneddate) ) { + # handle both undef and undef returned as 0000-00-00 + if (!defined $subs->{$datefield} or $subs->{$datefield}=~m/^00/) { + $subs->{$datefield} = 'XXX'; + } + else { + $subs->{$datefield} = format_date( $subs->{$datefield} ); + } + } $subs->{'branchname'} = GetBranchName( $subs->{'branchcode'} ); - $subs->{'planneddate'} = format_date( $subs->{'planneddate'} ); $subs->{ "status" . $subs->{'status'} } = 1; $subs->{"checked"} = $subs->{'status'} =~ /1|3|4|7/; -- 2.39.5