NEW Assign contact to a ticket message (#24735)
* NEW Assign contact to a ticket message * FIX conflict --------- Co-authored-by: Benjamin Falière <benjamin.faliere@altairis.fr> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
005bab38c3
commit
b220e1acbd
1 changed files with 18 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2019-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -1713,9 +1714,10 @@ class Ticket extends CommonObject
|
|||
* @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
|
||||
* @param boolean $public_area 1=Is the public area
|
||||
* @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, $public_area = false)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
|
@ -1758,6 +1760,20 @@ class Ticket extends CommonObject
|
|||
$actioncomm->fk_element = $this->id;
|
||||
$actioncomm->fk_project = $this->fk_project;
|
||||
|
||||
// add contact id from author email on public interface
|
||||
if ($public_area && !empty($this->origin_email) && !empty($conf->global->TICKET_ASSIGN_CONTACT_TO_MESSAGE)) {
|
||||
$contacts = $this->searchContactByEmail($this->origin_email);
|
||||
if (!empty($contacts)) {
|
||||
// Ensure that contact is active and select first active contact
|
||||
foreach ($contacts as $contact) {
|
||||
if ((int) $contact->statut == 1) {
|
||||
$actioncomm->contact_id = $contact->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$attachedfiles = array();
|
||||
$attachedfiles['paths'] = $filename_list;
|
||||
$attachedfiles['names'] = $mimefilename_list;
|
||||
|
|
@ -2560,7 +2576,7 @@ class Ticket extends CommonObject
|
|||
$listofnames = $resarray['listofnames'];
|
||||
$listofmimes = $resarray['listofmimes'];
|
||||
|
||||
$id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email);
|
||||
$id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email, $public_area);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
|
|
|
|||
Loading…
Reference in a new issue