From 3b55049895d41b7ea43b37877be6ff332d5c9a37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Mar 2018 10:23:25 +0100 Subject: [PATCH] Dolibarrize module ticket --- htdocs/commande/card.php | 22 +- .../modulebuilder/template/myobject_card.php | 24 +- htdocs/ticketsup/card.php | 291 +++++++++--------- .../class/actions_ticketsup.class.php | 120 ++++---- .../ticketsup/class/api_ticketsups.class.php | 4 +- htdocs/ticketsup/class/ticketsup.class.php | 199 ++++++------ htdocs/ticketsup/contact.php | 8 +- htdocs/ticketsup/document.php | 2 +- htdocs/ticketsup/history.php | 4 +- 9 files changed, 363 insertions(+), 311 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 44375df6dc8..c4f1acfb58d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1980,17 +1980,17 @@ if ($action == 'create' && $user->rights->commande->creer) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 2474345edb9..470825a6a61 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -284,22 +284,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->mymodule->creer) + if ($user->rights->mymodule->write) { if ($action != 'classify') - { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (! empty($object->fk_project)) { diff --git a/htdocs/ticketsup/card.php b/htdocs/ticketsup/card.php index 55ebed62c7d..0a8d57e7a7b 100644 --- a/htdocs/ticketsup/card.php +++ b/htdocs/ticketsup/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Christophe Battarel +/* Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +17,8 @@ */ /** - * Card of ticket - * - * @package ticketsup + * Card of ticket + * @ingroup ticketsup */ require '../main.inc.php'; @@ -71,7 +70,7 @@ if (GETPOST('modelselected')) { $url_page_current = DOL_URL_ROOT.'/ticketsup/card.php'; if ($id || $track_id || $ref) { - $res = $object->fetch($id, $track_id, $ref); + $res = $object->fetch($id, $ref, $track_id); } // Security check @@ -99,6 +98,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be inc $userstat = new User($db); $form = new Form($db); $formticket = new FormTicketsup($db); +$formproject = new FormProjets($db); if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { @@ -234,6 +234,40 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' '; $morehtmlref .= $object->origin_email . ' (' . $langs->trans("TicketEmailOriginIssuer") . ')'; } + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->ticketsup->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.=''; $linkback = '' . $langs->trans("BackToList") . ' '; @@ -308,27 +342,6 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti } print ''; - // Project - if (!empty($conf->projet->enabled)) { - $langs->load('projects'); - print ''; - print ''; - if ($action != 'classify' && $user->rights->ticketsup->write) { - print ''; - } - - print '
'; - print $langs->trans('Project'); - print '' . img_edit($langs->trans('SetProject')) . '
'; - print ''; - if ($action == 'classify') { - $form->form_project($url_page_current . '?track_id=' . $object->track_id, $object->socid, $object->fk_project, 'projectid'); - } else { - $form->form_project($url_page_current . '?track_id=' . $object->track_id, $object->socid, $object->fk_project, 'none'); - } - print ''; - } - // User assigned print '' . $langs->trans("UserAssignedTo") . ''; if ($object->fk_user_assign > 0) { @@ -339,17 +352,17 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti } // Show user list to assignate one if status is "read" - if (GETPOST('set') == "assign_ticket" && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) { + if (GETPOST('set','alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) { print '
'; print ''; print ''; print ''; print ' '; - print $form->select_dolusers($user->id, 'fk_user_assign', 0); + print $form->select_dolusers($user->id, 'fk_user_assign', 1); print ' '; print '
'; } - if ($object->fk_statut < 8 && GETPOST('set') != "assign_ticket" && $user->rights->ticketsup->manage) { + if ($object->fk_statut < 8 && GETPOST('set','alpha') != "assign_ticket" && $user->rights->ticketsup->manage) { print '' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . ''; } print ''; @@ -425,13 +438,14 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti print ''; - // View Original message - $actionobject->viewTicketOriginalMessage($user, $action); - - // Fin colonne gauche et début colonne droite print '
'; + + // View Original message + $actionobject->viewTicketOriginalMessage($user, $action, $object); + + /*************************************************** * * Classification and actions on ticket @@ -440,7 +454,8 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti /* * Ticket properties */ - print ''; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; print ''; print ''; // Category print ''; // Severity print ''; } print '
'; print $langs->trans('Properties'); @@ -496,31 +511,32 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti // Type print '
' . $langs->trans("Type") . ''; print $object->type_label; - if ($user->admin && !$noadmininfo) { + /*if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } + }*/ print '
' . $langs->trans("Category") . ''; print $object->category_label; - if ($user->admin && !$noadmininfo) { + /*if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } + }*/ print '
' . $langs->trans("TicketSeverity") . ''; print $object->severity_label; - if ($user->admin && !$noadmininfo) { + /*if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } + }*/ print '
'; // End table actions + print '
'; // Display navbar with links to change ticket status print ''; @@ -529,117 +545,120 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti } - print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); + if (! empty($conf->global->TICKETSUP_SHOW_CONTACT_ON_MAIN_TAB)) + { + print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; - print '
' . $langs->trans("Source") . '
-
' . $langs->trans("Company") . '
-
' . $langs->trans("Contacts") . '
-
' . $langs->trans("ContactType") . '
-
' . $langs->trans("Phone") . '
-
' . $langs->trans("Status") . '
'; - print '
'; + print '
'; + print '
' . $langs->trans("Source") . '
+
' . $langs->trans("Company") . '
+
' . $langs->trans("Contacts") . '
+
' . $langs->trans("ContactType") . '
+
' . $langs->trans("Phone") . '
+
' . $langs->trans("Status") . '
'; + print '
'; - // Contact list - $companystatic = new Societe($db); - $contactstatic = new Contact($db); - $userstatic = new User($db); - foreach (array('internal', 'external') as $source) { - $tmpobject = $object; - $tab = $tmpobject->listeContact(-1, $source); - $num = count($tab); - $i = 0; - while ($i < $num) { - $var = !$var; - print '
'; + // Contact list + $companystatic = new Societe($db); + $contactstatic = new Contact($db); + $userstatic = new User($db); + foreach (array('internal', 'external') as $source) { + $tmpobject = $object; + $tab = $tmpobject->listeContact(-1, $source); + $num = count($tab); + $i = 0; + while ($i < $num) { + $var = !$var; + print '
'; - print '
'; - if ($tab[$i]['source'] == 'internal') { - echo $langs->trans("User"); - } + print '
'; + if ($tab[$i]['source'] == 'internal') { + echo $langs->trans("User"); + } - if ($tab[$i]['source'] == 'external') { - echo $langs->trans("ThirdPartyContact"); - } + if ($tab[$i]['source'] == 'external') { + echo $langs->trans("ThirdPartyContact"); + } - print '
'; - print '
'; + print '
'; + print '
'; - if ($tab[$i]['socid'] > 0) { - $companystatic->fetch($tab[$i]['socid']); - echo $companystatic->getNomUrl(1); - } - if ($tab[$i]['socid'] < 0) { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; - } - if (!$tab[$i]['socid']) { - echo ' '; - } - print '
'; + if ($tab[$i]['socid'] > 0) { + $companystatic->fetch($tab[$i]['socid']); + echo $companystatic->getNomUrl(1); + } + if ($tab[$i]['socid'] < 0) { + echo $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (!$tab[$i]['socid']) { + echo ' '; + } + print '
'; - print '
'; - if ($tab[$i]['source'] == 'internal') { - if ($userstatic->fetch($tab[$i]['id'])) { - print $userstatic->getNomUrl(1); - } - } - if ($tab[$i]['source'] == 'external') { - if ($contactstatic->fetch($tab[$i]['id'])) { - print $contactstatic->getNomUrl(1); - } - } - print '
-
' . $tab[$i]['libelle'] . '
'; + print '
'; + if ($tab[$i]['source'] == 'internal') { + if ($userstatic->fetch($tab[$i]['id'])) { + print $userstatic->getNomUrl(1); + } + } + if ($tab[$i]['source'] == 'external') { + if ($contactstatic->fetch($tab[$i]['id'])) { + print $contactstatic->getNomUrl(1); + } + } + print '
+
' . $tab[$i]['libelle'] . '
'; - print '
'; + print '
'; - print dol_print_phone($tab[$i]['phone'], '', '', '', AC_TEL).'
'; + print dol_print_phone($tab[$i]['phone'], '', '', '', AC_TEL).'
'; - if (! empty($tab[$i]['phone_perso'])) { - //print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' '; - print '
'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', AC_TEL).'
'; - } - if (! empty($tab[$i]['phone_mobile'])) { - //print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' '; - print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', AC_TEL).'
'; - } - print '
'; + if (! empty($tab[$i]['phone_perso'])) { + //print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' '; + print '
'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', AC_TEL).'
'; + } + if (! empty($tab[$i]['phone_mobile'])) { + //print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' '; + print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', AC_TEL).'
'; + } + print '
'; - print '
'; - if ($object->statut >= 0) { - echo ''; - } + print '
'; + if ($object->statut >= 0) { + echo ''; + } - if ($tab[$i]['source'] == 'internal') { - $userstatic->id = $tab[$i]['id']; - $userstatic->lastname = $tab[$i]['lastname']; - $userstatic->firstname = $tab[$i]['firstname']; - echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3); - } - if ($tab[$i]['source'] == 'external') { - $contactstatic->id = $tab[$i]['id']; - $contactstatic->lastname = $tab[$i]['lastname']; - $contactstatic->firstname = $tab[$i]['firstname']; - echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); - } - if ($object->statut >= 0) { - echo ''; - } + if ($tab[$i]['source'] == 'internal') { + $userstatic->id = $tab[$i]['id']; + $userstatic->lastname = $tab[$i]['lastname']; + $userstatic->firstname = $tab[$i]['firstname']; + echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3); + } + if ($tab[$i]['source'] == 'external') { + $contactstatic->id = $tab[$i]['id']; + $contactstatic->lastname = $tab[$i]['lastname']; + $contactstatic->firstname = $tab[$i]['firstname']; + echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); + } + if ($object->statut >= 0) { + echo ''; + } - print '
'; + print '
'; - print '
'; + print '
'; - $i++; - } + $i++; + } + } + + print '
'; + print '
'; } - print '
'; - print '
'; - // Contract if ($action == 'sel_contract') { if (!empty($conf->contrat->enabled)) { @@ -706,8 +725,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti print '
'; if ($action == 'view' || $action == 'edit_message_init') { - print '
' - . '
'; + print '
'; //print '
'; // Message list @@ -716,7 +734,6 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti $actionobject->viewTicketTimelineMessages($show_private_message, true, $object); print '
'; - print '
'; print '
'; } elseif ($action == 'add_message') { diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php index 08c28ad3085..9a978e2e066 100644 --- a/htdocs/ticketsup/class/actions_ticketsup.class.php +++ b/htdocs/ticketsup/class/actions_ticketsup.class.php @@ -92,7 +92,7 @@ class ActionsTicketsup if (GETPOST('addfile')) { // altairis : allow files from public interface if (GETPOST('track_id')) { - $res = $object->fetch('', GETPOST('track_id','alpha')); + $res = $object->fetch('', '', GETPOST('track_id','alpha')); } ////if($res > 0) @@ -116,7 +116,7 @@ class ActionsTicketsup if (GETPOST('removedfile')) { // altairis : allow files from public interface if (GETPOST('track_id')) { - $res = $object->fetch('', GETPOST('track_id')); + $res = $object->fetch('', '', GETPOST('track_id','alpha')); } ////if($res > 0) @@ -309,7 +309,7 @@ class ActionsTicketsup } if ($action == "mark_ticket_read" && $user->rights->ticketsup->write) { - $object->fetch('', GETPOST("track_id")); + $object->fetch('', '', GETPOST("track_id",'alpha')); if ($object->markAsRead($user) > 0) { // Log action in ticket logs table @@ -328,22 +328,26 @@ class ActionsTicketsup $action = 'view'; } - if ($action == "assign_user" && GETPOST('btn_assign_user') && $user->rights->ticketsup->write) { - $object->fetch('', GETPOST("track_id")); - + if ($action == "assign_user" && GETPOST('btn_assign_user','aplha') && $user->rights->ticketsup->write) { + $object->fetch('', '', GETPOST("track_id",'alpha')); $useroriginassign = $object->fk_user_assign; - $usertoassign = GETPOST('fk_user_assign'); - if (!$usertoassign) { + $usertoassign = GETPOST('fk_user_assign','int'); + + /*if (! ($usertoassign > 0)) { $error++; array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("UserAssignedTo"))); $action = 'view'; + }*/ + + if (!$error) + { + $ret = $object->assignUser($user, $usertoassign); + if ($ret < 0) $error++; } - if (!$error) { - $ret = $object->assignUser($user, $usertoassign); - - if ($ret) { - // Si déjà un user assigné on le supprime des contacts + if (! $error) // Update list of contacts + { + // Si déjà un user assigné on le supprime des contacts if ($useroriginassign > 0) { $internal_contacts = $object->listeContact(-1, 'internal'); @@ -356,9 +360,12 @@ class ActionsTicketsup } } } - $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); - } + if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); + } + + if (! $error) + { // Log action in ticket logs table $object->fetch_user($usertoassign); $log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs)); @@ -377,7 +384,7 @@ class ActionsTicketsup } if ($action == "change_property" && GETPOST('btn_update_ticket_prop') && $user->rights->ticketsup->write) { - $this->fetch('', GETPOST('track_id')); + $this->fetch('', '', GETPOST('track_id','alpha')); $fieldtomodify = GETPOST('property') . '_code'; $fieldtomodify_label = GETPOST('property') . '_label'; @@ -423,7 +430,7 @@ class ActionsTicketsup } if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticketsup->write) { - $this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')); + $this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); if ($object->close()) { // Log action in ticket logs table $log_action = $langs->trans('TicketLogClosedBy', $user->getFullName($langs)); @@ -442,7 +449,7 @@ class ActionsTicketsup } if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') { - $this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')); + $this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); if (($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) && $object->close()) { // Log action in ticket logs table $log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']); @@ -461,7 +468,7 @@ class ActionsTicketsup } if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticketsup->delete) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->delete($user) > 0) { setEventMessages('
' . $langs->trans('TicketDeletedSuccess') . '
', null, 'mesgs'); Header("Location: ".DOL_URL_ROOT."/ticketsup/list.php"); @@ -476,7 +483,7 @@ class ActionsTicketsup // Set parent company if ($action == 'set_thirdparty' && $user->rights->societe->creer) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $result = $object->setCustomer(GETPOST('editcustomer', 'int')); $url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha'); header("Location: " . $url); @@ -485,7 +492,7 @@ class ActionsTicketsup } if ($action == 'set_progression' && $user->rights->ticketsup->write) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $result = $object->setProgression(GETPOST('progress')); // Log action in ticket logs table $log_action = $langs->trans('TicketLogProgressSetTo', GETPOST('progress')); @@ -517,7 +524,7 @@ class ActionsTicketsup } if ($action == "set_extrafields" && GETPOST('btn_edit_extrafields') && $user->rights->ticketsup->write && !GETPOST('cancel')) { - $res = $this->fetch('', GETPOST('track_id')); + $res = $this->fetch('', '', GETPOST('track_id','alpha')); $extrafields = new ExtraFields($this->db); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); @@ -534,7 +541,7 @@ class ActionsTicketsup $action = 'view'; } // Reopen ticket elseif ($action == 'confirm_reopen' && $user->rights->ticketsup->manage && !GETPOST('cancel')) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { // prevent browser refresh from reopening ticket several times if ($object->fk_statut == 8) { $res = $object->setStatut(4); @@ -550,7 +557,7 @@ class ActionsTicketsup } } // Categorisation dans projet elseif ($action == 'classin' && $user->rights->ticketsup->write) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $object->setProject(GETPOST('projectid')); $url = 'card.php?action=view&track_id=' . $object->track_id; header("Location: " . $url); @@ -558,7 +565,7 @@ class ActionsTicketsup } } // Categorisation dans contrat elseif ($action == 'setcontract' && $user->rights->ticketsup->write) { - if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $object->setContract(GETPOST('contractid')); $url = 'card.php?action=view&track_id=' . $object->track_id; header("Location: " . $url); @@ -567,7 +574,7 @@ class ActionsTicketsup } elseif ($action == "set_message" && $user->rights->ticketsup->manage) { // altairis: manage cancel button if (!GETPOST('cancel')) { - $this->fetch('', GETPOST('track_id')); + $this->fetch('', '', GETPOST('track_id','alpha')); $oldvalue_message = $object->message; $fieldtomodify = GETPOST('message_initial'); @@ -627,7 +634,7 @@ class ActionsTicketsup $error = 0; $object = new Ticketsup($this->db); - $ret = $object->fetch('', GETPOST('track_id')); + $ret = $object->fetch('', '', GETPOST('track_id','alpha')); $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if ($ret < 0) { @@ -833,7 +840,7 @@ class ActionsTicketsup global $mysoc, $conf, $langs; $error = 0; - $ret = $object->fetch('', GETPOST('track_id')); + $ret = $object->fetch('', '', GETPOST('track_id','alpha')); $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if ($ret < 0) { @@ -969,14 +976,14 @@ class ActionsTicketsup * Fetch object * * @param int $id ID of ticket - * @param int $track_id Track ID of ticket (for public area) * @param string $ref Reference of ticket + * @param string $track_id Track ID of ticket (for public area) * @return void */ - public function fetch($id = 0, $track_id = 0, $ref = '') + public function fetch($id = 0, $ref = '', $track_id = '') { $this->getInstanceDao(); - return $this->dao->fetch($id, $track_id, $ref); + return $this->dao->fetch($id, $ref, $track_id); } /** @@ -1000,7 +1007,7 @@ class ActionsTicketsup public function getInfo($id) { $this->getInstanceDao(); - $this->dao->fetch($id, $track_id); + $this->dao->fetch($id, '', $track_id); $this->label = $this->dao->label; $this->description = $this->dao->description; @@ -1140,10 +1147,12 @@ class ActionsTicketsup /** * Show ticket original message * - * @param User $user $user wich display - * @param string $action Action mode + * @param User $user User wich display + * @param string $action Action mode + * @param TicketSup $object Object ticket + * @return void */ - public function viewTicketOriginalMessage($user, $action = '') + public function viewTicketOriginalMessage($user, $action, $object) { global $langs; if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') { @@ -1151,16 +1160,18 @@ class ActionsTicketsup print '
'; print ''; - print ''; + print ''; print ''; } // Initial message - print ''; + print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; print ''; @@ -1169,20 +1180,20 @@ class ActionsTicketsup print ''; print ''; @@ -1202,14 +1213,15 @@ class ActionsTicketsup public function viewTicketMessages($show_private, $show_user = true) { global $conf, $langs, $user, $bc; + global $object; // Load logs in cache - $ret = $this->dao->loadCacheMsgsTicket(); + $ret = $object->loadCacheMsgsTicket(); $action = GETPOST('action'); $this->viewTicketOriginalMessage($user, $action); - if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) { + if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) { print_titre($langs->trans('TicketMailExchanges')); print '
'; print '' . $langs->trans("InitialMessage") . ' '; if ($user->rights->ticketsup->manage) { - print '' . img_edit($langs->trans('Modify')) . ' ' . $langs->trans('Modify') . ''; + print '' . img_edit($langs->trans('Modify')) . ' ' . $langs->trans('Modify') . ''; } print '
'; if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') { // MESSAGE - $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $this->dao->message; + $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message; include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $uselocalbrowser = true; $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser); $doleditor->Create(); } else { // Deal with format differences (text / HTML) - if (dol_textishtml($this->dao->message)) { - print $this->dao->message; + if (dol_textishtml($object->message)) { + print $object->message; } else { - print dol_nl2br($this->dao->message); + print dol_nl2br($object->message); } - //print '
' . $this->dao->message . '
'; + //print '
' . $object->message . '
'; } print '
'; @@ -1226,7 +1238,7 @@ class ActionsTicketsup print ''; } - foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) { + foreach ($object->cache_msgs_ticket as $id => $arraymsgs) { if (!$arraymsgs['private'] || ($arraymsgs['private'] == "1" && $show_private) ) { @@ -1331,7 +1343,7 @@ class ActionsTicketsup function load_previous_next_ref($filter, $fieldid) { $this->getInstanceDao(); - return $this->dao->load_previous_next_ref($filter, $fieldid); + return $object->load_previous_next_ref($filter, $fieldid); } /** @@ -1361,8 +1373,8 @@ class ActionsTicketsup // If no receiver defined, load all ticket linked contacts if (!is_array($array_receiver) || !count($array_receiver) > 0) { - $array_receiver = $this->dao->getInfosTicketInternalContact(); - $array_receiver = array_merge($array_receiver, $this->dao->getInfosTicketExternalContact()); + $array_receiver = $object->getInfosTicketInternalContact(); + $array_receiver = array_merge($array_receiver, $object->getInfosTicketExternalContact()); } if ($send_internal_cc) { @@ -1424,7 +1436,7 @@ class ActionsTicketsup */ public function copyFilesForTicket() { - global $conf; + global $conf, $object; // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; @@ -1444,7 +1456,7 @@ class ActionsTicketsup $mimetype = $attachedfiles['mimes']; // Copy files into ticket directory - $destdir = $conf->ticketsup->dir_output . '/' . $this->dao->track_id; + $destdir = $conf->ticketsup->dir_output . '/' . $object->track_id; if (!dol_is_dir($destdir)) { dol_mkdir($destdir); @@ -1492,8 +1504,10 @@ class ActionsTicketsup if (!in_array($status, $exclude_status)) { print '
'; - if ($object->fk_statut == Ticketsup::STATUS_READ || $status == Ticketsup::STATUS_READ|| empty($object->date_read)) $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=mark_ticket_read'; // To set as read, we use a dedicated action - else $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=set_status&new_status=' . $status; + if ($status == 1) + $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=mark_ticket_read'; // To set as read, we use a dedicated action + else + $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=set_status&new_status=' . $status; print ''; print img_picto($langs->trans($object->statuts_short[$status]), 'statut' . $status . '.png@ticketsup') . ' ' . $langs->trans($object->statuts_short[$status]); diff --git a/htdocs/ticketsup/class/api_ticketsups.class.php b/htdocs/ticketsup/class/api_ticketsups.class.php index bda05dd589c..ee696b34505 100644 --- a/htdocs/ticketsup/class/api_ticketsups.class.php +++ b/htdocs/ticketsup/class/api_ticketsups.class.php @@ -90,7 +90,7 @@ class Ticketsups extends DolibarrApi throw new RestException(401, 'Wrong parameters'); } - $result = $this->ticketsup->fetch($id, $track_id, $ref); + $result = $this->ticketsup->fetch($id, $ref, $track_id); if (! $result) { throw new RestException(404, 'Ticketsup not found'); } @@ -344,7 +344,7 @@ class Ticketsups extends DolibarrApi $this->ticketsup->$field = $value; } $ticketMessageText = $this->ticketsup->message; - $result = $this->ticketsup->fetch('', $this->ticketsup->track_id); + $result = $this->ticketsup->fetch('', '', $this->ticketsup->track_id); if (! $result) { throw new RestException(404, 'Ticketsup not found'); } diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index 584f9508f6d..ced9ad3ff73 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -174,9 +174,9 @@ class Ticketsup extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-2, 'enabled'=>0, 'position'=>20, 'notnull'=>1, 'index'=>1), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TrackID', 'visible'=>0, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"), + 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>1, 'enabled'=>1, 'position'=>49, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToProject"), - 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>1, 'enabled'=>1, 'position'=>11, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AuthorAssign', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>12, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), @@ -427,12 +427,12 @@ class Ticketsup extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @return int <0 if KO, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $track_id Track id, a hash like ref + * @return int <0 if KO, >0 if OK */ - - // possible to change the order of value, standard welcome is = id, ref, track_id ??? - public function fetch($id = '', $track_id = '', $ref = '') + public function fetch($id = '', $ref = '', $track_id = '') { global $langs; @@ -524,15 +524,7 @@ class Ticketsup extends CommonObject $this->date_close = $this->db->jdate($obj->date_close); $this->tms = $this->db->jdate($obj->tms); - if (!class_exists('ExtraFields')) { - include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; - } - - $extrafields = new ExtraFields($this->db); - $extralabels = $extrafields->fetch_name_optionals_label($this->table_element, true); - if (count($extralabels) > 0) { - $this->fetch_optionals($this->id, $extralabels); - } + $this->fetch_optionals(); } $this->db->free($resql); @@ -1318,43 +1310,71 @@ class Ticketsup extends CommonObject } } + /** - * Return clickable link to object + * Return a link to the object card (with optionaly the picto) * - * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * @param string $option Sur quoi pointe le lien - * @return string Chaine avec URL + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '') + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) { - global $langs; + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; - $result = ''; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $lien = ''; - $lienfin = ''; + $result = ''; + $companylink = ''; - $picto = 'ticketsup'; - if (!$this->public) { - $picto = 'ticketsup'; - } + $label = '' . $langs->trans("ShowTicket") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref.'
'; + $label.= '' . $langs->trans('TrackID') . ': ' . $this->track_id.'
'; + $label.= '' . $langs->trans('Subject') . ': ' . $this->subject; - $label = $langs->trans("ShowTicket") . ': ' . $this->ref . ' - ' . $this->subject; - if ($withpicto) { - $result .= ($lien . img_object($label, $picto) . $lienfin); - } + $url = dol_buildpath('/ticketsup/card.php',1).'?id='.$this->id; - if ($withpicto && $withpicto != 2) { - $result .= ' '; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } - if ($withpicto != 2) { - $result .= $lien . $this->ref . ' - ' . dol_trunc($this->subject) . $lienfin; - } + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowTicket"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); - return $result; + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + return $result; } + /** * Mark a message as read * @@ -1404,60 +1424,63 @@ class Ticketsup extends CommonObject } } - /** - * Mark a message as read - * - * @param User $user Object user - * @param int $id_assign_user ID of user assigned - * @param int $notrigger Disable trigger - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function assignUser($user, $id_assign_user, $notrigger = 0) - { - global $conf, $langs; + /** + * Mark a message as read + * + * @param User $user Object user + * @param int $id_assign_user ID of user assigned + * @param int $notrigger Disable trigger + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function assignUser($user, $id_assign_user, $notrigger = 0) + { + global $conf, $langs; - if ($id_assign_user > 0) { - $this->db->begin(); + $this->db->begin(); - $sql = "UPDATE " . MAIN_DB_PREFIX . "ticketsup"; - $sql .= " SET fk_user_assign=" . $id_assign_user; - $sql .= " , fk_statut=4"; - $sql .= " WHERE rowid = " . $this->id; + $sql = "UPDATE " . MAIN_DB_PREFIX . "ticketsup"; + if ($id_assign_user > 0) + { + $sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut=4"; + } + else + { + $sql .= " SET fk_user_assign=null, fk_statut=1"; + } + $sql .= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this) . "::assignUser sql=" . $sql); - $resql = $this->db->query($sql); - if ($resql) - { - $this->fk_user_assign = $id_assign_user; // May be used by trigger + dol_syslog(get_class($this) . "::assignUser sql=" . $sql); + $resql = $this->db->query($sql); + if ($resql) { + $this->fk_user_assign = $id_assign_user; // May be used by trigger - if (!$notrigger) { - // Call trigger - $result=$this->call_trigger('TICKET_ASSIGNED', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } + if (! $notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_ASSIGNED', $user); + if ($result < 0) { + $error ++; + } + // End call triggers + } - if (!$error) { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - $this->error = join(',', $this->errors); - dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); - return -1; - } - } else { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); - return -1; - } - } + if (! $error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + $this->error = join(',', $this->errors); + dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); + return - 1; + } + } else { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); + return - 1; + } - return 0; - } + return 0; + } /** * Create log for the ticket diff --git a/htdocs/ticketsup/contact.php b/htdocs/ticketsup/contact.php index 5dceabe9476..8199b6c84a5 100644 --- a/htdocs/ticketsup/contact.php +++ b/htdocs/ticketsup/contact.php @@ -70,7 +70,7 @@ $object = new Ticketsup($db); */ if ($action == 'addcontact' && $user->rights->ticketsup->write) { - $result = $object->fetch($id, $track_id); + $result = $object->fetch($id, '', $track_id); if ($result > 0 && ($id > 0 || (!empty($track_id)))) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); @@ -92,7 +92,7 @@ if ($action == 'addcontact' && $user->rights->ticketsup->write) { // bascule du statut d'un contact if ($action == 'swapstatut' && $user->rights->ticketsup->write) { - if ($object->fetch($id, $track_id)) { + if ($object->fetch($id, '', $track_id)) { $result = $object->swapContactStatus($ligne); } else { dol_print_error($db, $object->error); @@ -101,7 +101,7 @@ if ($action == 'swapstatut' && $user->rights->ticketsup->write) { // Efface un contact if ($action == 'deletecontact' && $user->rights->ticketsup->write) { - if ($object->fetch($id, $track_id)) { + if ($object->fetch($id, '', $track_id)) { $result = $object->delete_contact($lineid); if ($result >= 0) { @@ -129,7 +129,7 @@ $userstatic = new User($db); /* *************************************************************************** */ if ($id > 0 || !empty($track_id) || !empty($ref)) { - if ($object->fetch($id, $track_id, $ref) > 0) + if ($object->fetch($id, $ref, $track_id) > 0) { if ($socid > 0) { $object->fetch_thirdparty(); diff --git a/htdocs/ticketsup/document.php b/htdocs/ticketsup/document.php index 94348e1054c..cadb6731bfd 100644 --- a/htdocs/ticketsup/document.php +++ b/htdocs/ticketsup/document.php @@ -64,7 +64,7 @@ if (!$sortfield) { } $object = new Ticketsup($db); -$result = $object->fetch($id, $track_id, $ref); +$result = $object->fetch($id, $ref, $track_id); // to match document rules and compatibility $old_ref = $object->ref; diff --git a/htdocs/ticketsup/history.php b/htdocs/ticketsup/history.php index 56f8e95fe0b..4dda4c919e8 100644 --- a/htdocs/ticketsup/history.php +++ b/htdocs/ticketsup/history.php @@ -57,7 +57,7 @@ if (!$action) { } $object = new Ticketsup($db); -$object->fetch($id, $track_id, $ref); +$object->fetch($id, $ref, $track_id); /* @@ -83,7 +83,7 @@ $form = new Form($db); $formticket = new FormTicketsup($db); if ($action == 'view') { - $res = $object->fetch($id, $track_id, $ref); + $res = $object->fetch($id, $ref, $track_id); if ($res > 0) { // restrict access for externals users