NEW show messages on ticket card
This commit is contained in:
parent
4c04ace9d8
commit
ad489ab1b4
@ -55,6 +55,17 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
|
|
||||||
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
|
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
|
||||||
|
|
||||||
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
|
|
||||||
|
if (GETPOST('actioncode', 'array')) {
|
||||||
|
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||||
|
if (!count($actioncode)) $actioncode = '0';
|
||||||
|
} else {
|
||||||
|
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||||
|
}
|
||||||
|
$search_agenda_label = GETPOST('search_agenda_label');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of ticket. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of ticket. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('ticketcard', 'globalcard'));
|
$hookmanager->initHooks(array('ticketcard', 'globalcard'));
|
||||||
|
|
||||||
@ -116,10 +127,16 @@ $parameters = array();
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if ($cancel)
|
if (empty($reshook)) {
|
||||||
{
|
// Purge search criteria
|
||||||
if (!empty($backtopage))
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers{
|
||||||
{
|
{
|
||||||
|
$actioncode = '';
|
||||||
|
$search_agenda_label = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cancel) {
|
||||||
|
if (!empty($backtopage)) {
|
||||||
header("Location: " . $backtopage);
|
header("Location: " . $backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -164,8 +181,7 @@ if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
// Add contact
|
// Add contact
|
||||||
$contactid = GETPOST('contactid', 'int');
|
$contactid = GETPOST('contactid', 'int');
|
||||||
$type_contact = GETPOST("type", 'alpha');
|
$type_contact = GETPOST("type", 'alpha');
|
||||||
@ -202,8 +218,7 @@ if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto create fiche intervention
|
// Auto create fiche intervention
|
||||||
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)
|
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) {
|
||||||
{
|
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$fichinter->socid = $object->fk_soc;
|
$fichinter->socid = $object->fk_soc;
|
||||||
$fichinter->fk_project = GETPOST('projectid', 'int');
|
$fichinter->fk_project = GETPOST('projectid', 'int');
|
||||||
@ -225,14 +240,12 @@ if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
// File transfer
|
// File transfer
|
||||||
$object->copyFilesForTicket();
|
$object->copyFilesForTicket();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
@ -306,8 +319,7 @@ if (GETPOST('update', 'alpha') && GETPOST('id', 'int') && $user->rights->ticket-
|
|||||||
if ($action == "mark_ticket_read" && $user->rights->ticket->write) {
|
if ($action == "mark_ticket_read" && $user->rights->ticket->write) {
|
||||||
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
||||||
|
|
||||||
if ($object->markAsRead($user) > 0)
|
if ($object->markAsRead($user) > 0) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
|
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
|
||||||
|
|
||||||
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
||||||
@ -330,8 +342,7 @@ if ($action == "assign_user" && GETPOST('btn_assign_user', 'alpha') && $user->ri
|
|||||||
$action = 'view';
|
$action = 'view';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$ret = $object->assignUser($user, $usertoassign);
|
$ret = $object->assignUser($user, $usertoassign);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
}
|
}
|
||||||
@ -355,8 +366,7 @@ if ($action == "assign_user" && GETPOST('btn_assign_user', 'alpha') && $user->ri
|
|||||||
if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
|
if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
// Log action in ticket logs table
|
// Log action in ticket logs table
|
||||||
$object->fetch_user($usertoassign);
|
$object->fetch_user($usertoassign);
|
||||||
$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
|
$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
|
||||||
@ -389,8 +399,7 @@ if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $user->rights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write)
|
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) {
|
||||||
{
|
|
||||||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||||
|
|
||||||
if ($object->close($user)) {
|
if ($object->close($user)) {
|
||||||
@ -546,28 +555,23 @@ elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action to update one extrafield
|
// Action to update one extrafield
|
||||||
if ($action == "update_extras" && !empty($permissiontoadd))
|
if ($action == "update_extras" && !empty($permissiontoadd)) {
|
||||||
{
|
|
||||||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||||
$attributekey = GETPOST('attribute', 'alpha');
|
$attributekey = GETPOST('attribute', 'alpha');
|
||||||
$attributekeylong = 'options_' . $attributekey;
|
$attributekeylong = 'options_' . $attributekey;
|
||||||
$object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha');
|
$object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha');
|
||||||
|
|
||||||
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
||||||
if ($result > 0)
|
if ($result > 0) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
$action = 'view';
|
$action = 'view';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $user->rights->ticket->write)
|
if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $user->rights->ticket->write) {
|
||||||
{
|
|
||||||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||||
|
|
||||||
$object->type_code = GETPOST('update_value_type', 'aZ09');
|
$object->type_code = GETPOST('update_value_type', 'aZ09');
|
||||||
@ -601,7 +605,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
|||||||
|
|
||||||
// Set $action to correct value for the case we used presend action to add a message
|
// Set $action to correct value for the case we used presend action to add a message
|
||||||
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -1213,30 +1217,8 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
|||||||
// Set $action to correct value for the case we used presend action to add a message
|
// Set $action to correct value for the case we used presend action to add a message
|
||||||
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
||||||
|
|
||||||
if ($action != 'presend' && $action != 'presend_addmessage')
|
// add a message
|
||||||
{
|
if ($action == 'presend' || $action == 'presend_addmessage') {
|
||||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
|
||||||
print '<a name="builddoc"></a>'; // ancre
|
|
||||||
|
|
||||||
// Show links to link elements
|
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('ticket'));
|
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
|
||||||
|
|
||||||
// Show direct link to public interface
|
|
||||||
print '<br><!-- Link to public interface -->'."\n";
|
|
||||||
print showDirectPublicLink($object).'<br>';
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
|
||||||
|
|
||||||
// List of actions on element
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
|
||||||
$formactions = new FormActions($db);
|
|
||||||
$somethingshown = $formactions->showactions($object, 'ticket', $socid, 1);
|
|
||||||
|
|
||||||
print '</div></div></div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$action = 'add_message'; // action to use to post the message
|
$action = 'add_message'; // action to use to post the message
|
||||||
$modelmail = 'ticket_send';
|
$modelmail = 'ticket_send';
|
||||||
|
|
||||||
@ -1310,6 +1292,63 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
|||||||
$formticket->showMessageForm('100%');
|
$formticket->showMessageForm('100%');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show messages on card
|
||||||
|
if (empty($conf->global->TICKET_HIDE_MESSAGES_ON_CARD)) {
|
||||||
|
$param = '&id='.$object->id;
|
||||||
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||||
|
if ($actioncode) $param .= '&actioncode='.urlencode($actioncode);
|
||||||
|
if ($search_agenda_label) $param .= '&search_agenda_label='.urlencode($search_agenda_label);
|
||||||
|
|
||||||
|
$morehtmlright = '';
|
||||||
|
|
||||||
|
$messagingUrl = DOL_URL_ROOT . '/ticket/agenda.php?track_id=' . $object->track_id;
|
||||||
|
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fal fa-list-alt imgforviewmode', $messagingUrl, '', 1);
|
||||||
|
|
||||||
|
// Show link to add a message (if read and not closed)
|
||||||
|
$btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message";
|
||||||
|
$url = 'card.php?track_id=' . $object->track_id . '&action=presend_addmessage&mode=init';
|
||||||
|
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fal fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
|
||||||
|
|
||||||
|
// Show link to add event (if read and not closed)
|
||||||
|
$btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message";;
|
||||||
|
$url = dol_buildpath('/comm/action/card.php', 1) . '?action=create&datep=' . date('YmdHi') . '&origin=ticket&originid=' . $object->id . '&projectid=' . $object->fk_project . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?track_id=' . $object->track_id);
|
||||||
|
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fal fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
|
||||||
|
|
||||||
|
// List of all actions
|
||||||
|
$filters = array();
|
||||||
|
$filters['search_agenda_label'] = $search_agenda_label;
|
||||||
|
show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'presend' && $action != 'presend_addmessage') {
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
|
|
||||||
|
// Show links to link elements
|
||||||
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('ticket'));
|
||||||
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
// Show direct link to public interface
|
||||||
|
print '<br><!-- Link to public interface -->'."\n";
|
||||||
|
print showDirectPublicLink($object).'<br>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
if (!empty($conf->global->TICKET_HIDE_MESSAGES_ON_CARD)) {
|
||||||
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
// List of actions on element
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
|
$formactions = new FormActions($db);
|
||||||
|
$somethingshown = $formactions->showactions($object, 'ticket', $socid, 1);
|
||||||
|
|
||||||
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user