Bug 27821

Summary: sanitize_zero_date does not handle datetime
Product: Koha Reporter: Jonathan Druart <jonathan.druart+koha>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart+koha>
Status: Pushed to oldoldstable --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrew, fridolin.somers, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 26997    
Bug Blocks: 7806    
Attachments: Bug 27821: Make sanitize_zero_date support datetime and timestamp

Description Jonathan Druart 2021-03-01 10:12:46 UTC
Only datatype "date" is handled correctly.

Atomic update generated errors: main::sanitize_zero_date(): DBI Exception: DBD::mysql::db do failed: Truncated incorrect CHAR(10) value: '2021-03-01 09:43:56' [for Statement "                                   
        UPDATE old_issues
        SET returndate = NULL
        WHERE CAST(returndate AS CHAR(10)) = '0000-00-00';
    "] at (eval 1481) line 5
Comment 1 Jonathan Druart 2021-03-01 10:14:02 UTC
RMaints, keep an eye on this one, you may need to backport it quickly.
Comment 2 Jonathan Druart 2021-03-01 10:14:57 UTC
Created attachment 117432 [details] [review]
Bug 27821: Make sanitize_zero_date support datetime and timestamp
Comment 3 Jonathan Druart 2021-03-01 10:29:21 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 4 Fridolin Somers 2021-03-04 09:24:08 UTC
Pushed to 20.11.x for 20.11.04
Comment 5 Andrew Fuerste-Henry 2021-03-05 20:13:42 UTC
Pushed to 20.05.x for 20.05.10
Comment 6 Victor Grousset/tuxayo 2021-03-22 15:25:41 UTC
Backported: Pushed to 19.11.x branch for 19.11.16