Debug module ticket

This commit is contained in:
Laurent Destailleur 2019-04-10 15:11:38 +02:00
parent 1f6f6f6edb
commit 26594fab98
14 changed files with 75 additions and 54 deletions

View File

@ -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');

View File

@ -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();

View File

@ -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');

View File

@ -137,7 +137,7 @@ $form = new Form($db);
$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;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";

View File

@ -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

View File

@ -158,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&amp;entity='.$conf->entity.'&amp;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&amp;entity='.$conf->entity.'&amp;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&amp;entity='.$conf->entity.'&amp;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&amp;entity='.$conf->entity.'&amp;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>';
}

View File

@ -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

View File

@ -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

View File

@ -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
#
@ -254,7 +254,7 @@ TicketPublicInfoCreateTicket=This form allows you to record a support ticket in
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=Public Tracking ID
OneOfTicketTrackId=One of yours 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

View File

@ -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

View File

@ -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 = '';

View File

@ -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');
@ -266,7 +278,6 @@ if ($action == "view_ticketlist")
if (!$sortfield) {
$sortfield = 't.datec';
}
if (!$sortorder) {
$sortorder = 'DESC';
}
@ -430,7 +441,6 @@ if ($action == "view_ticketlist")
/*
* Filter bar
*/
$formTicket = new FormTicket($db);
print '<tr class="liste_titre">';

View File

@ -185,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'))
);

View File

@ -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
// --------------------------------------------------------------------
@ -295,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);
@ -468,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 = '';