I'm currently working on a migration from MSCRM into SugarCRM Pro, and ran into an issue creating a report. I want to be able to query a date field to return only results older than 3 days from the current date.
(a) Is there an easy method to do this?
(b) If I write a new query function, how should I go about it in a portable (upgrade-proof) manner?
For (b), I did track down the file include/generic/SugarWidgets/SugarWidgetFielddate.php (and *datetime.php), which contains the actual functions used for date fields, such as function queryFilterTP_last_7_days. I'd have to modify a few other files to add it to the drop down, but I also need to find how these are called and associated with the dropdown. I also need to know how to do this 'correctly' as a customization.
Thanks for any direction anyone can provide!
Edit:
This looks like editing (SugarPro 5.2.0a):
modules/Reports/templates/templates_modules_def_js.php - Add this around line 406:
modules/Reports/language/en_us.lang.php - Add this around line 271:Code:qualifiers[qualifiers.length] = {name:'tp_before_3_days_ago',value:'<?php echo $mod_strings['LBL_BEFORE_3_DAYS_AGO]; ?>'};
include/generic/SugarWidgets/SugarWidgetFielddatetime.php - Add around line 405:Code:'LBL_BEFORE_3_DAYS_AGO'=>'Before 3 Days Ago',
Same file, add around line 839:Code:function queryFilterBefore(& $layout_def) { // Taken from queryFilterBefore and queryFilterYesterday global $timedate; $begin_timestamp = time() - (3*86400); $begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); return $this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($begin)."'\n"; }
(All of the above is untested, just what I've documented and hacked together so far. The problem is I don't want to actually edit any of the above core files, but rather put them in a more portable place.)Code:'TP_before_3_days_ago' => $home_mode_strings['LBL_BEFORE_3_DAYS_AGO'],


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks