From ff541af7bdc83c589d42b891089459ba38cd266b Mon Sep 17 00:00:00 2001 From: seto Date: Thu, 19 Dec 2024 14:32:09 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#4036=20=E3=80=90=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=80=91=E9=80=81=E4=BF=A1=E6=83=85=E5=A0=B1=E3=82=92?= =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E3=83=99=E3=83=BC=E3=82=B9=E3=81=AB?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=81=97=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AB=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E6=B7=BB?= =?UTF-8?q?=E4=BB=98=E3=81=99=E3=82=8B=E3=81=A8=E9=80=81=E4=BF=A1=E3=81=AB?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Plugin/Mail/Controller/MailController.php | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/lib/Baser/Plugin/Mail/Controller/MailController.php b/lib/Baser/Plugin/Mail/Controller/MailController.php index 0c2dabe0b1..1c1f91795c 100755 --- a/lib/Baser/Plugin/Mail/Controller/MailController.php +++ b/lib/Baser/Plugin/Mail/Controller/MailController.php @@ -367,13 +367,7 @@ public function submit($id = null) // データの入力チェックを行う if ($this->MailMessage->validates()) { - // 送信データを保存するか確認 - if ($this->dbDatas['mailContent']['MailContent']['save_info']) { - // validation OK - $result = $this->MailMessage->save(null, false); - } else { - $result = $this->MailMessage->data; - } + $result = $this->MailMessage->save(null, false); if ($result) { @@ -409,22 +403,7 @@ public function submit($id = null) // メール送信 if ($this->_sendEmail($sendEmailOptions)) { if (!$this->dbDatas['mailContent']['MailContent']['save_info']) { - $fileRecords = []; - foreach($this->dbDatas['mailFields'] as $key => $field) { - if ($field['MailField']['type'] !== 'file') { - continue; - } - // 削除フラグをセット - $field_name = $field['MailField']['field_name']; - $fileRecords['MailMessage'] = [ - $field_name => $this->request->data['MailMessage'][$field_name], - $field_name . '_delete' => true, - ]; - // BcUploadBehavior::deleteFiles() はデータベースのデータを削除する前提となっているため、 - // Model->data['MailMessage']['field_name'] に、配列ではなく、文字列がセットされている状態を想定しているので状態を模倣する - $this->MailMessage->data['MailMessage'][$field_name] = $this->request->data['MailMessage'][$field_name]; - } - $this->MailMessage->deleteFiles($fileRecords); + $this->MailMessage->delete($result['MailMessage']['id']); } $this->Session->delete('Mail.valid'); @@ -434,6 +413,10 @@ public function submit($id = null) 'data' => $this->request->data ]); } else { + if (!$this->dbDatas['mailContent']['MailContent']['save_info']) { + $this->MailMessage->delete($result['MailMessage']['id']); + } + $this->BcMessage->setError( __('エラー : 送信中にエラーが発生しました。しばらくたってから再度送信お願いします。') );