Merge pull request #22272 from atm-GregM/NEW_update_typecode_email_ticket_message

NEW Update ActionComm type_code on email message ticket
This commit is contained in:
Laurent Destailleur 2022-09-20 00:51:35 +02:00 committed by GitHub
commit 5b520c7802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1724,9 +1724,10 @@ 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;
@ -1752,6 +1753,9 @@ class Ticket extends CommonObject
if ($this->private) {
$actioncomm->code = 'TICKET_MSG_PRIVATE';
}
if ($send_email) {
$actioncomm->type_code = 'AC_EMAIL';
}
$actioncomm->socid = $this->socid;
$actioncomm->label = $this->subject;
$actioncomm->note_private = $this->message;
@ -2536,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;