Fatal error on every Date fields with inline edit.

After trying to find something on Google I post it here :

Just note before, it happen ONLY on date, on date time it work perfectly !

When I edit in-line a date, when I push enter or click on the small confirm icon I got this instead of the date value :


Fatal error:  Uncaught Error: Call to a member function format() on boolean in /XXXX/SuiteCRM/include/InlineEditing/InlineEditing.php:445
Stack trace:
#0 /XXXX/SuiteCRM/include/InlineEditing/InlineEditing.php(392): formatDisplayValue(Object(AOS_Contracts), '28/04/2019 00:0...', Array, 'save')
#1 /XXXX/SuiteCRM/include/InlineEditing/InlineEditing.php(370): getDisplayValue(Object(AOS_Contracts), 'start_date')
#2 /XXXX/SuiteCRM/modules/Home/controller.php(64): saveField('start_date', '7ede7c39-69a3-3...', 'AOS_Contracts', '28/04/2019', 'DetailView')
#3 /XXXX/SuiteCRM/include/MVC/Controller/SugarController.php(523): HomeController->action_saveHTMLField()
#4 /XXXX/SuiteCRM/include/MVC/Controller/SugarController.php(491): SugarController->do_action()
#5 /XXXX/SuiteCRM/include/MVC/Controller/SugarController.php(465): SugarController->handle_action()
#6 /home in /XXXX/SuiteCRM/include/InlineEditing/InlineEditing.php on line 445

Tried on a custom module, a normal module with custom fields, and a normal module without any custom thing (like module I dont use, here contract.)

I Have to refresh to get, sometime the old value, sometime the new value.

PS : Find out that it bug on the demo too : https://demo.suiteondemand.com

They just disable php error, so the field become blank, but it dont work too.

Same here… I didnt notice this thread so I started up my own…

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/22123-error-when-changing-date-in-client-list-view#79121

I must say its a pretty nasty bug and kind of unexpected to be in such a system…

If it happen to everyone, this maybe is know by the devs, we have to push the info on github

I just posted an issue on github:

https://github.com/salesagility/SuiteCRM/issues/7067

2 Likes

Thanks guys, I’ve created a fix here: #7072.

2 Likes

Wonderful, thank you!!! It works as expected.

Thanks a lot for your reactivity !

Btw, do you know if on github I can ask a tech-question ? I’ve asked it here on the forum but I got no answer. I want some pro feedback before coding anything.

@holdusback, I guess it would depend on the question but you might just get asked to move it to the forums. We do also have a Gitter channel that developers regularly talk in which might be more suited.

1 Like

That hotfix doesn’t work for me. strtotime($value) function (line 428) return false if $values has the “d/m/Y” format. I made these changes to make it work:


if ($vardef['type'] === 'date') {
            // $value = date('Y-m-d', strtotime($value));
            $date_format = $timedate->get_date_format(); //added

            $value .= ' 00:00:00';

            // $datetime = DateTime::createFromFormat('Y-m-d H:i:s', $value, new DateTimeZone('UTC'));
            $datetime = DateTime::createFromFormat($date_format . ' H:i:s', $value, new DateTimeZone('UTC')); //added
        }

Bye
Loba