[Koha-patches] [PATCH] Bug 5021 Formatting of undefined serials dates
Colin Campbell
colin.campbell at ptfs-europe.com
Fri Jul 16 13:55:19 CEST 2010
Routine was checking undefinedness but such dates were
normalized on retrieval to 0000-00-00
Also planned/received date should also be checked
---
C4/Serials.pm | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/C4/Serials.pm b/C4/Serials.pm
index 35cc5be..032246c 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/;
--
1.7.1.1
More information about the Koha-patches
mailing list