From 780c6e3ce19c5aaa3ff841c4fca7586092c12ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2022 21:43:00 +0200 Subject: [PATCH] FIX Debug add event on a ticket --- htdocs/comm/action/card.php | 14 ++++++++------ htdocs/core/lib/ticket.lib.php | 2 +- htdocs/ticket/agenda.php | 2 +- htdocs/ticket/messaging.php | 24 ++++++++++++++---------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 27d3c049c64..53ac5846628 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -90,6 +90,14 @@ if ($fulldayevent) { $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } +$reg = array(); +if (GETPOST('datep')) { + if (GETPOST('datep') == 'now') { + $datep = dol_now(); + } elseif (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { // Try to not use this. Use insteead '&datep=now' + $datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1], 'tzuser'); + } +} // Security check $socid = GETPOST('socid', 'int'); @@ -1070,7 +1078,6 @@ if (empty($reshook)) { } - /* * View */ @@ -1498,11 +1505,6 @@ if ($action == 'create') { } } - $reg = array(); - if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { - $object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]); - } - // Priority if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) { print ''.$langs->trans("Priority").''; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 9223c1c4dd8..42fbc9786cb 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -567,7 +567,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no } } - // Set $out to sow events + // Set $out to show events $out = ''; if (!isModEnabled('agenda')) { diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index ac121045597..d14cff7a474 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -253,7 +253,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 6817268eca8..6e5ee567805 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -173,14 +178,13 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'; - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' '; - }*/ - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + if (isModEnabled("societe")) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; + } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } } @@ -188,7 +192,7 @@ if (isModEnabled("societe")) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; @@ -245,7 +249,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);