* Finish task #112118.

This commit is contained in:
hufangzhou
2024-03-05 11:20:57 +08:00
parent 771aa849f9
commit 13604b7c34
12 changed files with 80 additions and 16 deletions
+3 -1
View File
@@ -261,7 +261,8 @@ $lang->action->desc->deletesnapshot = '$date, <strong>$actor</strong> dele
$lang->action->desc->online = '$date, set online by <strong>$actor</strong> .' . "\n";
$lang->action->desc->offline = '$date, set offline by <strong>$actor</strong> .' . "\n";
$lang->action->desc->linkhost = '$date, the host is linked by <strong>$actor</strong> .' . "\n";
$lang->action->desc->createrepobranch = '$date, <strong>$actor</strong> created code branch <strong>$extra</strong>。' . "\n";
$lang->action->desc->createrepobranch = '$date, <strong>$actor</strong> created code branch <strong>$extra</strong>.' . "\n";
$lang->action->desc->changedprogram = '$date, <strong>$actor</strong> adjust the program <strong>$extra</strong>.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
@@ -516,6 +517,7 @@ $lang->action->label->unpublished = 'Unpublished';
$lang->action->label->prompt = 'Prompt';
$lang->action->label->delist = 'delist';
$lang->action->label->createrepobranch = 'Created branch from';
$lang->action->label->changedprogram = 'Changed program';
/* Dynamic information is grouped by object. */
$lang->action->dynamicAction = new stdclass;
+2
View File
@@ -262,6 +262,7 @@ $lang->action->desc->online = '$date, set online by <strong>$actor
$lang->action->desc->offline = '$date, set offline by <strong>$actor</strong> .' . "\n";
$lang->action->desc->linkhost = '$date, the host is linked by <strong>$actor</strong> .' . "\n";
$lang->action->desc->createrepobranch = '$date, <strong>$actor</strong> created code branch <strong>$extra</strong>。' . "\n";
$lang->action->desc->changedprogram = '$date, <strong>$actor</strong> adjust the program <strong>$extra</strong>.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
@@ -516,6 +517,7 @@ $lang->action->label->unpublished = 'Unpublished';
$lang->action->label->prompt = 'Prompt';
$lang->action->label->delist = 'delist';
$lang->action->label->createrepobranch = 'Created branch from';
$lang->action->label->changedprogram = 'Changed program';
/* Dynamic information is grouped by object. */
$lang->action->dynamicAction = new stdclass;
+3 -1
View File
@@ -261,7 +261,8 @@ $lang->action->desc->deletesnapshot = '$date, <strong>$actor</strong> dele
$lang->action->desc->online = '$date, set online by <strong>$actor</strong> .' . "\n";
$lang->action->desc->offline = '$date, set offline by <strong>$actor</strong> .' . "\n";
$lang->action->desc->linkhost = '$date, the host is linked by <strong>$actor</strong> .' . "\n";
$lang->action->desc->createrepobranch = '$date, <strong>$actor</strong> created code branch <strong>$extra</strong>。' . "\n";
$lang->action->desc->createrepobranch = '$date, <strong>$actor</strong> created code branch <strong>$extra</strong>.' . "\n";
$lang->action->desc->changedprogram = '$date, <strong>$actor</strong> adjust the program <strong>$extra</strong>.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> a créé un sous-tâche <strong>$extra</strong>。' . "\n";
@@ -516,6 +517,7 @@ $lang->action->label->unpublished = 'Unpublished';
$lang->action->label->prompt = 'Prompt';
$lang->action->label->delist = 'delist';
$lang->action->label->createrepobranch = 'Created branch from';
$lang->action->label->changedprogram = 'Changed program';
/* Dynamic information is grouped by object. */
$lang->action->dynamicAction = new stdclass();
+2
View File
@@ -262,6 +262,7 @@ $lang->action->desc->online = '$date, 由 <strong>$actor</strong>
$lang->action->desc->offline = '$date, 由 <strong>$actor</strong> 下架。' . "\n";
$lang->action->desc->linkhost = '$date, 由 <strong>$actor</strong> 关联主机。' . "\n";
$lang->action->desc->createrepobranch = '$date, 由 <strong>$actor</strong> 创建了代码分支 <strong>$extra</strong>。' . "\n";
$lang->action->desc->changedprogram = '$date, 由 <strong>$actor</strong> 调整了所属项目集。' . "\n";
/* 用来描述和父子任务相关的操作历史记录。*/
$lang->action->desc->createchildren = '$date, 由 <strong>$actor</strong> 创建子任务 <strong>$extra</strong>。' . "\n";
@@ -516,6 +517,7 @@ $lang->action->label->unpublished = '下架了';
$lang->action->label->prompt = '提词';
$lang->action->label->delist = '下架了';
$lang->action->label->createrepobranch = '创建了分支从';
$lang->action->label->changedprogram = '调整了项目集';
/* 动态信息按照对象分组 */
$lang->action->dynamicAction = new stdclass();
+13
View File
@@ -1649,4 +1649,17 @@ class product extends control
$data = fixer::input('post')->get();
$this->loadModel('setting')->updateItem("{$this->app->user->account}.product.showAllProjects", $data->showAllProjects);
}
/**
* AJAX: get products by line.
*
* @param int $lineID
* @access public
* @return void
*/
public function ajaxGetProductByLine($lineID)
{
$products = $this->product->getList(0, 'all', 1, $lineID);
return print($products ? json_encode($products) : '');
}
}
+20
View File
@@ -26,3 +26,23 @@ function deleteItem(obj)
});
}
}
$('#lineForm').on('change', '.col-programs select', function()
{
isProductLineEmpty(this);
})
function isProductLineEmpty(obj)
{
var lineInputID = $(obj).closest('.col-programs').siblings('.col-module').find('input').attr('id');
var lineID = lineInputID.replace('modulesid', '');
$.get(createLink('product', 'ajaxGetProductByLine', 'lineID=' + lineID), function(data)
{
if(data && !hasPrompted)
{
hasPrompted = true;
alert(changeProgramTip);
}
})
}
+1
View File
@@ -105,6 +105,7 @@ $lang->product->programEmpty = 'Program should not be empty!';
$lang->product->nameIsDuplicate = "『%s』 product line already exists, please reset!";
$lang->product->nameIsDuplicated = "Product Line『%s』 exists. Go to Admin->System->Data->Recycle Bin to restore it, if you are sure it is deleted.";
$lang->product->reviewStory = 'You are not a reviewer for needs "%s" , and cannot review. This operation has been filtered';
$lang->product->lineChangeProgram = "The product line has already been associated with {$lang->productCommon}s. After adjusting the program, all {$lang->productCommon}s under the product line will synchronously adjust to the new program.";
$lang->product->id = 'ID';
$lang->product->program = "Program";
+1
View File
@@ -105,6 +105,7 @@ $lang->product->programEmpty = 'Program should not be empty!';
$lang->product->nameIsDuplicate = "『%s』 product line already exists, please reset!";
$lang->product->nameIsDuplicated = "Product Line『%s』 exists. Go to Admin->System->Data->Recycle Bin to restore it, if you are sure it is deleted.";
$lang->product->reviewStory = 'You are not a reviewer for needs "%s" , and cannot review. This operation has been filtered';
$lang->product->lineChangeProgram = "The product line has already been associated with {$lang->productCommon}s. After adjusting the program, all {$lang->productCommon}s under the product line will synchronously adjust to the new program.";
$lang->product->id = 'ID';
$lang->product->program = "Program";
+1
View File
@@ -105,6 +105,7 @@ $lang->product->programEmpty = 'Program should not be empty!';
$lang->product->nameIsDuplicate = "『%s』 product line already exists, please reset!";
$lang->product->nameIsDuplicated = "Product Line『%s』 exists. Go to Admin->System->Data->Recycle Bin to restore it, if you are sure it is deleted.";
$lang->product->reviewStory = 'You are not a reviewer for needs "%s" , and cannot review. This operation has been filtered';
$lang->product->lineChangeProgram = "The product line has already been associated with {$lang->productCommon}s. After adjusting the program, all {$lang->productCommon}s under the product line will synchronously adjust to the new program.";
$lang->product->id = 'ID';
$lang->product->program = "Program";
+1
View File
@@ -105,6 +105,7 @@ $lang->product->programEmpty = '项目集不能为空';
$lang->product->nameIsDuplicate = "『%s』产品线已经存在,请重新设置!";
$lang->product->nameIsDuplicated = "产品线已经有『%s』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。";
$lang->product->reviewStory = '您不是研发需求 "%s" 的评审人,无法评审,本次操作已被过滤。';
$lang->product->lineChangeProgram = "该产品线下已经关联了{$lang->productCommon},调整所属项目集后,产品线下的所有{$lang->productCommon}将同步调整所属项目集。";
$lang->product->id = '编号';
$lang->product->program = "所属项目集";
+31 -14
View File
@@ -1012,20 +1012,6 @@ class productModel extends model
$oldLines = $this->getLines();
$data = fixer::input('post')->get();
/* When there are products under the line, the program cannot be modified */
if(in_array($this->config->systemMode, array('ALM', 'PLM')))
{
foreach($oldLines as $oldLine)
{
$oldLineID = 'id' . $oldLine->id;
if($data->programs[$oldLineID] != $oldLine->root)
{
$product = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->eq($oldLine->id)->fetch();
if(!empty($product)) return print(js::error($this->lang->product->changeLineError));
}
}
}
$line = new stdClass();
$line->type = 'line';
$line->parent = 0;
@@ -1071,6 +1057,37 @@ class productModel extends model
$lineID = str_replace('id', '', $id);
$this->dao->update(TABLE_MODULE)->data($line)->where('id')->eq($lineID)->exec();
}
if(!dao::isError()) $this->syncprogram2product($line->root, $lineID);
}
}
/**
* Sync program to product.
*
* @param int $programID
* @param int $lineID
* @access public
* @return void
*/
public function syncprogram2product($programID, $lineID)
{
$this->loadModel('action');
$oldProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->eq($lineID)->fetchAll('id');
$this->dao->update(TABLE_PRODUCT)->set('program')->eq($programID)->where('line')->eq($lineID)->exec();
if(!dao::isError())
{
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->eq($lineID)->fetchAll('id');
foreach($products as $productID => $product)
{
if($oldProducts[$productID]->program != $product->program)
{
$changes = common::createChanges($oldProducts[$productID], $product);
$actionID = $this->action->create('product', $productID, 'ChangedProgram');
$this->action->logHistory($actionID, $changes);
}
}
}
}
+2
View File
@@ -10,6 +10,8 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('hasPrompted', false);?>
<?php js::set('changeProgramTip', $lang->product->lineChangeProgram);?>
<div id="mainContent" class="main-row fade">
<div class='side-col col-4'>
<div class='panel'>