From 751fec28e866323034b0336b3b844bb86dd6d2a5 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 21 Feb 2022 08:53:25 +0000 Subject: [PATCH 1/3] Finish task #49302. --- module/group/lang/resource.php | 34 ++++++++++--------- module/productplan/control.php | 25 ++++++++++++++ module/productplan/js/browse.js | 2 ++ module/productplan/lang/en.php | 33 +++++++++++------- module/productplan/lang/zh-cn.php | 33 +++++++++++------- module/productplan/model.php | 27 +++++++++++++++ module/productplan/view/browsebylist.html.php | 24 ++++++++++--- 7 files changed, 131 insertions(+), 47 deletions(-) diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index e34fe1783b..3dd57b32c0 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -563,22 +563,23 @@ $lang->story->methodOrder[140] = 'processStoryChange'; /* Product plan. */ $lang->resource->productplan = new stdclass(); -$lang->resource->productplan->browse = 'browse'; -$lang->resource->productplan->create = 'create'; -$lang->resource->productplan->edit = 'edit'; -$lang->resource->productplan->delete = 'delete'; -$lang->resource->productplan->view = 'view'; -$lang->resource->productplan->linkStory = 'linkStory'; -$lang->resource->productplan->unlinkStory = 'unlinkStory'; -$lang->resource->productplan->batchUnlinkStory = 'batchUnlinkStory'; -$lang->resource->productplan->linkBug = 'linkBug'; -$lang->resource->productplan->unlinkBug = 'unlinkBug'; -$lang->resource->productplan->batchUnlinkBug = 'batchUnlinkBug'; -$lang->resource->productplan->batchEdit = 'batchEdit'; -$lang->resource->productplan->start = 'start'; -$lang->resource->productplan->finish = 'finish'; -$lang->resource->productplan->close = 'close'; -$lang->resource->productplan->activate = 'activate'; +$lang->resource->productplan->browse = 'browse'; +$lang->resource->productplan->create = 'create'; +$lang->resource->productplan->edit = 'edit'; +$lang->resource->productplan->delete = 'delete'; +$lang->resource->productplan->view = 'view'; +$lang->resource->productplan->linkStory = 'linkStory'; +$lang->resource->productplan->unlinkStory = 'unlinkStory'; +$lang->resource->productplan->batchUnlinkStory = 'batchUnlinkStory'; +$lang->resource->productplan->linkBug = 'linkBug'; +$lang->resource->productplan->unlinkBug = 'unlinkBug'; +$lang->resource->productplan->batchUnlinkBug = 'batchUnlinkBug'; +$lang->resource->productplan->batchEdit = 'batchEdit'; +$lang->resource->productplan->start = 'start'; +$lang->resource->productplan->finish = 'finish'; +$lang->resource->productplan->close = 'close'; +$lang->resource->productplan->activate = 'activate'; +$lang->resource->productplan->batchChangeStatus = 'batchChangeStatus'; $lang->productplan->methodOrder[5] = 'browse'; $lang->productplan->methodOrder[10] = 'create'; @@ -596,6 +597,7 @@ $lang->productplan->methodOrder[65] = 'start'; $lang->productplan->methodOrder[70] = 'finish'; $lang->productplan->methodOrder[75] = 'close'; $lang->productplan->methodOrder[80] = 'activate'; +$lang->productplan->methodOrder[85] = 'batchChangeStatus'; /* Release. */ $lang->resource->release = new stdclass(); diff --git a/module/productplan/control.php b/module/productplan/control.php index 0eae192bfb..73249c0e97 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -181,6 +181,31 @@ class productplan extends control $this->display(); } + /** + * Batch change the status of productplan. + * + * @param string $status + * @access public + * @return void + */ + public function batchChangeStatus($status) + { + if($this->post->planIDList) + { + $planIDList = $this->post->planIDList; + unset($_POST['planIDList']); + $allChanges = $this->productplan->batchChangeStatus($planIDList, $status); + if(dao::isError()) die(js::error(dao::getError())); + foreach($allChanges as $planID => $changes) + { + $this->loadModel('action'); + $actionID = $this->action->create('productplan', $planID, 'edited'); + $this->action->logHistory($actionID, $changes); + } + die(js::reload('parent')); + } + } + /** * Delete a plan. * diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index b41b74cf9c..3df6eb3021 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -455,3 +455,5 @@ if(!window.kanbanDropRules) closed: ['doing'] } } + +$('#submit').attr('id', 'submitButton'); diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php index 8c86a68aaf..bb93a6bbe9 100644 --- a/module/productplan/lang/en.php +++ b/module/productplan/lang/en.php @@ -33,19 +33,20 @@ $lang->productplan->allAB = 'All'; $lang->productplan->to = 'To'; $lang->productplan->more = 'More'; -$lang->productplan->batchUnlink = "Batch Unlink"; -$lang->productplan->unlinkAB = "Unlink"; -$lang->productplan->linkStory = "Link Story"; -$lang->productplan->unlinkStory = "Unlink Story"; -$lang->productplan->unlinkStoryAB = "Unlink"; -$lang->productplan->batchUnlinkStory = "Batch Unlink"; -$lang->productplan->linkedStories = 'Linked Stories'; -$lang->productplan->unlinkedStories = 'Unlinked Stories'; -$lang->productplan->updateOrder = 'Order'; -$lang->productplan->createChildren = "Create Child Plans"; -$lang->productplan->createExecution = "Create {$lang->execution->common}"; -$lang->productplan->list = 'List'; -$lang->productplan->kanban = 'Kanban'; +$lang->productplan->batchUnlink = "Batch Unlink"; +$lang->productplan->batchChangeStatus = "Batch Change Status"; +$lang->productplan->unlinkAB = "Unlink"; +$lang->productplan->linkStory = "Link Story"; +$lang->productplan->unlinkStory = "Unlink Story"; +$lang->productplan->unlinkStoryAB = "Unlink"; +$lang->productplan->batchUnlinkStory = "Batch Unlink"; +$lang->productplan->linkedStories = 'Linked Stories'; +$lang->productplan->unlinkedStories = 'Unlinked Stories'; +$lang->productplan->updateOrder = 'Order'; +$lang->productplan->createChildren = "Create Child Plans"; +$lang->productplan->createExecution = "Create {$lang->execution->common}"; +$lang->productplan->list = 'List'; +$lang->productplan->kanban = 'Kanban'; $lang->productplan->linkBug = "Link Bug"; $lang->productplan->unlinkBug = "Unlink Bug"; @@ -91,6 +92,7 @@ $lang->productplan->order = "Order"; $lang->productplan->deleted = "Deleted"; $lang->productplan->mailto = "Mailto"; $lang->productplan->status = "Plan Status"; +$lang->productplan->planStatus = "Status"; $lang->productplan->statusList['wait'] = 'Wait'; $lang->productplan->statusList['doing'] = 'Doing'; @@ -132,6 +134,11 @@ $lang->productplan->featureBar['browse']['doing'] = 'Doing'; $lang->productplan->featureBar['browse']['done'] = 'Done'; $lang->productplan->featureBar['browse']['closed'] = 'Closed'; +$lang->productplan->statusList['wait'] = 'Wait'; +$lang->productplan->statusList['doing'] = 'Doing'; +$lang->productplan->statusList['done'] = 'Done'; +$lang->productplan->statusList['closed'] = 'Closed'; + $lang->productplan->orderList['begin_desc'] = 'Begin Descend'; $lang->productplan->orderList['begin_asc'] = 'Begin Ascend'; $lang->productplan->orderList['title_desc'] = 'Title Descend'; diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php index 46f523b6c9..e36caf8863 100644 --- a/module/productplan/lang/zh-cn.php +++ b/module/productplan/lang/zh-cn.php @@ -33,19 +33,20 @@ $lang->productplan->allAB = '所有'; $lang->productplan->to = '至'; $lang->productplan->more = '更多操作'; -$lang->productplan->batchUnlink = "批量移除"; -$lang->productplan->unlinkAB = "移除"; -$lang->productplan->linkStory = "关联{$lang->SRCommon}"; -$lang->productplan->unlinkStory = "移除{$lang->SRCommon}"; -$lang->productplan->unlinkStoryAB = "移除"; -$lang->productplan->batchUnlinkStory = "批量移除{$lang->SRCommon}"; -$lang->productplan->linkedStories = $lang->SRCommon; -$lang->productplan->unlinkedStories = "未关联{$lang->SRCommon}"; -$lang->productplan->updateOrder = '排序'; -$lang->productplan->createChildren = "创建子计划"; -$lang->productplan->createExecution = "创建{$lang->execution->common}"; -$lang->productplan->list = '列表'; -$lang->productplan->kanban = '看板'; +$lang->productplan->batchUnlink = "批量移除"; +$lang->productplan->batchChangeStatus = "批量修改状态"; +$lang->productplan->unlinkAB = "移除"; +$lang->productplan->linkStory = "关联{$lang->SRCommon}"; +$lang->productplan->unlinkStory = "移除{$lang->SRCommon}"; +$lang->productplan->unlinkStoryAB = "移除"; +$lang->productplan->batchUnlinkStory = "批量移除{$lang->SRCommon}"; +$lang->productplan->linkedStories = $lang->SRCommon; +$lang->productplan->unlinkedStories = "未关联{$lang->SRCommon}"; +$lang->productplan->updateOrder = '排序'; +$lang->productplan->createChildren = "创建子计划"; +$lang->productplan->createExecution = "创建{$lang->execution->common}"; +$lang->productplan->list = '列表'; +$lang->productplan->kanban = '看板'; $lang->productplan->linkBug = "关联Bug"; $lang->productplan->unlinkBug = "移除Bug"; @@ -91,6 +92,7 @@ $lang->productplan->order = "排序"; $lang->productplan->deleted = "已删除"; $lang->productplan->mailto = "抄送给"; $lang->productplan->status = "计划状态"; +$lang->productplan->planStatus = "状态"; $lang->productplan->statusList['wait'] = '未开始'; $lang->productplan->statusList['doing'] = '进行中'; @@ -132,6 +134,11 @@ $lang->productplan->featureBar['browse']['doing'] = '进行中'; $lang->productplan->featureBar['browse']['done'] = '已完成'; $lang->productplan->featureBar['browse']['closed'] = '已关闭'; +$lang->productplan->statusList['wait'] = '未开始'; +$lang->productplan->statusList['doing'] = '进行中'; +$lang->productplan->statusList['done'] = '已完成'; +$lang->productplan->statusList['closed'] = '已关闭'; + $lang->productplan->orderList['begin_desc'] = '计划开始时间倒序'; $lang->productplan->orderList['begin_asc'] = '计划开始时间正序'; $lang->productplan->orderList['title_desc'] = '计划名称倒序'; diff --git a/module/productplan/model.php b/module/productplan/model.php index 3a4202134b..a8cd30660c 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -693,6 +693,33 @@ class productplanModel extends model return $changes; } + /** + * Batch change the status of productplan. + * + * @param array $planIDList + * @param string $status + * @access public + * @return array + */ + public function batchChangeStatus($planIDList, $status) + { + $now = helper::now(); + $allChanges = array(); + $oldPlans = $this->getByIDList($planIDList, $status); + foreach($planIDList as $planID) + { + $oldPlan = $oldPlans[$planID]; + if($status == $oldPlan->status) continue; + + $plan = new stdclass(); + $plan->status = $status; + + $this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->where('id')->eq((int)$planID)->exec(); + if(!dao::isError()) $allChanges[$planID] = common::createChanges($oldPlan, $plan); + } + return $allChanges; + } + /** * Check date for plan. * diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index e49427f137..598fdb75df 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -48,7 +48,7 @@ recTotal}&recPerPage={$pager->recPerPage}"; ?> - +
@@ -104,7 +104,7 @@ ?> - + id => ''), '', $attribute) . html::a(helper::createLink('productplan', 'view', "planID=$plan->id"), sprintf('%03d', $plan->id));?> id);?> @@ -211,12 +211,26 @@ From ae8d371efb3e534b98a53c381c2484b42eed82e0 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 22 Feb 2022 01:12:41 +0000 Subject: [PATCH 2/3] Fix bug. . --- module/productplan/view/browsebylist.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 598fdb75df..e9977c4a75 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -229,6 +229,7 @@ } ?> + show('right', 'pagerjs');?> From 63be4b0948e980c6d0c40b05ab163a14e66afdca Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 22 Feb 2022 01:56:44 +0000 Subject: [PATCH 3/3] Adjust code. --- module/productplan/js/browse.js | 2 -- module/productplan/view/browsebylist.html.php | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 3df6eb3021..b41b74cf9c 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -455,5 +455,3 @@ if(!window.kanbanDropRules) closed: ['doing'] } } - -$('#submit').attr('id', 'submitButton'); diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index e9977c4a75..2c96e7ae15 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -215,20 +215,20 @@
inlink('batchEdit', "productID=$product->id&branch=$branch");?> - edit, "onclick=\"setFormAction('$actionLink')\"", 'btn');?> + edit, "data-form-action='$actionLink'");?>