diff --git a/db/update17.6.sql b/db/update17.6.sql index fbf496ac27..68e4b95191 100644 --- a/db/update17.6.sql +++ b/db/update17.6.sql @@ -14,3 +14,4 @@ CREATE TABLE `zt_taskteam` ( ALTER TABLE `zt_taskestimate` ADD `order` tinyint unsigned NULL DEFAULT '0'; ALTER TABLE `zt_effort` ADD `order` tinyint unsigned NOT NULL DEFAULT '0' AFTER `end`; ALTER TABLE `zt_storyspec` ADD `files` text NOT NULL AFTER `verify`; +ALTER TABLE `zt_block` CHANGE `block` `block` varchar(30) COLLATE 'utf8_general_ci' NOT NULL AFTER `source`; \ No newline at end of file diff --git a/db/zentao.sql b/db/zentao.sql index 81e7813a04..d5266fc5e3 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -218,7 +218,7 @@ CREATE TABLE IF NOT EXISTS `zt_block` ( `type` char(30) NOT NULL, `title` varchar(100) NOT NULL, `source` varchar(20) NOT NULL, - `block` varchar(20) NOT NULL, + `block` varchar(30) NOT NULL, `params` text NOT NULL, `order` tinyint(3) unsigned NOT NULL DEFAULT '0', `grid` tinyint(3) unsigned NOT NULL DEFAULT '0', diff --git a/module/block/control.php b/module/block/control.php index c078c7a1bc..eac467486a 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -935,8 +935,9 @@ class block extends control $current = zget($weeks, $monday, ''); $current = substr($current, 0, -11) . substr($current, -6); - $project->pv = $this->weekly->getPV($projectID, $today); - $project->ev = $this->weekly->getEV($projectID, $today); + $PVEV = $this->weekly->getPVEV($projectID, $today); + $project->pv = $PVEV['PV']; + $project->ev = $PVEV['EV']; $project->ac = $this->weekly->getAC($projectID, $today); $project->sv = $this->weekly->getSV($project->ev, $project->pv); $project->cv = $this->weekly->getCV($project->ev, $project->ac); @@ -1200,8 +1201,9 @@ class block extends control $this->weekly->save($this->session->project, $date); - $this->view->pv = (float)$this->weekly->getPV($this->session->project, $today); - $this->view->ev = (float)$this->weekly->getEV($this->session->project, $today); + $PVEV = $this->weekly->getPVEV($this->session->project, $today); + $this->view->pv = (float)$PVEV['PV']; + $this->view->ev = (float)$PVEV['EV']; $this->view->ac = (float)$this->weekly->getAC($this->session->project, $today); $this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv); $this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac); @@ -1210,6 +1212,28 @@ class block extends control $this->view->progress = !empty($this->view->pv) ? floor($this->view->ac / $this->view->pv * 1000) / 1000 * 100 : 0; } + /** + * Print waterfall general report block. + * + * @access public + * @return void + */ + public function printWaterfallGeneralReportBlock() + { + $this->app->loadLang('programplan'); + $this->loadModel('project'); + $this->loadModel('weekly'); + + $PVEV = $this->project->getWaterfallPVEV($this->session->project); + $this->view->pv = (float)$PVEV['PV']; + $this->view->ev = (float)$PVEV['EV']; + $this->view->ac = (float)$this->project->getWaterfallAC($this->session->project); + $this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv); + $this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac); + + $this->view->progress = !empty($this->view->pv) ? floor($this->view->ac / $this->view->pv * 1000) / 1000 * 100 : 0; + } + /** * Print waterfall gantt block. * diff --git a/module/block/model.php b/module/block/model.php index 3086c24bfb..97d52b15b3 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -656,18 +656,29 @@ class blockModel extends model * Get waterfall project report pararms. * * @access public - * @return string + * @return bool */ public function getWaterfallReportParams() { return false; } + /** + * Get waterfall general report params. + * + * @access public + * @return bool + */ + public function getWaterfallGeneralReportParams() + { + return false; + } + /** * Get project estimate pararms. * * @access public - * @return string + * @return bool */ public function getWaterfallEstimateParams() { diff --git a/module/block/view/waterfallgeneralreportblock.html.php b/module/block/view/waterfallgeneralreportblock.html.php new file mode 100644 index 0000000000..4989d3373f --- /dev/null +++ b/module/block/view/waterfallgeneralreportblock.html.php @@ -0,0 +1,54 @@ + + +
+
+
+

project->progress;?>

+ +
+
+
+
+
+
+
+
+
programplan->end . ')';?>
+
+
+
+
programplan->realEnd . ')';?>
+
+
+
+
programplan->ac . ')';?>
+
+
+
+
programplan->sv . ')';?>
+
+
+
+
programplan->cv . ')';?>
+
+
+
+
+
+
diff --git a/module/my/control.php b/module/my/control.php index 3a85807391..203b6f9933 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -153,6 +153,7 @@ class my extends control $riskCount = 0; $reviewCount = 0; $ncCount = 0; + $qaCount = 0; $meetingCount = 0; $isMax = $this->config->edition == 'max' ? 1 : 0; diff --git a/module/product/config.php b/module/product/config.php index bb08427abd..c42c6ce6bd 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -109,7 +109,7 @@ $config->product->all->search['fields']['createdDate'] = $lang->product->created $config->product->all->search['fields']['createdBy'] = $lang->product->createdBy; $config->product->all->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); -$config->product->all->search['params']['code'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); +if(!isset($config->setCode) or $config->setCode == 1) $config->product->all->search['params']['code'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->product->all->search['params']['id'] = array('operator' => '=', 'control' => 'input', 'values' => ''); if($config->systemMode == 'new') $config->product->all->search['params']['program'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->product->all->search['params']['line'] = array('operator' => '=', 'control' => 'select', 'values' => ''); diff --git a/module/project/model.php b/module/project/model.php index 33ff71ccf4..7cf9c98e2d 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -415,6 +415,55 @@ class projectModel extends model return is_numeric($projectIDList) ? (empty($progressList) ? 0 : $progressList[$projectIDList]) : $progressList; } + /** + * Get waterfall general PV and EV. + * + * @param int $projectID + * @access public + * @return array + */ + public function getWaterfallPVEV($projectID) + { + $executions = $this->dao->select('id,begin,end,realEnd,status')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('vision')->eq($this->config->vision)->andWhere('project')->eq($projectID)->fetchAll('id'); + $stmt = $this->dao->select('id,status,estimate,consumed,`left`,closedReason')->from(TABLE_TASK)->where('execution')->in(array_keys($executions))->andWhere("parent")->ge(0)->andWhere("deleted")->eq(0)->query(); + + $PV = 0; + $EV = 0; + while($task = $stmt->fetch()) + { + $PV += $task->estimate; + if($task->status == 'done' or $task->closedReason == 'done') + { + $EV += $task->estimate; + } + else + { + $task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100; + $EV += round($task->estimate * $task->progress / 100, 2); + } + } + + return array('PV' => sprintf("%.2f", $PV), 'EV' => sprintf("%.2f", $EV)); + } + + /** + * Get waterfall general AC + * + * @param int $projectID + * @access public + * @return string + */ + public function getWaterfallAC($projectID) + { + $executions = $this->dao->select('id,begin,end,realEnd,status')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('vision')->eq($this->config->vision)->andWhere('project')->eq($projectID)->fetchAll('id'); + $taskIdList = $this->dao->select('id')->from(TABLE_TASK)->where('execution')->in(array_keys($executions))->andWhere("parent")->ge(0)->andWhere("deleted")->eq(0)->fetchPairs('id', 'id'); + + $AC = $this->dao->select('sum(consumed) as consumed')->from(TABLE_EFFORT)->where('objectType')->eq('task')->andWhere('objectID')->in($taskIdList)->andWhere('deleted')->eq('0')->fetch('consumed'); + if(is_null($AC)) $AC = 0; + + return sprintf("%.2f", $AC); + } + /** * Get project workhour info. * diff --git a/module/task/view/lineareffort.html.php b/module/task/view/lineareffort.html.php index caff269195..64314fa1df 100644 --- a/module/task/view/lineareffort.html.php +++ b/module/task/view/lineareffort.html.php @@ -48,6 +48,7 @@ foreach($efforts as $effort) + account != $this->app->user->account) continue;?> date;?> account);?> diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 5934918eaf..ca4d0151b8 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -74,10 +74,10 @@
- assignedTo != $app->user->account and $task->mode == 'linear'):?> -

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->logEfforts);?>

- members[$app->user->account])):?> + members[$app->user->account])):?>

task->deniedNotice, '' . $lang->task->teamMember . '', $lang->task->logEfforts);?>

+ assignedTo != $app->user->account and $task->mode == 'linear'):?> +

task->deniedNotice, '' . $task->assignedToRealName . '', $lang->task->logEfforts);?>

diff --git a/module/testreport/lang/fr.php b/module/testreport/lang/fr.php index 6cfc35a5b9..af4294d07a 100644 --- a/module/testreport/lang/fr.php +++ b/module/testreport/lang/fr.php @@ -49,7 +49,7 @@ $lang->testreport->legendCase = 'CasTests associés'; $lang->testreport->legendLegacyBugs = 'Bugs Restants'; $lang->testreport->legendReport = 'Rapport'; $lang->testreport->legendComment = 'Résumé'; -$lang->testreport->legendMore = 'Plus...'; +$lang->testreport->legendMore = 'Plus'; $lang->testreport->date = 'Date'; $lang->testreport->bugSeverityGroups = 'Distribution Sévérité de Bug'; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index e837f56d03..246e45a258 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -7308,7 +7308,7 @@ class upgradeModel extends model $this->dao->insert(TABLE_TASKTEAM)->data($oldTeam)->exec(); - $this->dao->update(TABLE_TASKESTIMATE)->set('`order`')->eq($order)->where('task')->($oldTeam->task)->andWhere('account')->eq($oldTeam->account)->exec(); + $this->dao->update(TABLE_TASKESTIMATE)->set('`order`')->eq($order)->where('task')->eq($oldTeam->task)->andWhere('account')->eq($oldTeam->account)->exec(); $this->dao->update(TABLE_EFFORT)->set('`order`')->eq($order)->where('objectType')->eq('task')->andWhere('objectID')->eq($oldTeam->task)->andWhere('account')->eq($oldTeam->account)->exec(); $order ++; } diff --git a/module/weekly/control.php b/module/weekly/control.php index 9407cece01..1222aaf804 100755 --- a/module/weekly/control.php +++ b/module/weekly/control.php @@ -54,8 +54,9 @@ class weekly extends control $this->view->title = $this->lang->weekly->common; - $this->view->pv = $this->weekly->getPV($projectID, $date); - $this->view->ev = $this->weekly->getEV($projectID, $date); + $PVEV = $this->weekly->getPVEV($projectID, $date); + $this->view->pv = $PVEV['PV']; + $this->view->ev = $PVEV['EV']; $this->view->ac = $this->weekly->getAC($projectID, $date); $this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv); $this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac); diff --git a/module/weekly/model.php b/module/weekly/model.php index 4610cdb712..3eeb0de923 100755 --- a/module/weekly/model.php +++ b/module/weekly/model.php @@ -121,8 +121,9 @@ class weeklyModel extends model ->exec(); $report = new stdclass; - $report->pv = $this->getPV($project, $date); - $report->ev = $this->getEV($project, $date); + $PVEV = $this->getPVEV($project, $date); + $report->pv = $PVEV['PV']; + $report->ev = $PVEV['EV']; $report->ac = $this->getAC($project, $date); $report->sv = $this->getSV($report->ev, $report->pv); $report->cv = $this->getCV($report->ev, $report->ac); @@ -369,17 +370,17 @@ class weeklyModel extends model } /** - * GetPV + * Get PV and EV * * @param int $project * @param string $date * @access public - * @return int + * @return array */ - public function getPV($projectID, $date = '') + public function getPVEV($projectID, $date = '') { $report = $this->getFromDB($projectID, $date); - if(!empty($report)) return $report->pv; + if(!empty($report)) return array('PV' => $report->pv, 'EV' => $report->ev); if(!$date) $date = date('Y-m-d'); $monday = $this->getThisMonday($date); @@ -397,6 +398,8 @@ class weeklyModel extends model ->fetchAll('id'); $PV = 0; + $EV = 0; + $this->loadModel('holiday'); foreach($tasks as $task) { if(helper::isZeroDate($task->estStarted)) $task->estStarted = date('Y-m-d', strtotime($task->openedDate)); @@ -407,74 +410,36 @@ class weeklyModel extends model if(helper::isZeroDate($task->finishedDate)) $task->deadline = date('Y-m-d', strtotime($task->finishedDate)); } - $fullDays = $this->loadModel('holiday')->getActualWorkingDays($task->estStarted, $task->deadline); + $fullDays = $this->holiday->getActualWorkingDays($task->estStarted, $task->deadline); if($task->estStarted < $monday and $task->deadline >= $nextMonday) { $weekActualDays = $workdays; } elseif($task->estStarted >= $monday and $task->estStarted < $nextMonday) { - $weekActualDays = $this->loadModel('holiday')->getActualWorkingDays($task->estStarted, $task->deadline >= $nextMonday ? $sunday : $task->deadline); + $weekActualDays = $this->holiday->getActualWorkingDays($task->estStarted, $task->deadline >= $nextMonday ? $sunday : $task->deadline); } elseif($task->deadline >= $monday and $task->deadline < $nextMonday) { - $weekActualDays = $this->loadModel('holiday')->getActualWorkingDays($monday, $task->deadline); + $weekActualDays = $this->holiday->getActualWorkingDays($monday, $task->deadline); } if(empty($fullDays) or empty($weekActualDays) or empty($task->estimate)) continue; - $PV += round(count($weekActualDays) / count($fullDays) * $task->estimate, 2); - } + $thisPV = round(count($weekActualDays) / count($fullDays) * $task->estimate, 2); - return sprintf("%.2f",$PV); - } - - /** - * Get EV data. - * - * @param int $projectID - * @param string $date - * @access public - * @return int - */ - public function getEV($projectID, $date = '') - { - $report = $this->getFromDB($projectID, $date); - if(!empty($report)) return $report->ev; - - $executions = $this->loadModel('execution')->getList($projectID); - $executionIdList = array_keys($executions); - - if(!$date) $date = date('Y-m-d'); - $monday = $this->getThisMonday($date); - $sunday = $this->getThisSunday($date); - $lastDay = $this->getLastDay($date); - $nextMonday = date('Y-m-d', strtotime($sunday) + 24 * 3600); - - $tasks = $this->dao->select('*') - ->from(TABLE_TASK) - ->where('execution')->in($executionIdList) - ->andWhere('consumed')->gt(0) - ->andWhere("((estStarted >= '$monday' AND estStarted < '$nextMonday') OR (deadline >= '$monday' AND deadline < '$nextMonday') OR (estStarted < '$monday' AND deadline > '$nextMonday'))") - ->andWhere("parent")->ge(0) - ->andWhere("deleted")->eq(0) - ->andWhere('status')->ne('cancel') - ->query(); - - $EV = 0; - foreach($tasks as $task) - { if($task->status == 'done' or $task->closedReason == 'done') { - $EV += $task->estimate; + $EV += $thisPV; } else { $task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100; - $EV += $task->estimate * $task->progress / 100; + $EV += round($thisPV * $task->progress / 100, 2); } + $PV += $thisPV; } - return sprintf("%.2f", $EV); + return array('PV' => sprintf("%.2f", $PV), 'EV' => sprintf("%.2f", $EV)); } /** @@ -492,15 +457,10 @@ class weeklyModel extends model if(!$date) $date = date('Y-m-d'); - $monday = $this->getThisMonday($date); - $nextMonday = date('Y-m-d', strtotime($monday) + (7 * 24 * 3600)); - $executions = $this->dao->select('id,begin,end,realEnd,status')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('vision')->eq($this->config->vision)->andWhere('project')->eq($project)->fetchAll('id'); - $executionIdList = array_keys($executions); - $taskIdList = $this->dao->select('id')->from(TABLE_TASK) - ->where('execution')->in($executionIdList) - ->andWhere("parent")->ge(0) - ->andWhere("deleted")->eq(0) - ->fetchPairs(); + $monday = $this->getThisMonday($date); + $nextMonday = date('Y-m-d', strtotime($monday) + (7 * 24 * 3600)); + $executions = $this->dao->select('id,begin,end,realEnd,status')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('vision')->eq($this->config->vision)->andWhere('project')->eq($project)->fetchAll('id'); + $taskIdList = $this->dao->select('id')->from(TABLE_TASK)->where('execution')->in(array_keys($executions))->andWhere("parent")->ge(0)->andWhere("deleted")->eq(0)->fetchPairs(); $AC = $this->dao->select('sum(consumed) as consumed') ->from(TABLE_EFFORT)