diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index def9a30fc8d34..f9e985cec94d5 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -181,7 +181,7 @@ llxHeader('', $langs->trans($page_name), $help_url); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index f63af3d2a8230..3c65fcf693e6a 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -66,7 +66,7 @@ $page_name = "TicketSetup"; llxHeader('', $langs->trans($page_name), $help_url); -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans("TicketSetup"), $linkback, 'title_setup'); $head = ticketAdminPrepareHead(); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 939a357999b12..1bcff705aef7c 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -103,7 +103,7 @@ } $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 @@ } $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 @@ } $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 @@ llxHeader('', $langs->trans($page_name), $help_url); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 6f0003e3be549..f73c3d4ecf31c 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -137,7 +137,7 @@ $help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios'; llxHeader('', $langs->trans("UsersSetup"), $help_url); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("UsersSetup"), $linkback, 'title_setup'); @@ -183,8 +183,6 @@ $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); -$form=new Form($db); - // Defini tableau def des modeles $def = array(); $sql = "SELECT nom"; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index c8610224cb7f1..34dd24eef9783 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -136,6 +136,10 @@ { $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 diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index bd449cc91e92a..c5791e5c89e04 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -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 ''; - if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) { - // Print 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 '
'; - print 'Logo
'; - print '' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . ''; + if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) { + print '
'; + // 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 'Logo
'; + } + if (! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) + { + print '' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . ''; + } print '

'; } diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 3c1c6c4306853..fdc92e70602dc 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -94,7 +94,7 @@ public function __construct($db) // 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 diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ba6a65c7b3096..c739f8d5624aa 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -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 diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 235abd885b666..83786c55a877d 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -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=

Ticket has just been created with ID #%s, see information:

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 diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1b16fd7723960..6355c7e3e7fe1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -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 diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 85605e2a97748..8cae415c6e1fb 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -370,10 +370,10 @@ function init_myfunc() $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 '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 73b691500fd06..c341d32cf3e68 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -58,7 +58,7 @@ $email = $_SESSION['email_customer']; } -$object = new ActionsTicket($db); +$object = new Ticket($db); @@ -83,7 +83,7 @@ } 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 (!$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 @@ $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 @@ } } -$object->doActions($action); +//$object->doActions($action); @@ -138,10 +150,11 @@ $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 @@ if ($action == "view_ticketlist") { - if ($display_ticket_list) { // Filters $search_fk_status = GETPOST("search_fk_status", 'alpha'); @@ -266,7 +278,6 @@ if (!$sortfield) { $sortfield = 't.datec'; } - if (!$sortorder) { $sortorder = 'DESC'; } @@ -430,7 +441,6 @@ /* * Filter bar */ - $formTicket = new FormTicket($db); print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 1aebd879fc260..17638c9a39473 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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')) ); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index fe6ff269087b0..989bbda8072d2 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -85,7 +85,7 @@ 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 @@ $help_url = ''; $title = $langs->trans('TicketList'); -llxHeader('', $title, $help_url); - - // Build and execute select // -------------------------------------------------------------------- @@ -295,6 +292,9 @@ // 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 @@ $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 '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
'; } $moreforfilter = '';