Bug 12633: Fix specific default values
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 21 Apr 2015 14:50:12 +0000 (16:50 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 15 May 2015 18:38:05 +0000 (15:38 -0300)
The dates should be set to undef if defined but empty, otherwise with an
empty string, '0000-00-00' will be inserted into the DB.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Members.pm

index 81e83ac..c5e5453 100644 (file)
@@ -670,6 +670,9 @@ sub ModMember {
     my $new_borrower = { map { join(' ', @columns) =~ /$_/ ? ( $_ => $data{$_} ) : () } keys(%data) };
     delete $new_borrower->{flags};
 
+    $new_borrower->{dateofbirth}  ||= undef if exists $new_borrower->{dateofbirth};
+    $new_borrower->{dateenrolled} ||= undef if exists $new_borrower->{dateenrolled};
+    $new_borrower->{dateexpiry}   ||= undef if exists $new_borrower->{dateexpiry};
     my $rs = $schema->resultset('Borrower')->search({
         borrowernumber => $new_borrower->{borrowernumber},
      });