* Finish task #8497.
This commit is contained in:
@@ -228,6 +228,51 @@ class projectrelease extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a release.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $confirm yes|no
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function delete($releaseID, $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->release->confirmDelete, $this->createLink('projectrelease', 'delete', "releaseID=$releaseID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->release->delete(TABLE_RELEASE, $releaseID);
|
||||
|
||||
$release = $this->dao->select('*')->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch();
|
||||
$build = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq((int)$release->build)->fetch();
|
||||
if(empty($build->project)) $this->loadModel('build')->delete(TABLE_BUILD, $build->id);
|
||||
|
||||
$this->executeHooks($releaseID);
|
||||
|
||||
/* if ajax request, send result. */
|
||||
if($this->server->ajax)
|
||||
{
|
||||
if(dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
$release = $this->release->getById($releaseID);
|
||||
$this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq($release->build)->andWhere('name')->eq($release->name)->exec();
|
||||
}
|
||||
$this->send($response);
|
||||
}
|
||||
die(js::locate($this->session->releaseList, 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the stories of release to HTML.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user