[Koha-bugs] [Bug 11221] New: New patrons are created with invalid dateofbirth value if field is left empty

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 8 17:01:12 CET 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11221

            Bug ID: 11221
           Summary: New patrons are created with invalid dateofbirth value
                    if field is left empty
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: oleonard at myacpl.org
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

If you leave the date of birth field empty when you create a new patron an
invalid value is saved to the database: '0000-00-00' instead of NULL. To
reproduce:

1. Create a new patron. Leave dateofbirth empty.
2. Save the record.
3. Open the record for editing.
4. Save the record without making changes.
5. Koha gives you an error: "Date of birth is invalid."

According to git bisect this bug was caused by the fix for Bug 10403. I assume
it was this change to SQLHelper.pm since all other changes in that bug are
related to acquisitions:

--- a/C4/SQLHelper.pm
+++ b/C4/SQLHelper.pm
@@ -406,7 +406,7 @@ sub _filter_hash{
                ## supposed to be a hash of simple values, hashes of arrays
could be implemented
               
$filter_input->{$field}=format_date_in_iso($filter_input->{$field})
           if $columns->{$field}{Type}=~/date/ &&
-             $filter_input->{$field} !~C4::Dates->regexp("iso");
+             ($filter_input->{$field} && $filter_input->{$field}
!~C4::Dates->regexp("iso"));
                my ($tmpkeys,
$localvalues)=_Process_Operands($filter_input->{$field},"$tablename.$field",$searchtype,$columns);

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list