From ba2aafaf6f7495a457a94e7e9f162cb05d1d273c Mon Sep 17 00:00:00 2001 From: GregM Date: Wed, 14 Sep 2022 14:29:50 +0200 Subject: [PATCH 1/4] Update ActionComm type_code on email message ticket --- htdocs/ticket/class/ticket.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index df581d96fdc..1d7360b44a7 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1732,6 +1732,7 @@ class Ticket extends CommonObject $error = 0; $now = dol_now(); + $send_email = GETPOST('send_email','int'); // Clean parameters if (isset($this->fk_track_id)) { @@ -1752,6 +1753,9 @@ class Ticket extends CommonObject if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } + if ($send_email > 0){ + $actioncomm->type_code = 'AC_EMAIL'; + } $actioncomm->socid = $this->socid; $actioncomm->label = $this->subject; $actioncomm->note_private = $this->message; From b7db0af78b5b707b0fe478c5baf8259a061af72c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 14 Sep 2022 12:48:21 +0000 Subject: [PATCH 2/4] Fixing style errors. --- htdocs/ticket/class/ticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 1d7360b44a7..2ee10b855a8 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1732,7 +1732,7 @@ class Ticket extends CommonObject $error = 0; $now = dol_now(); - $send_email = GETPOST('send_email','int'); + $send_email = GETPOST('send_email', 'int'); // Clean parameters if (isset($this->fk_track_id)) { @@ -1753,7 +1753,7 @@ class Ticket extends CommonObject if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } - if ($send_email > 0){ + if ($send_email > 0) { $actioncomm->type_code = 'AC_EMAIL'; } $actioncomm->socid = $this->socid; From 16ee0a5c966dc6be89bf9b29b7f615e6e67d7c2b Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 15 Sep 2022 09:56:50 +0200 Subject: [PATCH 3/4] Update function createTicketMessage --- htdocs/ticket/class/ticket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 1d7360b44a7..f7cd47ead07 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1724,15 +1724,15 @@ class Ticket extends CommonObject * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message + * @param boolean $send_email Whether the message is sent by email * @return int <0 if KO, >0 if OK */ - public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) + public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = FALSE) { global $conf, $langs; $error = 0; $now = dol_now(); - $send_email = GETPOST('send_email','int'); // Clean parameters if (isset($this->fk_track_id)) { @@ -1753,7 +1753,7 @@ class Ticket extends CommonObject if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } - if ($send_email > 0){ + if ($send_email){ $actioncomm->type_code = 'AC_EMAIL'; } $actioncomm->socid = $this->socid; @@ -2540,7 +2540,7 @@ class Ticket extends CommonObject $listofnames = $resarray['listofnames']; $listofmimes = $resarray['listofmimes']; - $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames); + $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email); if ($id <= 0) { $error++; $this->error = $object->error; From d4e57f34d948e41dd868f6f4d51da16f29d447ba Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 15 Sep 2022 08:05:40 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/ticket/class/ticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f7cd47ead07..4994faf5230 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1727,7 +1727,7 @@ class Ticket extends CommonObject * @param boolean $send_email Whether the message is sent by email * @return int <0 if KO, >0 if OK */ - public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = FALSE) + public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = false) { global $conf, $langs; $error = 0; @@ -1753,7 +1753,7 @@ class Ticket extends CommonObject if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } - if ($send_email){ + if ($send_email) { $actioncomm->type_code = 'AC_EMAIL'; } $actioncomm->socid = $this->socid;