28require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/ticket.lib.php';
39require_once DOL_DOCUMENT_ROOT.
"/core/lib/company.lib.php";
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
45 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
46 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
50$langs->loadLangs(array(
'companies',
'other',
'ticket'));
55$track_id =
GETPOST(
'track_id',
'alpha', 3);
57$action =
GETPOST(
'action',
'aZ09');
60$url_page_current = DOL_URL_ROOT.
'/ticket/messaging.php';
63$sortfield =
GETPOST(
"sortfield",
"aZ09comma");
64$sortorder =
GETPOST(
"sortorder",
'aZ09comma');
66$page = is_numeric($page) ? $page : 0;
67$page = $page == -1 ? 0 : $page;
69 $sortfield =
"a.datep,a.id";
74$offset = $limit * $page;
79 $actioncode =
GETPOST(
'actioncode',
'array:alpha', 3);
80 if (!count($actioncode)) {
83 $actioncode = implode(
',', $actioncode);
89$search_rowid =
GETPOST(
'search_rowid');
90$search_agenda_label =
GETPOST(
'search_agenda_label');
93$hookmanager->initHooks(array(
'ticketmessaging',
'globalcard'));
95$object->fetch($id, $ref, $track_id);
98$extrafields->fetch_name_optionals_label(
$object->table_element);
104$permissiontoadd = $user->hasRight(
'ticket',
'write');
105$permissiontomanage = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'ticket',
'write')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'ticket',
'manage_advance')));
109if ($user->socid > 0) {
110 $socid = $user->socid;
115if ($user->socid > 0 && (
$object->fk_soc != $user->socid)) {
119if (!$user->socid && (
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY') &&
$object->fk_user_assign != $user->id) && !$permissiontomanage) {
128$parameters = array(
'id' => $socid);
129$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
134if (empty($reshook)) {
136 $_SESSION[
'ticket-view-type'] =
"messaging";
140if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
142 $search_agenda_label =
'';
146if ($action ==
'set_thirdparty' && $user->hasRight(
'ticket',
'write')) {
149 $url = $_SERVER[
"PHP_SELF"].
'?track_id='.
GETPOST(
'track_id',
'alpha');
150 header(
"Location: ".$url);
164$title = $langs->trans(
"Ticket").
' - '.
$object->ref.
' '.
$object->name;
166 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
"Info");
168$help_url =
'FR:DocumentationModuleTicket';
169llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-ticket page-card_messaging');
177 dol_banner_tab(
$object->thirdparty,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
183 $object->next_prev_filter =
"te.fk_user_assign:=:".((int) $user->id);
184} elseif ($user->socid > 0) {
185 $object->next_prev_filter =
"te.fk_soc:=:".((int) $user->socid);
189print
dol_get_fiche_head($head,
'tabTicketLogs', $langs->trans(
"Ticket"), 0,
'ticket');
191$morehtmlref =
'<div class="refidno">';
192$morehtmlref .=
$object->subject;
194if (
$object->fk_user_create > 0) {
195 $morehtmlref .=
'<br>';
198 $fuser->fetch(
$object->fk_user_create);
199 $morehtmlref .= $fuser->getNomUrl(-1);
200} elseif (!empty(
$object->email_msgid)) {
201 $morehtmlref .=
'<br>';
203 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
204 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$form->textwithpicto($langs->trans(
"CreatedByEmailCollector"), $langs->trans(
"EmailMsgID").
': '.
$object->email_msgid).
')</small>';
205} elseif (!empty(
$object->origin_email)) {
206 $morehtmlref .=
'<br>';
208 $morehtmlref .=
img_picto(
'',
'email',
'class="paddingrightonly"');
209 $morehtmlref .=
dol_escape_htmltag(
$object->origin_email).
' <small class="hideonsmartphone opacitymedium">('.$langs->trans(
"CreatedByPublicPortal").
')</small>';
215 $morehtmlref .=
'<br>';
216 $morehtmlref .=
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth"');
217 if ($action !=
'editcustomer' && $permissiontoadd) {
218 $morehtmlref .=
'<a class="editfielda" href="'.$url_page_current.
'?action=editcustomer&token='.
newToken().
'&track_id='.
$object->track_id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetThirdParty'), 0).
'</a> ';
220 $morehtmlref .= $form->form_thirdparty($url_page_current.
'?track_id='.
$object->track_id, (
string)
$object->socid, $action ==
'editcustomer' ?
'editcustomer' :
'none',
'', 1, 0, 0, array(), 1);
226 $langs->load(
"projects");
227 $morehtmlref .=
'<br>';
229 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
230 if ($action !=
'classify') {
231 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
233 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
235 if (!empty(
$object->fk_project)) {
237 $proj->fetch(
$object->fk_project);
238 $morehtmlref .= $proj->getNomUrl(1);
240 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
246$morehtmlref .=
'</div>';
248$linkback =
'<a href="'.DOL_URL_ROOT.
'/ticket/list.php"><strong>'.$langs->trans(
"BackToList").
'</strong></a> ';
250dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
258 $param =
'&id='.$object->id;
259 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
260 $param .=
'&contextpage='.$contextpage;
262 if ($limit > 0 && $limit !=
$conf->liste_limit) {
263 $param .=
'&limit='.$limit;
268 $messagingUrl = DOL_URL_ROOT.
'/ticket/messaging.php?track_id='.
$object->track_id;
269 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1, array(
'morecss' =>
'btnTitleSelected'));
270 $messagingUrl = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.
$object->track_id;
271 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'MessageListViewType'),
'',
'fa fa-bars imgforviewmode', $messagingUrl,
'', 1);
274 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
275 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?track_id='.
$object->track_id).
'#formmailbeforetitle';
276 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'SendMail'),
'',
'fa fa-paper-plane', $url,
'email-title-button', (
int) $btnstatus);
279 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
280 $url =
'card.php?track_id='.$object->track_id.
'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?track_id='.
$object->track_id).
'#formmailbeforetitle';
281 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'TicketAddMessage'),
'',
'fa fa-comment-dots', $url,
'add-new-ticket-title-button', (
int) $btnstatus);
284 $btnstatus =
$object->status < Ticket::STATUS_CLOSED && $action !=
"presend" && $action !=
"presend_addmessage";
285 $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);
286 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', $url,
'add-new-ticket-even-button', (
int) $btnstatus);
288 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
289 $cachekey =
'count_events_ticket_'.$object->id;
292 $titlelist = $langs->trans(
"ActionsOnTicket").(is_numeric($nbEvent) ?
'<span class="opacitymedium colorblack paddingleft">('.$nbEvent.
')</span>' :
'');
293 if (!empty(
$conf->dol_optimize_smallscreen)) {
294 $titlelist = $langs->trans(
"Actions").(is_numeric($nbEvent) ?
'<span class="opacitymedium colorblack paddingleft">('.$nbEvent.
')</span>' :
'');
298 $parameters = array(
'morehtmlright' => &$morehtmlright,
'elementtype' =>
$object->element);
299 $reshook = $hookmanager->executeHooks(
'printObjectRightToolbar', $parameters, $object, $action);
303 $morehtmlright .= $hookmanager->resPrint;
306 print_barre_liste($titlelist, 0, $_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 0);
310 $filters[
'search_agenda_label'] = $search_agenda_label;
311 $filters[
'search_rowid'] = $search_rowid;
313 show_actions_messaging(
$conf, $langs,
$db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage Dolibarr users.
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
show_actions_messaging($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions in messaging format.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.
Class to generate the form for creating a new ticket.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
ticket_prepare_head($object)
Build tabs for a Ticket object.