Bug 18016 - C4::Auth_with_ldap::ldap_entry_2_hash inserts 0000-00-00 for invalid dateofbirth
Summary: C4::Auth_with_ldap::ldap_entry_2_hash inserts 0000-00-00 for invalid dateofbirth
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Authentication (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Dobrica Pavlinusic
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 31143
  Show dependency treegraph
 
Reported: 2017-01-30 15:56 UTC by Dobrica Pavlinusic
Modified: 2023-06-17 13:12 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.