This commit is contained in:
liumengyi
2023-02-17 07:50:45 +00:00
parent 1e13b25094
commit b1f57ce0da
+6 -6
View File
@@ -749,7 +749,7 @@ class programplanModel extends model
foreach($datas as $index => $plan)
{
if(!empty($sameNames) and in_array($plan->name, $sameNames)) dao::$errors[$index]['name'] = empty($type) ? $this->lang->programplan->error->sameName : str_replace($this->lang->execution->stage, '', $this->lang->programplan->error->sameName);
if($setCode and $sameCodes !== true and !empty($sameCodes) and in_array($plan->code, $sameCodes)) dao::$errors[$index]['code'] = sprintf($this->lang->error->repeat, $this->lang->execution->code, $plan->code);
if($setCode and $sameCodes !== true and !empty($sameCodes) and in_array($plan->code, $sameCodes)) dao::$errors[$index]['code'] = sprintf($this->lang->error->repeat, $plan->type == 'stage' ? $this->lang->execution->code : $this->lang->code, $plan->code);
if($plan->percent and !preg_match("/^[0-9]+(.[0-9]{1,3})?$/", $plan->percent))
{
@@ -778,7 +778,7 @@ class programplanModel extends model
if(isset($parentStage) and ($plan->end > $parentStage->end || $plan->begin < $parentStage->begin))
{
if($plan->begin < $parentStage->begin and empty(dao::$errors[$index]['begin'])) dao::$errors[$index]['begin'] = $this->lang->programplan->error->parentDuration;
if($plan->end < $parentStage->end and empty(dao::$errors[$index]['end'])) dao::$errors[$index]['end'] = $this->lang->programplan->error->parentDuration;
if($plan->end > $parentStage->end and empty(dao::$errors[$index]['end'])) dao::$errors[$index]['end'] = $this->lang->programplan->error->parentDuration;
}
if($plan->begin < $project->begin and empty(dao::$errors[$index]['begin']))
{
@@ -793,7 +793,7 @@ class programplanModel extends model
if(helper::isZeroDate($plan->end)) $plan->end = '';
if($setCode and empty($plan->code))
{
dao::$errors[$index]['code'] = sprintf($this->lang->error->notempty, $this->lang->execution->code);
dao::$errors[$index]['code'] = sprintf($this->lang->error->notempty, $plan->type == 'stage' ? $this->lang->execution->code : $this->lang->code);
}
foreach(explode(',', $this->config->programplan->create->requiredFields) as $field)
{
@@ -1346,15 +1346,15 @@ class programplanModel extends model
public function checkCodeUnique($codes, $planIDList)
{
$codes = array_filter($codes);
if(count(array_unique($codes)) != count($codes)) return false;
$code = $this->dao->select('code')->from(TABLE_EXECUTION)
$sameCodes = $this->dao->select('code')->from(TABLE_EXECUTION)
->where('type')->in('sprint,stage,kanban')
->andWhere('deleted')->eq('0')
->andWhere('code')->in($codes)
->beginIF($planIDList)->andWhere('id')->notin($planIDList)->fi()
->fetchPairs('code');
return $code ? $code : true;
if(count(array_unique($codes)) != count($codes)) $sameCodes += array_diff_assoc($codes, array_unique($codes));
return $sameCodes ? $sameCodes : true;
}
/**