[Vtigercrm-developers] VT6 Report Meta Date filters
Alan Lord
alanslists at gmail.com
Thu May 8 09:06:18 GMT 2014
Reports are still a bit of a mess frankly...
The definition of the Meta date values like $last30days is replicated in
several places.
Having added a new option:
> $beginingoftime = date("Y-m-t", 0); // the Unix epoch
and the filter option:
> } elseif ($type == "over30days") {
> $dateValues[0] = $beginingoftime;
> $dateValues[1] = $last30days;
to modules/Vtiger/models/Field.php (and a label)
I can select this as an option in my report and it populates the dates
correctly in the report display (see screenshot from yesterday).
But I was looking at the logs this morning to see why the report wasn't
working and the query that was being generated didn't have the
comparator "BETWEEN" or any dates in it.
Following my nose led me to modules/CustomView/CustomView.php
getStdFilterConditions(); that contains a hard-coded list of the meta
date filters.
Then it just goes on & on & on...These date declaration statements like
$last30days are *everywhere* (even in the same file!) and so is all the
related code to support them.
> alanlord at web-dev:/var/www/vt6$ grep -rn '\$last30days =' *
> modules/Vtiger/models/Field.php:548: $last30days = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 29, date("Y")));
> modules/Reports/ReportRun.php:1415: $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
> modules/Reports/Reports.php:946: $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
> modules/CustomView/CustomView.php:621: $last30days = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 29, date("Y")));
> modules/CustomView/CustomView.php:1547: $last30days = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 29, date("Y")));
> modules/CustomView/models/Record.php:644: $last30days = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 29, date("Y")));
So I've gone back to the customer and told them it will not be cost
effective for them to be able to create a report that shows them all
invoices with a due date over 30 days :-(
I wanted to be able to do this as it would be good for future customer
requests too, but I can't expect my customer to pay for hours and hours
of work just to add a simple date filter.
Al
More information about the vtigercrm-developers
mailing list