https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31143

David Nind <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Text to go in the|This new script identifies  |This enhancement:
      release notes|patron fields that have     |
                   |'0000-00-00' for date       |1.
                   |fields (for example:        |Updates the
                   |dateofbirth) and updates    |misc/maintenance/search_for
                   |them to 'NULL'. Date fields |_data_inconsistencies.pl
                   |with a value of '000-00-00' |script so that it
                   |can cause upgrade and API   |identifies patrons with any
                   |issues, stop the            |date fields that have
                   |autocomplete patron search  |0000-00-00 values.
                   |working, and generate a 500 |
                   |internal server error issue |2. Adds
                   |with normal patron          |a new script
                   |searching.                  |misc/cronjobs/fix_invalid_d
                   |                            |ates.pl that fixes any
                   |                            |patron date fields that
                   |                            |have '0000-00-00' values
                   |                            |(for example: dateofbirth)
                   |                            |by updating them to 'NULL'.
                   |                            |Patron date fields with a
                   |                            |value of '000-00-00' can
                   |                            |cause upgrade and API
                   |                            |issues, stop the
                   |                            |autocomplete patron search
                   |                            |working, and generate a 500
                   |                            |internal server error issue
                   |                            |with normal patron
                   |                            |searching.

--- Comment #49 from David Nind <[email protected]> ---
Testing notes (using KTD):

1. Fix record 369 (Strk̆v̜elser illustreret af Jean Anderson dansk udgave ved 
Lis
Engel [overst̆telse ved Jesper Langer]) so that the
misc/maintenance/search_for_data_inconsistencies.pl script doesn't show MARC
records in the sample data that needs fixing.

2. Update a couple of patron records using this SQL (Mary (49) and Henry (19)):
   . koha-mysql kohadev
   . update borrowers set dateofbirth ="0000-00-00" where borrowernumber =
"49";
   . update borrowers set date_renewed ="0000-00-00" where borrowernumber =
"19";

3. Note that the values updated now have a value of 0000-00-00 (SQL example:
select * from borrowers where borrowernumber = 19;).

4. In the staff interface, go to patrons. Note that the autocomplete for the
search in the header doesn't work (search for hen), and that you get a 500
error if you use the search on the left-hand side:

  Something went wrong when loading the table.
  500: Internal Server Error. 
  Month out of range.

5. Run the search for data inconsistencies script:
misc/maintenance/search_for_data_inconsistencies.pl. You will get this error:
   Can't call method "time_zone" on an undefined value at
/usr/lib/x86_64-linux-gnu/perl5/5.36/DateTime.pm line 1483.

6. Apply the second patch: Bug 31143: Work around subtracting datetime if
date_of_birth undef

7. Run this command: misc/maintenance/search_for_data_inconsistencies.pl -v
   Result:
    == Patrons with invalid age for category ==
         * Patron borrowernumber=49 has an invalid age of 0 for their category
'PT' (18 to 999)
    => You may change the patron's category automatically with
misc/cronjobs/update_patrons_category.pl

8. Apply the first patch.

9. Run this command again: misc/maintenance/search_for_data_inconsistencies.pl
-v
   Result: now identifies that some patrons have invalid dates
    == Patrons with invalid age for category ==
         * Patron borrowernumber=49 has an invalid age of 0 for their category
'PT' (18 to 999)
       => You may change the patron's category automatically with
misc/cronjobs/update_patrons_category.pl

    == 2 invalid dates found ==
    => You may change the date with script: misc/cronjobs/fix_invalid_dates.pl
(-c -v)

10. Run the new script with just the -v option:
     misc/cronjobs/fix_invalid_dates.pl -v
     2 invalid dates found

11. Run the new script with the -c -v options: 
     misc/cronjobs/fix_invalid_dates.pl -c -v
     2 wrong dates found and fixed

12. Repeat step 4 - things should now work as expected.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to