* Finish task #72762.
This commit is contained in:
@@ -1713,7 +1713,11 @@ class projectModel extends model
|
||||
/* When it has multiple errors, only the first one is prompted */
|
||||
if(dao::isError() and count(dao::$errors['realBegan']) > 1) dao::$errors['realBegan'] = dao::$errors['realBegan'][0];
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldProject, $project);
|
||||
if(!dao::isError())
|
||||
{
|
||||
if(!$oldProject->multiple) $this->changeExecutionStatus($projectID, 'start');
|
||||
return common::createChanges($oldProject, $project);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1773,7 +1777,11 @@ class projectModel extends model
|
||||
->where('id')->eq((int)$projectID)
|
||||
->exec();
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldProject, $project);
|
||||
if(!dao::isError())
|
||||
{
|
||||
if(!$oldProject->multiple) $this->changeExecutionStatus($projectID, 'suspend');
|
||||
return common::createChanges($oldProject, $project);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1817,6 +1825,8 @@ class projectModel extends model
|
||||
|
||||
if(dao::isError()) return false;
|
||||
|
||||
if(!$oldProject->multiple) $this->changeExecutionStatus($projectID, 'activate');
|
||||
|
||||
/* Readjust task. */
|
||||
if($this->post->readjustTime and $this->post->readjustTask)
|
||||
{
|
||||
@@ -1909,6 +1919,8 @@ class projectModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$oldProject->multiple) $this->changeExecutionStatus($projectID, 'close');
|
||||
|
||||
/* Close the shadow product of the project. */
|
||||
if(!$oldProject->hasProduct)
|
||||
{
|
||||
@@ -1921,6 +1933,20 @@ class projectModel extends model
|
||||
return common::createChanges($oldProject, $project);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the execution status when changing the status of no execution project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function changeExecutionStatus($projectID, $status)
|
||||
{
|
||||
$executionID = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('multiple')->eq('0')->fetch('id');
|
||||
return $this->loadModel('execution')->$status($executionID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a product's name as its project.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user