$start = empty($_REQUEST['from_date']) ? date('Y-m-01') :
date('Y-m-01', strtotime($_REQUEST['from_date']));
-
+ $start_day = empty($_REQUEST['from_date']) ? date('Y-m-d') :
+ date('Y-m-d', strtotime($_REQUEST['from_date']));
+
$e->whereAdd("
( ontable='mtrack_ticket' AND
onid IN (SELECT id FROM mtrack_ticket where project_id = $pid)
$isSummary = true;
$e->whereAdd("changedate >= '$start 00:00:00' AND changedate < '$start 00:00:00' + INTERVAL 1 MONTH");
$e->selectAdd();
- $e->joinAdd(DB_DataObject::factory('Person'), 'LEFT');
+ $e->joinAdd(DB_DataObject::factory('core_person'), 'LEFT');
$e->selectAdd("
DATE_FORMAT(changedate, '%Y-%m-%d') as changeday,
CONCAT(DATE_FORMAT(changedate, '%Y-%m-%d-') ,Person.id) as id,
$this->jdata($ret);
- } else {
- $e->whereAdd("changedate >= '$start 00:00:00' AND changedate < '$start 00:00:00' + INTERVAL 3 DAY");
- }
-
+ }
+ $e->whereAdd("changedate >= '$start_day 00:00:00' AND
+ changedate < '$start_day 00:00:00' + INTERVAL 1 DAY");
+
+ //DB_DataObject::debugLevel(1);
$this->events[] = $add;
}
-
- $extra = array(
+ $total = count($this->events);
+ $extra = !$total ? array() : array(
'metaData' => $this->meta($e, $this->events)
);
- $this->jdata($this->events, count($this->events), $extra);
+ $this->jdata($this->events, $total, $extra);
}
-
+ /**
+ * this is a very simple version of the main one in roo.php
+ */
function meta($x, $data)
{
// this is not going to work on queries where the data does not match the database def..
$rdata = unserialize(file_get_contents($reader));
- echo '<PRE>';print_r($rdata);exit;
+ //echo '<PRE>';print_r($rdata);exit;
$meta = array();
foreach($cols as $c ) {
- if (!isset($this->cols[$c]) || !isset($rdata[$this->cols[$c]]) || !is_array($rdata[$this->cols[$c]])) {
+ $cc = $x->tableName().'.'.$c;
+ if ( !isset($rdata[$cc])
+ || !is_array($rdata[$cc])
+ ) {
+
$meta[] = $c;
continue;
}
- $add = $rdata[$this->cols[$c]];
+ $add = $rdata[$cc];
$add['name'] = $c;
$meta[] = $add;
}
+
+
+
return array(
'totalProperty' => 'total',
'successProperty' => 'success',