';
+ print '';
@@ -1137,2 +919,2 @@
- if ($action != 'progression' && isset($object->status) && $object->status < $object::STATUS_CLOSED && !$user->socid) {
- print ' | '.img_edit($langs->trans('Modify')).' | ';
+ if ($action != 'progression' && $object->fk_statut < 8 && !$user->socid) {
+ print ''.img_edit($langs->trans('Modify')).' | ';
@@ -1141,2 +923,2 @@
- print '';
- if ($user->hasRight('ticket', 'write') && $action == 'progression') {
+ print ' | ';
+ if ($user->rights->ticket->write && $action == 'progression') {
@@ -1147,2 +929,2 @@
- print '';
- print ' ';
+ print '';
+ print ' ';
@@ -1157 +939,2 @@
- if (isModEnabled('ficheinter')) {
+ if ($conf->fichinter->enabled)
+ {
@@ -1161 +943,0 @@
- $foundinter = 0;
@@ -1164 +946 @@
- if ($objecttype == "fichinter") {
+ if ($objecttype = "fichinter") {
@@ -1166 +947,0 @@
- $foundinter++;
@@ -1172 +953,2 @@
- print ' | ';
+ print ' | ';
+
@@ -1175 +957 @@
- print $foundinter ? convertSecondToTime($timing, 'all', getDolGlobalString('MAIN_DURATION_OF_WORKDAY')) : '';
+ print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
@@ -1185,4 +967,8 @@
- // End of left column and beginning of right column
- print ' ';
-
-
+ // Fin colonne gauche et début colonne droite
+ print ' ';
+
+
+ // View Original message
+ $actionobject->viewTicketOriginalMessage($user, $action, $object);
+
+ // Classification of ticket
@@ -1191,0 +978 @@
+ print ' ';
@@ -1193,51 +980 @@
- print ' ';
-
- // Categories
- if (isModEnabled('categorie')) {
- print ' ';
- print ' ';
- print '';
- print '';
- print '';
- print ' | ';
-
- if ($user->hasRight('ticket', 'write') && $action == 'categories') {
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
- if (is_array($cate_arbo)) {
- // Categories
- print '';
- print '';
- print " | ";
- }
- } else {
- print '';
- print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
- print " | ";
- }
-
- print ' ';
- }
-
- // View Original message
- $actionobject->viewTicketOriginalMessage($user, $action, $object);
-
- // Classification of ticket
+
@@ -1245 +982 @@
- print ' ';
+ print '';
@@ -1248 +985 @@
- print $langs->trans('TicketProperties');
+ print $langs->trans('Properties');
@@ -1251,6 +988,7 @@
- if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
- print '';
- } else {
- // Button to edit Properties
- if (isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO || getDolGlobalString('TICKET_ALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $user->hasRight('ticket', 'write')) {
- print ' '.img_edit($langs->trans('Modify')).'';
+ if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
+ print '';
+ }
+ else {
+ // Button to edit Properties
+ if ($object->fk_statut < 5 && $user->rights->ticket->write) {
+ print ''.img_edit($langs->trans('Modify')).'';
@@ -1262 +1000 @@
- if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
+ if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
@@ -1266 +1004 @@
- print $langs->trans('Type');
+ print $langs->trans('TicketChangeType');
@@ -1274 +1012 @@
- print $langs->trans('TicketCategory');
+ print $langs->trans('TicketChangeCategory');
@@ -1276 +1014 @@
- $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2, 0, 0, 0, 'maxwidth500 widthcentpercentminusxx');
+ $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2);
@@ -1282 +1020 @@
- print $langs->trans('TicketSeverity');
+ print $langs->trans('TicketChangeSeverity');
@@ -1290,3 +1028 @@
- if (!empty($object->type_code)) {
- print $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
- }
+ print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label');
@@ -1295,6 +1031,2 @@
- $s = '';
- if (!empty($object->category_code)) {
- $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
- }
- print ''.$langs->trans("TicketCategory").' | ';
- print dol_escape_htmltag($s);
+ print ' | '.$langs->trans("TicketGroup").' | ';
+ print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label');
@@ -1304,3 +1036 @@
- if (!empty($object->severity_code)) {
- print $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
- }
+ print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label');
@@ -1316 +1046 @@
- if (!$user->socid && $user->hasRight('ticket', 'write') && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
+ if (!$user->socid && $user->rights->ticket->write && $object->fk_statut < 8 && GETPOST('set') !== 'properties') {
@@ -1321 +1051,2 @@
- if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
+ if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
+ {
@@ -1340 +1070,0 @@
- $var = false;
@@ -1364 +1094 @@
- echo $companystatic->getNomUrl(-1);
+ echo $companystatic->getNomUrl(1);
@@ -1367 +1097 @@
- echo getDolGlobalString('MAIN_INFO_SOCIETE_NOM');
+ echo $conf->global->MAIN_INFO_SOCIETE_NOM;
@@ -1377 +1107 @@
- print $userstatic->getNomUrl(-1);
+ print $userstatic->getNomUrl(1);
@@ -1382 +1112 @@
- print $contactstatic->getNomUrl(-1);
+ print $contactstatic->getNomUrl(1);
@@ -1403 +1133 @@
- if ($object->status >= 0) {
+ if ($object->statut >= 0) {
@@ -1419 +1149 @@
- if ($object->status >= 0) {
+ if ($object->statut >= 0) {
@@ -1435,4 +1165,4 @@
- print '';
- print '';
-
- print dol_get_fiche_end();
+ print '';
+ print '';
+
+ dol_fiche_end();
@@ -1446,10 +1176,4 @@
- if ($reshook < 0) {
- setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- }
-
- if (empty($reshook)) {
- // Email
- if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
- print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', '');
- }
-
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+ if (empty($reshook))
+ {
@@ -1457,2 +1181,2 @@
- if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
- print dolGetButtonAction('', $langs->trans('TicketAddPrivateMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', '');
+ if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
+ print '';
@@ -1463,15 +1187,10 @@
- if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
- print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
- }
- if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ficheinter', 'creer')) {
- print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
- }
-
- // Close ticket if status is read
- if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
- print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
- }
-
- // Abandon ticket if status is read
- if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
- print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, '');
+ if (!$object->fk_soc && $user->rights->ficheinter->creer) {
+ print '';
+ }
+ if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
+ print '';
+ }
+
+ // Close ticket if statut is read
+ if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
+ print '';
@@ -1481,2 +1200,2 @@
- if (!$user->socid && (isset($object->status) && ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
- print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, '');
+ if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) {
+ print '';
@@ -1486,2 +1205,2 @@
- if ($user->hasRight('ticket', 'delete') && !$user->socid) {
- print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&track_id='.$object->track_id, '');
+ if ($user->rights->ticket->delete && !$user->socid) {
+ print '';
@@ -1491,2 +1210,4 @@
- } else {
- //print ' ';
+ }
+ else
+ {
+ print ' ';
@@ -1500,3 +1221 @@
- if (GETPOSTISSET('actionbis') && $action == 'presend') {
- $action = 'presend_addmessage';
- }
+ if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
@@ -1505,19 +1224,2 @@
- if ($action == 'presend' || $action == 'presend_addmessage') {
- if ($object->fk_soc > 0) {
- $object->fetch_thirdparty();
- }
-
- $outputlangs = $langs;
- $newlang = '';
- if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
- $newlang = GETPOST('lang_id', 'aZ09');
- } elseif (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && is_object($object->thirdparty)) {
- $newlang = $object->thirdparty->default_lang;
- }
- if (!empty($newlang)) {
- $outputlangs = new Translate("", $conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $arrayoffamiliestoexclude = array('objectamount');
-
+ if ($action == 'presend' || $action == 'presend_addmessage')
+ {
@@ -1530 +1232,27 @@
- $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
+ $substitutionarray = array();
+ if ($object->fk_soc > 0) {
+ $object->fetch_thirdparty();
+ $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
+ }
+ $substitutionarray['__SIGNATURE__'] = $user->signature;
+ $substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
+ $substitutionarray['__TICKET_REF__'] = $object->ref;
+ $substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
+ $substitutionarray['__TICKET_TYPE__'] = $object->type_code;
+ $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code;
+ $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility
+ $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code;
+ $substitutionarray['__TICKET_MESSAGE__'] = $object->message;
+ $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress;
+ if ($object->fk_user_assign > 0) {
+ $userstat->fetch($object->fk_user_assign);
+ $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+
+ if ($object->fk_user_create > 0) {
+ $userstat->fetch($object->fk_user_create);
+ $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+ foreach ($substitutionarray as $key => $val) {
+ $help .= $key.' -> '.$langs->trans($val).' ';
+ }
@@ -1534,3 +1261,0 @@
-
- print '';
-
@@ -1539,0 +1265,10 @@
+
+ // Define output language
+ $outputlangs = $langs;
+ $newlang = '';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) {
+ $newlang = $_REQUEST['lang_id'];
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ $newlang = $object->default_lang;
+ }
@@ -1547 +1281,0 @@
- $formticket->trackid = 'tic'.$object->id;
@@ -1554 +1288 @@
- // Table of additional post parameters
+ // Tableau des parametres complementaires du post
@@ -1562,2 +1295,0 @@
- $formticket->backtopage = $backtopage;
-
@@ -1569 +1301 @@
- if (getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD')) {
+ if (! empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
@@ -1571,12 +1303,4 @@
- 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);
- }
+ 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);
@@ -1586,2 +1310,2 @@
- $messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
- $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
+ $messagingUrl = DOL_URL_ROOT . '/ticket/agenda.php?track_id=' . $object->track_id;
+ $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fal fa-list-alt imgforviewmode', $messagingUrl, '', 1);
@@ -1590,3 +1314,3 @@
- $btnstatus = $object->status < 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'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
+ $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);
@@ -1595,3 +1319,3 @@
- $btnstatus = $object->status < 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'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);
+ $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);
@@ -1604,3 +1328 @@
- $filters['search_rowid'] = $search_rowid;
-
- show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
+ show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
@@ -1622,2 +1344,2 @@
- if (getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD')) {
- print '';
+ if (empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
+ print ' ';
@@ -1627,4 +1349,3 @@
- $morehtmlcenter = ' ';
- $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/ticket/messaging.php?id='.$object->id);
- $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/ticket/agenda.php?id='.$object->id);
- $morehtmlcenter .= ' ';
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/ticket/messaging.php?id='.$object->id);
+ $morehtmlcenter .= ' ';
+ $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullList'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/ticket/agenda.php?id='.$object->id);
@@ -1633 +1354 @@
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
@@ -1637 +1358 @@
- print ' ';
+ print ' ';
--- /tmp/dsg/dolibarr/htdocs/ticket/github_19.0.3_contact.php
+++ /tmp/dsg/dolibarr/htdocs/ticket/client_contact.php
@@ -27 +26,0 @@
-// Load Dolibarr environment
@@ -37,5 +35,0 @@
-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';
-}
@@ -58,0 +53,5 @@
+// Protection if external user
+if ($user->socid > 0) {
+ $socid = $user->socid;
+ accessforbidden();
+}
@@ -61 +60 @@
-$url_page_current = DOL_URL_ROOT.'/ticket/contact.php';
+$url_page_current = dol_buildpath('/ticket/contact.php', 1);
@@ -64,18 +62,0 @@
-
-// Security check
-$id = GETPOST("id", 'int');
-if ($user->socid > 0) {
- $socid = $user->socid;
-}
-$result = restrictedArea($user, 'ticket', $object->id, '');
-
-// restrict access for externals users
-if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
- accessforbidden();
-}
-// or for unauthorized internals users
-if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {
- accessforbidden();
-}
-
-$permissiontoadd = $user->rights->ticket->write;
@@ -88,45 +69,19 @@
-if ($action == 'addcontact' && $user->hasRight('ticket', 'write')) {
- $result = $object->fetch($id, '', $track_id);
-
- if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
- $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
- $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
-
- $error = 0;
-
- $codecontact = dol_getIdFromCode($db, $typeid, 'c_type_contact', 'rowid', 'code');
- if ($codecontact=='SUPPORTTEC') {
- $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
- foreach ($internal_contacts as $key => $contact) {
- if ($contact['id'] !== $contactid) {
- //print "user à effacer : ".$useroriginassign;
- $result = $object->delete_contact($contact['rowid']);
- if ($result<0) {
- $error ++;
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
- }
- $ret = $object->assignUser($user, $contactid);
- if ($ret < 0) {
- $error ++;
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
-
- if (empty($error)) {
- $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
- }
- }
-
- if ($result >= 0) {
- header("Location: ".$url_page_current."?id=".$object->id);
- exit;
- } else {
- if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
- } else {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
+if ($action == 'addcontact' && $user->rights->ticket->write) {
+ $result = $object->fetch($id, '', $track_id);
+
+ if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
+ $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
+ $result = $object->add_contact($contactid, $type, $source);
+ }
+
+ if ($result >= 0) {
+ Header("Location: ".$url_page_current."?id=".$object->id);
+ exit;
+ } else {
+ if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
@@ -136,6 +91,6 @@
-if ($action == 'swapstatut' && $user->hasRight('ticket', 'write')) {
- if ($object->fetch($id, '', $track_id)) {
- $result = $object->swapContactStatus($ligne);
- } else {
- dol_print_error($db, $object->error);
- }
+if ($action == 'swapstatut' && $user->rights->ticket->write) {
+ if ($object->fetch($id, '', $track_id)) {
+ $result = $object->swapContactStatus($ligne);
+ } else {
+ dol_print_error($db, $object->error);
+ }
@@ -145,30 +100,11 @@
-if ($action == 'deletecontact' && $user->hasRight('ticket', 'write')) {
- if ($object->fetch($id, '', $track_id)) {
- $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
- foreach ($internal_contacts as $key => $contact) {
- if ($contact['rowid'] == $lineid && $object->fk_user_assign==$contact['id']) {
- $ret = $object->assignUser($user, null);
- if ($ret < 0) {
- $error ++;
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
- }
- $result = $object->delete_contact($lineid);
-
- if ($result >= 0) {
- Header("Location: ".$url_page_current."?id=".$object->id);
- exit;
- }
- }
-}
-
-// Set parent company
-if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
- if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
- $result = $object->setCustomer(GETPOST('editcustomer', 'int'));
- $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
- header("Location: ".$url);
- exit();
- }
-}
+if ($action == 'deletecontact' && $user->rights->ticket->write) {
+ if ($object->fetch($id, '', $track_id)) {
+ $result = $object->delete_contact($lineid);
+
+ if ($result >= 0) {
+ Header("Location: ".$url_page_current."?id=".$object->id);
+ exit;
+ }
+ }
+}
+
@@ -190,56 +126,61 @@
- if ($object->fetch($id, $ref, $track_id) > 0) {
- if ($socid > 0) {
- $object->fetch_thirdparty();
- $head = societe_prepare_head($object->thirdparty);
- print dol_get_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
- print dol_get_fiche_end();
- }
-
- if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) {
- $object->next_prev_filter = "te.fk_user_assign ='".((int) $user->id);
- } elseif ($user->socid > 0) {
- $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid);
- }
-
- $head = ticket_prepare_head($object);
-
- print dol_get_fiche_head($head, 'contact', $langs->trans("Ticket"), -1, 'ticket');
-
- $morehtmlref = '';
- $morehtmlref .= $object->subject;
- // Author
- if ($object->fk_user_create > 0) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
-
- $fuser = new User($db);
- $fuser->fetch($object->fk_user_create);
- $morehtmlref .= $fuser->getNomUrl(-1);
- } elseif (!empty($object->email_msgid)) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
- $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')';
- } elseif (!empty($object->origin_email)) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
- $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("CreatedByPublicPortal").')';
- }
-
- // Thirdparty
- if (isModEnabled("societe")) {
- $morehtmlref .= ' ';
- $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
- if ($action != 'editcustomer' && $permissiontoadd) {
- $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);
- }
-
- // Project
- if (isModEnabled('project')) {
- $langs->load("projects");
- if (0) {
- $morehtmlref .= ' ';
- $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
- if ($action != 'classify') {
- $morehtmlref .= ' '.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
+ if ($object->fetch($id, $ref, $track_id) > 0)
+ {
+ if ($socid > 0) {
+ $object->fetch_thirdparty();
+ $head = societe_prepare_head($object->thirdparty);
+ dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
+ dol_fiche_end();
+ }
+
+ if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
+ } elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
+ }
+
+ $head = ticket_prepare_head($object);
+
+ dol_fiche_head($head, 'contact', $langs->trans("Ticket"), -1, 'ticket');
+
+ $morehtmlref = ' ';
+ $morehtmlref .= $object->subject;
+ // Author
+ if ($object->fk_user_create > 0) {
+ $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
+
+ $langs->load("users");
+ $fuser = new User($db);
+ $fuser->fetch($object->fk_user_create);
+ $morehtmlref .= $fuser->getNomUrl(0);
+ }
+ if (!empty($object->origin_email)) {
+ $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
+ $morehtmlref .= $object->origin_email.' ('.$langs->trans("TicketEmailOriginIssuer").')';
+ }
+
+ // Thirdparty
+ if (!empty($conf->societe->enabled))
+ {
+ $morehtmlref .= ' '.$langs->trans('ThirdParty');
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
+ $morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '';
+ }*/
+ $morehtmlref .= ' : ';
+ 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);
+ }
+ }
+
+ // Project
+ if (!empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
+ if ($user->rights->ticket->write)
+ {
+ if ($action != 'classify') {
+ //$morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
+ $morehtmlref .= ' : ';
@@ -247,37 +188,45 @@
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
- } else {
- if (!empty($object->fk_project)) {
- $morehtmlref .= ' ';
- $proj = new Project($db);
- $proj->fetch($object->fk_project);
- $morehtmlref .= $proj->getNomUrl(1);
- if ($proj->title) {
- $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).'';
- }
- }
- }
- }
-
- $morehtmlref .= ' ';
-
- $linkback = ' '.$langs->trans("BackToList").' ';
-
- dol_banner_tab($object, 'ref', $linkback, (empty($user->socid) ? 1 : 0), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, '');
-
- print dol_get_fiche_end();
-
- //print ' ';
-
- $permission = $user->rights->ticket->write;
-
- // Contacts lines (modules that overwrite templates must declare this into descriptor)
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
- foreach ($dirtpls as $reldir) {
- $res = @include dol_buildpath($reldir.'/contacts.tpl.php');
- if ($res) {
- break;
- }
- }
- } else {
- print "ErrorRecordNotFound";
- }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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 .= $proj->getNomUrl(1);
+ } else {
+ $morehtmlref .= '';
+ }
+ }
+ }
+
+ $morehtmlref .= ' ';
+
+ $linkback = ''.$langs->trans("BackToList").' ';
+
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, '');
+
+ dol_fiche_end();
+
+ //print ' ';
+
+ $permission = $user->rights->ticket->write;
+
+ // Contacts lines (modules that overwrite templates must declare this into descriptor)
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
+ foreach ($dirtpls as $reldir) {
+ $res = @include dol_buildpath($reldir.'/contacts.tpl.php');
+ if ($res) {
+ break;
+ }
+ }
+ } else {
+ print "ErrorRecordNotFound";
+ }
--- /tmp/dsg/dolibarr/htdocs/ticket/github_19.0.3_document.php
+++ /tmp/dsg/dolibarr/htdocs/ticket/client_document.php
@@ -28 +27,0 @@
-// Load Dolibarr environment
@@ -36,5 +34,0 @@
-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';
-}
@@ -46 +39,0 @@
-$socid = GETPOST('socid', 'int');
@@ -52,2 +45,4 @@
-// Store current page url
-$url_page_current = DOL_URL_ROOT.'/ticket/document.php';
+// Security check
+if (!$user->rights->ticket->read) {
+ accessforbidden();
+}
@@ -57,2 +52,2 @@
-$sortfield = GETPOST('sortfield', 'aZ09comma');
-$sortorder = GETPOST('sortorder', 'aZ09comma');
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
@@ -60,3 +55 @@
-if (empty($page) || $page == -1) {
- $page = 0;
-} // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
@@ -66,6 +59,2 @@
-if (!$sortorder) {
- $sortorder = "ASC";
-}
-if (!$sortfield) {
- $sortfield = "position_name";
-}
+if (!$sortorder) $sortorder = "ASC";
+if (!$sortfield) $sortfield = "position_name";
@@ -79,16 +68,2 @@
- $upload_dir = $conf->ticket->dir_output."/".dol_sanitizeFileName($object->ref);
-}
-
-// Security check - Protection if external user
-$result = restrictedArea($user, 'ticket', $object->id);
-
-// restrict access for externals users
-if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
- accessforbidden();
-}
-// or for unauthorized internals users
-if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id && !$user->hasRight('ticket', 'manage')) {
- accessforbidden();
-}
-
-$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
+ $upload_dir = $conf->ticket->dir_output."/".dol_sanitizeFileName($object->ref);
+}
@@ -101,11 +76,2 @@
-include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
-
-// Set parent company
-if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
- if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
- $result = $object->setCustomer(GETPOST('editcustomer', 'int'));
- $url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
- header("Location: ".$url);
- exit();
- }
-}
+include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+
@@ -123 +89,2 @@
-if ($object->id) {
+if ($object->id)
+{
@@ -127,55 +94,59 @@
- if ($socid > 0) {
- $object->fetch_thirdparty();
- $head = societe_prepare_head($object->thirdparty);
- print dol_get_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
- print dol_get_fiche_end();
- }
-
- if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) {
- $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id);
- } elseif ($user->socid > 0) {
- $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid);
- }
-
- $head = ticket_prepare_head($object);
-
- print dol_get_fiche_head($head, 'tabTicketDocument', $langs->trans("Ticket"), 0, 'ticket');
-
- $morehtmlref = '';
- $morehtmlref .= $object->subject;
- // Author
- if ($object->fk_user_create > 0) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
-
- $fuser = new User($db);
- $fuser->fetch($object->fk_user_create);
- $morehtmlref .= $fuser->getNomUrl(-1);
- } elseif (!empty($object->email_msgid)) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
- $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')';
- } elseif (!empty($object->origin_email)) {
- $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
- $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("CreatedByPublicPortal").')';
- }
-
- // Thirdparty
- if (isModEnabled("societe")) {
- $morehtmlref .= ' ';
- $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
- if ($action != 'editcustomer' && $permissiontoadd) {
- $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);
- }
-
- // Project
- if (isModEnabled('project')) {
- $langs->load("projects");
- if (0) {
- $morehtmlref .= ' ';
- $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
- if ($action != 'classify') {
- $morehtmlref .= ' '.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
+ if ($socid > 0) {
+ $object->fetch_thirdparty();
+ $head = societe_prepare_head($object->thirdparty);
+ dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
+ dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
+ dol_fiche_end();
+ }
+
+ if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
+ } elseif ($user->socid > 0) {
+ $object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
+ }
+
+ $head = ticket_prepare_head($object);
+
+ dol_fiche_head($head, 'tabTicketDocument', $langs->trans("Ticket"), 0, 'ticket');
+
+ $morehtmlref = ' ';
+ $morehtmlref .= $object->subject;
+ // Author
+ if ($object->fk_user_create > 0) {
+ $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
+
+ $langs->load("users");
+ $fuser = new User($db);
+ $fuser->fetch($object->fk_user_create);
+ $morehtmlref .= $fuser->getNomUrl(0);
+ }
+ if (!empty($object->origin_email)) {
+ $morehtmlref .= ' '.$langs->trans("CreatedBy").' : ';
+ $morehtmlref .= $object->origin_email.' ('.$langs->trans("TicketEmailOriginIssuer").')';
+ }
+
+ // Thirdparty
+ if (!empty($conf->societe->enabled))
+ {
+ $morehtmlref .= ' '.$langs->trans('ThirdParty');
+ /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
+ $morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '';
+ }*/
+ $morehtmlref .= ' : ';
+ 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);
+ }
+ }
+
+ // Project
+ if (!empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
+ if ($user->rights->ticket->write)
+ {
+ if ($action != 'classify') {
+ //$morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '';
+ $morehtmlref .= ' : ';
@@ -183,38 +154,48 @@
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
- } else {
- if (!empty($object->fk_project)) {
- $morehtmlref .= ' ';
- $proj = new Project($db);
- $proj->fetch($object->fk_project);
- $morehtmlref .= $proj->getNomUrl(1);
- if ($proj->title) {
- $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).'';
- }
- }
- }
- }
-
- $morehtmlref .= ' ';
-
- $linkback = ' '.$langs->trans("BackToList").' ';
-
- dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
-
- print dol_get_fiche_end();
-
- // Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
- $totalsize = 0;
- foreach ($filearray as $key => $file) {
- $totalsize += $file['size'];
- }
-
- //$object->ref = $object->track_id; // For compatibility we use track ID for directory
- $modulepart = 'ticket';
- $permissiontoadd = $user->rights->ticket->write;
- $permtoedit = $user->rights->ticket->write;
- $param = '&id='.$object->id;
-
- include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
-} else {
- accessforbidden('', 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 .= ' ';
+ } 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 .= $proj->getNomUrl(1);
+ } else {
+ $morehtmlref .= '';
+ }
+ }
+ }
+
+ $morehtmlref .= ' ';
+
+ $linkback = ''.$langs->trans("BackToList").' ';
+
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+
+ dol_fiche_end();
+
+ // Build file list
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file) {
+ $totalsize += $file['size'];
+ }
+
+ //$object->ref = $object->track_id; // For compatibility we use track ID for directory
+ $modulepart = 'ticket';
+ $permission = $user->rights->ticket->write;
+ $permtoedit = $user->rights->ticket->write;
+ $param = '&id='.$object->id;
+
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+}
+else
+{
+ accessforbidden('', 0, 1);
--- /tmp/dsg/dolibarr/htdocs/ticket/github_19.0.3_index.php
+++ /tmp/dsg/dolibarr/htdocs/ticket/client_index.php
@@ -4 +3,0 @@
- * Copyright (C) 2021 Frédéric France
@@ -21,5 +20,4 @@
- * \file htdocs/ticket/index.php
- * \ingroup ticket
- */
-
-// Load Dolibarr environment
+ * \file htdocs/ticket/agenda.php
+ * \ingroup ticket
+ */
+
@@ -27,3 +24,0 @@
-require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -32 +27,2 @@
-
+require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -51 +46,0 @@
-$socid = 0;
@@ -53,8 +48,10 @@
- $socid = $user->socid;
-}
-$userid = $user->id;
-
-$nowarray = dol_getdate(dol_now(), true);
-$nowyear = $nowarray['year'];
-$year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear;
-$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
+ $socid = $user->socid;
+}
+
+// Security check
+$result = restrictedArea($user, 'ticket', 0, '', '', '', '');
+
+$nowyear = strftime("%Y", dol_now());
+$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
+//$startyear=$year-2;
+$startyear = $year - 1;
@@ -63 +59,0 @@
-// Initialize objects
@@ -65,7 +60,0 @@
-
-// Security check
-//$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', '');
-if (!$user->hasRight('ticket', 'read') && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
- accessforbidden('Not enought permissions');
-}
-
@@ -81 +69,0 @@
-
@@ -86,2 +73,0 @@
-$resultboxes = FormOther::getBoxesArea($user, "11"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
-
@@ -88,0 +75 @@
+$tickesupstatic = new Ticket($db);
@@ -93 +80 @@
-print load_fiche_titre($langs->trans('TicketsIndex'), $resultboxes['selectboxlist'], 'ticket');
+print load_fiche_titre($langs->trans('TicketsIndex'), $linkback, 'ticket');
@@ -106,8 +93,8 @@
- $endyear = GETPOST($param_year, 'int');
- $shownb = GETPOST($param_shownb, 'alpha');
- $showtot = GETPOST($param_showtot, 'alpha');
-} elseif (!empty($_COOKIE['DOLUSERCOOKIE_ticket_by_status'])) {
- $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_ticket_by_status'], true);
- $endyear = $tmparray['year'];
- $shownb = empty($tmparray['shownb']) ? 0 : $tmparray['shownb'];
- $showtot = empty($tmparray['showtot']) ? 0 : $tmparray['showtot'];
+ $endyear = GETPOST($param_year, 'int');
+ $shownb = GETPOST($param_shownb, 'alpha');
+ $showtot = GETPOST($param_showtot, 'alpha');
+} else {
+ $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_ticket_by_status'], true);
+ $endyear = $tmparray['year'];
+ $shownb = $tmparray['shownb'];
+ $showtot = $tmparray['showtot'];
@@ -116,4 +103,4 @@
- $showtot = 1;
- $shownb = 0;
-}
-
+ $showtot = 1;
+}
+
+$nowarray = dol_getdate(dol_now(), true);
@@ -121 +108 @@
- $endyear = $nowarray['year'];
+ $endyear = $nowarray['year'];
@@ -125,2 +111,0 @@
-
-// Change default WIDHT and HEIGHT (we need a smaller than default for both desktop and smartphone)
@@ -128,12 +113,3 @@
-if (empty($conf->dol_optimize_smallscreen)) {
- $HEIGHT = '200';
-} else {
- $HEIGHT = '160';
-}
-
-print '';
-print '';
-
-print ' ';
-
-print ' ';
+$HEIGHT = '200';
+
+print ' ';
@@ -145,10 +121,8 @@
- 'unread' => 0,
- 'read' => 0,
- 'needmoreinfo' => 0,
- 'answered' => 0,
- 'assigned' => 0,
- 'inprogress' => 0,
- 'waiting' => 0,
- 'closed' => 0,
- 'canceled' => 0,
- 'deleted' => 0,
+ 'unread' => 0,
+ 'read' => 0,
+ 'answered' => 0,
+ 'assigned' => 0,
+ 'inprogress' => 0,
+ 'waiting' => 0,
+ 'closed' => 0,
+ 'deleted' => 0,
@@ -159,2 +133,2 @@
-if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -165,2 +139,2 @@
-if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
- $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
@@ -171 +145 @@
- $sql .= " AND t.fk_soc= ".((int) $user->socid);
+ $sql .= " AND t.fk_soc='".$user->socid."'";
@@ -173,4 +147,4 @@
- // For internals users,
- if (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && !$user->hasRight('ticket', 'manage')) {
- $sql .= " AND t.fk_user_assign = ".((int) $user->id);
- }
+ // For internals users,
+ if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) {
+ $sql .= " AND t.fk_user_assign=".$user->id;
+ }
@@ -182,49 +156,49 @@
- while ($objp = $db->fetch_object($result)) {
- $found = 0;
- if ($objp->fk_statut == Ticket::STATUS_NOT_READ) {
- $tick['unread'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_READ) {
- $tick['read'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) {
- $tick['needmoreinfo'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) {
- $tick['assigned'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) {
- $tick['inprogress'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_WAITING) {
- $tick['waiting'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_CLOSED) {
- $tick['closed'] = $objp->nb;
- }
- if ($objp->fk_statut == Ticket::STATUS_CANCELED) {
- $tick['canceled'] = $objp->nb;
- }
- }
-
- include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
-
- $dataseries = array();
- $colorseries = array();
-
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_NOT_READ]), 'data' => round($tick['unread']));
- $colorseries[Ticket::STATUS_NOT_READ] = '-'.$badgeStatus0;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_READ]), 'data' => round($tick['read']));
- $colorseries[Ticket::STATUS_READ] = $badgeStatus1;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_ASSIGNED]), 'data' => round($tick['assigned']));
- $colorseries[Ticket::STATUS_ASSIGNED] = $badgeStatus3;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_IN_PROGRESS]), 'data' => round($tick['inprogress']));
- $colorseries[Ticket::STATUS_IN_PROGRESS] = $badgeStatus4;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_WAITING]), 'data' => round($tick['waiting']));
- $colorseries[Ticket::STATUS_WAITING] = '-'.$badgeStatus4;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_NEED_MORE_INFO]), 'data' => round($tick['needmoreinfo']));
- $colorseries[Ticket::STATUS_NEED_MORE_INFO] = '-'.$badgeStatus3;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_CANCELED]), 'data' => round($tick['canceled']));
- $colorseries[Ticket::STATUS_CANCELED] = $badgeStatus9;
- $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_CLOSED]), 'data' => round($tick['closed']));
- $colorseries[Ticket::STATUS_CLOSED] = $badgeStatus6;
+ while ($objp = $db->fetch_object($result)) {
+ $found = 0;
+ if ($objp->fk_statut == Ticket::STATUS_NOT_READ) {
+ $tick['unread'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_READ) {
+ $tick['read'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) {
+ $tick['needmoreinfo'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) {
+ $tick['assigned'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) {
+ $tick['inprogress'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_WAITING) {
+ $tick['waiting'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_CLOSED) {
+ $tick['closed'] = $objp->nb;
+ }
+ if ($objp->fk_statut == Ticket::STATUS_CANCELED) {
+ $tick['canceled'] = $objp->nb;
+ }
+ }
+
+ include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
+
+ $dataseries = array();
+ $colorseries = array();
+
+ $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
+ $colorseries[Ticket::STATUS_NOT_READ] = '-'.$badgeStatus0;
+ $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
+ $colorseries[Ticket::STATUS_READ] = $badgeStatus1;
+ $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
+ $colorseries[Ticket::STATUS_ASSIGNED] = $badgeStatus3;
+ $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
+ $colorseries[Ticket::STATUS_IN_PROGRESS] = $badgeStatus4;
+ $dataseries[] = array('label' => $langs->trans("Suspended"), 'data' => round($tick['waiting']));
+ $colorseries[Ticket::STATUS_WAITING] = '-'.$badgeStatus3;
+ $dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo']));
+ $colorseries[Ticket::STATUS_NEED_MORE_INFO] = $badgeStatus9;
+ $dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled']));
+ $colorseries[Ticket::STATUS_CANCELED] = $badgeStatus9;
+ $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
+ $colorseries[Ticket::STATUS_CLOSED] = $badgeStatus6;
@@ -232,4 +206,4 @@
- dol_print_error($db);
-}
-
-$stringtoshow = ' | |
|