* Refactor projectrelease::notify.

This commit is contained in:
liumengyi
2023-06-20 15:24:35 +08:00
parent 6468c6a978
commit b7e87d16c7
2 changed files with 17 additions and 32 deletions
+1 -30
View File
@@ -254,36 +254,7 @@ class projectrelease extends control
*/
public function notify($releaseID)
{
if($_POST)
{
if(isset($_POST['notify']))
{
$notify = implode(',', $this->post->notify);
$this->dao->update(TABLE_RELEASE)->set('notify')->eq($notify)->where('id')->eq($releaseID)->exec();
$this->release->sendmail($releaseID);
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$release = $this->release->getByID($releaseID);
$project = $this->loadModel('project')->getByID($this->session->project);
if(!$project->hasProduct)
{
unset($this->lang->release->notifyList['FB']);
unset($this->lang->release->notifyList['PO']);
unset($this->lang->release->notifyList['QD']);
}
if(!$project->multiple) unset($this->lang->release->notifyList['ET']);
$this->view->release = $release;
$this->view->actions = $this->loadModel('action')->getList('release', $releaseID);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->notifyList = $this->lang->release->notifyList;
$this->display();
echo $this->fetch('release', 'notify', "releaseID={$releaseID}&projectID={$this->session->project}");
}
/**
+16 -2
View File
@@ -281,7 +281,7 @@ class release extends control
* @access public
* @return void
*/
public function notify($releaseID)
public function notify(int $releaseID, int $projectID = 0)
{
if($_POST)
{
@@ -294,7 +294,21 @@ class release extends control
$this->loadModel('action')->create('release', $releaseID, 'notified');
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
}
if($this->app->tab == 'project' && $projectID != 0)
{
$project = $this->loadModel('project')->getByID($this->session->project);
if(!$project->hasProduct)
{
unset($this->lang->release->notifyList['FB']);
unset($this->lang->release->notifyList['PO']);
unset($this->lang->release->notifyList['QD']);
}
if(!$project->multiple) unset($this->lang->release->notifyList['ET']);
}
$this->view->release = $this->release->getById($releaseID);