Bug 14717: Invalid dates in debarred column
authorChris Cormack <chrisc@catalyst.net.nz>
Mon, 24 Aug 2015 22:00:20 +0000 (10:00 +1200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Sep 2015 13:49:48 +0000 (10:49 -0300)
To test
1/ Import a patron using the patron import tool, make sure they have
no debarred column in the file
2/ Check the database, notice the debarred column is 0000-00-00
3/ For bonus points, checkout an item to that borrower, then check it in
notice Koha errors
4/ Apply patch
5/ Import a new patron
6/ Notice column is now NULL and that checkins work

Signed-off-by: Eugene Espinoza <eugenegf@yahoo.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

C4/Members.pm

index 91c89f8..0f4aeba 100644 (file)
@@ -759,7 +759,10 @@ sub AddMember {
 
     # create a disabled account if no password provided
     $data{'password'} = ($data{'password'})? hash_password($data{'password'}) : '!';
+
+    # we don't want invalid dates in the db (mysql has a bad habit of inserting 0000-00-00
     $data{'dateofbirth'} = undef if( not $data{'dateofbirth'} );
+    $data{'debarred'} = undef if ( not $data{'debarred'} );
 
     # get only the columns of Borrower
     my @columns = $schema->source('Borrower')->columns;