diff --git a/module/block/control.php b/module/block/control.php index 7432d1df2c..ee2b7c09cb 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1084,9 +1084,12 @@ class block extends control if($product->status == 'closed') $closed++; } - $this->view->total = $normal + $closed; - $this->view->normal = $normal; - $this->view->closed = $closed; + $total = $normal + $closed; + + $this->view->total = $total; + $this->view->normal = $normal; + $this->view->closed = $closed; + $this->view->normalPercent = $total ? round(($normal / $total), 2) * 100 : 0; } /** diff --git a/module/block/view/productoverviewblock.html.php b/module/block/view/productoverviewblock.html.php index fed0156e85..f91d3e7fb7 100644 --- a/module/block/view/productoverviewblock.html.php +++ b/module/block/view/productoverviewblock.html.php @@ -20,7 +20,7 @@
-
+
product->all;?> diff --git a/module/datatable/model.php b/module/datatable/model.php index 7bc9d4db7b..3eb81dcc56 100644 --- a/module/datatable/model.php +++ b/module/datatable/model.php @@ -129,6 +129,7 @@ class datatableModel extends model $fixed = $col->fixed == 'no' ? 'true': 'false'; $width = is_numeric($col->width) ? "{$col->width}px" : $col->width; $title = isset($col->title) ? "title='$col->title'" : ''; + $title = (isset($col->name) and $col->name) ? "title='$col->name'" : $title; if($id == 'id' and (int)$width < 90) $width = '90px'; $width = "data-width='$width' style='width:$width'"; $align = $id == 'actions' ? 'text-center' : ''; diff --git a/module/report/model.php b/module/report/model.php index 1b1c651534..fdaa2aa2f0 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -248,16 +248,15 @@ class reportModel extends model */ public function getWorkload($dept = 0, $assign = 'assign') { - $depts = array(); - if($dept) $depts = $this->loadModel('dept')->getAllChildId($dept); + $deptUsers = array(); + if($dept) $deptUsers = $this->loadModel('dept')->getDeptUserPairs($dept); if($assign == 'noassign') { $members = $this->dao->select('t1.account,t2.name,t1.root')->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t2.id = t1.root') - ->leftJoin(TABLE_USER)->alias('t3')->on('t3.account = t1.account') ->where('t2.status')->notin('cancel, closed, done, suspended') - ->beginIF($dept)->andWhere('t3.dept')->in($depts)->fi() + ->beginIF($dept)->andWhere('t1.account')->in(array_keys($deptUsers))->fi() ->andWhere('t1.type')->eq('project') ->andWhere("t1.account NOT IN(SELECT `assignedTo` FROM " . TABLE_TASK . " WHERE `project` = t1.`root` AND `status` NOT IN('cancel, closed, done, pause') AND assignedTo != '' GROUP BY assignedTo)") ->fetchGroup('account', 'name'); @@ -283,18 +282,18 @@ class reportModel extends model return $workload; } - $tasks = $this->dao->select('t1.*, t2.name as projectName')->from(TABLE_TASK)->alias('t1') + $stmt = $this->dao->select('t1.*, t2.name as projectName')->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') - ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') ->where('t1.deleted')->eq(0) ->andWhere('t1.status')->notin('cancel, closed, done, pause') ->andWhere('t2.deleted')->eq(0) ->andWhere('t2.status')->notin('cancel, closed, done, suspended') - ->andWhere('assignedTo')->ne('') - ->beginIF($dept)->andWhere('t3.dept')->in($depts)->fi() - ->fetchAll('id'); + ->andWhere('assignedTo')->ne(''); - if(empty($tasks)) return array(); + $allTasks = $stmt->fetchAll('id'); + $tasks = $stmt->beginIF($dept)->andWhere('t1.assignedTo')->in(array_keys($deptUsers))->fi()->fetchAll('id'); + + if(empty($allTasks)) return array(); /* Fix bug for children. */ $parents = array(); @@ -307,13 +306,14 @@ class reportModel extends model } $multiTaskTeams = $this->dao->select('*')->from(TABLE_TEAM)->where('type')->eq('task') - ->andWhere('root')->in(array_keys($tasks)) + ->andWhere('root')->in(array_keys($allTasks)) + ->beginIF($dept)->andWhere('account')->in(array_keys($deptUsers))->fi() ->fetchGroup('account', 'root'); foreach($multiTaskTeams as $assignedTo => $multiTasks) { foreach($multiTasks as $task) { - $userTask = $tasks[$task->root]; + $userTask = $allTasks[$task->root]; $userTask->estimate = $task->estimate; $userTask->consumed = $task->consumed; $userTask->left = $task->left;