}
function postListFilter($data, $authUser, $request)
{
- if (empty($q['ontable']) || $q['ontable'] != 'mtrack_ticket') {
+ if (empty($q['ontable']) || empty($q['onid']) || $q['ontable'] != 'mtrack_ticket') {
return $data;
}
// look up in the accounting system what time was spent on the ticket..
+ $ie = DB_DataObject::factory('invoice_entry');
+ $ie->ticket_id = $q['onid'];
+ $ie->orderBy('entered_dt ASC'); // doesnt matter really - we will sort it..
+ $ie->autoJoin();
+ $ie->selectAdd();
+ $ie->selectAdd("
+ id * -1 as id,
+ person_id as person_id,
+ join_person_id_core_person.name as person_id_name,
+ entered_dt as changedate,
+ CONCAT(qtyvalue , ' Hours worked') as reason
+ ");
+ $hours = $ie->fetchAll(false,false,'toArray');
+ return $data;
+
}