diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 105e70e18bc..7788c72ea59 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1716,7 +1716,7 @@ if ($id > 0) {
if ($backtopage) {
print '';
}
- if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->code != "TICKET_MSG_PRIVATE") {
+ if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
print '';
}
@@ -1742,7 +1742,9 @@ if ($id > 0) {
}
// Private
- if ($object->elementtype == 'ticket') print '
| '.$langs->trans("PrivateEventMessage").' | code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'> |
';
+ if ($object->elementtype == 'ticket') {
+ print '| '.$langs->trans("PrivateEventMessage").' | code) ? ' checked' : '').'> |
';
+ }
// Title
print '| global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").' | |
';
@@ -2214,7 +2216,7 @@ if ($id > 0) {
// Private
if ($object->elementtype == 'ticket') {
- print '| '.$langs->trans("PrivateEventMessage").' | '.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).' |
';
+ print '| '.$langs->trans("PrivateEventMessage").' | '.yn(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? 1 : 0, 3).' |
';
}
// Full day event
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index d3d90067bf3..b3be88d6b8f 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1763,11 +1763,11 @@ class ActionComm extends CommonObject
$imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type_code == 'AC_FAX') {
$imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright');
- } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') {
+ } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || preg_match('/_SENTBYMAIL/', $this->code)) {
$imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type_code == 'AC_INT') {
$imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright');
- } elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') {
+ } elseif (preg_match('/^TICKET_MSG/', $this->code)) {
$imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type != 'systemauto') {
$imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright');
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 27c4988ffd8..d9c96180822 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -974,7 +974,7 @@ while ($i < $imaxinloop) {
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
$labeltype = 'AC_OTH';
}
- if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
+ if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) {
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index ed9b8d3094a..63e705aa1f7 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -303,7 +303,7 @@ class FormActions
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
$labeltype = 'AC_OTH';
}
- if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
+ if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) {
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 3d0cb72e7c9..5274d196dc1 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1896,7 +1896,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
$labeltype = 'AC_OTH';
}
- if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
+ if (preg_mach('/^TICKET_MSG/', $actionstatic->code)) {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index b5450f7317f..eb22b2b5153 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -11450,9 +11450,9 @@ function getTimelineIcon($actionstatic, &$histo, $key)
$iconClass = 'fa fa-ticket';
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
$iconClass = 'fa fa-pencilxxx';
- } elseif ($actionstatic->code == 'TICKET_MSG') {
+ } elseif (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$iconClass = 'fa fa-comments';
- } elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
+ } elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
$iconClass = 'fa fa-mask';
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($actionstatic->type_picto) {
@@ -11997,9 +11997,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
// Title
$out .= ' ';
- if ($actionstatic->code == 'TICKET_MSG') {
+ if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage');
- } elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
+ } elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage').' ('.$langs->trans('Private').')';
} else {
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 440950628d1..2aacffefcd1 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1612,13 +1612,13 @@ class Ticket extends CommonObject
// Insert entry into agenda with code 'TICKET_MSG'
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
- $actioncomm->type_code = 'AC_OTH';
+ $actioncomm->type_code = 'AC_OTH_AUTO'; // This is not an entry that must appears into manual calendar but only into CRM calendar
$actioncomm->code = 'TICKET_MSG';
if ($this->private) {
$actioncomm->code = 'TICKET_MSG_PRIVATE';
}
if ($send_email) {
- $actioncomm->type_code = 'AC_EMAIL';
+ $actioncomm->code .= '_SENTBYMAIL';
}
$actioncomm->socid = $this->socid;
$actioncomm->label = $this->subject;
@@ -1691,7 +1691,7 @@ class Ticket extends CommonObject
$this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
$this->cache_msgs_ticket[$i]['subject'] = $obj->label;
$this->cache_msgs_ticket[$i]['message'] = $obj->message;
- $this->cache_msgs_ticket[$i]['private'] = ($obj->code == 'TICKET_MSG_PRIVATE' ? 1 : 0);
+ $this->cache_msgs_ticket[$i]['private'] = (preg_match('/^TICKET_MSG_PRIVATE/', $obj->code) ? 1 : 0);
$i++;
}
return $num;