From b7e87d16c7aeeb3cadf0265b7172819e550910ab Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 20 Jun 2023 15:24:35 +0800 Subject: [PATCH] * Refactor projectrelease::notify. --- module/projectrelease/control.php | 31 +------------------------------ module/release/control.php | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 42e890f8b0..99d105b93f 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -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}"); } /** diff --git a/module/release/control.php b/module/release/control.php index 44fd8f4109..48e1a121d0 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -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);