* Adjust code.
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user