Merge https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
a9e30e4f5c
@ -134,8 +134,7 @@ $head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
||||
print $langs->trans("OnlyActiveElementsAreShown", 'modules.php').'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("AgendaAutoActionDesc")." ".$langs->trans("OnlyActiveElementsAreShown", 'modules.php').'</span><br>';
|
||||
print "<br>\n";
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
|
||||
@ -140,7 +140,7 @@ $head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print $langs->trans("AgendaExtSitesDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ $head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AgendaSetupOtherDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -520,8 +520,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$arrayoftypes=array(
|
||||
'loadthirdparty'=>'LoadThirdPartyFromName',
|
||||
'loadandcreatethirdparty'=>'LoadThirdPartyFromNameOrCreate',
|
||||
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
|
||||
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
|
||||
'recordevent'=>'RecordEvent');
|
||||
if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
|
||||
if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty';
|
||||
|
||||
@ -181,7 +181,7 @@ $page_name = "TicketSetup";
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ $help_url = "FR:Module_Ticket";
|
||||
$page_name = "TicketSetup";
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans("TicketSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = ticketAdminPrepareHead();
|
||||
|
||||
@ -103,7 +103,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
|
||||
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
if (!empty($url_interface)) {
|
||||
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
|
||||
@ -113,7 +113,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
|
||||
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
if (!empty($topic_interface)) {
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
|
||||
@ -123,7 +123,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
|
||||
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
|
||||
if (!empty($mail_signature)) {
|
||||
if (!empty($text_home)) {
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
|
||||
@ -208,7 +208,7 @@ $page_name = "TicketSetup";
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ jQuery(document).ready(function() {
|
||||
print load_fiche_titre($langs->trans("Backup"), '', 'title_setup');
|
||||
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
|
||||
|
||||
print '<div class="center">';
|
||||
print '<div class="center opacitymedium">';
|
||||
print $langs->trans("BackupDesc", DOL_DATA_ROOT);
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -67,7 +67,7 @@ jQuery(document).ready(function() {
|
||||
|
||||
print load_fiche_titre($langs->trans("Restore"), '', 'title_setup');
|
||||
|
||||
print '<div class="center">';
|
||||
print '<div class="center opacitymedium">';
|
||||
print $langs->trans("RestoreDesc", DOL_DATA_ROOT);
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -137,7 +137,7 @@ $form = new Form($db);
|
||||
$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios';
|
||||
llxHeader('', $langs->trans("UsersSetup"), $help_url);
|
||||
|
||||
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("UsersSetup"), $linkback, 'title_setup');
|
||||
|
||||
|
||||
@ -183,8 +183,6 @@ print '<br>';
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
// Defini tableau def des modeles
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
|
||||
@ -136,6 +136,10 @@ if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOL
|
||||
{
|
||||
$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
|
||||
}
|
||||
if (! empty($conf->ticket->enabled) && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->rights->ticket->read)
|
||||
{
|
||||
$arrayresult['searchintotickets']=array('position'=>220, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
|
||||
}
|
||||
|
||||
|
||||
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
|
||||
|
||||
@ -1139,7 +1139,7 @@ class FormFile
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table width="100%" id="tablelines" class="'.(($useinecm && $useinecm != 6)?'liste noborder':'liste').'">'."\n";
|
||||
print '<table width="100%" id="tablelines" class="liste noborder nobottom">'."\n";
|
||||
|
||||
if (! empty($addfilterfields))
|
||||
{
|
||||
@ -1156,10 +1156,10 @@ class FormFile
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
|
||||
print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, ' left');
|
||||
print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, ' right');
|
||||
print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, ' center');
|
||||
if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, ' center'); // Preview
|
||||
print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, 'center '); // Preview
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('');
|
||||
if (! $disablemove) print_liste_field_titre('');
|
||||
@ -1734,7 +1734,7 @@ class FormFile
|
||||
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
|
||||
|
||||
print '<table width="100%" class="liste">';
|
||||
print '<table width="100%" class="liste noborder nobottom">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Links"),
|
||||
@ -1742,9 +1742,10 @@ class FormFile
|
||||
"name",
|
||||
"",
|
||||
$param,
|
||||
'class="left"',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
$sortorder,
|
||||
''
|
||||
);
|
||||
print_liste_field_titre(
|
||||
"",
|
||||
@ -1752,7 +1753,10 @@ class FormFile
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
'class="right"'
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'right '
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Date"),
|
||||
@ -1760,9 +1764,10 @@ class FormFile
|
||||
"date",
|
||||
"",
|
||||
$param,
|
||||
'class="center"',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
$sortorder,
|
||||
'center '
|
||||
);
|
||||
print_liste_field_titre(
|
||||
'',
|
||||
@ -1770,7 +1775,10 @@ class FormFile
|
||||
"",
|
||||
"",
|
||||
$param,
|
||||
'class="center"'
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'center '
|
||||
);
|
||||
print_liste_field_titre('', '', '');
|
||||
print '</tr>';
|
||||
|
||||
@ -167,6 +167,85 @@ class FormTicket
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Ref") . '</span></td><td><input size="18" type="text" name="ref" value="' . (GETPOST("ref", 'alpha') ? GETPOST("ref", 'alpha') : $defaultref) . '"></td></tr>';
|
||||
}
|
||||
|
||||
// TITLE
|
||||
if ($this->withemail) {
|
||||
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans("Email") . '</span></label></td><td>';
|
||||
print '<input class="text minwidth200" id="email" name="email" value="' . (GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $subject) . '" />';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Si origin du ticket
|
||||
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $this->param['origin'];
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) {
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||
$classname = ucfirst($subelement);
|
||||
$objectsrc = new $classname($this->db);
|
||||
$objectsrc->fetch(GETPOST('originid', 'int'));
|
||||
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
|
||||
$objectsrc->fetch_lines();
|
||||
}
|
||||
|
||||
$objectsrc->fetch_thirdparty();
|
||||
$newclassname = $classname;
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2"><input name="' . $subelement . 'id" value="' . GETPOST('originid') . '" type="hidden" />' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">' . $langs->trans("TicketTypeRequest") . '</span></label></td><td>';
|
||||
$this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity
|
||||
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">' . $langs->trans("TicketSeverity") . '</span></label></td><td>';
|
||||
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// Group
|
||||
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">' . $langs->trans("TicketGroup") . '</span></label></td><td>';
|
||||
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// Subject
|
||||
if ($this->withtitletopic) {
|
||||
print '<tr><td><label for="subject"><span class="fieldrequired">' . $langs->trans("Subject") . '</span></label></td><td>';
|
||||
|
||||
// Réponse à un ticket : affichage du titre du thread en readonly
|
||||
if ($this->withtopicreadonly) {
|
||||
print $langs->trans('SubjectAnswerToTicket') . ' ' . $this->topic_title;
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
if ($this->withthreadid > 0) {
|
||||
$subject = $langs->trans('SubjectAnswerToTicket') . ' ' . $this->withthreadid . ' : ' . $this->topic_title . '';
|
||||
}
|
||||
print '<input class="text" size="50" id="subject" name="subject" value="' . (GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject) . '" />';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// MESSAGE
|
||||
$msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
|
||||
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
|
||||
|
||||
// If public form, display more information
|
||||
$toolbarname = 'dolibarr_notes';
|
||||
if ($this->ispublic)
|
||||
{
|
||||
$toolbarname = 'dolibarr_details';
|
||||
print '<div class="warning">' . ($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')) . '</div>';
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$uselocalbrowser = true;
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
// FK_USER_CREATE
|
||||
if ($this->withusercreate > 0 && $this->fk_user_create) {
|
||||
print '<tr><td class="titlefield">' . $langs->trans("CreatedBy") . '</td><td>';
|
||||
@ -269,85 +348,6 @@ class FormTicket
|
||||
}
|
||||
}
|
||||
|
||||
// TITLE
|
||||
if ($this->withemail) {
|
||||
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans("Email") . '</span></label></td><td>';
|
||||
print '<input class="text minwidth200" id="email" name="email" value="' . (GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $subject) . '" />';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Si origin du ticket
|
||||
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $this->param['origin'];
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) {
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||
$classname = ucfirst($subelement);
|
||||
$objectsrc = new $classname($this->db);
|
||||
$objectsrc->fetch(GETPOST('originid', 'int'));
|
||||
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
|
||||
$objectsrc->fetch_lines();
|
||||
}
|
||||
|
||||
$objectsrc->fetch_thirdparty();
|
||||
$newclassname = $classname;
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2"><input name="' . $subelement . 'id" value="' . GETPOST('originid') . '" type="hidden" />' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">' . $langs->trans("TicketTypeRequest") . '</span></label></td><td>';
|
||||
$this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity
|
||||
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">' . $langs->trans("TicketSeverity") . '</span></label></td><td>';
|
||||
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// Group
|
||||
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">' . $langs->trans("TicketGroup") . '</span></label></td><td>';
|
||||
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
|
||||
print '</td></tr>';
|
||||
|
||||
// TITLE
|
||||
if ($this->withtitletopic) {
|
||||
print '<tr><td><label for="subject"><span class="fieldrequired">' . $langs->trans("Subject") . '</span></label></td><td>';
|
||||
|
||||
// Réponse à un ticket : affichage du titre du thread en readonly
|
||||
if ($this->withtopicreadonly) {
|
||||
print $langs->trans('SubjectAnswerToTicket') . ' ' . $this->topic_title;
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
if ($this->withthreadid > 0) {
|
||||
$subject = $langs->trans('SubjectAnswerToTicket') . ' ' . $this->withthreadid . ' : ' . $this->topic_title . '';
|
||||
}
|
||||
print '<input class="text" size="50" id="subject" name="subject" value="' . (GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject) . '" />';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// MESSAGE
|
||||
$msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
|
||||
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
|
||||
|
||||
// If public form, display more information
|
||||
$toolbarname = 'dolibarr_notes';
|
||||
if ($this->ispublic)
|
||||
{
|
||||
$toolbarname = 'dolibarr_details';
|
||||
print '<div class="warning">' . ($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')) . '</div>';
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$uselocalbrowser = true;
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->projet->enabled) && ! $this->ispublic)
|
||||
{
|
||||
$formproject=new FormProjets($this->db);
|
||||
@ -831,7 +831,8 @@ class FormTicket
|
||||
print '<table class="border" width="' . $width . '">';
|
||||
|
||||
// External users can't send message email
|
||||
if ($user->rights->ticket->write && !$user->socid) {
|
||||
if ($user->rights->ticket->write && !$user->socid)
|
||||
{
|
||||
print '<tr><td width="30%"></td><td colspan="2">';
|
||||
$checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : '');
|
||||
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
|
||||
|
||||
@ -6694,7 +6694,7 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
|
||||
return $cache_codes[$tablename][$key][$fieldid]; // Found in cache
|
||||
}
|
||||
|
||||
dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG);
|
||||
dol_syslog('dol_getIdFromCode (value for field '.$fieldid.' from key '.$key.' not found into cache)', LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT ".$fieldid." as valuetoget";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
|
||||
|
||||
@ -81,7 +81,6 @@ function ticket_prepare_head($object)
|
||||
$head[$h][2] = 'tabTicket';
|
||||
$h++;
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid))
|
||||
{
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
@ -96,9 +95,9 @@ function ticket_prepare_head($object)
|
||||
|
||||
// Attached files
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->ticket->dir_output . "/" . $object->track_id;
|
||||
$upload_dir = $conf->ticket->dir_output . "/" . $object->ref;
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files'));
|
||||
$head[$h][0] = dol_buildpath('/ticket/document.php', 1) . '?track_id=' . $object->track_id;
|
||||
$head[$h][0] = dol_buildpath('/ticket/document.php', 1) . '?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if ($nbFiles > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">' . $nbFiles . '</span>';
|
||||
@ -159,23 +158,30 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
|
||||
|
||||
print '<body id="mainbody" class="publicnewticketform" style="margin-top: 10px;">';
|
||||
|
||||
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) {
|
||||
// Print logo
|
||||
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
|
||||
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
|
||||
print '<center>';
|
||||
// Print logo
|
||||
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO))
|
||||
{
|
||||
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
|
||||
|
||||
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
|
||||
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode('logos/thumbs/'.$mysoc->logo_small);
|
||||
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
|
||||
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode('logos/'.$mysoc->logo);
|
||||
$width = 128;
|
||||
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
|
||||
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
|
||||
}
|
||||
print '<center>';
|
||||
print '<a href="' . ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket/index.php', 1)) . '"><img alt="Logo" id="logosubscribe" title="" src="' . $urllogo . '" style="max-width: 440px" /></a><br>';
|
||||
print '<strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
|
||||
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
|
||||
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode('logos/thumbs/'.$mysoc->logo_small);
|
||||
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
|
||||
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode('logos/'.$mysoc->logo);
|
||||
$width = 128;
|
||||
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
|
||||
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
|
||||
}
|
||||
print '<a href="' . ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket/index.php', 1)) . '"><img alt="Logo" id="logosubscribe" title="" src="' . $urllogo . '" style="max-width: 440px" /></a><br>';
|
||||
}
|
||||
if (! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC))
|
||||
{
|
||||
print '<strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
|
||||
}
|
||||
print '</center><br>';
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ class modTicket extends DolibarrModules
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->depends = array('modAgenda'); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
@ -285,7 +285,6 @@ class modTicket extends DolibarrModules
|
||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110121, 'ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110122, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1);", "ignoreerror" => 1),
|
||||
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110123, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
|
||||
array("sql" => "insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values ('','TICKETMESSAGE_SENTBYMAIL','Send email for ticket','Executed when a response is made on a ticket','ticket','');", "ignoreerror" => 1),
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
|
||||
@ -103,7 +103,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan=9;
|
||||
$colspan=13;
|
||||
if (! empty($conf->multicompany->enabled)) $colspan++;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="opacitymedium" colspan="'.$colspan.'">';
|
||||
|
||||
@ -63,7 +63,7 @@ $userstatic=new User($db);
|
||||
<!-- BEGIN PHP TEMPLATE CONTACTS -->
|
||||
<div class="underbanner clearboth"></div>
|
||||
<div class="div-table-responsive">
|
||||
<div class="tagtable centpercent noborder nobordertop allwidth">
|
||||
<div class="tagtable tableforcontact centpercent noborder nobordertop allwidth">
|
||||
|
||||
<?php
|
||||
if ($permission) {
|
||||
|
||||
@ -260,16 +260,34 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
|
||||
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
|
||||
<?php } else { ?>
|
||||
<td class="linecolht nowrap right"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
|
||||
<td class="linecolht nowrap right"><?php
|
||||
$coldisplay++;
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
print '<span class="classfortooltip" title="';
|
||||
print $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
|
||||
print '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_tva);
|
||||
if (price2num($line->total_localtax1)) print '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax1);
|
||||
if (price2num($line->total_localtax2)) print '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax2);
|
||||
print '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc);
|
||||
print '">';
|
||||
}
|
||||
print price($line->total_ht);
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
print '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
|
||||
<td class="linecolutotalht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_total_ht); ?></td>
|
||||
<td class="linecolutotalht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_total_ht); ?></td>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($outputalsopricetotalwithtax) { ?>
|
||||
<?php if ($outputalsopricetotalwithtax) { ?>
|
||||
<td class="linecolht nowrap right"><?php $coldisplay++; ?><?php echo price($line->total_ttc); ?></td>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
@ -786,7 +786,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
// TODO Merge all previous cases into this generic one
|
||||
else // $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
|
||||
{
|
||||
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function)
|
||||
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). Key can be set in agenda setup if defined into c_action_trigger
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda","other"));
|
||||
|
||||
|
||||
@ -1265,7 +1265,6 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Do operations
|
||||
foreach($this->actions as $operation)
|
||||
{
|
||||
@ -1381,7 +1380,15 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
elseif ($result == 0)
|
||||
{
|
||||
if ($operation['type'] == 'loadandcreatethirdparty')
|
||||
if ($operation['type'] == 'loadthirdparty')
|
||||
{
|
||||
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found");
|
||||
|
||||
$errorforactions++;
|
||||
$this->error = 'ErrorFailedToLoadThirdParty';
|
||||
$this->errors[] = 'ErrorFailedToLoadThirdParty';
|
||||
}
|
||||
elseif ($operation['type'] == 'loadandcreatethirdparty')
|
||||
{
|
||||
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found. We try to create it.");
|
||||
|
||||
@ -1408,10 +1415,6 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1476,7 +1479,7 @@ class EmailCollector extends CommonObject
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($actioncommn, $operation['actionparam'], $messagetext, $subject, $header);
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header);
|
||||
|
||||
if ($errorforthisaction)
|
||||
{
|
||||
@ -1566,10 +1569,10 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)
|
||||
if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0))
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref';
|
||||
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref with numbering template '.$modele;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1609,11 +1612,12 @@ class EmailCollector extends CommonObject
|
||||
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
|
||||
$descriptionfull = dol_concatdesc($descriptionfull, $header);
|
||||
|
||||
$tickettocreate->title = $subject;
|
||||
$tickettocreate->subject = $subject;
|
||||
$tickettocreate->message = $description;
|
||||
$tickettocreate->type_code = 0;
|
||||
$tickettocreate->category_code = 0;
|
||||
$tickettocreate->severity_code = 0;
|
||||
$tickettocreate->origin_email = $fromstring;
|
||||
$tickettocreate->origin_email = $from;
|
||||
$tickettocreate->fk_user_create = $user->id;
|
||||
$tickettocreate->entity = $conf->entity;
|
||||
$tickettocreate->datec = $date;
|
||||
|
||||
@ -37,4 +37,4 @@ $formfile->form_attach_new_file(
|
||||
1
|
||||
);
|
||||
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -109,7 +109,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',164);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',164);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',165);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',166);
|
||||
-- actions not enabled by default (no constant created for that) when we enable module agenda
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
|
||||
|
||||
@ -280,3 +280,7 @@ ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime;
|
||||
|
||||
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_HOVER' AND value = '0';
|
||||
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0';
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',164);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166);
|
||||
|
||||
|
||||
@ -1842,8 +1842,8 @@ CreateLeadAndThirdParty=Create lead (and third party if necessary)
|
||||
CreateTicketAndThirdParty=Create ticket (and third party if necessary)
|
||||
CodeLastResult=Latest result code
|
||||
NbOfEmailsInInbox=Number of emails in source directory
|
||||
LoadThirdPartyFromName=Load third party from name (load only)
|
||||
LoadThirdPartyFromNameOrCreate=Load third party from name (create if not found)
|
||||
LoadThirdPartyFromName=Load third party searching on %s (load only)
|
||||
LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found)
|
||||
WithDolTrackingID=Dolibarr Tracking ID found
|
||||
WithoutDolTrackingID=Dolibarr Tracking ID not found
|
||||
FormatZip=Zip
|
||||
|
||||
@ -95,6 +95,7 @@ PROJECT_MODIFYInDolibarr=Project %s modified
|
||||
PROJECT_DELETEInDolibarr=Project %s deleted
|
||||
TICKET_CREATEInDolibarr=Ticket %s created
|
||||
TICKET_MODIFYInDolibarr=Ticket %s modified
|
||||
TICKET_CLOSEInDolibarr=Ticket %s closed
|
||||
TICKET_DELETEInDolibarr=Ticket %s deleted
|
||||
##### End agenda events #####
|
||||
AgendaModelModule=Document templates for event
|
||||
|
||||
@ -942,6 +942,7 @@ SearchIntoContracts=Contracts
|
||||
SearchIntoCustomerShipments=Customer shipments
|
||||
SearchIntoExpenseReports=Expense reports
|
||||
SearchIntoLeaves=Leave
|
||||
SearchIntoTickets=Tickets
|
||||
CommentLink=Comments
|
||||
NbComments=Number of comments
|
||||
CommentPage=Comments space
|
||||
|
||||
@ -246,9 +246,10 @@ YourPasswordHasBeenReset=Your password has been reset successfully
|
||||
ApplicantIpAddress=IP address of applicant
|
||||
SMSSentTo=SMS sent to %s
|
||||
MissingIds=Missing ids
|
||||
ThirdPartyCreatedByEmailCollector=Third party created by email collector from email ID %s
|
||||
ContactCreatedByEmailCollector=Contact/address created by email collector from email ID %s
|
||||
ProjectCreatedByEmailCollector=Project created by email collector from email ID %s
|
||||
ThirdPartyCreatedByEmailCollector=Third party created by email collector from email MSGID %s
|
||||
ContactCreatedByEmailCollector=Contact/address created by email collector from email MSGID %s
|
||||
ProjectCreatedByEmailCollector=Project created by email collector from email MSGID %s
|
||||
TicketCreatedByEmailCollector=Ticket created by email collector from email MSGID %s
|
||||
|
||||
##### Export #####
|
||||
ExportsArea=Exports area
|
||||
|
||||
@ -53,7 +53,7 @@ TypeContact_ticket_external_SUPPORTCLI=Customer contact / incident tracking
|
||||
TypeContact_ticket_external_CONTRIBUTOR=External contributor
|
||||
|
||||
OriginEmail=Email source
|
||||
Notify_TICKETMESSAGE_SENTBYMAIL=Send ticket answer by email
|
||||
Notify_TICKET_SENTBYMAIL=Send ticket message by email
|
||||
|
||||
# Status
|
||||
NotRead=Not read
|
||||
@ -124,7 +124,7 @@ TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automaticall
|
||||
TicketNumberingModules=Tickets numbering module
|
||||
TicketNotifyTiersAtCreation=Notify third party at creation
|
||||
TicketGroup=Group
|
||||
TicketsDisableCustomerEmail=Alsways disable emails when a ticket is created from public interface
|
||||
TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface
|
||||
#
|
||||
# Index & list page
|
||||
#
|
||||
@ -152,7 +152,7 @@ TicketCategory=Analytic code
|
||||
SeeTicket=See ticket
|
||||
TicketMarkedAsRead=Ticket has been marked as read
|
||||
TicketReadOn=Read on
|
||||
TicketCloseOn=Clotured on
|
||||
TicketCloseOn=Closing date
|
||||
MarkAsRead=Mark ticket as read
|
||||
TicketHistory=Ticket history
|
||||
AssignUser=Assign to user
|
||||
@ -253,8 +253,8 @@ TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this emai
|
||||
TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system.
|
||||
TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request.
|
||||
TicketPublicMsgViewLogIn=Please enter ticket tracking ID
|
||||
TicketTrackId=Tracking ID
|
||||
OneOfTicketTrackId=One of yours tracking ID
|
||||
TicketTrackId=Public Tracking ID
|
||||
OneOfTicketTrackId=One of your tracking ID
|
||||
ErrorTicketNotFound=Ticket with tracking ID %s not found!
|
||||
Subject=Subject
|
||||
ViewTicket=View ticket
|
||||
@ -264,6 +264,7 @@ TicketNewEmailSubjectAdmin=New ticket created
|
||||
TicketNewEmailBodyAdmin=<p>Ticket has just been created with ID #%s, see information:</p>
|
||||
SeeThisTicketIntomanagementInterface=See ticket in management interface
|
||||
TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled
|
||||
ErrorEmailOrTrackingInvalid=Bad value for tracking ID or email
|
||||
|
||||
# notifications
|
||||
TicketNotificationEmailSubject=Ticket %s updated
|
||||
|
||||
@ -1903,11 +1903,11 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
||||
if (! is_object($form)) $form=new Form($db);
|
||||
$selected=-1;
|
||||
$usedbyinclude=1;
|
||||
$arrayresult=null;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM))
|
||||
{
|
||||
//$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
|
||||
$searchform.=$form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY)?1:0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
|
||||
}
|
||||
else
|
||||
|
||||
@ -370,10 +370,10 @@ $objecttmp=new MyObject($db);
|
||||
$trackid='xxxx'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -190,10 +190,10 @@ class Project extends CommonObject
|
||||
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) && ! $this->socid > 0)
|
||||
if (! empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) && ! ($this->socid > 0))
|
||||
{
|
||||
$this->error = 'ErrorFieldsRequired';
|
||||
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create error -1 thirdparty not defined and option PROJECT_THIRDPARTY_REQUIRED is set", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ if (isset($_SESSION['email_customer'])) {
|
||||
$email = $_SESSION['email_customer'];
|
||||
}
|
||||
|
||||
$object = new ActionsTicket($db);
|
||||
$object = new Ticket($db);
|
||||
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ if ($action == "view_ticketlist") {
|
||||
} else {
|
||||
if (!isValidEmail($email)) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorEmailInvalid"));
|
||||
array_push($object->errors, $langs->trans("ErrorEmailOrTrackingInvalid"));
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -91,9 +91,9 @@ if ($action == "view_ticketlist") {
|
||||
if (!$error) {
|
||||
$ret = $object->fetch('', '', $track_id);
|
||||
|
||||
if ($ret && $object->dao->id > 0) {
|
||||
if ($ret && $object->id > 0) {
|
||||
// vérifie si l'adresse email est bien dans les contacts du ticket
|
||||
$contacts = $object->dao->liste_contact(-1, 'external');
|
||||
$contacts = $object->liste_contact(-1, 'external');
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['email'] == $email) {
|
||||
$display_ticket_list = true;
|
||||
@ -104,12 +104,24 @@ if ($action == "view_ticketlist") {
|
||||
$display_ticket_list = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->dao->fk_soc > 0) {
|
||||
$object->dao->fetch_thirdparty();
|
||||
if ($object->fk_soc > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
if ($email == $object->thirdparty->email) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($email == $object->dao->origin_email || $email == $object->dao->thirdparty->email) {
|
||||
if ($object->fk_user_create > 0) {
|
||||
$tmpuser=new User($db);
|
||||
$tmpuser->fetch($object->fk_user_create);
|
||||
if ($email == $tmpuser->email) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
}
|
||||
}
|
||||
if ($email == $object->origin_email) {
|
||||
$display_ticket_list = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
$_SESSION['track_id_customer'] = $track_id;
|
||||
@ -127,7 +139,7 @@ if ($action == "view_ticketlist") {
|
||||
}
|
||||
}
|
||||
|
||||
$object->doActions($action);
|
||||
//$object->doActions($action);
|
||||
|
||||
|
||||
|
||||
@ -138,10 +150,11 @@ $object->doActions($action);
|
||||
$form = new Form($db);
|
||||
$user_assign = new User($db);
|
||||
$user_create = new User($db);
|
||||
$formticket = new FormTicket($db);
|
||||
$formTicket = new FormTicket($db);
|
||||
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array('/ticket/css/styles.css.php');
|
||||
|
||||
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
|
||||
@ -154,7 +167,6 @@ print '<div style="margin: 0 auto; width:60%">';
|
||||
|
||||
if ($action == "view_ticketlist")
|
||||
{
|
||||
|
||||
if ($display_ticket_list) {
|
||||
// Filters
|
||||
$search_fk_status = GETPOST("search_fk_status", 'alpha');
|
||||
@ -185,7 +197,7 @@ if ($action == "view_ticketlist")
|
||||
$search_array_options = $extrafields->getOptionalsFromPost('ticket', '', 'search_');
|
||||
|
||||
$filter = array();
|
||||
$param = '';
|
||||
$param = 'action=view_ticketlist';
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array(
|
||||
@ -247,12 +259,10 @@ if ($action == "view_ticketlist")
|
||||
$param .= '&search_fk_user_create=' . $search_fk_user_create;
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($search_fk_status) && $search_fk_status != '') && $search_fk_status != '-1' && $search_fk_status != 'non_closed') {
|
||||
$filter['t.fk_statut'] = $search_fk_status;
|
||||
$param .= '&search_fk_status=' . $search_fk_status;
|
||||
}
|
||||
|
||||
if (isset($search_fk_status) && $search_fk_status == 'non_closed') {
|
||||
$filter['t.fk_statut'] = array(0, 1, 3, 4, 5, 6);
|
||||
$param .= '&search_fk_status=non_closed';
|
||||
@ -266,7 +276,6 @@ if ($action == "view_ticketlist")
|
||||
if (!$sortfield) {
|
||||
$sortfield = 't.datec';
|
||||
}
|
||||
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
}
|
||||
@ -361,9 +370,7 @@ if ($action == "view_ticketlist")
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($langs->trans('TicketList'), $page, 'public/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
|
||||
|
||||
/*
|
||||
* Search bar
|
||||
*/
|
||||
// Search bar
|
||||
print '<form method="get" action="' . $url_form . '" id="searchFormList" >' . "\n";
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
@ -388,9 +395,6 @@ if ($action == "view_ticketlist")
|
||||
if (!empty($arrayfields['t.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.ref']['label'], $url_page_current, 't.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.fk_statut']['label'], $url_page_current, 't.fk_statut', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['t.subject']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.subject']['label']);
|
||||
}
|
||||
@ -424,13 +428,15 @@ if ($action == "view_ticketlist")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.fk_statut']['label'], $url_page_current, 't.fk_statut', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
* Filter bar
|
||||
*/
|
||||
$formTicket = new FormTicket($db);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -449,14 +455,6 @@ if ($action == "view_ticketlist")
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
|
||||
// Status
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$selected = ($search_fk_status != "non_closed" ? $search_fk_status : '');
|
||||
//$object->printSelectStatus($selected);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.subject']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_subject" value="' . $search_subject . '" size="20">';
|
||||
@ -506,6 +504,14 @@ if ($action == "view_ticketlist")
|
||||
}
|
||||
}
|
||||
|
||||
// Status
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$selected = ($search_fk_status != "non_closed" ? $search_fk_status : '');
|
||||
//$object->printSelectStatus($selected);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre nowraponall right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
@ -537,21 +543,13 @@ if ($action == "view_ticketlist")
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// ref
|
||||
// Ref
|
||||
if (!empty($arrayfields['t.ref']['checked'])) {
|
||||
print '<td>';
|
||||
print $obj->ref;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Statut
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print '<td>';
|
||||
$object->fk_statut = $obj->fk_statut;
|
||||
print $object->getLibStatut(2);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Subject
|
||||
if (!empty($arrayfields['t.subject']['checked'])) {
|
||||
print '<td>';
|
||||
@ -635,7 +633,17 @@ if ($action == "view_ticketlist")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Statut
|
||||
if (!empty($arrayfields['t.fk_statut']['checked'])) {
|
||||
print '<td>';
|
||||
$object->fk_statut = $obj->fk_statut;
|
||||
print $object->getLibStatut(2);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
$i++;
|
||||
print '</tr>';
|
||||
}
|
||||
@ -670,7 +678,7 @@ if ($action == "view_ticketlist")
|
||||
print '<form method="post" name="form_view_ticketlist" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||
//print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||
|
||||
print '<p><label for="track_id" style="display: inline-block; width: 30%; "><span class="fieldrequired">' . $langs->trans("OneOfTicketTrackId") . '</span></label>';
|
||||
print '<input size="30" id="track_id" name="track_id" value="' . (GETPOST('track_id', 'alpha') ? GETPOST('track_id', 'alpha') : '') . '" />';
|
||||
|
||||
@ -118,7 +118,8 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
$object->doActions($action);
|
||||
|
||||
//$object->doActions($action);
|
||||
|
||||
|
||||
|
||||
@ -261,7 +262,7 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">';
|
||||
print '<input type="hidden" name="email" value="'.$_SESSION['email_customer'].'">';
|
||||
print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||
//print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||
print "</form>\n";
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -2631,9 +2631,6 @@ tr.liste_titre_filter td.liste_titre {
|
||||
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
|
||||
border-top-style: solid;
|
||||
}
|
||||
/*.liste_titre_create td.nobottom, tr#trlinefordates td {
|
||||
background-color: rgb(<?php echo $colorbacktitle1; ?>) !important;
|
||||
}*/
|
||||
tr#trlinefordates td {
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
@ -2932,6 +2929,9 @@ form.pair, form.impair {
|
||||
form.tagtr:last-of-type div.tagtd, tr.pair:last-of-type td, tr.impair:last-of-type td {
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
div.tableforcontact form.tagtr:last-of-type div.tagtd {
|
||||
border-bottom: 1px solid #ddd !important;
|
||||
}
|
||||
tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td {
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
@ -2939,6 +2939,9 @@ table.nobottomiftotal tr.liste_total td {
|
||||
background-color: #fff;
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
table.nobottom {
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
div.liste_titre .tagtd {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
BIN
htdocs/theme/eldy/img/object_bom.png
Normal file
BIN
htdocs/theme/eldy/img/object_bom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 548 B |
BIN
htdocs/theme/md/img/object_bom.png
Normal file
BIN
htdocs/theme/md/img/object_bom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 548 B |
@ -123,8 +123,430 @@ if ($cancel)
|
||||
$action='view';
|
||||
}
|
||||
|
||||
// Do action
|
||||
$actionobject->doActions($action, $object);
|
||||
if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
if (!GETPOST("subject", 'alpha')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif (!GETPOST("message", 'alpha')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$object->ref = GETPOST("ref", 'alpha');
|
||||
$object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0;
|
||||
$object->subject = GETPOST("subject", 'alpha');
|
||||
$object->message = GETPOST("message", 'none');
|
||||
|
||||
$object->type_code = GETPOST("type_code", 'alpha');
|
||||
$object->category_code = GETPOST("category_code", 'alpha');
|
||||
$object->severity_code = GETPOST("severity_code", 'alpha');
|
||||
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
|
||||
$object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
|
||||
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
setEventMessage($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Add contact
|
||||
$contactid = GETPOST('contactid', 'int');
|
||||
$type_contact = GETPOST("type", 'alpha');
|
||||
|
||||
if ($contactid > 0 && $type_contact) {
|
||||
$result = $object->add_contact($contactid, GETPOST("type"), 'external');
|
||||
}
|
||||
|
||||
// altairis: link ticket to project
|
||||
if (GETPOST('projectid') > 0) {
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
// Auto assign user
|
||||
if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) {
|
||||
$result = $object->assignUser($user, $user->id, 1);
|
||||
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
|
||||
}
|
||||
|
||||
// Auto assign contrat
|
||||
$contractid = 0;
|
||||
if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) {
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->socid = $object->fk_soc;
|
||||
$list = $contrat->getListOfContracts();
|
||||
|
||||
if (is_array($list) && !empty($list)) {
|
||||
if (count($list) == 1) {
|
||||
$contractid = $list[0]->id;
|
||||
$object->setContract($contractid);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto create fiche intervention
|
||||
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->socid = $object->fk_soc;
|
||||
$fichinter->fk_project = GETPOST('projectid', 'int');
|
||||
$fichinter->fk_contrat = $contractid;
|
||||
$fichinter->author = $user->id;
|
||||
$fichinter->modelpdf = 'soleil';
|
||||
$fichinter->origin = $object->element;
|
||||
$fichinter->origin_id = $object->id;
|
||||
|
||||
// Extrafields
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($fichinter->table_element);
|
||||
$array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
|
||||
$fichinter->array_options = $array_options;
|
||||
|
||||
$id = $fichinter->create($user);
|
||||
if ($id <= 0) {
|
||||
setEventMessages($fichinter->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// File transfer
|
||||
$object->copyFilesForTicket();
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?track_id=' . $object->track_id;
|
||||
}
|
||||
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit' && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
if ($object->fetch(GETPOST('id')) < 0) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$_GET["action"] = $_POST["action"] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('update') && GETPOST('id') && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
$ret = $object->fetch(GETPOST('id'));
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
} elseif (!GETPOST("label")) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")));
|
||||
$action = 'edit';
|
||||
} elseif (!GETPOST("subject")) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$object->label = GETPOST("label");
|
||||
$object->description = GETPOST("description");
|
||||
|
||||
//...
|
||||
$ret = $object->update($user);
|
||||
if ($ret <= 0) {
|
||||
$error++;
|
||||
setEventMessage($object->error, $object->errors, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!$error && $ret > 0) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "mark_ticket_read" && $user->rights->ticket->write) {
|
||||
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
||||
|
||||
if ($object->markAsRead($user) > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
|
||||
|
||||
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
if ($action == "assign_user" && GETPOST('btn_assign_user', 'aplha') && $user->rights->ticket->write) {
|
||||
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
||||
$useroriginassign = $object->fk_user_assign;
|
||||
$usertoassign = GETPOST('fk_user_assign', 'int');
|
||||
|
||||
/*if (! ($usertoassign > 0)) {
|
||||
$error++;
|
||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("AssignedTo")));
|
||||
$action = 'view';
|
||||
}*/
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$ret = $object->assignUser($user, $usertoassign);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
foreach ($internal_contacts as $key => $contact) {
|
||||
if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) {
|
||||
}
|
||||
{
|
||||
//print "user à effacer : ".$useroriginassign;
|
||||
$object->delete_contact($contact['rowid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
|
||||
|
||||
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
||||
exit;
|
||||
} else {
|
||||
array_push($object->errors, $object->error);
|
||||
}
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
if ($action == "new_message" && GETPOST('btn_add_message') && $user->rights->ticket->read) {
|
||||
$ret = $object->newMessage($user, $action);
|
||||
if ($ret) {
|
||||
if (!empty($backtopage)) {
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
}
|
||||
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
$action = 'add_message';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "new_public_message" && GETPOST('btn_add_message')) {
|
||||
$object->newMessagePublic($user, $action);
|
||||
}
|
||||
|
||||
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write)
|
||||
{
|
||||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||
|
||||
if ($object->close($user)) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogClosedBy', $user->getFullName($langs));
|
||||
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha');
|
||||
header("Location: " . $url);
|
||||
} else {
|
||||
$action = '';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') {
|
||||
$object->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']);
|
||||
|
||||
setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
|
||||
|
||||
$url = 'view.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha');
|
||||
header("Location: " . $url);
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticket->delete) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
if ($object->delete($user) > 0) {
|
||||
setEventMessages('<div class="confirm">' . $langs->trans('TicketDeletedSuccess') . '</div>', null, 'mesgs');
|
||||
Header("Location: ".DOL_URL_ROOT."/ticket/list.php");
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">' . $langs->trans($object->error) . '</div>';
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set parent company
|
||||
if ($action == 'set_thirdparty' && $user->rights->societe->creer) {
|
||||
if ($object->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);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_progression' && $user->rights->ticket->write) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$result = $object->setProgression(GETPOST('progress', 'alpha'));
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setsubject') {
|
||||
if ($object->fetch(GETPOST('id', 'int'))) {
|
||||
if ($action == 'setsubject') {
|
||||
$object->subject = trim(GETPOST('subject', 'alpha'));
|
||||
}
|
||||
|
||||
if ($action == 'setsubject' && empty($object->subject)) {
|
||||
$mesg .= ($mesg ? '<br>' : '') . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"));
|
||||
}
|
||||
|
||||
if (!$mesg) {
|
||||
if ($object->update($user) >= 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $object->track_id);
|
||||
exit;
|
||||
}
|
||||
$mesg = $object->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
// prevent browser refresh from reopening ticket several times
|
||||
if ($object->fk_statut == Ticket::STATUS_CLOSED) {
|
||||
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogReopen');
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Categorisation dans projet
|
||||
elseif ($action == 'classin' && $user->rights->ticket->write) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
} // Categorisation dans contrat
|
||||
elseif ($action == 'setcontract' && $user->rights->ticket->write) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setContract(GETPOST('contractid', 'int'));
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == "set_message" && $user->rights->ticket->manage) {
|
||||
// altairis: manage cancel button
|
||||
if (!GETPOST('cancel')) {
|
||||
$object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$oldvalue_message = $object->message;
|
||||
$fieldtomodify = GETPOST('message_initial');
|
||||
|
||||
$object->message = $fieldtomodify;
|
||||
$ret = $object->update($user);
|
||||
if ($ret > 0) {
|
||||
$log_action = $langs->trans('TicketInitialMessageModified') . " \n";
|
||||
// include the Diff class
|
||||
dol_include_once('/ticket/class/utils_diff.class.php');
|
||||
// output the result of comparing two files as plain text
|
||||
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
|
||||
|
||||
setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
$action = 'view';
|
||||
} // Reopen ticket
|
||||
elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) {
|
||||
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$new_status = GETPOST('new_status', 'int');
|
||||
$old_status = $object->fk_statut;
|
||||
$res = $object->setStatut($new_status);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status]));
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update one extrafield
|
||||
if ($action == "update_extras" && ! empty($permissiontoadd))
|
||||
@ -164,9 +586,21 @@ if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') &
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
|
||||
$permissiondellink = $user->rights->ticket->write;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->ticket->dir_output;
|
||||
$permissioncreate = $user->rights->ticket->write;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='TICKET_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
|
||||
$trackid='tic'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
|
||||
@ -184,7 +618,7 @@ $page_title = $actionobject->getTitle($action);
|
||||
|
||||
llxHeader('', $page_title, $help_url);
|
||||
|
||||
if ($action == 'create')
|
||||
if ($action == 'create' || $action == 'presend')
|
||||
{
|
||||
$formticket = new FormTicket($db);
|
||||
|
||||
@ -210,7 +644,6 @@ if ($action == 'create')
|
||||
if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|
||||
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink')
|
||||
{
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
// or for unauthorized internals users
|
||||
@ -525,12 +958,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
$actionobject->viewTicketOriginalMessage($user, $action, $object);
|
||||
|
||||
|
||||
/***************************************************
|
||||
*
|
||||
* Classification and actions on ticket
|
||||
*
|
||||
***************************************************/
|
||||
|
||||
// Classification of ticket
|
||||
print '<form method="post" name="formticketproperties" action="' . $url_page_current . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="change_property">';
|
||||
@ -557,19 +985,14 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
print '</tr>';
|
||||
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
|
||||
print '<tr>';
|
||||
// Type
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans('TicketChangeType');
|
||||
print '</td><td>';
|
||||
print $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $langs->trans('TicketChangeSeverity');
|
||||
print '</td><td>';
|
||||
print $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Group
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $langs->trans('TicketChangeCategory');
|
||||
@ -577,6 +1000,14 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
print $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Severity
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $langs->trans('TicketChangeSeverity');
|
||||
print '</td><td>';
|
||||
print $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
// Type
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Type") . '</td><td>';
|
||||
@ -585,15 +1016,6 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity
|
||||
print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>';
|
||||
print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label');
|
||||
/*if ($user->admin && !$noadmininfo) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Group
|
||||
print '<tr><td>' . $langs->trans("TicketGroup") . '</td><td>';
|
||||
print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label');
|
||||
@ -601,6 +1023,13 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
// Severity
|
||||
print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>';
|
||||
print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label');
|
||||
/*if ($user->admin && !$noadmininfo) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>'; // End table actions
|
||||
|
||||
@ -781,7 +1210,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'delete' || $action == 'edit_message_init')
|
||||
if ($action != 'add_message')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
@ -801,7 +1230,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
print '</div><!-- fichecenter -->';
|
||||
print '<br style="clear: both">';
|
||||
}
|
||||
elseif ($action == 'add_message')
|
||||
else
|
||||
{
|
||||
$action='new_message';
|
||||
$modelmail='ticket_send';
|
||||
|
||||
@ -102,849 +102,6 @@ class ActionsTicket
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doActions
|
||||
*
|
||||
* @param string $action Action type
|
||||
* @param Ticket $object Object Ticket
|
||||
* @return int 0
|
||||
*/
|
||||
public function doActions(&$action = '', Ticket $object = null)
|
||||
{
|
||||
global $conf, $user, $langs, $mysoc;
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (GETPOST('addfile', 'alpha')) {
|
||||
// altairis : allow files from public interface
|
||||
if (GETPOST('track_id', 'alpha')) {
|
||||
$res = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
}
|
||||
|
||||
////if($res > 0)
|
||||
////{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp directory TODO Use a dedicated directory for temp mails files
|
||||
$vardir = $conf->ticket->dir_output . (!empty($object->track_id) ? '/' . dol_sanitizeFileName($object->track_id) : '');
|
||||
$upload_dir_tmp = $vardir . '/temp';
|
||||
if (!dol_is_dir($upload_dir_tmp)) {
|
||||
dol_mkdir($upload_dir_tmp);
|
||||
}
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '-__file__');
|
||||
$action = !empty($object->track_id) ? 'add_message' : 'create';
|
||||
////}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
if (GETPOST('removedfile', 'alpha')) {
|
||||
// altairis : allow files from public interface
|
||||
if (GETPOST('track_id')) {
|
||||
$res = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
}
|
||||
|
||||
////if($res > 0)
|
||||
////{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp directory
|
||||
$vardir = $conf->ticket->dir_output . (!empty($object->track_id) ? '/' . dol_sanitizeFileName($object->track_id) : '');
|
||||
$upload_dir_tmp = $vardir . '/temp';
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process($_POST['removedfile'], 0);
|
||||
$action = !empty($object->track_id) ? 'add_message' : 'create';
|
||||
////}
|
||||
}
|
||||
|
||||
if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
if (!GETPOST("subject")) {
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"));
|
||||
$action = 'create';
|
||||
} elseif (!GETPOST("message")) {
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("message"));
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->db->begin();
|
||||
|
||||
$object->track_id = generate_random_id(16);
|
||||
|
||||
$object->ref = GETPOST("ref", 'alpha');
|
||||
$object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0;
|
||||
$object->subject = GETPOST("subject", 'alpha');
|
||||
$object->message = GETPOST("message");
|
||||
|
||||
$object->type_code = GETPOST("type_code", 'alpha');
|
||||
$object->category_code = GETPOST("category_code", 'alpha');
|
||||
$object->severity_code = GETPOST("severity_code", 'alpha');
|
||||
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
|
||||
$object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
|
||||
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error && $id > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
// File transfer
|
||||
$this->copyFilesForTicket();
|
||||
|
||||
// Add contact
|
||||
$contactid = GETPOST('contactid', 'int');
|
||||
$type_contact = GETPOST("type", 'alpha');
|
||||
|
||||
if ($contactid > 0 && $type_contact) {
|
||||
$result = $object->add_contact($contactid, GETPOST("type"), 'external');
|
||||
}
|
||||
|
||||
// altairis: link ticket to project
|
||||
if (GETPOST('projectid') > 0) {
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
// Auto assign user
|
||||
if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) {
|
||||
$result = $object->assignUser($user, $user->id, 1);
|
||||
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
|
||||
}
|
||||
|
||||
// Auto assign contrat
|
||||
$contractid = 0;
|
||||
if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) {
|
||||
$contrat = new Contrat($this->db);
|
||||
$contrat->socid = $object->fk_soc;
|
||||
$list = $contrat->getListOfContracts();
|
||||
|
||||
if (is_array($list) && !empty($list)) {
|
||||
if (count($list) == 1) {
|
||||
$contractid = $list[0]->id;
|
||||
$object->setContract($contractid);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto create fiche intervention
|
||||
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)
|
||||
{
|
||||
$fichinter = new Fichinter($this->db);
|
||||
$fichinter->socid = $object->fk_soc;
|
||||
$fichinter->fk_project = GETPOST('projectid', 'int');
|
||||
$fichinter->fk_contrat = $contractid;
|
||||
$fichinter->author = $user->id;
|
||||
$fichinter->modelpdf = 'soleil';
|
||||
$fichinter->origin = $object->element;
|
||||
$fichinter->origin_id = $object->id;
|
||||
|
||||
// Extrafields
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($fichinter->table_element);
|
||||
$array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
|
||||
$fichinter->array_options = $array_options;
|
||||
|
||||
$id = $fichinter->create($user);
|
||||
if ($id <= 0) {
|
||||
setEventMessages($fichinter->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?track_id=' . $object->track_id;
|
||||
}
|
||||
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit' && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
if ($object->fetch(GETPOST('id')) < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$_GET["action"] = $_POST["action"] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('update') && GETPOST('id') && $user->rights->ticket->write) {
|
||||
$error = 0;
|
||||
|
||||
$ret = $object->fetch(GETPOST('id'));
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
} elseif (!GETPOST("label")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")));
|
||||
$action = 'edit';
|
||||
} elseif (!GETPOST("subject")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->db->begin();
|
||||
|
||||
$object->label = GETPOST("label");
|
||||
$object->description = GETPOST("description");
|
||||
|
||||
//...
|
||||
$ret = $object->update($user);
|
||||
if ($ret <= 0) {
|
||||
$error++;
|
||||
$this->errors = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!$error && $ret > 0) {
|
||||
$this->db->commit();
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "mark_ticket_read" && $user->rights->ticket->write) {
|
||||
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
||||
|
||||
if ($object->markAsRead($user) > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
|
||||
|
||||
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
||||
exit;
|
||||
} else {
|
||||
$this->errors = $object->error;
|
||||
$this->error = $object->error;
|
||||
}
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
if ($action == "assign_user" && GETPOST('btn_assign_user', 'aplha') && $user->rights->ticket->write) {
|
||||
$object->fetch('', '', GETPOST("track_id", 'alpha'));
|
||||
$useroriginassign = $object->fk_user_assign;
|
||||
$usertoassign = GETPOST('fk_user_assign', 'int');
|
||||
|
||||
/*if (! ($usertoassign > 0)) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("AssignedTo")));
|
||||
$action = 'view';
|
||||
}*/
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$ret = $object->assignUser($user, $usertoassign);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
foreach ($internal_contacts as $key => $contact) {
|
||||
if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) {
|
||||
}
|
||||
{
|
||||
//print "user à effacer : ".$useroriginassign;
|
||||
$object->delete_contact($contact['rowid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
|
||||
|
||||
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
|
||||
exit;
|
||||
} else {
|
||||
array_push($this->errors, $object->error);
|
||||
}
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
if ($action == "new_message" && GETPOST('btn_add_message') && $user->rights->ticket->read) {
|
||||
$ret = $this->newMessage($user, $action);
|
||||
if ($ret) {
|
||||
if (!empty($backtopage)) {
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
}
|
||||
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
$action = 'add_message';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "new_public_message" && GETPOST('btn_add_message')) {
|
||||
$this->newMessagePublic($user, $action);
|
||||
}
|
||||
|
||||
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) {
|
||||
$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));
|
||||
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha');
|
||||
header("Location: " . $url);
|
||||
} else {
|
||||
$action = '';
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') {
|
||||
$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']);
|
||||
|
||||
setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
|
||||
|
||||
$url = 'view.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha');
|
||||
header("Location: " . $url);
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticket->delete) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
if ($object->delete($user) > 0) {
|
||||
setEventMessages('<div class="confirm">' . $langs->trans('TicketDeletedSuccess') . '</div>', null, 'mesgs');
|
||||
Header("Location: ".DOL_URL_ROOT."/ticket/list.php");
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">' . $langs->trans($this->error) . '</div>';
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set parent company
|
||||
if ($action == 'set_thirdparty' && $user->rights->societe->creer) {
|
||||
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);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_progression' && $user->rights->ticket->write) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$result = $object->setProgression(GETPOST('progress', 'alpha'));
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setsubject') {
|
||||
if ($this->fetch(GETPOST('id', 'int'))) {
|
||||
if ($action == 'setsubject') {
|
||||
$object->subject = trim(GETPOST('subject', 'alpha'));
|
||||
}
|
||||
|
||||
if ($action == 'setsubject' && empty($object->subject)) {
|
||||
$mesg .= ($mesg ? '<br>' : '') . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"));
|
||||
}
|
||||
|
||||
if (!$mesg) {
|
||||
if ($object->update($user) >= 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $object->track_id);
|
||||
exit;
|
||||
}
|
||||
$mesg = $object->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
// prevent browser refresh from reopening ticket several times
|
||||
if ($object->fk_statut == Ticket::STATUS_CLOSED) {
|
||||
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogReopen');
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Categorisation dans projet
|
||||
elseif ($action == 'classin' && $user->rights->ticket->write) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
} // Categorisation dans contrat
|
||||
elseif ($action == 'setcontract' && $user->rights->ticket->write) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setContract(GETPOST('contractid', 'int'));
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == "set_message" && $user->rights->ticket->manage) {
|
||||
// altairis: manage cancel button
|
||||
if (!GETPOST('cancel')) {
|
||||
$this->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$oldvalue_message = $object->message;
|
||||
$fieldtomodify = GETPOST('message_initial');
|
||||
|
||||
$object->message = $fieldtomodify;
|
||||
$ret = $object->update($user);
|
||||
if ($ret > 0) {
|
||||
$log_action = $langs->trans('TicketInitialMessageModified') . " \n";
|
||||
// include the Diff class
|
||||
dol_include_once('/ticket/class/utils_diff.class.php');
|
||||
// output the result of comparing two files as plain text
|
||||
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
|
||||
|
||||
setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
$action = 'view';
|
||||
} // Reopen ticket
|
||||
elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) {
|
||||
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$new_status = GETPOST('new_status', 'int');
|
||||
$old_status = $object->fk_statut;
|
||||
$res = $object->setStatut($new_status);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status]));
|
||||
|
||||
$url = 'card.php?action=view&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new message on a ticket (private area)
|
||||
*
|
||||
* @param User $user User for action
|
||||
* @param string $action Action string
|
||||
* @return int
|
||||
*/
|
||||
private function newMessage($user, &$action)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
if (!class_exists('Contact')) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
}
|
||||
|
||||
$contactstatic = new Contact($this->db);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$object = new Ticket($this->db);
|
||||
$ret = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (!GETPOST("message")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object->message = GETPOST("message");
|
||||
$object->private = GETPOST("private_message");
|
||||
$send_email = GETPOST('send_email', 'int');
|
||||
|
||||
$id = $object->createTicketMessage($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->errors = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error && $id > 0) {
|
||||
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
|
||||
|
||||
/*
|
||||
* Send email to linked contacts
|
||||
*/
|
||||
if ($send_email > 0) {
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
|
||||
// altairis: set default subject
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message_intro = $langs->trans('TicketNotificationEmailBody', "#" . $object->id);
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroText');
|
||||
$message .= "\n\n";
|
||||
$message .= GETPOST('message');
|
||||
|
||||
// Coordonnées client
|
||||
$message .= "\n\n";
|
||||
$message .= "==============================================\n";
|
||||
$message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
||||
$message .= !empty($object->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||
$message .= !empty($object->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||
|
||||
// Build array to display recipient list
|
||||
foreach ($internal_contacts as $key => $info_sendto) {
|
||||
// altairis: avoid duplicate notifications
|
||||
if ($info_sendto['id'] == $user->id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($info_sendto['email'] != '') {
|
||||
if(!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
|
||||
//Contact type
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
}
|
||||
$message .= "\n";
|
||||
// URL ticket
|
||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||
|
||||
// altairis: make html link on url
|
||||
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . '<a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>' . "\n";
|
||||
|
||||
// Add global email address recipient
|
||||
// altairis: use new TICKET_NOTIFICATION_EMAIL_TO configuration variable
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
|
||||
// altairis: dont try to send email if no recipient
|
||||
if (!empty($sendto)) {
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Email for externals users if not private
|
||||
*/
|
||||
if (empty($object->private)) {
|
||||
// Retrieve email of all contacts (external)
|
||||
$external_contacts = $object->getInfosTicketExternalContact();
|
||||
|
||||
// If no contact, get email from thirdparty
|
||||
if (is_array($external_contacts) && count($external_contacts) === 0) {
|
||||
if (!empty($object->fk_soc)) {
|
||||
$object->fetch_thirdparty($object->fk_soc);
|
||||
$array_company = array(array('firstname' => '', 'lastname' => $object->thirdparty->name, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
|
||||
$external_contacts = array_merge($external_contacts, $array_company);
|
||||
} elseif (empty($object->fk_soc) && !empty($object->origin_email)) {
|
||||
$array_external = array(array('firstname' => '', 'lastname' => $object->origin_email, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
|
||||
$external_contacts = array_merge($external_contacts, $array_external);
|
||||
}
|
||||
}
|
||||
|
||||
$sendto = array();
|
||||
if (is_array($external_contacts) && count($external_contacts) > 0) {
|
||||
// altairis: get default subject for email to external contacts
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
// We put intro after
|
||||
$message = GETPOST('message');
|
||||
$message .= "\n\n";
|
||||
|
||||
foreach ($external_contacts as $key => $info_sendto) {
|
||||
// altairis: avoid duplicate emails to external contacts
|
||||
if ($info_sendto['id'] == $user->contactid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
|
||||
if(!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
}
|
||||
|
||||
// If public interface is not enable, use link to internal page into mail
|
||||
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
|
||||
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ?
|
||||
$conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' :
|
||||
dol_buildpath('/public/ticket/view.php', 2)
|
||||
) :
|
||||
dol_buildpath('/ticket/card.php', 2)
|
||||
) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
|
||||
|
||||
// Build final message
|
||||
$message = $message_intro . $message;
|
||||
|
||||
// Add signature
|
||||
$message .= '<br>' . $message_signature;
|
||||
|
||||
if (!empty($object->origin_email)) {
|
||||
$sendto[] = $object->origin_email;
|
||||
}
|
||||
|
||||
if ($object->fk_soc > 0 && ! in_array($object->origin_email, $sendto)) {
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if(!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
// altairis: Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
|
||||
// altairis: dont try to send email when no recipient
|
||||
if (!empty($sendto)) {
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->copyFilesForTicket();
|
||||
|
||||
// Set status to "answered" if not set yet, only for internal users
|
||||
if ($object->fk_statut < 3 && !$user->societe_id) {
|
||||
$object->setStatut(3);
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new message on a ticket (public area)
|
||||
*
|
||||
* @param User $user User for action
|
||||
* @param string $action Action string
|
||||
* @return void
|
||||
*/
|
||||
private function newMessagePublic($user, &$action)
|
||||
{
|
||||
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
$object = new Ticket($this->db);
|
||||
$error = 0;
|
||||
$ret = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (!GETPOST("message")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object->message = (string) GETPOST("message");
|
||||
$id = $object->createTicketMessage($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error && $id > 0) {
|
||||
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
|
||||
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
|
||||
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
|
||||
$message .= "\n";
|
||||
$message .= GETPOST('message');
|
||||
$message .= "\n";
|
||||
|
||||
// Coordonnées client
|
||||
if ($object->thirdparty->id > 0) {
|
||||
$message .= "\n\n";
|
||||
$message .= "==============================================\n";
|
||||
$message .= $langs->trans('Thirparty') . " : " . $object->thirdparty->name;
|
||||
$message .= !empty($object->thirdparty->town) ? $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||
$message .= "\n";
|
||||
$message .= !empty($object->thirdparty->phone) ? $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
// Build array to display recipient list
|
||||
foreach ($internal_contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
}
|
||||
|
||||
// Contact type
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
// URL ticket
|
||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . $url_internal_ticket . "\n";
|
||||
|
||||
$message .= "\n\n";
|
||||
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
// Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_FROM, $sendto)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM;
|
||||
}
|
||||
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
|
||||
/*
|
||||
* Email for externals users if not private
|
||||
*/
|
||||
|
||||
// Retrieve email of all contacts external
|
||||
$external_contacts = $object->getInfosTicketExternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($external_contacts) && count($external_contacts) > 0) {
|
||||
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
|
||||
$message .= "\n";
|
||||
|
||||
$message .= GETPOST('message');
|
||||
$message .= "\n\n";
|
||||
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
foreach ($external_contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
}
|
||||
$recipient = '';
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . $url_public_ticket . "\n";
|
||||
|
||||
// Add signature
|
||||
$message .= '\n\n' . $message_signature;
|
||||
|
||||
if (!empty($object->origin_email) && !in_array($object->origin_email, $sendto)) {
|
||||
$sendto[] = $object->origin_email;
|
||||
}
|
||||
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
|
||||
$sendto[] = $object->thirdparty->email;
|
||||
}
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
|
||||
$this->copyFilesForTicket();
|
||||
|
||||
$url = 'view.php?action=view_ticket&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch object
|
||||
*
|
||||
@ -1129,6 +286,8 @@ class ActionsTicket
|
||||
public function viewTicketOriginalMessage($user, $action, $object)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
print '<!-- initial message of ticket -->'."\n";
|
||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||
// MESSAGE
|
||||
|
||||
@ -1169,14 +328,15 @@ class ActionsTicket
|
||||
|
||||
//print '<div>' . $object->message . '</div>';
|
||||
}
|
||||
if ($user->rights->ticket->manage && $action == 'edit_message_init') {
|
||||
print '<div class="center">';
|
||||
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
|
||||
print '</div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
if ($user->rights->ticket->manage && $action == 'edit_message_init') {
|
||||
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* View html list of message for ticket
|
||||
@ -1405,53 +565,6 @@ class ActionsTicket
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy files into ticket directory
|
||||
* Used for files linked into messages
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function copyFilesForTicket()
|
||||
{
|
||||
global $conf, $object;
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
|
||||
|
||||
$maxwidthsmall = 270;
|
||||
$maxheightsmall = 150;
|
||||
$maxwidthmini = 128;
|
||||
$maxheightmini = 72;
|
||||
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
$attachedfiles = $formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Copy files into ticket directory
|
||||
$destdir = $conf->ticket->dir_output . '/' . $object->track_id;
|
||||
|
||||
if (!dol_is_dir($destdir)) {
|
||||
dol_mkdir($destdir);
|
||||
}
|
||||
foreach ($filename as $i => $val) {
|
||||
$res = dol_move($filepath[$i], $destdir . '/' . $filename[$i]);
|
||||
if (image_format_supported($destdir . '/' . $filename[$i]) == 1) {
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destdir . '/' . $filename[$i], $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destdir . '/' . $filename[$i], $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
}
|
||||
$formmail->remove_attached_files($i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print html navbar with link to set ticket status
|
||||
*
|
||||
@ -1490,7 +603,7 @@ class ActionsTicket
|
||||
$urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=set_status&new_status=' . $status;
|
||||
}
|
||||
|
||||
print '<a class="button" href="' . $urlforbutton . '">';
|
||||
print '<a class="button buttonticket" href="' . $urlforbutton . '">';
|
||||
print img_picto($langs->trans($object->statuts_short[$status]), 'statut' . $status . '.png@ticket') . ' ' . $langs->trans($object->statuts_short[$status]);
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/class/commonobject.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
//require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -66,7 +65,7 @@ class Ticket extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* @var string Hash to identify ticket
|
||||
* @var string Hash to identify ticket publically
|
||||
*/
|
||||
public $track_id;
|
||||
|
||||
@ -186,19 +185,19 @@ class Ticket extends CommonObject
|
||||
'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"),
|
||||
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),
|
||||
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
|
||||
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
|
||||
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
|
||||
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
|
||||
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
|
||||
'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"),
|
||||
'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToProject"),
|
||||
'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"),
|
||||
'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""),
|
||||
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
|
||||
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
|
||||
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1),
|
||||
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
|
||||
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
|
||||
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'searchall'=>1, 'css'=>'right', 'help'=>""),
|
||||
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>""),
|
||||
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1),
|
||||
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted'))
|
||||
);
|
||||
@ -327,11 +326,14 @@ class Ticket extends CommonObject
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
$this->datec = dol_now();
|
||||
if (empty($this->track_id)) $this->track_id = generate_random_id(16);
|
||||
|
||||
// Check more parameters
|
||||
// If error, this->errors[] is filled
|
||||
$result = $this->verify();
|
||||
|
||||
if ($result >= 0) {
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "ticket(";
|
||||
@ -1749,11 +1751,12 @@ class Ticket extends CommonObject
|
||||
/**
|
||||
* Close a ticket
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that close
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function close()
|
||||
public function close(User $user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
if ($this->fk_statut != 9) { // not closed
|
||||
$this->db->begin();
|
||||
@ -1774,7 +1777,7 @@ class Ticket extends CommonObject
|
||||
foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) {
|
||||
$fichinter = new Fichinter($this->db);
|
||||
$fichinter->fetch($fichinter_id);
|
||||
if($fichinter->statut == 0) {
|
||||
if ($fichinter->statut == 0) {
|
||||
$result = $fichinter->setValid($user);
|
||||
if (!$result) {
|
||||
$this->errors[] = $fichinter->error;
|
||||
@ -2430,6 +2433,416 @@ class Ticket extends CommonObject
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy files into ticket directory
|
||||
* Used for files linked into messages
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function copyFilesForTicket()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
|
||||
|
||||
$maxwidthsmall = 270;
|
||||
$maxheightsmall = 150;
|
||||
$maxwidthmini = 128;
|
||||
$maxheightmini = 72;
|
||||
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
$attachedfiles = $formmail->get_attached_files();
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Copy files into ticket directory
|
||||
$destdir = $conf->ticket->dir_output . '/' . $this->ref;
|
||||
|
||||
if (!dol_is_dir($destdir)) {
|
||||
dol_mkdir($destdir);
|
||||
}
|
||||
foreach ($filename as $i => $val) {
|
||||
$res = dol_move($filepath[$i], $destdir . '/' . $filename[$i]);
|
||||
if (image_format_supported($destdir . '/' . $filename[$i]) == 1) {
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destdir . '/' . $filename[$i], $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destdir . '/' . $filename[$i], $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
}
|
||||
$formmail->remove_attached_files($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add new message on a ticket (private area)
|
||||
*
|
||||
* @param User $user User for action
|
||||
* @param string $action Action string
|
||||
* @return int
|
||||
*/
|
||||
public function newMessage($user, &$action)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
if (!class_exists('Contact')) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
}
|
||||
|
||||
$contactstatic = new Contact($this->db);
|
||||
$object = new Ticket($this->db);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$ret = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (!GETPOST("message")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object->message = GETPOST("message");
|
||||
$object->private = GETPOST("private_message");
|
||||
$send_email = GETPOST('send_email', 'int');
|
||||
|
||||
$id = $object->createTicketMessage($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->errors = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error && $id > 0) {
|
||||
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
|
||||
|
||||
/*
|
||||
* Send email to linked contacts
|
||||
*/
|
||||
if ($send_email > 0) {
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
|
||||
// altairis: set default subject
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message_intro = $langs->trans('TicketNotificationEmailBody', "#" . $object->id);
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroText');
|
||||
$message .= "\n\n";
|
||||
$message .= GETPOST('message');
|
||||
|
||||
// Coordonnées client
|
||||
$message .= "\n\n";
|
||||
$message .= "==============================================\n";
|
||||
$message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
||||
$message .= !empty($object->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||
$message .= !empty($object->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||
|
||||
// Build array to display recipient list
|
||||
foreach ($internal_contacts as $key => $info_sendto) {
|
||||
// altairis: avoid duplicate notifications
|
||||
if ($info_sendto['id'] == $user->id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($info_sendto['email'] != '') {
|
||||
if(!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
|
||||
//Contact type
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
}
|
||||
$message .= "\n";
|
||||
// URL ticket
|
||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||
|
||||
// altairis: make html link on url
|
||||
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . '<a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>' . "\n";
|
||||
|
||||
// Add global email address recipient
|
||||
// altairis: use new TICKET_NOTIFICATION_EMAIL_TO configuration variable
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
|
||||
// altairis: dont try to send email if no recipient
|
||||
if (!empty($sendto)) {
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Email for externals users if not private
|
||||
*/
|
||||
if (empty($object->private)) {
|
||||
// Retrieve email of all contacts (external)
|
||||
$external_contacts = $object->getInfosTicketExternalContact();
|
||||
|
||||
// If no contact, get email from thirdparty
|
||||
if (is_array($external_contacts) && count($external_contacts) === 0) {
|
||||
if (!empty($object->fk_soc)) {
|
||||
$object->fetch_thirdparty($object->fk_soc);
|
||||
$array_company = array(array('firstname' => '', 'lastname' => $object->thirdparty->name, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
|
||||
$external_contacts = array_merge($external_contacts, $array_company);
|
||||
} elseif (empty($object->fk_soc) && !empty($object->origin_email)) {
|
||||
$array_external = array(array('firstname' => '', 'lastname' => $object->origin_email, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
|
||||
$external_contacts = array_merge($external_contacts, $array_external);
|
||||
}
|
||||
}
|
||||
|
||||
$sendto = array();
|
||||
if (is_array($external_contacts) && count($external_contacts) > 0) {
|
||||
// altairis: get default subject for email to external contacts
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
// We put intro after
|
||||
$message = GETPOST('message');
|
||||
$message .= "\n\n";
|
||||
|
||||
foreach ($external_contacts as $key => $info_sendto) {
|
||||
// altairis: avoid duplicate emails to external contacts
|
||||
if ($info_sendto['id'] == $user->contactid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
|
||||
if(!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
}
|
||||
|
||||
// If public interface is not enable, use link to internal page into mail
|
||||
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
|
||||
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ?
|
||||
$conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' :
|
||||
dol_buildpath('/public/ticket/view.php', 2)
|
||||
) :
|
||||
dol_buildpath('/ticket/card.php', 2)
|
||||
) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
|
||||
|
||||
// Build final message
|
||||
$message = $message_intro . $message;
|
||||
|
||||
// Add signature
|
||||
$message .= '<br>' . $message_signature;
|
||||
|
||||
if (!empty($object->origin_email)) {
|
||||
$sendto[] = $object->origin_email;
|
||||
}
|
||||
|
||||
if ($object->fk_soc > 0 && ! in_array($object->origin_email, $sendto)) {
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if(!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
// altairis: Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
|
||||
// altairis: dont try to send email when no recipient
|
||||
if (!empty($sendto)) {
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object->copyFilesForTicket();
|
||||
|
||||
// Set status to "answered" if not set yet, only for internal users
|
||||
if ($object->fk_statut < 3 && !$user->societe_id) {
|
||||
$object->setStatut(3);
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new message on a ticket (public area)
|
||||
*
|
||||
* @param User $user User for action
|
||||
* @param string $action Action string
|
||||
* @return void
|
||||
*/
|
||||
public function newMessagePublic($user, &$action)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
$object = new Ticket($this->db);
|
||||
|
||||
$error = 0;
|
||||
$ret = $object->fetch('', '', GETPOST('track_id', 'alpha'));
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (!GETPOST("message")) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object->message = (string) GETPOST("message");
|
||||
$id = $object->createTicketMessage($user);
|
||||
if ($id <= 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
$action = 'add_message';
|
||||
}
|
||||
|
||||
if (!$error && $id > 0) {
|
||||
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
|
||||
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
|
||||
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
|
||||
$message .= "\n";
|
||||
$message .= GETPOST('message');
|
||||
$message .= "\n";
|
||||
|
||||
// Coordonnées client
|
||||
if ($object->thirdparty->id > 0) {
|
||||
$message .= "\n\n";
|
||||
$message .= "==============================================\n";
|
||||
$message .= $langs->trans('Thirparty') . " : " . $object->thirdparty->name;
|
||||
$message .= !empty($object->thirdparty->town) ? $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||
$message .= "\n";
|
||||
$message .= !empty($object->thirdparty->phone) ? $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
// Build array to display recipient list
|
||||
foreach ($internal_contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
}
|
||||
|
||||
// Contact type
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
// URL ticket
|
||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . $url_internal_ticket . "\n";
|
||||
|
||||
$message .= "\n\n";
|
||||
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
|
||||
// Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_FROM, $sendto)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM;
|
||||
}
|
||||
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
|
||||
/*
|
||||
* Email for externals users if not private
|
||||
*/
|
||||
|
||||
// Retrieve email of all contacts external
|
||||
$external_contacts = $object->getInfosTicketExternalContact();
|
||||
$sendto = array();
|
||||
if (is_array($external_contacts) && count($external_contacts) > 0) {
|
||||
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||
|
||||
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
|
||||
$message .= "\n";
|
||||
|
||||
$message .= GETPOST('message');
|
||||
$message .= "\n\n";
|
||||
|
||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||
foreach ($external_contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||
}
|
||||
$recipient = '';
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
||||
}
|
||||
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) . '?track_id=' . $object->track_id;
|
||||
$message .= "\n\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . $url_public_ticket . "\n";
|
||||
|
||||
// Add signature
|
||||
$message .= '\n\n' . $message_signature;
|
||||
|
||||
if (!empty($object->origin_email) && !in_array($object->origin_email, $sendto)) {
|
||||
$sendto[] = $object->origin_email;
|
||||
}
|
||||
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
|
||||
$sendto[] = $object->thirdparty->email;
|
||||
}
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||
}
|
||||
|
||||
$object->copyFilesForTicket();
|
||||
|
||||
$url = 'view.php?action=view_ticket&track_id=' . $object->track_id;
|
||||
header("Location: " . $url);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -63,13 +63,13 @@ class TicketStats extends Stats
|
||||
|
||||
$this->where = " fk_statut > 0";
|
||||
$this->where .= " AND entity = " . $conf->entity;
|
||||
if ($this->socid) {
|
||||
if ($this->socid > 0) {
|
||||
$this->where .= " AND fk_soc = " . $this->socid;
|
||||
}
|
||||
if (is_array($this->userid) && count($this->userid) > 0) {
|
||||
$this->where .= ' AND fk_user IN (' . join(',', $this->userid) . ')';
|
||||
$this->where .= ' AND fk_user_create IN (' . join(',', $this->userid) . ')';
|
||||
} elseif ($this->userid > 0) {
|
||||
$this->where .= ' AND fk_user = ' . $this->userid;
|
||||
$this->where .= ' AND fk_user_create = ' . $this->userid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,9 +50,6 @@ $source = GETPOST('source', 'alpha');
|
||||
$ligne = GETPOST('ligne', 'int');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
|
||||
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) {
|
||||
$socid = $user->societe_id;
|
||||
@ -64,8 +61,9 @@ $url_page_current = dol_buildpath('/ticket/contact.php', 1);
|
||||
|
||||
$object = new Ticket($db);
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->ticket->write) {
|
||||
@ -110,9 +108,12 @@ if ($action == 'deletecontact' && $user->rights->ticket->write) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url = 'FR:DocumentationModuleTicket';
|
||||
llxHeader('', $langs->trans("TicketContacts"), $help_url);
|
||||
|
||||
@ -121,12 +122,6 @@ $formcompany = new FormCompany($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($id > 0 || !empty($track_id) || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref, $track_id) > 0)
|
||||
{
|
||||
@ -146,7 +141,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
|
||||
|
||||
$head = ticket_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'contact', $langs->trans("Ticket"), 0, 'ticket');
|
||||
dol_fiche_head($head, 'contact', $langs->trans("Ticket"), -1, 'ticket');
|
||||
|
||||
$morehtmlref ='<div class="refidno">';
|
||||
$morehtmlref.= $object->subject;
|
||||
|
||||
@ -61,15 +61,10 @@ if (! $sortfield) $sortfield="position_name";
|
||||
$object = new Ticket($db);
|
||||
$result = $object->fetch($id, $ref, $track_id);
|
||||
|
||||
// to match document rules and compatibility
|
||||
$old_ref = $object->ref;
|
||||
$object->ref = $object->track_id;
|
||||
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$upload_dir = $conf->ticket->dir_output . "/" . dol_sanitizeFileName($object->track_id);
|
||||
$upload_dir = $conf->ticket->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
|
||||
@ -79,8 +74,6 @@ if ($result < 0) {
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
$object->ref = $old_ref;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -193,7 +186,7 @@ if ($object->id)
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
$object->ref = $object->track_id; // For compatibility we use track ID for directory
|
||||
//$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;
|
||||
|
||||
@ -85,7 +85,7 @@ if (! $sortorder) $sortorder="DESC";
|
||||
if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][]='openall'; // For backward compatibility
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all=trim(GETPOST("search_all", 'alpha'));
|
||||
$search_all=trim(GETPOSTISSET("search_all")?GETPOSTISSET("search_all", 'alpha'):GETPOST('sall'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
@ -190,9 +190,6 @@ $socstatic = new Societe($db);
|
||||
$help_url = '';
|
||||
$title = $langs->trans('TicketList');
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
@ -216,7 +213,7 @@ else $sql.=" WHERE 1 = 1";
|
||||
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
if ($key == 'fk_statut')
|
||||
if ($key == 'fk_statut')
|
||||
{
|
||||
$tmpstatus='';
|
||||
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'0', '1', '3', '4', '5', '6'";
|
||||
@ -225,8 +222,13 @@ foreach($search as $key => $val)
|
||||
elseif (is_array($search[$key]) && count($search[$key])) $sql.=natural_search($key, join(',', $search[$key]), 2);
|
||||
continue;
|
||||
}
|
||||
if ($key == 'fk_user_assign')
|
||||
{
|
||||
if ($search[$key] > 0) $sql.=natural_search($key, $search[$key], 2);
|
||||
continue;
|
||||
}
|
||||
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search));
|
||||
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], $mode_search);
|
||||
}
|
||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc, 2);
|
||||
@ -244,22 +246,6 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY "
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
*/
|
||||
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@ -306,6 +292,9 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
if ($socid && !$projectid && $user->rights->societe->lire) {
|
||||
$socstat = new Societe($db);
|
||||
$res = $socstat->fetch($socid);
|
||||
@ -479,10 +468,10 @@ $objecttmp=new Ticket($db);
|
||||
$trackid='tick'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticketstats.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
@ -57,7 +58,7 @@ $langs->loadLangs(array('orders', 'companies', 'other', 'tickets'));
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
//$formticket=new FormTicket($db);
|
||||
$object=new Ticket($db);
|
||||
|
||||
$title=$langs->trans("Statistics");
|
||||
$dir=$conf->ticket->dir_temp;
|
||||
@ -69,7 +70,7 @@ print load_fiche_titre($title, '', 'title_ticket.png');
|
||||
dol_mkdir($dir);
|
||||
|
||||
$stats = new TicketStats($db, $socid, ($userid>0?$userid:0));
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND fk_statut IN ('.$db->escape($object_status).')';
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
@ -242,16 +243,8 @@ print '<tr><td class="left">'.$langs->trans("CreatedBy").'</td><td class="left">
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
// Status
|
||||
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
|
||||
$liststatus=array(
|
||||
Ticket::STATUS_NOT_READ=>$langs->trans("StatusNotRead"),
|
||||
Ticket::STATUS_READ=>$langs->trans("StatusRead"),
|
||||
Ticket::STATUS_ASSIGNED=>$langs->trans("StatusAssigned"),
|
||||
Ticket::STATUS_IN_PROGRESS=>$langs->trans("StatusInProgress"),
|
||||
Ticket::STATUS_ANSWERED=>$langs->trans("StatusAnswered"),
|
||||
Ticket::STATUS_CLOSED=>$langs->trans("StatusClosed"),
|
||||
Ticket::STATUS_WAITING=>$langs->trans("StatusWaiting")
|
||||
);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4);
|
||||
$liststatus = $object->fields['fk_statut']['arrayofkeyval'];
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
|
||||
|
||||
@ -184,6 +184,7 @@ if ($resql)
|
||||
print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", $_SERVER["PHP_SELF"]);
|
||||
print "</tr>\n";
|
||||
|
||||
$grouptemp = new UserGroup($db);
|
||||
@ -212,7 +213,8 @@ if ($resql)
|
||||
}
|
||||
print '<td class="center">'.$obj->nb.'</td>';
|
||||
print '<td class="center">'.$obj->nbpermissions.'</td>';
|
||||
print '<td class="right nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
|
||||
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user