Merge pull request #8340 from Librethic/ticketsup_core
Fix PHPCS errors with ticketsup module
This commit is contained in:
commit
4b3c2bb824
@ -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 '<select id="select' . $htmlname . '" class="flat select_ticketcategory" name="' . $htmlname . '">';
|
||||
if ($empty) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?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>
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -134,8 +134,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$message .= '</ul>';
|
||||
$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>' . $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></p>';
|
||||
|
||||
$sendto = $userstat->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('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>';
|
||||
|
||||
$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.='<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;
|
||||
$message_customer.='<p>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||
$message_customer.='<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||
|
||||
@ -275,7 +275,7 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) {
|
||||
}
|
||||
}
|
||||
$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>';
|
||||
|
||||
$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 '<div class="ok">' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>' . $object->track_id . '</strong>');
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
print $langs->trans('PleaseRememberThisId');
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
@ -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 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 Object user
|
||||
* @param string $action 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 int $id Id
|
||||
* @param int $track_id Track id
|
||||
* @param string $ref 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 = '')
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
*/
|
||||
function load_cache_categories_tickets()
|
||||
public function loadCacheCategoriesTickets()
|
||||
{
|
||||
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
|
||||
* @return string Label
|
||||
* @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
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->fk_statut, $mode);
|
||||
return $this->libStatut($this->fk_statut, $mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 string $option Sur quoi pointe le lien
|
||||
* @return string Chaine avec URL
|
||||
* @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
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '')
|
||||
{
|
||||
@ -1330,9 +1333,9 @@ class Ticketsup extends CommonObject
|
||||
/**
|
||||
* Mark a message as read
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger No trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger No trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function markAsRead($user, $notrigger = 0)
|
||||
{
|
||||
@ -1431,10 +1434,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)
|
||||
{
|
||||
@ -1492,7 +1495,7 @@ class Ticketsup extends CommonObject
|
||||
* @param string $log_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;
|
||||
|
||||
@ -1501,8 +1504,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)) {
|
||||
@ -2034,7 +2037,7 @@ class Ticketsup extends CommonObject
|
||||
*/
|
||||
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()
|
||||
{
|
||||
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 $texte Message to send
|
||||
@ -2243,10 +2246,9 @@ class Ticketsup extends CommonObject
|
||||
* @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 int $list 0:Return array contains all properties, 1:Return array contains just id
|
||||
* @param string $code Code
|
||||
* @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;
|
||||
|
||||
@ -2298,8 +2300,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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user