From 88653f881fa56c2a1e770d7cbaf6c167e77bff60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Wed, 3 Jan 2018 21:14:05 +0800 Subject: [PATCH 1/2] * Finish task#3574 --- module/report/model.php | 34 ++++++++++++++++++++++++++++ module/report/view/workload.html.php | 9 ++++++++ 2 files changed, 43 insertions(+) diff --git a/module/report/model.php b/module/report/model.php index f043ae8c2e..853fad668c 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -249,6 +249,40 @@ class reportModel extends model $depts = array(); if($dept) $depts = $this->loadModel('dept')->getAllChildId($dept); + if($assign == 0) + { + $project = $this->dao->select('id')->from(TABLE_PROJECT) + ->where('deleted')->eq(0) + ->andWhere('status')->notin('cancel, closed, done, suspended') + ->fetchPairs('id'); + + $members = $this->dao->select('t1.account')->from(TABLE_TEAM)->alias('t1') + ->leftJoin(TABLE_USER)->alias('t2')->on('t2.account = t1.account') + ->where('t1.type')->eq('project') + ->beginIF($dept)->andWhere('t2.dept')->in($depts)->fi() + ->andWhere('t1.root')->in(array_keys($project)) + ->fetchPairs('account'); + + $taskAccounts = $this->dao->select('assignedTo')->from(TABLE_TASK) + ->where('deleted')->eq(0) + ->andWhere('project')->in(array_keys($project)) + ->andWhere('status')->notin('cancel, closed, done, pause') + ->fetchPairs('assignedTo'); + + if(!empty($taskAccounts) && !empty($members)) + { + foreach($members as $member) + { + if(!empty($member) && in_array($member, $taskAccounts)) + { + unset($members[$member]); + } + } + } + + return $members; + } + $tasks = $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') diff --git a/module/report/view/workload.html.php b/module/report/view/workload.html.php index 96f711b686..7092ce9c3e 100644 --- a/module/report/view/workload.html.php +++ b/module/report/view/workload.html.php @@ -70,6 +70,7 @@ + $info):?> ';?> @@ -90,6 +91,14 @@ '; $id ++;?> + + + 0 + 0 + 0 + 0 + 0 + From a92a0bdb29c9dd3876c43889872b358dd2e7e56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Wed, 3 Jan 2018 22:06:04 +0800 Subject: [PATCH 2/2] * Finish task#3553 --- module/productplan/config.php | 4 +- module/productplan/js/create.js | 20 +++++--- module/productplan/js/edit.js | 19 +++++--- module/productplan/lang/en.php | 16 ++++--- module/productplan/lang/zh-cn.php | 16 ++++--- module/productplan/model.php | 66 +++++++++++++++------------ module/productplan/view/edit.html.php | 19 ++++---- module/productplan/view/view.html.php | 2 +- 8 files changed, 95 insertions(+), 67 deletions(-) diff --git a/module/productplan/config.php b/module/productplan/config.php index c506aacdc0..0f7486b95b 100644 --- a/module/productplan/config.php +++ b/module/productplan/config.php @@ -2,8 +2,8 @@ $config->productplan = new stdclass(); $config->productplan->create = new stdclass(); $config->productplan->edit = new stdclass(); -$config->productplan->create->requiredFields = 'title,begin,end'; -$config->productplan->edit->requiredFields = 'title,begin,end'; +$config->productplan->create->requiredFields = 'title,begin'; +$config->productplan->edit->requiredFields = 'title,begin'; $config->productplan->editor = new stdclass(); $config->productplan->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); diff --git a/module/productplan/js/create.js b/module/productplan/js/create.js index e58173c215..c7d495d46f 100644 --- a/module/productplan/js/create.js +++ b/module/productplan/js/create.js @@ -1,7 +1,7 @@ /** * Convert a date string like 2011-11-11 to date object in js. - * - * @param string $date + * + * @param string $date * @access public * @return date */ @@ -9,14 +9,14 @@ function convertStringToDate(dateString) { dateString = dateString.split('-'); dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0]; - + return Date.parse(dateString); } /** * Compute the end date for productplan. - * - * @param int $delta + * + * @param int $delta * @access public * @return void */ @@ -33,7 +33,15 @@ function computeEndDate(delta) } endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd'); - $('#end').val(endDate); + + if(delta == 9999) + { + $('#end').val('').attr("disabled","disabled"); + } + else + { + $('#end').val(endDate).removeAttr('disabled'); + } } $('#begin').on('change', function() diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js index b23058c54e..c7fb9892ad 100644 --- a/module/productplan/js/edit.js +++ b/module/productplan/js/edit.js @@ -1,7 +1,7 @@ /** * Convert a date string like 2011-11-11 to date object in js. - * - * @param string $date + * + * @param string $date * @access public * @return date */ @@ -9,14 +9,14 @@ function convertStringToDate(dateString) { dateString = dateString.split('-'); dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0]; - + return Date.parse(dateString); } /** * Compute the end date for productplan. - * - * @param int $delta + * + * @param int $delta * @access public * @return void */ @@ -33,5 +33,12 @@ function computeEndDate(delta) } endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd'); - $('#end').val(endDate).datetimepicker('update') + if(delta == 9999) + { + $('#end').val('').attr("disabled","disabled"); + } + else + { + $('#end').val(endDate).removeAttr('disabled').datetimepicker('update'); + } } diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php index c8d9744a0a..6a3b5fba20 100644 --- a/module/productplan/lang/en.php +++ b/module/productplan/lang/en.php @@ -46,14 +46,16 @@ $lang->productplan->desc = 'Description'; $lang->productplan->begin = 'Begin'; $lang->productplan->end = 'End'; $lang->productplan->last = 'Last plan'; +$lang->productplan->future = 'Future'; -$lang->productplan->endList[7] = '1 Week'; -$lang->productplan->endList[14] = '2 Weeks'; -$lang->productplan->endList[31] = '1 Month'; -$lang->productplan->endList[62] = '2 Months'; -$lang->productplan->endList[93] = '3 Months'; -$lang->productplan->endList[186] = '6 Months'; -$lang->productplan->endList[365] = '1 Year'; +$lang->productplan->endList[7] = '1 Week'; +$lang->productplan->endList[14] = '2 Weeks'; +$lang->productplan->endList[31] = '1 Month'; +$lang->productplan->endList[62] = '2 Months'; +$lang->productplan->endList[93] = '3 Months'; +$lang->productplan->endList[186] = '6 Months'; +$lang->productplan->endList[365] = '1 Year'; +$lang->productplan->endList[9999] = 'Future'; $lang->productplan->errorNoTitle = 'ID %s title should not be empty.'; $lang->productplan->errorNoBegin = 'ID %s begin time should not be empty.'; diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php index c2c8b5973e..509b88a4bf 100644 --- a/module/productplan/lang/zh-cn.php +++ b/module/productplan/lang/zh-cn.php @@ -46,14 +46,16 @@ $lang->productplan->desc = '描述'; $lang->productplan->begin = '开始日期'; $lang->productplan->end = '结束日期'; $lang->productplan->last = '上次计划'; +$lang->productplan->future = '待定'; -$lang->productplan->endList[7] = '一星期'; -$lang->productplan->endList[14] = '两星期'; -$lang->productplan->endList[31] = '一个月'; -$lang->productplan->endList[62] = '两个月'; -$lang->productplan->endList[93] = '三个月'; -$lang->productplan->endList[186] = '半年'; -$lang->productplan->endList[365] = '一年'; +$lang->productplan->endList[7] = '一星期'; +$lang->productplan->endList[14] = '两星期'; +$lang->productplan->endList[31] = '一个月'; +$lang->productplan->endList[62] = '两个月'; +$lang->productplan->endList[93] = '三个月'; +$lang->productplan->endList[186] = '半年'; +$lang->productplan->endList[365] = '一年'; +$lang->productplan->endList[9999] = '待定'; $lang->productplan->errorNoTitle = 'ID %s 标题不能为空'; $lang->productplan->errorNoBegin = 'ID %s 开始时间不能为空'; diff --git a/module/productplan/model.php b/module/productplan/model.php index 22f6b0604b..ab3f767ecc 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -15,8 +15,8 @@ class productplanModel extends model { /** * Get plan by id. - * - * @param int $planID + * + * @param int $planID * @param bool $setImgSize * @access public * @return object @@ -30,9 +30,9 @@ class productplanModel extends model } /** - * Get plans by idList - * - * @param int $planIDList + * Get plans by idList + * + * @param int $planIDList * @access public * @return array */ @@ -43,8 +43,8 @@ class productplanModel extends model /** * Get last plan. - * - * @param int $productID + * + * @param int $productID * @access public * @return void */ @@ -60,9 +60,9 @@ class productplanModel extends model } /** - * Get list - * - * @param int $product + * Get list + * + * @param int $product * @param int $branch * @param string $browseType * @param object $pager @@ -85,9 +85,9 @@ class productplanModel extends model /** * Get plan pairs. - * - * @param array|int $product - * @param string $expired + * + * @param array|int $product + * @param string $expired * @access public * @return array */ @@ -117,9 +117,9 @@ class productplanModel extends model } /** - * Get plans for products - * - * @param int $products + * Get plans for products + * + * @param int $products * @access public * @return void */ @@ -133,13 +133,16 @@ class productplanModel extends model /** * Create a plan. - * + * * @access public * @return int */ public function create() { - $plan = fixer::input('post')->stripTags($this->config->productplan->editor->create['id'], $this->config->allowedTags)->remove('delta,uid')->get(); + $plan = fixer::input('post')->stripTags($this->config->productplan->editor->create['id'], $this->config->allowedTags) + ->setIF($this->post->delta == 9999 || empty($this->post->end), 'end', '2030-01-01') + ->remove('delta,uid') + ->get(); $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_PRODUCTPLAN) ->data($plan) @@ -158,15 +161,18 @@ class productplanModel extends model /** * Update a plan - * - * @param int $planID + * + * @param int $planID * @access public * @return array */ public function update($planID) { $oldPlan = $this->dao->findByID((int)$planID)->from(TABLE_PRODUCTPLAN)->fetch(); - $plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags)->remove('delta,uid')->get(); + $plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags) + ->setIF($this->post->delta == 9999 || empty($this->post->end), 'end', '2030-01-01') + ->remove('delta,uid') + ->get(); $plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_PRODUCTPLAN) ->data($plan) @@ -184,8 +190,8 @@ class productplanModel extends model /** * Batch update plan. - * - * @param int $productID + * + * @param int $productID * @access public * @return array */ @@ -233,8 +239,8 @@ class productplanModel extends model /** * Link stories. - * - * @param int $planID + * + * @param int $planID * @access public * @return void */ @@ -267,9 +273,9 @@ class productplanModel extends model } /** - * Unlink story - * - * @param int $storyID + * Unlink story + * + * @param int $storyID * @access public * @return void */ @@ -284,8 +290,8 @@ class productplanModel extends model /** * Link bugs. - * - * @param int $planID + * + * @param int $planID * @access public * @return void */ diff --git a/module/productplan/view/edit.html.php b/module/productplan/view/edit.html.php index 2585b5532f..9bba0bad30 100644 --- a/module/productplan/view/edit.html.php +++ b/module/productplan/view/edit.html.php @@ -24,28 +24,31 @@
- +
- + type != 'normal'):?> - + - + - + - + @@ -53,11 +56,11 @@ - + - +
productplan->product;?> name;?>
product->branch;?> branch, 'class="form-control"');?>
productplan->title;?> title, "class='form-control' autocomplete='off'");?>
productplan->begin;?> begin, "class='form-control form-date'");?>
productplan->end;?>end, 'class="form-control form-date"');?> + end == '2030-01-01' ? ' disabled="disabled"' : '';?> + end : '', 'class="form-control form-date"' . $disabled);?> +     productplan->endList , '', "onclick='computeEndDate(this.value)'");?>
productplan->desc;?> desc), "rows='10' class='form-control'");?>
- id); diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index a3f29aeb65..7b018fa00c 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -413,7 +413,7 @@
productplan->end;?>end;?>end == '2030-01-01' ? $lang->productplan->future : $plan->end;?>
productplan->desc;?>