Merge branch 'zentaopms_239'
This commit is contained in:
@@ -37,9 +37,11 @@ class programplan extends control
|
||||
{
|
||||
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
|
||||
$productID = $this->product->saveState($productID, $products);
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
|
||||
$this->session->set('hasProduct', $project->hasProduct);
|
||||
$this->productID = $productID;
|
||||
$this->loadModel('project')->setMenu($projectID);
|
||||
$this->project->setMenu($projectID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +64,7 @@ class programplan extends control
|
||||
if(!defined('RUN_MODE') || RUN_MODE != 'api') $projectID = $this->project->saveState((int)$projectID, $this->project->getPairsByProgram());
|
||||
|
||||
$products = $this->loadModel('product')->getProducts($projectID);
|
||||
$this->lang->modulePageNav = $this->product->select($products, $this->productID, 'programplan', 'browse', $type, 0, 0, '', false);
|
||||
if($this->session->hasProduct) $this->lang->modulePageNav = $this->product->select($products, $this->productID, 'programplan', 'browse', $type, 0, 0, '', false);
|
||||
|
||||
$this->lang->TRActions = "<button class='btn btn-link' data-toggle='dropdown'><i class='icon icon-export muted'></i> <span class='text'>" . $this->lang->export . "</span> <span class='caret'></span></button>";
|
||||
$this->lang->TRActions .= "<ul class='dropdown-menu' id='exportActionMenu'>";
|
||||
@@ -151,9 +153,10 @@ class programplan extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
|
||||
}
|
||||
|
||||
$productList = array();
|
||||
$this->app->loadLang('stage');
|
||||
$project = $this->loadModel('project')->getById($projectID);
|
||||
$productList = $this->loadModel('product')->getProductPairsByProject($projectID);
|
||||
if($this->session->hasProduct) $productList = $this->loadModel('product')->getProductPairsByProject($projectID);
|
||||
|
||||
$this->view->title = $this->lang->programplan->create . $this->lang->colon . $project->name;
|
||||
$this->view->position[] = html::a($this->createLink('programplan', 'browse', "projectID=$projectID"), $project->name);
|
||||
|
||||
@@ -702,7 +702,8 @@ class programplanModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
$setCode = (!isset($this->config->setCode) or $this->config->setCode == 1) ? true : false;
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
$setCode = (!isset($this->config->setCode) or $this->config->setCode == 1) ? true : false;
|
||||
$checkCode = $this->checkCodeUnique($codes, isset($planIDList) ? $planIDList : '');
|
||||
if($setCode and $checkCode !== true)
|
||||
{
|
||||
@@ -717,27 +718,27 @@ class programplanModel extends model
|
||||
if(empty($name)) continue;
|
||||
|
||||
$plan = new stdclass();
|
||||
$plan->id = isset($planIDList[$key]) ? $planIDList[$key] : '';
|
||||
$plan->type = 'stage';
|
||||
$plan->project = $projectID;
|
||||
$plan->parent = $parentID ? $parentID : $projectID;
|
||||
$plan->name = $names[$key];
|
||||
$plan->id = isset($planIDList[$key]) ? $planIDList[$key] : '';
|
||||
$plan->type = 'stage';
|
||||
$plan->project = $projectID;
|
||||
$plan->parent = $parentID ? $parentID : $projectID;
|
||||
$plan->name = $names[$key];
|
||||
if($setCode) $plan->code = $codes[$key];
|
||||
$plan->percent = $percents[$key];
|
||||
$plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute;
|
||||
$plan->milestone = $milestone[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key];
|
||||
$plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key];
|
||||
$plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key];
|
||||
$plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]);
|
||||
$plan->acl = empty($parentID) ? $acl[$key] : $parentACL;
|
||||
$plan->PM = empty($PM[$key]) ? '' : $PM[$key];
|
||||
$plan->percent = $percents[$key];
|
||||
$plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute;
|
||||
$plan->milestone = $milestone[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key];
|
||||
$plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key];
|
||||
$plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key];
|
||||
$plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]);
|
||||
$plan->acl = empty($parentID) ? $acl[$key] : $parentACL;
|
||||
$plan->PM = empty($PM[$key]) ? '' : $PM[$key];
|
||||
$plan->hasProduct = $project->hasProduct;
|
||||
|
||||
$datas[] = $plan;
|
||||
}
|
||||
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
|
||||
$totalPercent = 0;
|
||||
$totalDevType = 0;
|
||||
@@ -957,7 +958,14 @@ class programplanModel extends model
|
||||
$spec->end = $data->end;
|
||||
$this->dao->insert(TABLE_PROJECTSPEC)->data($spec)->exec();
|
||||
|
||||
$this->action->create('execution', $stageID, 'opened', '', join(',', $_POST['products']));
|
||||
if($project->hasProduct)
|
||||
{
|
||||
$this->action->create('execution', $stageID, 'opened', '', join(',', $_POST['products']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->action->create('execution', $stageID, 'opened');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1078,8 +1086,8 @@ class programplanModel extends model
|
||||
->batchCheck($this->config->programplan->edit->requiredFields, 'notempty')
|
||||
->checkIF($plan->end != '0000-00-00', 'end', 'ge', $plan->begin)
|
||||
->checkIF($plan->percent != false, 'percent', 'float')
|
||||
->checkIF((!empty($plan->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != {$planID} and type in ('sprint','stage') and `project` = {$oldPlan->project} and `deleted` = '0'" . ($parentStage ? " and `parent` = {$oldPlan->parent}" : ''))
|
||||
->checkIF(!empty($plan->code), 'code', 'unique', "id != $planID and type in ('sprint','stage','kanban') and `deleted` = '0'")
|
||||
->checkIF(!empty($plan->name), 'name', 'unique', "id != {$planID} and type in ('sprint','stage') and `project` = {$oldPlan->project} and `deleted` = '0'" . ($parentStage ? " and `parent` = {$oldPlan->parent}" : ''))
|
||||
->checkIF(!empty($plan->code) and $setCode, 'code', 'unique', "id != $planID and type in ('sprint','stage','kanban') and `deleted` = '0'")
|
||||
->where('id')->eq($planID)
|
||||
->exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user