SuiteCRM
SuiteCRM copied to clipboard
AOR_Reports - Contional date value decrements on every "update"
When you're pulling a report (avoiding bug #1082 by all using same format) with the conditional date fields set to "value", every time you click update, each of the date fields decrements by 1 day.
Example:
- Set condition date1: value > 2016-03-01
- Set condition date2: value > 2016-03-11
- Hit "update". Proper results are shown
- Look at dates, date1 now equals 2016-02-29 and date2 now equals 2016-03-10
Hello jellydonuts, I've tried to replicate this issue (including setting my locale to different formats), but was unable to get the same error. In my tests I always get back the same dates (the dates do not decrement and not modified at all). Also looking at the code in modules/AOR_Reports/tpls/report.tpl , the following function just puts the same value without any modifications to format or the date itself: $('#updateParametersButton').click(function(){ --- line 30
Alright, I will investigate further and update here
hey vladbar, what type is your date variable?
I've investigated and you're right, it's not changing anything before passing the values to form.submit().
I just had a thought though about the value's type as I am using a field that is of the 'date' type (time always equals 00:00:00, created through the studio) not the usual 'datetime' type, so maybe when the value is read back by the system, it is some how tricking the system into thinking it's the previous date?
I have confirmed via console.output before the form.submit that the value being passed is only the date, and not the time. e.g. '2016-03-01' and '2016-03-11'
Thank you for further feedback. I also tested with fields of type date instead of type datetime and still cannot reproduce this error.
I think I've found it. On the user you're running your report with, what's is the user management > advanced > Time Zone set to?
Mine was set to GMT -7 before when I was having the problem, but i just set it to UTC (GMT+0:00) and the dates stopped changing.
I'm not sure where the conversion is happening but I'm guessing it's taking my date value of 2016-03-01 (at 00:00:00) and doing an additional -7hrs on it, causing it to go back 1 day.
+edit
To further this, I logged my sql queries and noticed that the dates sent to SQL are the proper dates (before they are changed). So it must be something after the results are returned that converts it from what it thinks is UTC back to GMT -7
i've also verified that everything (php apache2, php cli, mysql and suitecrm) are all using GMT -7... so there should be no conversion taking place.
This bug still seems to exist in the current release, but I believe the current code has changed so that vladbar's fix may need to be redone.
Fix #1141 works as expected on hotfix-7.8.x
Was able to replicate in 7.13.1