Suitecrm: InLine Date Edit bug - Call to a member function format() on boolean

Created on 18 Mar 2019  路  5Comments  路  Source: salesagility/SuiteCRM



Issue

suiteCRM 7.11.2

When you edit any date field inline (in my case its in clients list) when you click the ticker or hit enter it throws a fatal error. The bug is ALSO in a demo version of suiteCRM! As described in this thread:

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/21998-fatal-error-on-every-date-fields-with-inline-edit

The error is:

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

Yet - in my case it actually saves the new date. But it yells a fatal error... My thread (made a duplicate by mistake :-( ): https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/22123-error-when-changing-date-in-client-list-view#79121

Expected Behavior

Guess expected behaviour is to just click the ticker and it should save the edited version...

Actual Behavior

When you click on save button (ticker) it says Fatal Error. But it saves a new version.

Possible Fix

Steps to Reproduce


  1. Be on a latest version of suiteCRM 7.11.2
  2. Click on clients
  3. Try to change any date field directly from clients list

Context


I think this should be a high priority because it prevents a rather key functionality from working...,

Your Environment

  • SuiteCRM Version used: 7.11.2
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome 72.0.3626.121 64-bit, Firefox 65.0.2 (64 bit)
  • Environment name and version (e.g. MySQL, PHP 7): XAMPP 7.2.15, Apache 2.4.38, PHP 7.2.15, MariaDB 10.1.38
  • Operating System and version (e.g Ubuntu 16.04): Windows Server 2016
Important Fix Proposed Bug

Most helpful comment

It works!!! Excellent! Thank you very much! You guys rock!!!

All 5 comments

I follow this! Same bug here (7.11.2 too)

It works!!! Excellent! Thank you very much! You guys rock!!!

Hello.
This hotfix doesn't work for me (french dates). After validating, the field appears as 01/01/1970, but well saved if I refresh the page.
I am concerned about the usage of strtotime (english time format conversion):

include/InlineEditing/InlineEditing.php > function formatDisplayValue Ligne 427

if ($vardef['type'] === 'date') {
            $value = date('Y-m-d', strtotime($value));

Although, I might miss something, but I don't see the point to reformat the dates, as it is set by the user, it is well formated (localized)...
I just commented the code related to 'datetimecombo' , 'datetime' and 'date' on formatDisplayValue function and it's working as expected. I haven't found any side effect.

@vaudoin which version are you on? Do you have these changes, also? https://github.com/salesagility/SuiteCRM/pull/6669/files

@pgorod indeed it looks much better with this version of the file ! Thanks for your feedback. 馃憤
(I use SuiteCRM 7.9.10)

Was this page helpful?
0 / 5 - 0 ratings