* Adjust code.

This commit is contained in:
leiyong
2020-12-21 10:39:49 +08:00
parent a549ab0b46
commit 4458e57c9d
2 changed files with 12 additions and 25 deletions
+12 -2
View File
@@ -103,8 +103,18 @@ class holiday extends control
}
else
{
$result = $this->holiday->delete($id);
if(!$result) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$holidayInformation = $this->dao->select('begin, end')->from(TABLE_HOLIDAY)->where('id')->eq($id)->fetch();
$this->dao->delete()->from(TABLE_HOLIDAY)->where('id')->eq($id)->exec();
/* Update project. */
$this->holiday->updateProjectPlanDuration($holidayInformation->begin, $holidayInformation->end);
$this->holiday->updateProjectRealDuration($holidayInformation->begin, $holidayInformation->end);
/* Update task. */
$this->holiday->updateTaskPlanDuration($holidayInformation->begin, $holidayInformation->end);
$this->holiday->updateTaskRealDuration($holidayInformation->begin, $holidayInformation->end);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
die(js::reload('parent'));
}
}
-23
View File
@@ -128,29 +128,6 @@ class holidayModel extends model
return !dao::isError();
}
/**
* Delete a holiday.
*
* @param int $id
* @access public
* @return bool
*/
public function delete($id, $null = null)
{
$holidayInformation = $this->dao->select('begin, end')->from(TABLE_HOLIDAY)->where('id')->eq($id)->fetch();
$this->dao->delete()->from(TABLE_HOLIDAY)->where('id')->eq($id)->exec();
/* Update project. */
$this->updateProjectPlanDuration($holidayInformation->begin, $holidayInformation->end);
$this->updateProjectRealDuration($holidayInformation->begin, $holidayInformation->end);
/* Update task. */
$this->updateTaskPlanDuration($holidayInformation->begin, $holidayInformation->end);
$this->updateTaskRealDuration($holidayInformation->begin, $holidayInformation->end);
return !dao::isError();
}
/**
* Get holidays by begin and end.
*