Sort Calls by time and date
I'd like to be able to sort the calls by time and date, not just date.
I thought I'd create a new field that the user doesn't see in view or edit detail.
When the record is saved I'd like to create a new datetime field out of the start_date and start_time values that I can pull out of the database to use for sorting in list view.
This is what I've done so far.
Created a new date field in the Studio for Calls - date_time_start.
Changed the database type for the field from Date to DateTime in the calls_cstm table.
Changed 'data_type' => 'date', to 'data_type' => 'datetime', in cache/dynamic_fields/Calls/fields.php
In modules/Calls/EditView.php I've included
$focus->date_time_start_c = $timedate->to_db_date_time($focus->date_start, $focus->time_start) ;
after $focus->date_start and $focus->time_start are set.
This seems to write a value of 0000-00-00 00:00:00 into the database, when the date_start is 2007-02-01, time_start is 18:30:00.
Can anyone tell me what I'm doing wrong? Am I passing the dates in the incorrect format to the to_db_date_time function?
Thanks very much.
Last edited by ChocolateLover; 2007-02-07 at 10:15 PM.
SugarSuite 4.5.1
OSX 10.4.8
Apache 2
PHP 5
MySQL 4
Bookmarks