diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php
index 91de0eb661e..d57ff680dbf 100644
--- a/htdocs/public/ticketsup/create_ticket.php
+++ b/htdocs/public/ticketsup/create_ticket.php
@@ -75,7 +75,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Add file in email form
if (GETPOST('addfile') && !GETPOST('add_ticket')) {
- ////$res = $object->fetch('',GETPOST('track_id'));
+ ////$res = $object->fetch('','',GETPOST('track_id'));
////if($res > 0)
////{
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
diff --git a/htdocs/public/ticketsup/list.php b/htdocs/public/ticketsup/list.php
index 67d897cc493..9a930bc78b0 100644
--- a/htdocs/public/ticketsup/list.php
+++ b/htdocs/public/ticketsup/list.php
@@ -60,6 +60,13 @@ if (isset($_SESSION['email_customer'])) {
$object = new ActionsTicketsup($db);
+
+
+
+/*
+ * Actions
+ */
+
if ($action == "view_ticketlist") {
$error = 0;
$display_ticket_list = false;
@@ -82,7 +89,8 @@ if ($action == "view_ticketlist") {
}
if (!$error) {
- $ret = $object->fetch('', '', $track_id);
+ $ret = $object->fetch('', '', $track_id);
+
if ($ret && $object->dao->id > 0) {
// vérifie si l'adresse email est bien dans les contacts du ticket
$contacts = $object->dao->liste_contact(-1, 'external');
@@ -118,6 +126,7 @@ if ($action == "view_ticketlist") {
$action = '';
}
}
+
$object->doActions($action);
@@ -143,11 +152,13 @@ if (!$conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE) {
print '
';
-if ($action == "view_ticketlist") {
+if ($action == "view_ticketlist")
+{
+
if ($display_ticket_list) {
// Filters
$search_fk_status = GETPOST("search_fk_status", 'alpha');
- $search_subject = GETPOST("search_subject");
+ $search_subject = GETPOST("search_subject", 'alpha');
$search_type = GETPOST("search_type", 'alpha');
$search_category = GETPOST("search_category", 'alpha');
$search_severity = GETPOST("search_severity", 'alpha');
@@ -269,7 +280,7 @@ if ($action == "view_ticketlist") {
$pagenext = $page + 1;
// Request SQL
- $sql = "SELECT";
+ $sql = "SELECT DISTINCT";
$sql .= " t.rowid,";
$sql .= " t.ref,";
$sql .= " t.track_id,";
@@ -311,12 +322,12 @@ if ($action == "view_ticketlist") {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
}
$sql .= " WHERE t.entity IN (" . getEntity('ticketsup') . ")";
- $sql .= " AND tc.source = 'external'";
- $sql .= " AND tc.element='" . $object->dao->element . "'";
- $sql .= " AND tc.active=1";
- $sql .= " AND (sp.email='" . $db->escape($_SESSION['email_customer']) . "'";
+ $sql .= " AND ((tc.source = 'external'";
+ $sql .= " AND tc.element='" . $db->escape($object->dao->element) . "'";
+ $sql .= " AND tc.active=1)";
+ $sql .= " OR (sp.email='" . $db->escape($_SESSION['email_customer']) . "'";
$sql .= " OR s.email='" . $db->escape($_SESSION['email_customer']) . "'";
- $sql .= " OR t.origin_email='" . $db->escape($_SESSION['email_customer']) . "')";
+ $sql .= " OR t.origin_email='" . $db->escape($_SESSION['email_customer']) . "'))";
// Manage filter
if (!empty($filter)) {
foreach ($filter as $key => $value) {
@@ -335,7 +346,7 @@ if ($action == "view_ticketlist") {
}
}
}
- $sql .= " GROUP BY t.track_id";
+ //$sql .= " GROUP BY t.track_id";
$sql .= " ORDER BY " . $sortfield . ' ' . $sortorder;
$resql = $db->query($sql);
@@ -440,9 +451,9 @@ if ($action == "view_ticketlist") {
// Status
if (!empty($arrayfields['t.fk_statut']['checked'])) {
- print '
';
+ print ' | ';
$selected = ($search_fk_status != "non_closed" ? $search_fk_status : '');
- $object->printSelectStatus($selected);
+ //$object->printSelectStatus($selected);
print ' | ';
}
@@ -495,16 +506,15 @@ if ($action == "view_ticketlist") {
}
}
- print '
';
+ print ' | ';
print '';
print '';
print ' | ';
print '';
- $var = true;
- while ($obj = $db->fetch_object($resql)) {
- $var = !$var;
- print "
";
+ while ($obj = $db->fetch_object($resql))
+ {
+ print '
';
// Date ticket
if (!empty($arrayfields['t.datec']['checked'])) {
@@ -580,11 +590,11 @@ if ($action == "view_ticketlist") {
// Message author
if (!empty($arrayfields['t.fk_user_create']['checked'])) {
print '| ';
- if ($obj->fk_user_create) {
+ if ($obj->fk_user_create > 0) {
$user_create->firstname = (!empty($obj->user_create_firstname) ? $obj->user_create_firstname : '');
$user_create->name = (!empty($obj->user_create_lastname) ? $obj->user_create_lastname : '');
$user_create->id = (!empty($obj->fk_user_create) ? $obj->fk_user_create : '');
- print $user_create->getFullName();
+ print $user_create->getFullName($langs);
} else {
print $langs->trans('Email');
}
@@ -594,11 +604,11 @@ if ($action == "view_ticketlist") {
// Assigned author
if (!empty($arrayfields['t.fk_user_assign']['checked'])) {
print ' | ';
- if ($obj->fk_user_assign) {
+ if ($obj->fk_user_assig > 0) {
$user_assign->firstname = (!empty($obj->user_assign_firstname) ? $obj->user_assign_firstname : '');
$user_assign->lastname = (!empty($obj->user_assign_lastname) ? $obj->user_assign_lastname : '');
$user_assign->id = (!empty($obj->fk_user_assign) ? $obj->fk_user_assign : '');
- print $user_assign->getFullName();
+ print $user_assign->getFullName($langs);
} else {
print $langs->trans('None');
}
diff --git a/htdocs/public/ticketsup/view.php b/htdocs/public/ticketsup/view.php
index 81979600791..5f039d87ea5 100644
--- a/htdocs/public/ticketsup/view.php
+++ b/htdocs/public/ticketsup/view.php
@@ -40,9 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticketsup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ticketsup.lib.php';
// Load traductions files requiredby by page
-$langs->load("companies");
-$langs->load("other");
-$langs->load("ticketsup");
+$langs->loadLangs(array("companies","other","ticketsup"));
// Get parameters
$track_id = GETPOST('track_id', 'alpha');
@@ -58,6 +56,11 @@ if (isset($_SESSION['email_customer'])) {
$object = new ActionsTicketsup($db);
+
+/*
+ * Actions
+ */
+
if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close" || $action == "new_public_message") {
$error = 0;
$display_ticket = false;
@@ -116,16 +119,18 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
}
$object->doActions($action);
-/***************************************************
- * VIEW
- *
- ****************************************************/
+
+
+/*
+ * View
+ */
$form = new Form($db);
$formticket = new FormTicketsup($db);
$arrayofjs = array();
$arrayofcss = array('/ticketsup/css/styles.css.php');
+
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
if (!$conf->global->TICKETS_ENABLE_PUBLIC_INTERFACE) {
@@ -151,17 +156,17 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
print '';
// Ref
- print '| ' . $langs->trans("Ref") . ' | ';
+ print ' | | ' . $langs->trans("Ref") . ' | ';
print $object->dao->ref;
print ' | ';
// Tracking ID
- print '| ' . $langs->trans("TicketTrackId") . ' | ';
+ print ' | | ' . $langs->trans("TicketTrackId") . ' | ';
print $object->dao->track_id;
print ' | ';
// Subject
- print '| ' . $langs->trans("Subject") . ' | ';
+ print ' | | ' . $langs->trans("Subject") . ' | ';
print $object->dao->subject;
print ' | ';
@@ -218,7 +223,7 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
}
// User assigned
- print '| ' . $langs->trans("UserAssignedTo") . ' | ';
+ print ' | | ' . $langs->trans("AssignedTo") . ' | ';
if ($object->dao->fk_user_assign > 0) {
$fuser = new User($db);
$fuser->fetch($object->dao->fk_user_assign);
| |