From 923bad4da68e20fafdd2b41001182f3378f38ee8 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sat, 10 Mar 2018 23:59:34 +0100 Subject: [PATCH 01/15] add sql log on install debug new global variable INSTALL_DISPLAY_SQL_LOG to display sql log on module install --- htdocs/core/modules/DolibarrModules.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index eaf674d5eea..5eb049f8323 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); 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') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); 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') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); 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') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); if ($result <= 0) $error++; } } From bfaffe6692edb2a80e07bc333462c76be9ba0c41 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 11 Mar 2018 10:51:05 +0100 Subject: [PATCH 02/15] Changes Done --- htdocs/core/modules/DolibarrModules.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 5eb049f8323..c1c570e8269 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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') { - $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); + $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); + $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); + $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, $conf->global->INSTALL_DISPLAY_SQL_LOG, '', 1); + $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } From 26dbd4f3a1199fb673b00588e0ba9f4e1e01588a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 11 Mar 2018 11:43:12 +0100 Subject: [PATCH 03/15] Update linkedobjectblock.tpl.php --- htdocs/ticketsup/tpl/linkedobjectblock.tpl.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php index cd23471129e..4c1a00c3d82 100644 --- a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php @@ -16,6 +16,12 @@ * along with this program; if not, write to the Free Software * 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; +} ?> @@ -55,4 +61,4 @@ foreach ($linkedObjectBlock as $object) { - \ No newline at end of file + From 0f96575b41128b88626fa3f348c63beb7205e6cd Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 11 Mar 2018 11:54:30 +0100 Subject: [PATCH 04/15] Fix PHPCS errors with ticketsup module --- .../core/class/html.formticketsup.class.php | 13 ++- htdocs/core/lib/ticketsup.lib.php | 19 ++-- htdocs/ticketsup/card.php | 2 +- .../class/actions_ticketsup.class.php | 69 ++++++-------- htdocs/ticketsup/class/ticketsup.class.php | 91 +++++++++---------- 5 files changed, 95 insertions(+), 99 deletions(-) diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 0c10c256e83..52b470c0929 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -31,9 +31,11 @@ if (!class_exists('FormCompany')) { /** * Classe permettant la generation du formulaire d'un nouveau ticket. * - * Utilisation: $formticketsup = new FormTicketsup($db) - * $formticketsup->proprietes=1 ou chaine ou tableau de valeurs - * $formticketsup->show_form() affiche le formulaire + * @package Ticketsup + + * \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 { @@ -72,6 +74,7 @@ class FormTicketsup public $withcancel; /** + * * @var array $substit Substitutions */ public $substit = array(); @@ -526,7 +529,7 @@ class FormTicketsup $filterarray = explode(',', $filtertype); } - $ticketstat->load_cache_categories_tickets(); + $ticketstat->loadCacheCategoriesTickets(); print ''; if ($empty) { diff --git a/htdocs/core/lib/ticketsup.lib.php b/htdocs/core/lib/ticketsup.lib.php index c3063783a6f..c8bfb006091 100644 --- a/htdocs/core/lib/ticketsup.lib.php +++ b/htdocs/core/lib/ticketsup.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Jean-François FERRY +/* + * Copyright (C) 2013-2018 Jean-François FERRY * 2016 Christophe Battarel * * This program is free software: you can redistribute it and/or modify @@ -20,7 +20,13 @@ /** * \file core/lib/ticketsup.lib.php * \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() { @@ -58,10 +64,9 @@ function ticketsupAdminPrepareHead() } /** - * Prepare head for ticket card - * - * @param Object $object Object Ticket - * @return array Array of tabs + * Build tabs for a Ticketsup object + * @param Ticketsup $object Ticketsup object + * @return array */ function ticketsup_prepare_head($object) { diff --git a/htdocs/ticketsup/card.php b/htdocs/ticketsup/card.php index 5d005063b8b..4b082945c4a 100644 --- a/htdocs/ticketsup/card.php +++ b/htdocs/ticketsup/card.php @@ -533,7 +533,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti $userstatic = new User($db); foreach (array('internal', 'external') as $source) { $tmpobject = $object->dao; - $tab = $tmpobject->liste_contact(-1, $source); + $tab = $tmpobject->listeContact(-1, $source); $num = count($tab); $i = 0; while ($i < $num) { diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php index bc532619ce5..94ef7db5849 100644 --- a/htdocs/ticketsup/class/actions_ticketsup.class.php +++ b/htdocs/ticketsup/class/actions_ticketsup.class.php @@ -343,7 +343,7 @@ class ActionsTicketsup if ($ret) { // Si déjà un user assigné on le supprime des contacts if ($useroriginassign > 0) { - $internal_contacts = $this->dao->liste_contact(-1, 'internal'); + $internal_contacts = $this->dao->listeContact(-1, 'internal'); foreach ($internal_contacts as $key => $contact) { if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) { @@ -475,7 +475,7 @@ class ActionsTicketsup // Set parent company if ($action == 'set_thirdparty' && $user->rights->societe->creer) { if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { - $result = $this->dao->set_customer(GETPOST('editcustomer', 'int')); + $result = $this->dao->setCustomer(GETPOST('editcustomer', 'int')); $url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha'); header("Location: " . $url); exit(); @@ -609,8 +609,8 @@ class ActionsTicketsup /** * Add new message on a ticket (private area) * - * @param User $user Object user - * @param string $action Action + * @param User $user + * @param string $action */ private function newMessage($user, &$action) { @@ -820,8 +820,8 @@ class ActionsTicketsup /** * Add new message on a ticket (public area) * - * @param User $user Object user - * @param string $action Action + * @param User $user + * @param string $action */ private function newMessagePublic($user, &$action) { @@ -964,9 +964,9 @@ class ActionsTicketsup /** * Fetch object * - * @param int $id Id - * @param int $track_id Track id - * @param string $ref Ref + * @param string $id + * @param string $track_id + * @param string $ref * @return void */ public function fetch($id = 0, $track_id = 0, $ref = '') @@ -977,8 +977,7 @@ class ActionsTicketsup /** * print statut - * - * @param int $mode Mode + * @param int $mode Display mode * @return void */ public function getLibStatut($mode = 0) @@ -989,10 +988,9 @@ class ActionsTicketsup } /** - * Get ticket info + * Get ticket info * - * @param int $id Object id - * @return void + * @param int $id Object id */ public function getInfo($id) { @@ -1004,10 +1002,9 @@ class ActionsTicketsup } /** - * Get action title + * Get action title * - * @param string $action Type of action - * @return string Label + * @param string $action Type of action */ public function getTitle($action = '') { @@ -1029,8 +1026,7 @@ class ActionsTicketsup /** * View html list of logs * - * @param boolean $show_user Show user who make action - * @return void + * @param boolean $show_user Show user who make action */ public function viewTicketLogs($show_user = true) { @@ -1092,8 +1088,7 @@ class ActionsTicketsup /** * View list of logs with timeline view * - * @param boolean $show_user Show user who make action - * @return void + * @param boolean $show_user Show user who make action */ public function viewTimelineTicketLogs($show_user = true) { @@ -1139,9 +1134,8 @@ class ActionsTicketsup /** * Show ticket original message * - * @param User $user Object user - * @param string $action Action - * @return void + * @param User $user $user wich display + * @param string $action Action mode */ public function viewTicketOriginalMessage($user, $action = '') { @@ -1196,9 +1190,8 @@ class ActionsTicketsup /** * View html list of message for ticket * - * @param boolean $show_private Show private messages - * @param boolean $show_user Show user who make action - * @return void + * @param boolean $show_private Show private messages + * @param boolean $show_user Show user who make action */ public function viewTicketMessages($show_private, $show_user = true) { @@ -1268,9 +1261,8 @@ class ActionsTicketsup /** * View list of message for ticket with timeline display * - * @param boolean $show_private Show private messages - * @param boolean $show_user Show user who make action - * @return void + * @param boolean $show_private Show private messages + * @param boolean $show_user Show user who make action */ public function viewTicketTimelineMessages($show_private, $show_user = true) { @@ -1419,12 +1411,12 @@ class ActionsTicketsup /** * Copy files into ticket directory + * * Used for files linked into messages - * - * @return void */ public function copyFilesForTicket() { + global $conf; // Create form object @@ -1466,9 +1458,8 @@ class ActionsTicketsup /** * Print html navbar with link to set ticket status - * $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted' - * - * @return void + * + * @global type $langs */ public function viewStatusActions() { @@ -1520,10 +1511,10 @@ class ActionsTicketsup /** * Hook to add email element template * - * @param array $parameters Parameters - * @param Object $object Object - * @param string $action Action - * @param HookManager $hookmanager Hookmanager + * @param array $parameters Parameters + * @param Ticketsup $object Object for action + * @param string $action Action string + * @param HookManager $hookmanager Hookmanager object * @return int */ public function emailElementlist($parameters, &$object, &$action, $hookmanager) diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index 531ebec308a..0dfe7907f71 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -533,14 +533,15 @@ class Ticketsup extends CommonObject /** * Load all objects in memory from database * - * @param User $user Object user - * @param string $sortorder Sort order - * @param string $sortfield Sort field - * @param int $limit page number - * @param int $offset Offset - * @param int $arch archive or not (not used) - * @param array $filter Filter - * @return int <0 if KO, >0 if OK + * @param User $user User for action + * @param string $sortorder Sort order + * @param string $sortfield Sort field + * @param int $limit page number + * @param int $offset Offset for query + * @param int $arch archive or not (not used) + * @param array $filter Filter for query + * output + * @return int <0 if KO, >0 if OK */ 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 */ - public function load_cache_categories_tickets() + public function loadCacheCategoriesTickets() { global $langs; @@ -1092,7 +1093,7 @@ class Ticketsup extends CommonObject * * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko */ - public function load_cache_severities_tickets() + public function loadCacheSeveritiesTickets() { global $langs; @@ -1135,7 +1136,7 @@ class Ticketsup extends CommonObject */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->fk_statut, $mode); + return $this->libStatut($this->fk_statut, $mode); } /** @@ -1144,7 +1145,7 @@ class Ticketsup extends CommonObject * \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * \return string Label */ - public function LibStatut($statut, $mode = 0) + public function libStatut($statut, $mode = 0) { global $langs; @@ -1289,11 +1290,10 @@ class Ticketsup extends CommonObject } /** - * Renvoie nom clicable (avec eventuellement le picto) - * - * @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 - * @return string Chaine avec URL + * Return clckable link to object + * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * @param string $option Where to point the link + * @return string */ public function getNomUrl($withpicto = 0, $option = '') { @@ -1326,10 +1326,11 @@ class Ticketsup extends CommonObject } /** - * Mark a message as read - * - * @param User $user Object user - * @return int <0 if KO, >0 if OK + * Mark a message as read + * + * @param User $user User for action + * @param int $notrigger Lauch trigger or not + * @return int 1 if ok, -1 otherwise */ public function markAsRead($user, $notrigger = 0) { @@ -1374,12 +1375,12 @@ class Ticketsup extends CommonObject } /** - * Mark a message as read - * - * @param User $user Object user - * @param int $id_assign_user ID of user assigned - * @param int $notrigger Disable trigger - * @return int <0 if KO, >0 if OK + * Assign ticket to an user + * + * @param User $user User for action + * @param int $id_assign_user IP user assigned + * @param int $notrigger Disable trigger if 1 + * @return number */ public function assignUser($user, $id_assign_user, $notrigger = 0) { @@ -1428,10 +1429,10 @@ class Ticketsup extends CommonObject * 1- create entry into database for message storage * 2- if trigger, send an email to ticket contacts * - * @param User $user User that create - * @param string $message Log message - * @param int $noemail 0=send email after, 1=disable emails - * @return int <0 if KO, >0 if OK + * @param User $user User that create + * @param string $message Log message + * @param int $noemail 0=send email after, 1=disable emails + * @return int <0 if KO, >0 if OK */ public function createTicketLog(User $user, $message, $noemail = 0) { @@ -1489,7 +1490,7 @@ class Ticketsup extends CommonObject * @param string $message Log message * @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; @@ -1498,8 +1499,8 @@ class Ticketsup extends CommonObject $langs->load('ticketsup@ticketsup'); // Retrieve email of all contacts (internal and external) - $contacts = $this->liste_contact(-1, 'internal'); - $contacts = array_merge($contacts, $this->liste_contact(-1, 'external')); + $contacts = $this->listeContact(-1, 'internal'); + $contacts = array_merge($contacts, $this->listeContact(-1, 'external')); /* If origin_email and no socid, we add email to the list * */ if (!empty($this->origin_email) && empty($this->fk_soc)) { @@ -1914,7 +1915,7 @@ class Ticketsup extends CommonObject * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ - public function set_customer($id) + public function setCustomer($id) { if ($this->id) { $sql = "UPDATE " . MAIN_DB_PREFIX . "ticketsup"; @@ -2031,7 +2032,7 @@ class Ticketsup extends CommonObject */ public function getInfosTicketInternalContact() { - return $this->liste_contact(-1, 'internal'); + return $this->listeContact(-1, 'internal'); } /** @@ -2051,7 +2052,7 @@ class Ticketsup extends CommonObject */ public function getInfosTicketExternalContact() { - return $this->liste_contact(-1, 'external'); + return $this->listeContact(-1, 'external'); } /** @@ -2077,7 +2078,6 @@ class Ticketsup extends CommonObject /** * Return id of all contacts for ticket * - * @param int $exclude_self exclude_self Exclude current user form list */ public function getTicketAllContacts() { @@ -2096,7 +2096,6 @@ class Ticketsup extends CommonObject /** * Return id of all contacts for ticket * - * @param int $exclude_self exclude_self Exclude current user form list */ public function getTicketAllCustomerContacts() { @@ -2109,11 +2108,10 @@ class Ticketsup extends CommonObject } /** - * Check if contact are linked to the ticket. If yes, send mail and save trace into llx_notify. - * - * @param string $subject Subject - * @param string $texte Message to send - * @return int <0 if KO, or number of changes if OK + * Send message + * @param string $subject Subject for message + * @param string $texte Text for message + * @return int 1 if ok, -1 otherwise */ public function messageSend($subject, $texte) { @@ -2241,7 +2239,7 @@ class Ticketsup extends CommonObject * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @return array Array of contacts */ - public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') + public function listeContact($statut = -1, $source = 'external', $list = 0) { global $langs; @@ -2293,8 +2291,7 @@ class Ticketsup extends CommonObject } $sql .= " ORDER BY t.lastname ASC"; - //echo $sql; exit; - dol_syslog(get_class($this) . "::liste_contact sql=" . $sql); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); From 6d8566a2385ea50b4f7551c85caacea52df26939 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 11 Mar 2018 12:41:48 +0100 Subject: [PATCH 05/15] fix scrunitizer --- htdocs/core/lib/project.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e0f6f8e7954..c82839d8499 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -331,7 +331,7 @@ function project_admin_prepare_head() */ 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; $lastprojectid=0; @@ -1298,11 +1298,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } $tableCell =''; + $placeholder=''; if ($alreadyspent) { $tableCell.=''; //$placeholder=' placeholder="00:00"'; - $placeholder=''; //$tableCell.='+'; } $tableCell.='\n"; + $total_plannedworkload=0; + $total_declaredprogressworkload=0; while ($i < $num) { $objp = $db->fetch_object($resql); From df185de6aea7f485a3e641652ce4cc1c5597a98c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 11 Mar 2018 15:09:25 +0100 Subject: [PATCH 06/15] Fix mail send --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8ea76bb4fcb..55345d68cc7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -859,7 +859,7 @@ class FormMail extends Form if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1') { if ($arraydefaultmessage && $arraydefaultmessage->content) { - $defaultmessage = $arraydefaultmessage['content']; + $defaultmessage = $arraydefaultmessage->content; } elseif (! is_numeric($this->withbody)) { $defaultmessage = $this->withbody; } From 5656e17570f961bc94e852bb32cdc16c267e6d52 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 11 Mar 2018 16:06:11 +0100 Subject: [PATCH 07/15] Fix PHPCS errors (ticketsup module) --- .../class/actions_ticketsup.class.php | 16 ++++++------- htdocs/ticketsup/class/ticketsup.class.php | 24 +++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php index 94ef7db5849..c7668418980 100644 --- a/htdocs/ticketsup/class/actions_ticketsup.class.php +++ b/htdocs/ticketsup/class/actions_ticketsup.class.php @@ -609,8 +609,8 @@ class ActionsTicketsup /** * Add new message on a ticket (private area) * - * @param User $user - * @param string $action + * @param User $user User for action + * @param string $action Action string */ private function newMessage($user, &$action) { @@ -820,8 +820,8 @@ class ActionsTicketsup /** * Add new message on a ticket (public area) * - * @param User $user - * @param string $action + * @param User $user User for action + * @param string $action Action string */ private function newMessagePublic($user, &$action) { @@ -964,9 +964,9 @@ class ActionsTicketsup /** * Fetch object * - * @param string $id - * @param string $track_id - * @param string $ref + * @param int $id ID of ticket + * @param string $track_id Track ID of ticket (for public area) + * @param string $ref Reference of ticket * @return void */ public function fetch($id = 0, $track_id = 0, $ref = '') @@ -1321,7 +1321,7 @@ class ActionsTicketsup * @param int $fieldid Id * @return int 0 */ - public function load_previous_next_ref($filter, $fieldid) + function load_previous_next_ref($filter, $fieldid) { $this->getInstanceDao(); return $this->dao->load_previous_next_ref($filter, $fieldid); diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index 0dfe7907f71..a224b7d39f4 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -1129,21 +1129,25 @@ class Ticketsup extends CommonObject } } + /** - * \brief Return status label of object - * \param 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 status label of object + * + * @param number $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string */ public function getLibStatut($mode = 0) { return $this->libStatut($this->fk_statut, $mode); } + /** - * \brief Return status label of object - * \param statut id statut - * \param 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 status label of object + * + * @param int $statut id statut + * @param number $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string */ public function libStatut($statut, $mode = 0) { @@ -2390,7 +2394,7 @@ class Ticketsup extends CommonObject * @param string $morehtmlright More html code to show before navigation arrows * @return void */ - public function ticketsup_banner_tab($paramid, $morehtml = '', $shownav = 1, $fieldid = 'id', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '') + function ticketsup_banner_tab($paramid, $morehtml = '', $shownav = 1, $fieldid = 'id', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '') { global $conf, $form, $user, $langs; @@ -2453,7 +2457,7 @@ class Ticketsup extends CommonObject * @param string $sdir Repertoire a scanner * @return boolean true si photo dispo, false sinon */ - public function is_photo_available($sdir) + function is_photo_available($sdir) { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; @@ -2495,7 +2499,7 @@ class Ticketsup extends CommonObject * @param int $nolink Do not add a href link to view enlarged imaged into a new tab * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - public function show_photos($sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0) + function show_photos($sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0) { global $conf, $user, $langs; From cfdaa7c88dacbdef7a21c90b3808dc46d00c0162 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 11 Mar 2018 16:07:13 +0100 Subject: [PATCH 08/15] ticket sup make it work --- htdocs/admin/ticketsup.php | 6 +- htdocs/admin/ticketsup_extrafields.php | 3 +- htdocs/core/lib/ticketsup.lib.php | 26 ++--- .../ticketsup/mod_ticketsup_simple.php | 2 +- .../ticketsup/mod_ticketsup_universal.php | 2 +- .../install/mysql/migration/7.0.0-8.0.0.sql | 102 ++++++++++++++++++ .../mysql/tables/llx_ticketsup.key.sql | 3 +- .../mysql/tables/llx_ticketsup_logs.key.sql | 2 +- 8 files changed, 123 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/ticketsup.php b/htdocs/admin/ticketsup.php index ced25a1cd2d..529d64abf9c 100644 --- a/htdocs/admin/ticketsup.php +++ b/htdocs/admin/ticketsup.php @@ -34,10 +34,10 @@ if (file_exists("../../main.inc.php")) { // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once "../class/ticketsup.class.php"; -require_once "../lib/ticketsup.lib.php"; +require_once DOL_DOCUMENT_ROOT."/ticketsup/class/ticketsup.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/ticketsup.lib.php"; // Translations -$langs->load("ticketsup@ticketsup"); +$langs->load("ticketsup"); // Access control if (!$user->admin) { diff --git a/htdocs/admin/ticketsup_extrafields.php b/htdocs/admin/ticketsup_extrafields.php index 8a7ae788921..9084cac2ac1 100644 --- a/htdocs/admin/ticketsup_extrafields.php +++ b/htdocs/admin/ticketsup_extrafields.php @@ -29,7 +29,8 @@ if (file_exists("../../main.inc.php")) { } else { 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/lib/admin.lib.php'; diff --git a/htdocs/core/lib/ticketsup.lib.php b/htdocs/core/lib/ticketsup.lib.php index c3063783a6f..2d96a6faae5 100644 --- a/htdocs/core/lib/ticketsup.lib.php +++ b/htdocs/core/lib/ticketsup.lib.php @@ -31,18 +31,14 @@ function ticketsupAdminPrepareHead() $h = 0; $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][2] = 'settings'; $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][2] = 'attributes'; $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 // Entries must be declared in modules descriptor with line @@ -59,9 +55,9 @@ function ticketsupAdminPrepareHead() /** * Prepare head for ticket card - * + * * @param Object $object Object Ticket - * @return array Array of tabs + * @return array Array of tabs */ function ticketsup_prepare_head($object) { @@ -69,21 +65,21 @@ function ticketsup_prepare_head($object) $h = 0; $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][2] = 'tabTicketsup'; $h++; 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][2] = 'tabTicketContacts'; $h++; } complete_head_from_modules($conf, $langs, $object, $head, $h, 'ticketsup'); - - + + // Attached files include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $upload_dir = $conf->ticketsup->dir_output . "/" . $object->track_id; @@ -99,15 +95,15 @@ function ticketsup_prepare_head($object) // 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][2] = 'tabTicketLogs'; $h++; - + complete_head_from_modules($conf, $langs, $object, $head, $h, 'ticketsup','remove'); - + return $head; } diff --git a/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php b/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php index 25fabb12377..06c4863fc94 100644 --- a/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php +++ b/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php @@ -23,7 +23,7 @@ * \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 diff --git a/htdocs/core/modules/ticketsup/mod_ticketsup_universal.php b/htdocs/core/modules/ticketsup/mod_ticketsup_universal.php index cc8b88d7e8d..8c0c8c8fe0c 100644 --- a/htdocs/core/modules/ticketsup/mod_ticketsup_universal.php +++ b/htdocs/core/modules/ticketsup/mod_ticketsup_universal.php @@ -22,7 +22,7 @@ * \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 diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 7c82c54fb94..e9543583b03 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -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 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; diff --git a/htdocs/install/mysql/tables/llx_ticketsup.key.sql b/htdocs/install/mysql/tables/llx_ticketsup.key.sql index 4e06a1d8f44..abf853e718c 100755 --- a/htdocs/install/mysql/tables/llx_ticketsup.key.sql +++ b/htdocs/install/mysql/tables/llx_ticketsup.key.sql @@ -14,4 +14,5 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -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); diff --git a/htdocs/install/mysql/tables/llx_ticketsup_logs.key.sql b/htdocs/install/mysql/tables/llx_ticketsup_logs.key.sql index 764a6dc313a..180febe01bf 100755 --- a/htdocs/install/mysql/tables/llx_ticketsup_logs.key.sql +++ b/htdocs/install/mysql/tables/llx_ticketsup_logs.key.sql @@ -14,4 +14,4 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -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); From c3fab4c54cb0e6044b177ab7c80d797153c77d63 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 11 Mar 2018 16:48:26 +0100 Subject: [PATCH 09/15] Fix Phpunit issue --- htdocs/core/modules/ticketsup/mod_ticketsup_simple.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php b/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php index 25fabb12377..f0293f78d1f 100644 --- a/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php +++ b/htdocs/core/modules/ticketsup/mod_ticketsup_simple.php @@ -73,7 +73,8 @@ class mod_ticketsup_simple extends ModeleNumRefTicketsup $posindice = 8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; $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; $resql = $db->query($sql); if ($resql) { @@ -107,7 +108,8 @@ class mod_ticketsup_simple extends ModeleNumRefTicketsup $posindice = 8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; $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; $resql = $db->query($sql); From 3b814ebba2109c41b5d931981b0b7caa269564cf Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 11 Mar 2018 16:54:39 +0100 Subject: [PATCH 10/15] Try to fix phpunit test (br tag isuue) --- .../interface_50_modTicketsup_TicketEmail.class.php | 8 ++++---- htdocs/public/ticketsup/create_ticket.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicketsup_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicketsup_TicketEmail.class.php index 4f757c268ac..1990f184f84 100644 --- a/htdocs/core/triggers/interface_50_modTicketsup_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicketsup_TicketEmail.class.php @@ -134,8 +134,8 @@ class InterfaceTicketEmail extends DolibarrTriggers } $message .= ''; - $message .= '

' . $langs->trans('Message') . ' :
' . $object->message . '

'; - $message .= '

' . $langs->trans('SeeThisTicketIntomanagementInterface') . '

'; + $message .= '

' . $langs->trans('Message') . ' :
' . $object->message . '

'; + $message .= '

' . $langs->trans('SeeThisTicketIntomanagementInterface') . '

'; $sendto = $userstat->email; $from = dolGetFirstLastname($user->firstname, $user->lastname) . '<' . $user->email . '>'; @@ -202,7 +202,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin.='

'.$langs->trans('Company'). ' : '.$object->thirdparty->name.'

'; } - $message_admin.='

'.$langs->trans('Message').' :
'.$object->message.'

'; + $message_admin.='

'.$langs->trans('Message').' :
'.$object->message.'

'; $message_admin.='

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKETS_NOTIFICATION_EMAIL_FROM.'>'; @@ -250,7 +250,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } } $message_customer.=''; - $message_customer.='

'.$langs->trans('Message').' :
'.$object->message.'

'; + $message_customer.='

'.$langs->trans('Message').' :
'.$object->message.'

'; $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.='

' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : '.$url_public_ticket.'

'; $message_customer.='

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php index 06c6b85cb02..867658b48ac 100644 --- a/htdocs/public/ticketsup/create_ticket.php +++ b/htdocs/public/ticketsup/create_ticket.php @@ -275,7 +275,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { } } $message_admin .= ''; - $message_admin .= '

' . $langs->trans('Message') . ' :
' . $object->message . '

'; + $message_admin .= '

' . $langs->trans('Message') . ' :
' . $object->message . '

'; $message_admin .= '

' . $langs->trans('SeeThisTicketIntomanagementInterface') . '

'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM . '<' . $conf->global->TICKETS_NOTIFICATION_EMAIL_FROM . '>'; @@ -367,7 +367,7 @@ if ($action != "infos_success") { $formticket->showForm(); } else { print '
' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '' . $object->track_id . ''); - print '
'; + print '
'; print $langs->trans('PleaseRememberThisId'); } print '
'; From 435a04996004309bed90c321a8a52483403a42e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 11 Mar 2018 17:35:00 +0100 Subject: [PATCH 11/15] Create index.html --- htdocs/ticketsup/tpl/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/ticketsup/tpl/index.html diff --git a/htdocs/ticketsup/tpl/index.html b/htdocs/ticketsup/tpl/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/ticketsup/tpl/index.html @@ -0,0 +1 @@ + From af6f7f6773e5df4c27238bededaeb12decb38b92 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 11 Mar 2018 17:44:47 +0100 Subject: [PATCH 12/15] Fix: travis --- htdocs/public/ticketsup/list.php | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/htdocs/public/ticketsup/list.php b/htdocs/public/ticketsup/list.php index 0cbbd65f6b2..adea8def5ea 100644 --- a/htdocs/public/ticketsup/list.php +++ b/htdocs/public/ticketsup/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2016 Jean-François FERRY * * 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 @@ -34,28 +34,10 @@ if (!defined("NOLOGIN")) { } // If this page is public (can be called outside logged session) -// Change this following line to use the correct relative path (../, ../../, etc) -$res = 0; -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 && 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'); +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/ticketsup/class/actions_ticketsup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/ticketsup/class/html.formticketsup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/ticketsup/lib/ticketsup.lib.php'; // Load traductions files requiredby by page $langs->load("companies"); @@ -671,7 +653,7 @@ if ($action == "view_ticketlist") { } } } else { - print ''; + print ''; } } else { print '

' . $langs->trans("TicketPublicMsgViewLogIn") . '

'; From dea80eba4ebfd5f64386ba11e3badb13b10046ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 18:06:08 +0100 Subject: [PATCH 13/15] Use a constant name starting with MAIN --- htdocs/core/modules/DolibarrModules.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index c1c570e8269..160499d3a45 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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') { - $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); 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') { - $result=run_sql($dir.$file, empty($conf->global->INSTALL_DISPLAY_SQL_LOG)?0:1, '', 1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } From 5251a6c72a9ab69a55a29c13388159784b8ca800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 11 Mar 2018 18:12:32 +0100 Subject: [PATCH 14/15] Update index.php --- htdocs/ticketsup/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticketsup/index.php b/htdocs/ticketsup/index.php index 74a6000c2ee..505812f84c6 100644 --- a/htdocs/ticketsup/index.php +++ b/htdocs/ticketsup/index.php @@ -347,7 +347,7 @@ if ($result) { $db->free(); } else { - print '
' . $langs->trans('NoTicketsFound') . '
'; + print '
' . $langs->trans('NoTicketsFound') . '
'; } print ""; From 69f66f998df37593644e56c610c9fbe6ddb05154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 11 Mar 2018 18:13:39 +0100 Subject: [PATCH 15/15] Delete .gitignore --- htdocs/ticketsup/.gitignore | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100755 htdocs/ticketsup/.gitignore diff --git a/htdocs/ticketsup/.gitignore b/htdocs/ticketsup/.gitignore deleted file mode 100755 index 32dd28ee407..00000000000 --- a/htdocs/ticketsup/.gitignore +++ /dev/null @@ -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/