Bug 18016

Summary: C4::Auth_with_ldap::ldap_entry_2_hash inserts 0000-00-00 for invalid dateofbirth
Product: Koha Reporter: Dobrica Pavlinusic <dpavlin>
Component: AuthenticationAssignee: Dobrica Pavlinusic <dpavlin>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dpavlin, jonathan.druart, katrin.fischer, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17933
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 31143    

Description Dobrica Pavlinusic 2017-01-30 15:56:37 UTC

    
Comment 1 Jonathan Druart 2017-01-31 09:09:18 UTC
I guess

diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index a58f4e6..8a69d97 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -350,6 +350,9 @@ sub update_local {
     my $borrowerid = shift or croak "No borrowerid";
     my $borrower   = shift or croak "No borrower record";

+    for my $field ( qw( dateofbirth dateenrolled dateexpiry debarred sms_provider_id guarantorid ) ) {
+        delete $borrower->{$field} unless $borrower->{$field};
+    }
     my @keys = keys %$borrower;
     my $dbh = C4::Context->dbh;


Should fix this issue, but I am not able to test.
I am also wondering if it would not be better to call ModMember.
Comment 2 Dobrica Pavlinusic 2017-01-31 10:58:49 UTC
Seems good, but would it better to do dt_from_string on them to verify they are also valid?
Comment 3 Jonathan Druart 2017-02-01 09:37:33 UTC
(In reply to Dobrica Pavlinusic from comment #2)
> Seems good, but would it better to do dt_from_string on them to verify they
> are also valid?

It should not happen I think. If that happened, I guess some people would have raised this problem before.