* Modify code logic.

This commit is contained in:
tianshujie
2021-11-09 10:28:16 +08:00
parent 3986d8c297
commit eedcc1aed5
9 changed files with 12 additions and 11 deletions
+1
View File
@@ -3,4 +3,5 @@ ALTER TABLE `zt_branch` ADD `status` enum ('active', 'closed') NOT NULL DEFAULT
ALTER TABLE `zt_branch` ADD `desc` varchar(255) NOT NULL AFTER `status`;
ALTER TABLE `zt_branch` ADD `createdDate` date NOT NULL AFTER `desc`;
ALTER TABLE `zt_branch` ADD `closedDate` date NOT NULL AFTER `createdDate`;
ALTER TABLE `zt_projectstory` ADD `branch` mediumint(8) NOT NULL AFTER `product`;
ALTER TABLE `zt_projectproduct` ADD PRIMARY KEY `project_product_branch` (`project`, `product`, `branch`), DROP INDEX `PRIMARY`;
+1
View File
@@ -853,6 +853,7 @@ CREATE TABLE IF NOT EXISTS `zt_projectspec` (
CREATE TABLE IF NOT EXISTS `zt_projectstory` (
`project` mediumint(8) unsigned NOT NULL default '0',
`product` mediumint(8) unsigned NOT NULL,
`branch` mediumint(8) unsigned NOT NULL,
`story` mediumint(8) unsigned NOT NULL default '0',
`version` smallint(6) NOT NULL default '1',
`order` smallint(6) unsigned NOT NULL,
+1
View File
@@ -174,6 +174,7 @@ class branchModel extends model
->beginIF(strpos($params, 'noclosed') !== false)->andWhere('status')->eq('active')->fi()
->orderBy('`order`')
->fetchAll('id');
if(!empty($appendBranch)) $branches += $this->dao->select('*')->from(TABLE_BRANCH)->where('id')->in($appendBranch)->orderBy('`order`')->fetchAll('id');
$products = $this->loadModel('product')->getByIdList($products);
+1 -4
View File
@@ -2440,10 +2440,7 @@ class execution extends control
$productType = $product->type;
if(isset($branches[$product->id]))
{
foreach($branches[$product->id] as $branchID => $branch)
{
$branchPairs[$branchID] = $branchID;
}
foreach($branches[$product->id] as $branchID => $branch) $branchPairs[$branchID] = $branchID;
}
}
}
+3 -2
View File
@@ -2234,16 +2234,17 @@ class executionModel extends model
$versions = $this->loadModel('story')->getVersions($stories);
$linkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->orderBy('order_desc')->fetchPairs('story', 'order');
$lastOrder = reset($linkedStories);
$statusPairs = $this->dao->select('id, status')->from(TABLE_STORY)->where('id')->in(array_values($stories))->fetchPairs();
$storyList = $this->dao->select('id, status, branch')->from(TABLE_STORY)->where('id')->in(array_values($stories))->fetchAll('id');
foreach($stories as $key => $storyID)
{
$notAllowedStatus = $this->app->rawMethod == 'batchcreate' ? 'closed' : 'draft,closed';
if(strpos($notAllowedStatus, $statusPairs[$storyID]) !== false) continue;
if(strpos($notAllowedStatus, $storyList[$storyID]->status) !== false) continue;
if(isset($linkedStories[$storyID])) continue;
$data = new stdclass();
$data->project = $executionID;
$data->product = (int)$products[$storyID];
$data->branch = $storyList[$storyID]->branch;
$data->story = $storyID;
$data->version = $versions[$storyID];
$data->order = ++$lastOrder;
-2
View File
@@ -540,7 +540,6 @@ class project extends control
{
array_push($unmodifiableProducts, $productID);
array_push($unmodifiableBranches, $branchID);
continue;
}
}
}
@@ -1714,7 +1713,6 @@ class project extends control
{
array_push($unmodifiableProducts, $productID);
array_push($unmodifiableBranches, $branchID);
continue;
}
}
}
+1 -1
View File
@@ -142,7 +142,7 @@ function loadBranches(product)
$('#productsBox select').each(function()
{
var $product = $(product);
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id') && !abnormalProducts[$product.val()] && config.currentMethod != 'create')
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id') && !abnormalProducts[$product.val()])
{
alert(errorSameProducts);
$product.val(0);
+2 -1
View File
@@ -30,6 +30,7 @@ $(function()
{
var products = [];
var existedBranch = false;
/* Determine whether the products of the same branch are linked. */
$("#productsBox select[name^='products']").each(function()
{
var productID = $(this).val();
@@ -50,10 +51,10 @@ $(function()
products[productID][branchID] = branchID;
}
})
if(existedBranch) return false;
}
})
if(existedBranch)
{
alert(errorSameBranches);
+2 -1
View File
@@ -95,6 +95,7 @@ $(function()
{
var products = [];
var existedBranch = false;
/* Determine whether the products of the same branch are linked. */
$("#productsBox select[name^='products']").each(function()
{
var productID = $(this).val();
@@ -115,10 +116,10 @@ $(function()
products[productID][branchID] = branchID;
}
})
if(existedBranch) return false;
}
})
if(existedBranch)
{
alert(errorSameBranches);