* merge from 15.0.beta3.
This commit is contained in:
@@ -293,9 +293,11 @@ class executionModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->config->systemMode == 'new') $this->checkBeginAndEndDate($_POST['project'], $_POST['begin'], $_POST['end']);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
/* Determine whether to add a sprint or a stage according to the model of the execution. */
|
||||
$project = $this->loadModel('project')->getByID($_POST['project']);
|
||||
$type = zget($this->config->execution->modelList, $project->model, 'sprint');
|
||||
$type = zget($this->config->execution->modelList, $project->model, 'sprint');
|
||||
|
||||
$this->config->execution->create->requiredFields .= ',project';
|
||||
}
|
||||
@@ -335,6 +337,14 @@ class executionModel extends model
|
||||
}
|
||||
|
||||
$sprint = $this->loadModel('file')->processImgURL($sprint, $this->config->execution->editor->create['id'], $this->post->uid);
|
||||
|
||||
/* Replace required language. */
|
||||
if($this->app->openApp == 'project')
|
||||
{
|
||||
$this->lang->project->name = $this->lang->execution->name;
|
||||
$this->lang->project->code = $this->lang->execution->code;
|
||||
}
|
||||
|
||||
$this->dao->insert(TABLE_EXECUTION)->data($sprint)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchcheck($this->config->execution->create->requiredFields, 'notempty')
|
||||
@@ -453,6 +463,9 @@ class executionModel extends model
|
||||
->remove('products, branch, uid, plans')
|
||||
->get();
|
||||
|
||||
if($this->config->systemMode == 'new') $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
/* Child stage inherits parent stage permissions. */
|
||||
if(!isset($execution->acl)) $execution->acl = $oldExecution->acl;
|
||||
if($execution->acl == 'open') $execution->whitelist = '';
|
||||
@@ -532,6 +545,23 @@ class executionModel extends model
|
||||
$oldExecutions = $this->getByIdList($this->post->executionIDList);
|
||||
$nameList = array();
|
||||
$codeList = array();
|
||||
|
||||
/* Replace required language. */
|
||||
if($this->app->openApp == 'project')
|
||||
{
|
||||
$projectModel = $this->dao->select('model')->from(TABLE_PROJECT)->where('id')->eq($this->session->project)->fetch('model');
|
||||
if($projectModel == 'scrum')
|
||||
{
|
||||
$this->lang->project->name = $this->lang->execution->name;
|
||||
$this->lang->project->code = $this->lang->execution->code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->lang->project->name = str_replace($this->lang->project->common, $this->lang->project->stage, $this->lang->project->name);
|
||||
$this->lang->project->code = str_replace($this->lang->project->common, $this->lang->project->stage, $this->lang->project->code);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($data->executionIDList as $executionID)
|
||||
{
|
||||
$executionName = $data->names[$executionID];
|
||||
@@ -578,7 +608,7 @@ class executionModel extends model
|
||||
->checkIF($execution->begin != '', 'begin', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'gt', $execution->begin)
|
||||
->check('code', 'unique', "id NOT " . helper::dbIN($data->executionIDList) . " and deleted='0'")
|
||||
->checkIF($execution->code != '', 'code', 'unique', "id NOT " . helper::dbIN($data->executionIDList) . " and deleted='0'")
|
||||
->where('id')->eq($executionID)
|
||||
->limit(1)
|
||||
->exec();
|
||||
@@ -654,6 +684,9 @@ class executionModel extends model
|
||||
->remove('comment')
|
||||
->get();
|
||||
|
||||
if($this->config->systemMode == 'new') $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->dao->update(TABLE_EXECUTION)->data($execution)
|
||||
->autoCheck()
|
||||
->where('id')->eq((int)$executionID)
|
||||
@@ -837,6 +870,22 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check begin and end date.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkBeginAndEndDate($projectID, $begin, $end)
|
||||
{
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
if($begin < $project->begin) dao::$errors['begin'] = sprintf($this->lang->execution->errorBegin, $project->begin);
|
||||
|
||||
if($end > $project->end) dao::$errors['end'] = sprintf($this->lang->execution->errorEnd, $project->end);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get execution switcher.
|
||||
*
|
||||
@@ -857,6 +906,13 @@ class executionModel extends model
|
||||
$currentExecutionName = $currentExecution->name;
|
||||
}
|
||||
|
||||
if($this->app->viewType == 'mhtml' and $executionID)
|
||||
{
|
||||
$output = html::a(helper::createLink('execution', 'index'), $this->lang->executionCommon) . $this->lang->colon;
|
||||
$output .= "<a id='currentItem' href=\"javascript:showSearchMenu('execution', '$executionID', '$currentModule', '$currentMethod', '')\">{$currentExecutionName} <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
$dropMenuLink = helper::createLink('execution', 'ajaxGetDropMenu', "executionID=$executionID&module=$currentModule&method=$currentMethod&extra=");
|
||||
$output = "<div class='btn-group header-btn' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$currentExecutionName}'><span class='text'>{$currentExecutionName}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
@@ -1149,6 +1205,11 @@ class executionModel extends model
|
||||
$module = 'execution';
|
||||
$method = 'testcase';
|
||||
}
|
||||
if($module == 'testtask' and ($method == 'view' || $method == 'create' || $method == 'edit'))
|
||||
{
|
||||
$module = 'execution';
|
||||
$method = 'testtask';
|
||||
}
|
||||
if($module == 'build' and ($method == 'edit' || $method= 'view'))
|
||||
{
|
||||
$module = 'execution';
|
||||
|
||||
Reference in New Issue
Block a user