Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop

Conflicts:
	htdocs/ticketsup/class/actions_ticketsup.class.php
This commit is contained in:
Laurent Destailleur 2018-03-11 18:29:19 +01:00
commit 70490e2b4b
22 changed files with 250 additions and 159 deletions

View File

@ -34,10 +34,10 @@ if (file_exists("../../main.inc.php")) {
// Libraries // Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once "../class/ticketsup.class.php"; require_once DOL_DOCUMENT_ROOT."/ticketsup/class/ticketsup.class.php";
require_once "../lib/ticketsup.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/ticketsup.lib.php";
// Translations // Translations
$langs->load("ticketsup@ticketsup"); $langs->load("ticketsup");
// Access control // Access control
if (!$user->admin) { if (!$user->admin) {

View File

@ -29,7 +29,8 @@ if (file_exists("../../main.inc.php")) {
} else { } else {
die("Include of main fails"); die("Include of main fails");
} }
require_once '../lib/ticketsup.lib.php'; // Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/ticketsup.lib.php";
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';

View File

@ -859,7 +859,7 @@ class FormMail extends Form
if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1') if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1')
{ {
if ($arraydefaultmessage && $arraydefaultmessage->content) { if ($arraydefaultmessage && $arraydefaultmessage->content) {
$defaultmessage = $arraydefaultmessage['content']; $defaultmessage = $arraydefaultmessage->content;
} elseif (! is_numeric($this->withbody)) { } elseif (! is_numeric($this->withbody)) {
$defaultmessage = $this->withbody; $defaultmessage = $this->withbody;
} }

View File

@ -31,9 +31,11 @@ if (!class_exists('FormCompany')) {
/** /**
* Classe permettant la generation du formulaire d'un nouveau ticket. * Classe permettant la generation du formulaire d'un nouveau ticket.
* *
* Utilisation: $formticketsup = new FormTicketsup($db) * @package Ticketsup
* $formticketsup->proprietes=1 ou chaine ou tableau de valeurs
* $formticketsup->show_form() affiche le formulaire * \remarks Utilisation: $formticketsup = new FormTicketsup($db)
* \remarks $formticketsup->proprietes=1 ou chaine ou tableau de valeurs
* \remarks $formticketsup->show_form() affiche le formulaire
*/ */
class FormTicketsup class FormTicketsup
{ {
@ -72,6 +74,7 @@ class FormTicketsup
public $withcancel; public $withcancel;
/** /**
*
* @var array $substit Substitutions * @var array $substit Substitutions
*/ */
public $substit = array(); public $substit = array();
@ -526,7 +529,7 @@ class FormTicketsup
$filterarray = explode(',', $filtertype); $filterarray = explode(',', $filtertype);
} }
$ticketstat->load_cache_categories_tickets(); $ticketstat->loadCacheCategoriesTickets();
print '<select id="select' . $htmlname . '" class="flat select_ticketcategory" name="' . $htmlname . '">'; print '<select id="select' . $htmlname . '" class="flat select_ticketcategory" name="' . $htmlname . '">';
if ($empty) { if ($empty) {

View File

@ -331,7 +331,7 @@ function project_admin_prepare_head()
*/ */
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0) function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0)
{ {
global $user, $bc, $langs; global $user, $bc, $langs, $conf;
global $projectstatic, $taskstatic; global $projectstatic, $taskstatic;
$lastprojectid=0; $lastprojectid=0;
@ -1298,11 +1298,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
} }
$tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">';
$placeholder='';
if ($alreadyspent) if ($alreadyspent)
{ {
$tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
//$placeholder=' placeholder="00:00"'; //$placeholder=' placeholder="00:00"';
$placeholder='';
//$tableCell.='+'; //$tableCell.='+';
} }
$tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; $tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
@ -1525,6 +1525,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
$total_plannedworkload=0;
$total_declaredprogressworkload=0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);

View File

@ -1,6 +1,6 @@
<?php <?php
/* <one line to give the program's name and a brief idea of what it does.> /*
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io> * Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr> * 2016 Christophe Battarel <christophe@altairis.fr>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -20,7 +20,13 @@
/** /**
* \file core/lib/ticketsup.lib.php * \file core/lib/ticketsup.lib.php
* \ingroup ticketsup * \ingroup ticketsup
* \brief This file is an example module library * \brief This file is a library for TicketSup module
*/
/**
* Build tabs for admin page
*
* @return array
*/ */
function ticketsupAdminPrepareHead() function ticketsupAdminPrepareHead()
{ {
@ -31,18 +37,14 @@ function ticketsupAdminPrepareHead()
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath("/ticketsup/admin/admin_ticketsup.php", 1); $head[$h][0] = DOL_URL_ROOT.'/admin/admin_ticketsup.php';
$head[$h][1] = $langs->trans("TicketSupSettings"); $head[$h][1] = $langs->trans("TicketSupSettings");
$head[$h][2] = 'settings'; $head[$h][2] = 'settings';
$h++; $h++;
$head[$h][0] = dol_buildpath("/ticketsup/admin/ticketsup_extrafields.php", 1); $head[$h][0] = DOL_URL_ROOT.'/admin/ticketsup_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsTicketSup"); $head[$h][1] = $langs->trans("ExtraFieldsTicketSup");
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;
$head[$h][0] = dol_buildpath("/ticketsup/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
@ -58,10 +60,10 @@ function ticketsupAdminPrepareHead()
} }
/** /**
* Prepare head for ticket card * Build tabs for a Ticketsup object
* *
* @param Object $object Object Ticket * @param Ticketsup $object Object Ticket
* @return array Array of tabs * @return array Array of tabs
*/ */
function ticketsup_prepare_head($object) function ticketsup_prepare_head($object)
{ {
@ -69,13 +71,13 @@ function ticketsup_prepare_head($object)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath('/ticketsup/card.php', 1) . '?action=view&track_id=' . $object->track_id; $head[$h][0] = DOL_URL_ROOT.'/ticketsup/card.php?action=view&track_id=' . $object->track_id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'tabTicketsup'; $head[$h][2] = 'tabTicketsup';
$h++; $h++;
if (empty($user->socid)) { if (empty($user->socid)) {
$head[$h][0] = dol_buildpath('/ticketsup/contacts.php', 1) . '?track_id=' . $object->track_id; $head[$h][0] = DOL_URL_ROOT.'/ticketsup/contacts.php?track_id=' . $object->track_id;
$head[$h][1] = $langs->trans('Contacts'); $head[$h][1] = $langs->trans('Contacts');
$head[$h][2] = 'tabTicketContacts'; $head[$h][2] = 'tabTicketContacts';
$h++; $h++;
@ -99,7 +101,7 @@ function ticketsup_prepare_head($object)
// History // History
$head[$h][0] = dol_buildpath('/ticketsup/history.php', 1) . '?track_id=' . $object->track_id; $head[$h][0] = DOL_URL_ROOT.'/ticketsup/history.php?track_id=' . $object->track_id;
$head[$h][1] = $langs->trans('TicketHistory'); $head[$h][1] = $langs->trans('TicketHistory');
$head[$h][2] = 'tabTicketLogs'; $head[$h][2] = 'tabTicketLogs';
$h++; $h++;

View File

@ -1049,7 +1049,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{ {
$result=run_sql($dir.$file,1,'',1); $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1);
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
@ -1067,7 +1067,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{ {
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{ {
$result=run_sql($dir.$file,1,'',1); $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1);
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
@ -1085,7 +1085,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
{ {
$result=run_sql($dir.$file,1,'',1); $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1);
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
@ -1103,7 +1103,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
{ {
$result=run_sql($dir.$file,1,'',1); $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1);
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }

View File

@ -23,7 +23,7 @@
* \brief File with class to manage the numbering module Simple for ticketsup references * \brief File with class to manage the numbering module Simple for ticketsup references
*/ */
dol_include_once('/ticketsup/core/modules/modules_ticketsup.php'); require_once DOL_DOCUMENT_ROOT.'/core/modules/modules_ticketsup.php';
/** /**
* Class to manage the numbering module Simple for ticketsup references * Class to manage the numbering module Simple for ticketsup references
@ -73,7 +73,8 @@ class mod_ticketsup_simple extends ModeleNumRefTicketsup
$posindice = 8; $posindice = 8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup";
$sql .= " WHERE ref LIKE '" . $this->prefix . "____-%'"; $search = $this->prefix . "____-%";
$sql .= " WHERE ref LIKE '" . $search ."'";
$sql .= " AND entity = " . $conf->entity; $sql .= " AND entity = " . $conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
@ -107,7 +108,8 @@ class mod_ticketsup_simple extends ModeleNumRefTicketsup
$posindice = 8; $posindice = 8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup";
$sql .= " WHERE ref like '" . $this->prefix . "____-%'"; $search = $this->prefix . "____-%";
$sql .= " WHERE ref LIKE '" . $search ."'";
$sql .= " AND entity = " . $conf->entity; $sql .= " AND entity = " . $conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -22,7 +22,7 @@
* \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal * \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal
*/ */
dol_include_once('/ticketsup/core/modules/modules_ticketsup.php'); require_once DOL_DOCUMENT_ROOT.'/core/modules/modules_ticketsup.php';
/** /**
* Classe du modele de numerotation de reference de projet Universal * Classe du modele de numerotation de reference de projet Universal

View File

@ -134,8 +134,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
} }
$message .= '</ul>'; $message .= '</ul>';
$message .= '<p>' . $langs->trans('Message') . ' : <br />' . $object->message . '</p>'; $message .= '<p>' . $langs->trans('Message') . ' : <br>' . $object->message . '</p>';
$message .= '<p><a href="' . dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a><br /></p>'; $message .= '<p><a href="' . dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>';
$sendto = $userstat->email; $sendto = $userstat->email;
$from = dolGetFirstLastname($user->firstname, $user->lastname) . '<' . $user->email . '>'; $from = dolGetFirstLastname($user->firstname, $user->lastname) . '<' . $user->email . '>';
@ -202,7 +202,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
$message_admin.='<p>'.$langs->trans('Company'). ' : '.$object->thirdparty->name.'</p>'; $message_admin.='<p>'.$langs->trans('Company'). ' : '.$object->thirdparty->name.'</p>';
} }
$message_admin.='<p>'.$langs->trans('Message').' : <br />'.$object->message.'</p>'; $message_admin.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
$message_admin.='<p><a href="'.dol_buildpath('/ticketsup/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>'; $message_admin.='<p><a href="'.dol_buildpath('/ticketsup/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKETS_NOTIFICATION_EMAIL_FROM.'>'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKETS_NOTIFICATION_EMAIL_FROM.'>';
@ -250,7 +250,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
} }
} }
$message_customer.='</ul>'; $message_customer.='</ul>';
$message_customer.='<p>'.$langs->trans('Message').' : <br />'.$object->message.'</p>'; $message_customer.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
$url_public_ticket = ($conf->global->TICKETS_URL_PUBLIC_INTERFACE?$conf->global->TICKETS_URL_PUBLIC_INTERFACE.'/':dol_buildpath('/ticketsup/public/view.php', 2)).'?track_id='.$object->track_id; $url_public_ticket = ($conf->global->TICKETS_URL_PUBLIC_INTERFACE?$conf->global->TICKETS_URL_PUBLIC_INTERFACE.'/':dol_buildpath('/ticketsup/public/view.php', 2)).'?track_id='.$object->track_id;
$message_customer.='<p>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>'; $message_customer.='<p>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
$message_customer.='<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>'; $message_customer.='<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';

View File

@ -120,4 +120,106 @@ ALTER TABLE llx_societe_rib ADD COLUMN total_amount_of_all_payments double(24,8)
ALTER TABLE llx_societe_rib ADD COLUMN stripe_card_ref varchar(128); ALTER TABLE llx_societe_rib ADD COLUMN stripe_card_ref varchar(128);
ALTER TABLE llx_societe_rib ADD COLUMN status integer NOT NULL DEFAULT 1; ALTER TABLE llx_societe_rib ADD COLUMN status integer NOT NULL DEFAULT 1;
CREATE TABLE llx_ticketsup
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
ref varchar(128) NOT NULL,
track_id varchar(128) NOT NULL,
fk_soc integer DEFAULT 0,
fk_project integer DEFAULT 0,
origin_email varchar(128),
fk_user_create integer,
fk_user_assign integer,
subject varchar(255),
message text,
fk_statut integer,
resolution integer,
progress varchar(100),
timing varchar(20),
type_code varchar(32),
category_code varchar(32),
severity_code varchar(32),
datec datetime,
date_read datetime,
date_close datetime,
tms timestamp
)ENGINE=innodb;
ALTER TABLE llx_ticketsup ADD UNIQUE uk_ticketsup_rowid_track_id (rowid, track_id);
ALTER TABLE llx_ticketsup ADD INDEX id_ticketsup_track_id (track_id);
CREATE TABLE llx_ticketsup_msg
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
fk_track_id varchar(128),
fk_user_action integer,
datec datetime,
message text,
private integer DEFAULT 0
)ENGINE=innodb;
ALTER TABLE llx_ticketsup_msg ADD CONSTRAINT fk_ticketsup_msg_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticketsup (track_id);
CREATE TABLE llx_ticketsup_logs
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
fk_track_id varchar(128),
fk_user_create integer,
datec datetime,
message text
)ENGINE=innodb;
ALTER TABLE llx_ticketsup_logs ADD CONSTRAINT fk_ticketsup_logs_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticketsup (track_id);
CREATE TABLE llx_ticketsup_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14)
)ENGINE=innodb;
ALTER TABLE llx_c_ticketsup_category ADD INDEX idx_code (code);
CREATE TABLE llx_c_ticketsup_category
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
active integer DEFAULT 1,
use_default integer DEFAULT 1,
description varchar(255)
)ENGINE=innodb;
ALTER TABLE llx_c_ticketsup_severity ADD INDEX idx_code (code);
CREATE TABLE llx_c_ticketsup_severity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
color varchar(10) NOT NULL,
active integer DEFAULT 1,
use_default integer DEFAULT 1,
description varchar(255)
)ENGINE=innodb;
ALTER TABLE llx_c_ticketsup_type ADD INDEX idx_code (code);
CREATE TABLE llx_c_ticketsup_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
active integer DEFAULT 1,
use_default integer DEFAULT 1,
description varchar(255)
)ENGINE=innodb;

View File

@ -14,4 +14,5 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
ALTER TABLE llx_ticketsup ADD UNIQUE uk_matable_field(rowid, track_id); ALTER TABLE llx_ticketsup ADD UNIQUE uk_ticketsup_rowid_track_id (rowid, track_id);
ALTER TABLE llx_ticketsup ADD INDEX id_ticketsup_track_id (track_id);

View File

@ -14,4 +14,4 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
ALTER TABLE llx_ticketsup_logs ADD CONSTRAINT fk_ticketsup_logs_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticketsup (fk_track_id); ALTER TABLE llx_ticketsup_logs ADD CONSTRAINT fk_ticketsup_logs_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticketsup (track_id);

View File

@ -275,7 +275,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) {
} }
} }
$message_admin .= '</ul>'; $message_admin .= '</ul>';
$message_admin .= '<p>' . $langs->trans('Message') . ' : <br />' . $object->message . '</p>'; $message_admin .= '<p>' . $langs->trans('Message') . ' : <br>' . $object->message . '</p>';
$message_admin .= '<p><a href="' . dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>'; $message_admin .= '<p><a href="' . dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>';
$from = $conf->global->MAIN_INFO_SOCIETE_NOM . '<' . $conf->global->TICKETS_NOTIFICATION_EMAIL_FROM . '>'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM . '<' . $conf->global->TICKETS_NOTIFICATION_EMAIL_FROM . '>';
@ -367,7 +367,7 @@ if ($action != "infos_success") {
$formticket->showForm(); $formticket->showForm();
} else { } else {
print '<div class="ok">' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>' . $object->track_id . '</strong>'); print '<div class="ok">' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>' . $object->track_id . '</strong>');
print '<br />'; print '<br>';
print $langs->trans('PleaseRememberThisId'); print $langs->trans('PleaseRememberThisId');
} }
print '</div>'; print '</div>';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) - 2013-2016 Jean-François FERRY <jfefe@aternatik.fr> /* Copyright (C) 2013-2016 Jean-François FERRY <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -34,28 +34,10 @@ if (!defined("NOLOGIN")) {
} }
// If this page is public (can be called outside logged session) // If this page is public (can be called outside logged session)
// Change this following line to use the correct relative path (../, ../../, etc) require '../../main.inc.php';
$res = 0; require_once DOL_DOCUMENT_ROOT.'/ticketsup/class/actions_ticketsup.class.php';
if (!$res && file_exists("../main.inc.php")) { require_once DOL_DOCUMENT_ROOT.'/ticketsup/class/html.formticketsup.class.php';
$res = @include '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/ticketsup/lib/ticketsup.lib.php';
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include '../../main.inc.php';
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include '../../../main.inc.php';
}
if (!$res) {
die("Include of main fails");
}
// Change this following line to use the correct relative path from htdocs
dol_include_once('/ticketsup/class/actions_ticketsup.class.php');
dol_include_once('/ticketsup/class/html.formticketsup.class.php');
dol_include_once('/ticketsup/lib/ticketsup.lib.php');
// Load traductions files requiredby by page // Load traductions files requiredby by page
$langs->load("companies"); $langs->load("companies");
@ -671,7 +653,7 @@ if ($action == "view_ticketlist") {
} }
} }
} else { } else {
print '<div class="error">Not Allowed<br /><a href="' . $_SERVER['PHP_SELF'] . '?track_id=' . $object->dao->track_id . '">' . $langs->trans('Back') . '</a></div>'; print '<div class="error">Not Allowed<br><a href="' . $_SERVER['PHP_SELF'] . '?track_id=' . $object->dao->track_id . '">' . $langs->trans('Back') . '</a></div>';
} }
} else { } else {
print '<p style="text-align: center">' . $langs->trans("TicketPublicMsgViewLogIn") . '</p>'; print '<p style="text-align: center">' . $langs->trans("TicketPublicMsgViewLogIn") . '</p>';

View File

@ -1,19 +0,0 @@
# Generated binaries
/build/*.zip
# Doxygen generated documentation
/build/doxygen/doxygen_warnings.log
/doc/code/doxygen
# Composer managed dependencies
/vendor/
/dev/bin
# PHPdocumentor generated files
/build/phpdoc
/doc/code/phpdoc
# Sphinx generated files
/doc/user/build
/.settings/
/.buildpath
/.project
/test/report
# PhpStorm generated files
/.idea/

View File

@ -533,7 +533,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
$userstatic = new User($db); $userstatic = new User($db);
foreach (array('internal', 'external') as $source) { foreach (array('internal', 'external') as $source) {
$tmpobject = $object->dao; $tmpobject = $object->dao;
$tab = $tmpobject->liste_contact(-1, $source); $tab = $tmpobject->listeContact(-1, $source);
$num = count($tab); $num = count($tab);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {

View File

@ -343,7 +343,7 @@ class ActionsTicketsup
if ($ret) { if ($ret) {
// Si déjà un user assigné on le supprime des contacts // Si déjà un user assigné on le supprime des contacts
if ($useroriginassign > 0) { if ($useroriginassign > 0) {
$internal_contacts = $this->dao->liste_contact(-1, 'internal'); $internal_contacts = $this->dao->listeContact(-1, 'internal');
foreach ($internal_contacts as $key => $contact) { foreach ($internal_contacts as $key => $contact) {
if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) { if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) {
@ -609,8 +609,8 @@ class ActionsTicketsup
/** /**
* Add new message on a ticket (private area) * Add new message on a ticket (private area)
* *
* @param User $user Object user * @param User $user User for action
* @param string $action Action * @param string $action Action string
*/ */
private function newMessage($user, &$action) private function newMessage($user, &$action)
{ {
@ -820,8 +820,8 @@ class ActionsTicketsup
/** /**
* Add new message on a ticket (public area) * Add new message on a ticket (public area)
* *
* @param User $user Object user * @param User $user User for action
* @param string $action Action * @param string $action Action string
*/ */
private function newMessagePublic($user, &$action) private function newMessagePublic($user, &$action)
{ {
@ -964,10 +964,10 @@ class ActionsTicketsup
/** /**
* Fetch object * Fetch object
* *
* @param int $id Id * @param int $id ID of ticket
* @param int $track_id Track id * @param int $track_id Track ID of ticket (for public area)
* @param string $ref Ref * @param string $ref Reference of ticket
* @return void * @return void
*/ */
public function fetch($id = 0, $track_id = 0, $ref = '') public function fetch($id = 0, $track_id = 0, $ref = '')
{ {
@ -977,8 +977,12 @@ class ActionsTicketsup
/** /**
* print statut * print statut
<<<<<<< HEAD
* *
* @param int $mode Mode * @param int $mode Mode
=======
* @param int $mode Display mode
>>>>>>> branch 'develop' of git@github.com:Dolibarr/dolibarr.git
* @return void * @return void
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
@ -989,10 +993,9 @@ class ActionsTicketsup
} }
/** /**
* Get ticket info * Get ticket info
* *
* @param int $id Object id * @param int $id Object id
* @return void
*/ */
public function getInfo($id) public function getInfo($id)
{ {
@ -1004,10 +1007,9 @@ class ActionsTicketsup
} }
/** /**
* Get action title * Get action title
* *
* @param string $action Type of action * @param string $action Type of action
* @return string Label
*/ */
public function getTitle($action = '') public function getTitle($action = '')
{ {
@ -1029,8 +1031,7 @@ class ActionsTicketsup
/** /**
* View html list of logs * View html list of logs
* *
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketLogs($show_user = true) public function viewTicketLogs($show_user = true)
{ {
@ -1092,8 +1093,7 @@ class ActionsTicketsup
/** /**
* View list of logs with timeline view * View list of logs with timeline view
* *
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTimelineTicketLogs($show_user = true) public function viewTimelineTicketLogs($show_user = true)
{ {
@ -1139,9 +1139,8 @@ class ActionsTicketsup
/** /**
* Show ticket original message * Show ticket original message
* *
* @param User $user Object user * @param User $user $user wich display
* @param string $action Action * @param string $action Action mode
* @return void
*/ */
public function viewTicketOriginalMessage($user, $action = '') public function viewTicketOriginalMessage($user, $action = '')
{ {
@ -1196,9 +1195,8 @@ class ActionsTicketsup
/** /**
* View html list of message for ticket * View html list of message for ticket
* *
* @param boolean $show_private Show private messages * @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketMessages($show_private, $show_user = true) public function viewTicketMessages($show_private, $show_user = true)
{ {
@ -1268,9 +1266,8 @@ class ActionsTicketsup
/** /**
* View list of message for ticket with timeline display * View list of message for ticket with timeline display
* *
* @param boolean $show_private Show private messages * @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketTimelineMessages($show_private, $show_user = true) public function viewTicketTimelineMessages($show_private, $show_user = true)
{ {
@ -1419,12 +1416,17 @@ class ActionsTicketsup
/** /**
* Copy files into ticket directory * Copy files into ticket directory
*
* Used for files linked into messages * Used for files linked into messages
<<<<<<< HEAD
* *
* @return void * @return void
=======
>>>>>>> branch 'develop' of git@github.com:Dolibarr/dolibarr.git
*/ */
public function copyFilesForTicket() public function copyFilesForTicket()
{ {
global $conf; global $conf;
// Create form object // Create form object
@ -1466,9 +1468,14 @@ class ActionsTicketsup
/** /**
* Print html navbar with link to set ticket status * Print html navbar with link to set ticket status
<<<<<<< HEAD
* $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted' * $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted'
* *
* @return void * @return void
=======
*
* @global type $langs
>>>>>>> branch 'develop' of git@github.com:Dolibarr/dolibarr.git
*/ */
public function viewStatusActions() public function viewStatusActions()
{ {
@ -1520,10 +1527,10 @@ class ActionsTicketsup
/** /**
* Hook to add email element template * Hook to add email element template
* *
* @param array $parameters Parameters * @param array $parameters Parameters
* @param Object $object Object * @param Ticketsup $object Object for action
* @param string $action Action * @param string $action Action string
* @param HookManager $hookmanager Hookmanager * @param HookManager $hookmanager Hookmanager object
* @return int * @return int
*/ */
public function emailElementlist($parameters, &$object, &$action, $hookmanager) public function emailElementlist($parameters, &$object, &$action, $hookmanager)

View File

@ -533,14 +533,15 @@ class Ticketsup extends CommonObject
/** /**
* Load all objects in memory from database * Load all objects in memory from database
* *
* @param User $user Object user * @param User $user User for action
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit page number * @param int $limit page number
* @param int $offset Offset * @param int $offset Offset for query
* @param int $arch archive or not (not used) * @param int $arch archive or not (not used)
* @param array $filter Filter * @param array $filter Filter for query
* @return int <0 if KO, >0 if OK * output
* @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '') public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '')
{ {
@ -1052,7 +1053,7 @@ class Ticketsup extends CommonObject
* *
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko
*/ */
function load_cache_categories_tickets() public function loadCacheCategoriesTickets()
{ {
global $langs; global $langs;
@ -1128,17 +1129,19 @@ class Ticketsup extends CommonObject
} }
} }
/** /**
* Return status label of object * Return status label of object
* *
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->fk_statut, $mode); return $this->libStatut($this->fk_statut, $mode);
} }
/** /**
* Return status label of object * Return status label of object
* *
@ -1291,11 +1294,11 @@ class Ticketsup extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clickable link to object
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param string $option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
public function getNomUrl($withpicto = 0, $option = '') public function getNomUrl($withpicto = 0, $option = '')
{ {
@ -1330,9 +1333,9 @@ class Ticketsup extends CommonObject
/** /**
* Mark a message as read * Mark a message as read
* *
* @param User $user Object user * @param User $user Object user
* @param int $notrigger No trigger * @param int $notrigger No trigger
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function markAsRead($user, $notrigger = 0) public function markAsRead($user, $notrigger = 0)
{ {
@ -1431,10 +1434,10 @@ class Ticketsup extends CommonObject
* 1- create entry into database for message storage * 1- create entry into database for message storage
* 2- if trigger, send an email to ticket contacts * 2- if trigger, send an email to ticket contacts
* *
* @param User $user User that create * @param User $user User that create
* @param string $message Log message * @param string $message Log message
* @param int $noemail 0=send email after, 1=disable emails * @param int $noemail 0=send email after, 1=disable emails
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function createTicketLog(User $user, $message, $noemail = 0) public function createTicketLog(User $user, $message, $noemail = 0)
{ {
@ -1492,7 +1495,7 @@ class Ticketsup extends CommonObject
* @param string $log_message Log message * @param string $log_message Log message
* @return int <0 if KO, >0 if OK (number of emails sent) * @return int <0 if KO, >0 if OK (number of emails sent)
*/ */
private function sendLogByEmail($user, $log_message) private function sendLogByEmail($user, $message)
{ {
global $conf, $langs; global $conf, $langs;
@ -1501,8 +1504,8 @@ class Ticketsup extends CommonObject
$langs->load('ticketsup@ticketsup'); $langs->load('ticketsup@ticketsup');
// Retrieve email of all contacts (internal and external) // Retrieve email of all contacts (internal and external)
$contacts = $this->liste_contact(-1, 'internal'); $contacts = $this->listeContact(-1, 'internal');
$contacts = array_merge($contacts, $this->liste_contact(-1, 'external')); $contacts = array_merge($contacts, $this->listeContact(-1, 'external'));
/* If origin_email and no socid, we add email to the list * */ /* If origin_email and no socid, we add email to the list * */
if (!empty($this->origin_email) && empty($this->fk_soc)) { if (!empty($this->origin_email) && empty($this->fk_soc)) {
@ -2034,7 +2037,7 @@ class Ticketsup extends CommonObject
*/ */
public function getInfosTicketInternalContact() public function getInfosTicketInternalContact()
{ {
return $this->liste_contact(-1, 'internal'); return $this->listeContact(-1, 'internal');
} }
/** /**
@ -2054,7 +2057,7 @@ class Ticketsup extends CommonObject
*/ */
public function getInfosTicketExternalContact() public function getInfosTicketExternalContact()
{ {
return $this->liste_contact(-1, 'external'); return $this->listeContact(-1, 'external');
} }
/** /**
@ -2112,7 +2115,7 @@ class Ticketsup extends CommonObject
} }
/** /**
* Check if contact are linked to the ticket. If yes, send mail and save trace into llx_notify. * Send message
* *
* @param string $subject Subject * @param string $subject Subject
* @param string $texte Message to send * @param string $texte Message to send
@ -2243,10 +2246,9 @@ class Ticketsup extends CommonObject
* @param int $statut Status of lines to get (-1=all) * @param int $statut Status of lines to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @param string $code Code
* @return array Array of contacts * @return array Array of contacts
*/ */
function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') function liste_contact($statut = -1, $source = 'external', $list = 0)
{ {
global $langs; global $langs;
@ -2298,8 +2300,7 @@ class Ticketsup extends CommonObject
} }
$sql .= " ORDER BY t.lastname ASC"; $sql .= " ORDER BY t.lastname ASC";
//echo $sql; exit;
dol_syslog(get_class($this) . "::liste_contact sql=" . $sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);

View File

@ -347,7 +347,7 @@ if ($result) {
$db->free(); $db->free();
} else { } else {
print '<tr><td colspan="5"><div class="info">' . $langs->trans('NoTicketsFound') . '</div></td></tr>'; print '<tr><td colspan="6"><div class="info">' . $langs->trans('NoTicketsFound') . '</div></td></tr>';
} }
print "</table>"; print "</table>";

View File

@ -0,0 +1 @@

View File

@ -16,6 +16,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->