From c2230797de646779408a5b57ec3ebe339ed7abfc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 22 May 2013 15:38:33 +0200 Subject: [PATCH] Umstellung Geburtsspalte Ansprechppersonen auf Datum: Wert '0000-00-00' als leer werten --- sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl b/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl index bb45209e2..ab4a0175a 100644 --- a/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl +++ b/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl @@ -11,10 +11,10 @@ use parent qw(SL::DBUpgrade2::Base); sub convert_to_date { my ($self, $str) = @_; - return '' if !$str; + return '' if !$str || ($str =~ m/00.*00.*00.*00/); # 0000-00-00 may be present in old databases. my $sth = $self->dbh->prepare('SELECT ?::date AS date') or return undef; - $sth->execute($str) or return undef; + $sth->execute($str) or return undef; return $sth->fetchrow_hashref->{date}; } -- 2.20.1