Suitecrm: AOR Reports: Date parameter only accepts format 2016-06-20

Created on 20 Jun 2016  路  22Comments  路  Source: salesagility/SuiteCRM

If the user has a different date format like "20.06.2016" and tries to change a date parameter at the detailview or in a dashlet the report wont work with the new parameters.

If you save a report for the first time, the date format is no issue, so editview seems to handle the date format.
But if you try to edit the parameter "on-the-fly" and click update, or in a dashlet, the date is invalid.

Important Fix Proposed Bug

All 22 comments

I got these Problems in 7.6 and 7.7beta1 although there is an old bug report it seems not fixed:
https://github.com/salesagility/SuiteCRM/issues/1082

Seems to be a JavaScript issue. The non-standard Date.prototype.toLocaleFormat() method is being used to achieve the conversion.

We need to change this to Date.prototype.toLocaleFormat() method or use the standard Intl.DateTimeFormat. We could also use the new mement.js library that I included in the last release.

Why not handling like in the rest of sugar does where the date conversion works (converted server side)?

This issues appears to be caused by the same problem as issue #1700. Looks like the problem is line 470 in aow_utils.php e.g. $fieldlist[$fieldname]['value'] = $timedate->to_display_date($value);

The to_display_date method is meant to convert a DB date string to local date string, in this case it is not being passed a DB date string but a user formatted string. So when it tries to use the default date format of 'Y-m-d H:i:s' to convert the user formatted date string it fails to convert unless the user's date format is set to 'Y-m-d H:i:s'. A possible solution would be to convert the date to the db date format before calling to_display_date() on it.

Disregard my comment above, that is not where the problem lies.

There are couple of problems with the current modules/AOR_Reports/tpls/report.tpl:

  • first one is: fieldInput need to accept value from datepicker by utilising SuiteCRM functions isDate() and getDateObject(fieldInput) from jssource/src_files/include/javascript/sugar_3.js - this will solve the conversion issue.
  • Second problem is: there are many ajax requests firing on the background and loadConditionLine() still not ready by the time the code in $(document).ready(function() { is trying to access condition lines.

There is also a problem with fixUpFormatting() function:

  • function fixUpFormatting() in modules/AOW_WorkFlow/aow_utils.php trying to change dates (to previous/next day) if the date does not have any time assigned to it.

Another issue here is that Date.prototype.toLocaleFormat() only works for Firefox.

Latest commit after some testing done by our Support Team.

Simeon also added some fixes for issues raised in #1624 but this time for reports run in mssql environment

e736eaa and 782774c were tested by our support team and passed the testing

Might be worth mentioning here that 7.7.5 a report with a date format of 'd/m/Y' doesn't listen to sort in order, you have to select 'none' for full date sorting to work.

@gunnicom ,This issue it appears to be fixed in previous commits, can you confirm this is a case?

Maybe i will update to 7.7.8 on that instance next week and check.

Hi, not working in 7.7.8 either.

I have same bug.

My system date format : dd/mm/yyyy

In a report, with date parameter, when i click on date on datepicker, input format is filled with dd/mm/yyyy format. But when i update parameters with button, there is no result.

It works when i manually fill the date input with date formatted yyyy-mm-dd

@shogunpol Could not confirmed this in the demo version... or am I missing something? (Firefox on windows)
create:
2017-03-06 14_28_03-suitecrm
edit:
2017-03-06 14_28_19-suitecrm
final list
2017-03-06 14_28_44-suitecrm

@horus68 Its about the conditions, not about the fields shown.

@gunnicom Any particular combination on date conditions and modules/fields used?
It works for me on the demo site: Using accounts modules and date to list it worked for me (inline Update and also when editing the report conditions)

2017-03-06 17_55_13-suitecrm

Tested with Firefox and Edge on windows

@horus68 The bug is still there, in demo, too.
Steps To reproduce in demo site:

  1. Create Report for module opportunitites
  2. Fields: name, expected close date
  3. Conditions: expected close date less than value 01/01/2017, paramater checked
  4. Test report, works, shows filtered list
  5. change date format in your profile to 23.12.2023
  6. Go to report, still seems to work
  7. Press "update", parameter field gets empty, result is unfiltered

You missed the condition as parameter. I see no update button on your screenshots.

Confirmed now!
2017-03-08 16_34_00-suitecrm e mais 1 pagina - microsoft edge

@gunnicom sorry to have taken your time (maybe its because today I'm just using glasses for the first time :( !)

It is not reflecting in SuiteCRM 7.9.0. I have checked on demo instance also, but couldn't reproduce the error.

@ChangezKhan No. It is still reproducible in demo. Exactly follow my steps provided and you will see.

I have a problem in my report parameter..While i'm giving date like 12-11-2017 and press update button the time value can change like 11-12-2017 and once again i press update its changed as usual..

If i'm give date value greater than day 12 ...after update process the date box shows empty result..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

likhobory picture likhobory  路  3Comments

sasha2002 picture sasha2002  路  3Comments

ArturoBurela picture ArturoBurela  路  3Comments

criterion9 picture criterion9  路  3Comments

likhobory picture likhobory  路  3Comments