This topic is locked
[SOLVED]

 phprunner 10.3 - Dates changed from 0000-00-00 to empty string?

4/17/2020 4:01:37 PM
PHPRunner General questions
M
MikeB941 author

Hello:
phprunner 10.3 build 34624 x64
In the mysql database we have some dummy dates set as 0000-00-00
When these are read into the edit page, they appear as 0000-00-00 in the before display event, but checking their value in the before update event they've been changed from 0000-00-00 to '' empty strings (causing a Column can't be null error on save)?
Is this a known behavior for the date edit as?
Suggested work around?
Thanks for your help -

M
MikeB941 author 4/17/2020

A quick update -
This is happening AFTER the "Before Record Update" event -
As a test - I set the date field in the Before Record Update event:
$values['CP_DOB'] = '0000-00-00';
Somewhere after this event, PHPRUNNER 10.3 is changing the value of this date field to NULL before the mysql database record is written?
If I set CP_DOB to a different "non-dummy" value in the Before Record Update event all works fine:
$values['CP_DOB'] = '2020-04-17'; (this works)
Thanks again for your help -

M
MikeB941 author 4/17/2020

Just ran debug and confirmed based on the generated SQL that on the edit page, PHPRUNNER 10.3 is changing date fields that are stored in mysql as 0000-00-00 to null which bombs upon SAVE when it tries to update the field in mysql with the null value (these date fields are NOT set to accept null values).
I suspect there's date validation code that's taking the 0000-00-00 dates and changing them null as part of failing validation? Is there a way to override this?

M
MikeB941 author 4/17/2020

Just ran debug and confirmed based on the generated SQL that on the edit page, PHPRUNNER 10.3 is changing date fields that are stored in mysql as 0000-00-00 to null which bombs upon SAVE when it tries to update the field in mysql with the null value (these date fields are NOT set to accept null values).
I suspect there's date validation code that's taking the 0000-00-00 dates and changing them null as part of failing validation? Is there a way to override this?

M
MikeB941 author 4/18/2020

I went ahead and converted all of the date fields to accept null values with a default of null and that has resolved the issue