https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31143 wainuiwitikapark@catalyst.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This enhancement: |This enhancement: release notes| | |1. |1. |Updates the |Updates the |misc/maintenance/search_for |misc/maintenance/search_for |_data_inconsistencies.pl |_data_inconsistencies.pl |script so that it |script so that it |identifies patrons with any |identifies any occurrences |date fields that have |in the database with any |0000-00-00 values. |date fields that have | |0000-00-00 values. |2. Adds | |a new script |2. Adds |misc/cronjobs/fix_invalid_d |a new script |ates.pl that fixes any |misc/cronjobs/fix_invalid_d |patron date fields that |ates.pl that fixes any date |have '0000-00-00' values |fields that have |(for example: dateofbirth) |'0000-00-00' values by |by updating them to 'NULL'. |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 #62 from wainuiwitikapark@catalyst.net.nz --- (In reply to Shi Yao Wang from comment #61)
Created attachment 171977 [details] [review] Bug 31143: Fix/identify all cases where '0000-00-00' may still remain in the database
This patch identifies date fields in the database (timestamp, datetime, date) that are 0000-00-00 and sets them to NULL
Test plan -
Examples of setting up some 0000-00-00 date fields:
e.g. Borrowers table update borrowers set dateexpiry="0000-00-00" where borrowernumber=49;
e.g. Items table update items set datelastseen="0000-00-00" where itemnumber=12;
To identify the cases: 1) Set up some 0000-00-00 date fields 2) Run the misc/maintenance/search_for_data_inconsistencies.pl script 3) Run fix_invalid_dates.pl -v
To fix the cases: 1) Run fix_invalid_dates.pl -c -v 2) Notice the value has changed from 0000-00-00 to NULL
e.g. Borrowers table select dateexpiry from borrowers where borrowernumber=49;
e.g. Items table select datelastseen from items where itemnumber=12;
Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Thanks so much for signing off! -- You are receiving this mail because: You are watching all bug changes.