Existing field data type change - Suitecrm8

Hi there,

I have changed an AOS quote field data type (date_ entered) from “datetime” to “date” to display only
the date. I override the data type with a php file and after repairing the database I executed the script suggested to syncro the DB field type (datetime) with the new one (date).
Everything seemed fine. I also logged out and in again just to be sure.
Checked Studio->Quotes->Field and the “date_entered” field now shows “date”.
I Checked directly the DB with phpMyAdmin and the field "date_entered shows the type “date”.
If I display the list of quotes with phpMyAdmin the column “date_entered” displays the date with no time.

The problem is that I created a new quote and the “Date Created” now displays the date plus the time “01:00” and is always the same time if I create another quote.

Can anybody help on this?

Thanks
Mario

These changes I made:

  • created the file to override the field type “_override_sugarfield_date_entered.php” in /public/legacy/custom/Extension/modules/AOS_Quotes/Ext/Vardefs/ (see screenshot for content);

  • repaired and executed the script to sync DB with new type (see screenshot studio)

studio_quotes_fields

  • checked db whit phpMyAdmin (see screenshot)

  • created new quote, date created shows date + always the time 01:00 (see screenshot)

account_quotes_data_created_info

You really shouldn’t change that field type. It’s one of the basic Bean fields, there is code handling it all over the place, you’ll surely produce more problems than you will be able to tackle.

I suggest creating an additional custom field called myDate or something. Then use a Workflow or a logic_hook to keep it updated with the correct value.

Another approach, also without changing the default field is to change only the display, not the field type. You can just override the view to show the format you want, namely by omitting the time.

Thanks for your reply,

Please can you clarify the view option you suggested?
Think about that I need also to display the date on the pdf.

Thanks
Mario

Have a look at this list of articles:

https://github.com/salesagility/SuiteDocs/issues/206

in the section “UI Code customizations” you’ll find several techniques, according to which view type (Detail, List).

If you need it on a PDF, that’s one more reason to use a custom field, though.

Thank for replying.

I will have a look to those information and see if I find the right one.