2
0
forked from Wavyzz/dolibarr

Debug v17 - Finish move of type of event into actioncomm

This commit is contained in:
Laurent Destailleur
2022-11-25 12:11:51 +01:00
parent 6a28bcaafa
commit 0ccca81f12
7 changed files with 17 additions and 15 deletions

View File

@@ -1716,7 +1716,7 @@ if ($id > 0) {
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
}
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 '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
}
@@ -1742,7 +1742,9 @@ if ($id > 0) {
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(($object->code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'></td></tr>';
if ($object->elementtype == 'ticket') {
print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
}
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
@@ -2214,7 +2216,7 @@ if ($id > 0) {
// Private
if ($object->elementtype == 'ticket') {
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? 1 : 0, 3).'</td></tr>';
}
// Full day event

View File

@@ -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');

View File

@@ -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])) {

View File

@@ -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])) {

View File

@@ -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])) {

View File

@@ -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 .= ' <span class="messaging-title">';
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').' <em>('.$langs->trans('Private').')</em>';
} else {
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {

View File

@@ -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;