function load($oid = null, $strip = true) { $result = parent::load($oid, $strip); if ($result && $oid) { $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8; $q = new DBQuery(); $q->addTable('projects'); $q->addQuery(" SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}" . ", t1.task_duration_type)) AS project_percent_complete"); $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project'); $q->addWhere(" project_id = {$oid} AND t1.task_id = t1.task_parent"); $this->project_percent_complete = $q->loadResult(); } return $result; }
function load($oid = null, $strip = true) { $result = parent::load($oid, $strip); if ($result && $oid) { $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8; $q = new DBQuery(); $q->addTable('projects', 'p'); $q->addQuery(' SUM(t1.task_duration * t1.task_percent_complete' . ' * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type)) / SUM(t1.task_duration' . ' * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type)) AS project_percent_complete'); $q->addJoin('tasks', 't1', 'p.project_id = t1.task_project'); $q->addWhere('project_id = ' . $oid . ' AND t1.task_id = t1.task_parent'); $this->project_percent_complete = $q->loadResult(); } return $result; }
function load($oid = null, $strip = true) { $result = parent::load($oid, $strip); if ($result && $oid) { $q = new DBQuery(); $q->addTable('projects'); $q->addQuery('SUM(t1.task_duration*t1.task_duration_type*t1.task_percent_complete) / SUM(t1.task_duration*t1.task_duration_type) AS project_percent_complete'); $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project'); $q->addWhere(" project_id = {$oid}"); $this->project_percent_complete = $q->loadResult(); } return $result; }
function load($oid = null, $strip = false, $skipUpdate = false) { // use parent function to load the given object $loaded = parent::load($oid, $strip); /* ** Update the values of a dynamic task from ** the children's properties each time the ** dynamic task is loaded. ** Additionally store the values in the db. ** Only treat umbrella tasks of dynamics '1'. */ if ($this->task_dynamic == 1 && !$skipUpdate) { // update task from children $this->htmlDecode(); $this->updateDynamics(true); /* ** Use parent function to store the updated values in the db ** instead of store function of this object in order to ** prevent from infinite loops. */ parent::store(); $loaded = parent::load($oid, $strip); } // return whether the object load process has been successful or not return $loaded; }