Dolibarrize module
This commit is contained in:
parent
f0a0c8c3e5
commit
8b6dea218b
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Module descriptor for ticket system
|
/* Copyright (C) - 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||||
* Copyright (C) - 2013-2018 Jean-François FERRY <hello@librethic.io>
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -14,17 +13,20 @@
|
|||||||
*
|
*
|
||||||
* 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/>.
|
||||||
|
*
|
||||||
|
* Module descriptor for ticket system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup ticketsup Ticketsup module
|
* \defgroup ticketsup Ticketsup module
|
||||||
* \brief Ticketsup module descriptor.
|
* \brief Ticketsup module descriptor.
|
||||||
* \file core/modules/modTicketsup.class.php
|
* \file core/modules/modTicketsup.class.php
|
||||||
* \ingroup ticketsup
|
* \ingroup ticketsup
|
||||||
* \brief Description and activation file for module Ticketsup
|
* \brief Description and activation file for module Ticketsup
|
||||||
*/
|
*/
|
||||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
|
require_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description and activation class for module Ticketsup
|
* Description and activation class for module Ticketsup
|
||||||
*/
|
*/
|
||||||
@ -45,13 +47,10 @@ class modTicketsup extends DolibarrModules
|
|||||||
// Id for module (must be unique).
|
// Id for module (must be unique).
|
||||||
// Use a free id here
|
// Use a free id here
|
||||||
// (See in Home -> System information -> Dolibarr for list of used modules id).
|
// (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||||
$this->numero = 110120;
|
$this->numero = 56000;
|
||||||
// Key text used to identify module (for permissions, menus, etc...)
|
// Key text used to identify module (for permissions, menus, etc...)
|
||||||
$this->rights_class = 'ticketsup';
|
$this->rights_class = 'ticketsup';
|
||||||
|
|
||||||
$this->editor_name = "Dolibarr";
|
|
||||||
$this->editor_web = "https://dolibrr.org";
|
|
||||||
|
|
||||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||||
// It is used to group modules in module setup page
|
// It is used to group modules in module setup page
|
||||||
$this->family = "crm";
|
$this->family = "crm";
|
||||||
@ -70,9 +69,6 @@ class modTicketsup extends DolibarrModules
|
|||||||
// Key used in llx_const table to save module status enabled/disabled
|
// Key used in llx_const table to save module status enabled/disabled
|
||||||
// (where MYMODULE is value of property name of module in uppercase)
|
// (where MYMODULE is value of property name of module in uppercase)
|
||||||
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||||
// Where to store the module in setup page
|
|
||||||
// (0=common,1=interface,2=others,3=very specific)
|
|
||||||
$this->special = 2;
|
|
||||||
// Name of image file used for this module.
|
// Name of image file used for this module.
|
||||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png
|
// If file is in theme/yourtheme/img directory under name object_pictovalue.png
|
||||||
// use this->picto='pictovalue'
|
// use this->picto='pictovalue'
|
||||||
@ -119,7 +115,7 @@ class modTicketsup extends DolibarrModules
|
|||||||
$this->requiredby = array();
|
$this->requiredby = array();
|
||||||
// Minimum version of PHP required by module
|
// Minimum version of PHP required by module
|
||||||
$this->phpmin = array(5, 3);
|
$this->phpmin = array(5, 3);
|
||||||
$this->langfiles = array("ticketsup");
|
$this->langfiles = array("ticketsup");
|
||||||
// Constants
|
// Constants
|
||||||
// List of particular constants to add when module is enabled
|
// List of particular constants to add when module is enabled
|
||||||
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||||
@ -168,43 +164,36 @@ class modTicketsup extends DolibarrModules
|
|||||||
$r = 0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 110120; // id de la permission
|
$this->rights[$r][0] = 56001; // id de la permission
|
||||||
$this->rights[$r][1] = "Créer un ticket"; // libelle de la permission
|
$this->rights[$r][1] = "Read ticket"; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'c'; // type de la permission (deprecie a ce jour)
|
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
|
||||||
$this->rights[$r][4] = 'create';
|
|
||||||
|
|
||||||
$r++;
|
|
||||||
$this->rights[$r][0] = 110121; // id de la permission
|
|
||||||
$this->rights[$r][1] = "Lire les tickets"; // libelle de la permission
|
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'read';
|
$this->rights[$r][4] = 'read';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 110122; // id de la permission
|
$this->rights[$r][0] = 56002; // id de la permission
|
||||||
$this->rights[$r][1] = "Modifier les tickets"; // libelle de la permission
|
$this->rights[$r][1] = "Create les tickets"; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'write';
|
$this->rights[$r][4] = 'write';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 110123; // id de la permission
|
$this->rights[$r][0] = 56003; // id de la permission
|
||||||
$this->rights[$r][1] = "Supprimer les tickets"; // libelle de la permission
|
$this->rights[$r][1] = "Delete les tickets"; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'delete';
|
$this->rights[$r][4] = 'delete';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 110124; // id de la permission
|
$this->rights[$r][0] = 56004; // id de la permission
|
||||||
$this->rights[$r][1] = "Gérer les tickets"; // libelle de la permission
|
$this->rights[$r][1] = "Manage tickets"; // libelle de la permission
|
||||||
//$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
//$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'manage';
|
$this->rights[$r][4] = 'manage';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 110125; // id de la permission
|
$this->rights[$r][0] = 56005; // id de la permission
|
||||||
$this->rights[$r][1] = 'Voir tous les tickets (non effectif pour les utilisateurs externes, toujours limités au tiers dont ils dépendent)'; // libelle de la permission
|
$this->rights[$r][1] = 'See all tickets, even if not assigned to (not effective for external users, always restricted to the thirdpardy they depends on)'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'view';
|
$this->rights[$r][4] = 'view';
|
||||||
@ -250,7 +239,7 @@ class modTicketsup extends DolibarrModules
|
|||||||
'langs' => 'ticketsup@ticketsup',
|
'langs' => 'ticketsup@ticketsup',
|
||||||
'position' => 102,
|
'position' => 102,
|
||||||
'enabled' => 1,
|
'enabled' => 1,
|
||||||
'perms' => '$user->rights->ticketsup->create',
|
'perms' => '$user->rights->ticketsup->write',
|
||||||
'target' => '',
|
'target' => '',
|
||||||
'user' => 2);
|
'user' => 2);
|
||||||
$r++;
|
$r++;
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class ActionsTicketsup
|
|||||||
////}
|
////}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('add_ticket') && $user->rights->ticketsup->create) {
|
if (GETPOST('add_ticket') && $user->rights->ticketsup->write) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (!GETPOST("subject")) {
|
if (!GETPOST("subject")) {
|
||||||
@ -602,7 +602,7 @@ class ActionsTicketsup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ class ActionsTicketsup
|
|||||||
if ($conf->global->TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKETS_NOTIFICATION_EMAIL_TO, $sendto)) {
|
if ($conf->global->TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKETS_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||||
if(!empty($conf->global->TICKETS_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKETS_NOTIFICATION_EMAIL_TO;
|
if(!empty($conf->global->TICKETS_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKETS_NOTIFICATION_EMAIL_TO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// altairis: dont try to send email if no recipient
|
// altairis: dont try to send email if no recipient
|
||||||
if (!empty($sendto)) {
|
if (!empty($sendto)) {
|
||||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
|
||||||
@ -779,13 +779,13 @@ class ActionsTicketsup
|
|||||||
if (!empty($this->dao->origin_email)) {
|
if (!empty($this->dao->origin_email)) {
|
||||||
$sendto[] = $this->dao->origin_email;
|
$sendto[] = $this->dao->origin_email;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->dao->fk_soc > 0 && ! in_array($this->dao->origin_email, $sendto)) {
|
if ($this->dao->fk_soc > 0 && ! in_array($this->dao->origin_email, $sendto)) {
|
||||||
$this->dao->socid = $this->dao->fk_soc;
|
$this->dao->socid = $this->dao->fk_soc;
|
||||||
$this->dao->fetch_thirdparty();
|
$this->dao->fetch_thirdparty();
|
||||||
if(!empty($this->dao->thirdparty->email)) $sendto[] = $this->dao->thirdparty->email;
|
if(!empty($this->dao->thirdparty->email)) $sendto[] = $this->dao->thirdparty->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
// altairis: Add global email address reciepient
|
// altairis: Add global email address reciepient
|
||||||
if ($conf->global->TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKETS_NOTIFICATION_EMAIL_TO, $sendto)) {
|
if ($conf->global->TICKETS_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKETS_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||||
if(!empty($conf->global->TICKETS_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKETS_NOTIFICATION_EMAIL_TO;
|
if(!empty($conf->global->TICKETS_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKETS_NOTIFICATION_EMAIL_TO;
|
||||||
@ -963,7 +963,7 @@ class ActionsTicketsup
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch object
|
* Fetch object
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @param int $track_id Track id
|
* @param int $track_id Track id
|
||||||
* @param string $ref Ref
|
* @param string $ref Ref
|
||||||
@ -977,7 +977,7 @@ class ActionsTicketsup
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* print statut
|
* print statut
|
||||||
*
|
*
|
||||||
* @param int $mode Mode
|
* @param int $mode Mode
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -1088,7 +1088,7 @@ class ActionsTicketsup
|
|||||||
print '<div class="info">' . $langs->trans('NoLogForThisTicket') . '</div>';
|
print '<div class="info">' . $langs->trans('NoLogForThisTicket') . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View list of logs with timeline view
|
* View list of logs with timeline view
|
||||||
*
|
*
|
||||||
@ -1098,10 +1098,10 @@ class ActionsTicketsup
|
|||||||
public function viewTimelineTicketLogs($show_user = true)
|
public function viewTimelineTicketLogs($show_user = true)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $bc;
|
global $conf, $langs, $bc;
|
||||||
|
|
||||||
// Load logs in cache
|
// Load logs in cache
|
||||||
$ret = $this->dao->loadCacheLogsTicket();
|
$ret = $this->dao->loadCacheLogsTicket();
|
||||||
|
|
||||||
if (is_array($this->dao->cache_logs_ticket) && count($this->dao->cache_logs_ticket) > 0) {
|
if (is_array($this->dao->cache_logs_ticket) && count($this->dao->cache_logs_ticket) > 0) {
|
||||||
print '<section id="cd-timeline">';
|
print '<section id="cd-timeline">';
|
||||||
|
|
||||||
@ -1110,13 +1110,13 @@ class ActionsTicketsup
|
|||||||
print '<div class="cd-timeline-img">';
|
print '<div class="cd-timeline-img">';
|
||||||
//print '<img src="img/history.png" alt="">';
|
//print '<img src="img/history.png" alt="">';
|
||||||
print '</div> <!-- cd-timeline-img -->';
|
print '</div> <!-- cd-timeline-img -->';
|
||||||
|
|
||||||
print '<div class="cd-timeline-content">';
|
print '<div class="cd-timeline-content">';
|
||||||
print dol_nl2br($arraylogs['message']);
|
print dol_nl2br($arraylogs['message']);
|
||||||
|
|
||||||
print '<span class="cd-date">';
|
print '<span class="cd-date">';
|
||||||
print dol_print_date($arraylogs['datec'], 'dayhour');
|
print dol_print_date($arraylogs['datec'], 'dayhour');
|
||||||
|
|
||||||
if ($show_user) {
|
if ($show_user) {
|
||||||
if ($arraylogs['fk_user_create'] > 0) {
|
if ($arraylogs['fk_user_create'] > 0) {
|
||||||
$userstat = new User($this->db);
|
$userstat = new User($this->db);
|
||||||
@ -1148,13 +1148,13 @@ class ActionsTicketsup
|
|||||||
global $langs;
|
global $langs;
|
||||||
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
|
||||||
// MESSAGE
|
// MESSAGE
|
||||||
|
|
||||||
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="track_id" value="' . $this->dao->track_id . '">';
|
print '<input type="hidden" name="track_id" value="' . $this->dao->track_id . '">';
|
||||||
print '<input type="hidden" name="action" value="set_message">';
|
print '<input type="hidden" name="action" value="set_message">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial message
|
// Initial message
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr class="liste_titre"><td class="nowrap" colspan="2">';
|
print '<tr class="liste_titre"><td class="nowrap" colspan="2">';
|
||||||
@ -1163,9 +1163,9 @@ class ActionsTicketsup
|
|||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=edit_message_init&track_id=' . $this->dao->track_id . '">' . img_edit($langs->trans('Modify')) . ' ' . $langs->trans('Modify') . '</a>';
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=edit_message_init&track_id=' . $this->dao->track_id . '">' . img_edit($langs->trans('Modify')) . ' ' . $langs->trans('Modify') . '</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
|
||||||
// MESSAGE
|
// MESSAGE
|
||||||
@ -1181,7 +1181,7 @@ class ActionsTicketsup
|
|||||||
} else {
|
} else {
|
||||||
print dol_nl2br($this->dao->message);
|
print dol_nl2br($this->dao->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<div>' . $this->dao->message . '</div>';
|
//print '<div>' . $this->dao->message . '</div>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1209,7 +1209,7 @@ class ActionsTicketsup
|
|||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
|
|
||||||
$this->viewTicketOriginalMessage($user, $action);
|
$this->viewTicketOriginalMessage($user, $action);
|
||||||
|
|
||||||
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
|
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
|
||||||
print_titre($langs->trans('TicketMailExchanges'));
|
print_titre($langs->trans('TicketMailExchanges'));
|
||||||
|
|
||||||
@ -1264,7 +1264,7 @@ class ActionsTicketsup
|
|||||||
print '<div class="info">' . $langs->trans('NoMsgForThisTicket') . '</div>';
|
print '<div class="info">' . $langs->trans('NoMsgForThisTicket') . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View list of message for ticket with timeline display
|
* View list of message for ticket with timeline display
|
||||||
*
|
*
|
||||||
@ -1275,11 +1275,11 @@ class ActionsTicketsup
|
|||||||
public function viewTicketTimelineMessages($show_private, $show_user = true)
|
public function viewTicketTimelineMessages($show_private, $show_user = true)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user, $bc;
|
global $conf, $langs, $user, $bc;
|
||||||
|
|
||||||
// Load logs in cache
|
// Load logs in cache
|
||||||
$ret = $this->dao->loadCacheMsgsTicket();
|
$ret = $this->dao->loadCacheMsgsTicket();
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
|
|
||||||
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
|
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
|
||||||
print '<section id="cd-timeline">';
|
print '<section id="cd-timeline">';
|
||||||
|
|
||||||
@ -1291,13 +1291,13 @@ class ActionsTicketsup
|
|||||||
print '<div class="cd-timeline-img">';
|
print '<div class="cd-timeline-img">';
|
||||||
print '<img src="img/messages.png" alt="">';
|
print '<img src="img/messages.png" alt="">';
|
||||||
print '</div> <!-- cd-timeline-img -->';
|
print '</div> <!-- cd-timeline-img -->';
|
||||||
|
|
||||||
print '<div class="cd-timeline-content">';
|
print '<div class="cd-timeline-content">';
|
||||||
print $arraymsgs['message'];
|
print $arraymsgs['message'];
|
||||||
|
|
||||||
print '<span class="cd-date">';
|
print '<span class="cd-date">';
|
||||||
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
||||||
|
|
||||||
if ($show_user) {
|
if ($show_user) {
|
||||||
if ($arraymsgs['fk_user_action'] > 0) {
|
if ($arraymsgs['fk_user_action'] > 0) {
|
||||||
$userstat = new User($this->db);
|
$userstat = new User($this->db);
|
||||||
@ -1324,7 +1324,7 @@ class ActionsTicketsup
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* load_previous_next_ref
|
* load_previous_next_ref
|
||||||
*
|
*
|
||||||
* @param string $filter Filter
|
* @param string $filter Filter
|
||||||
* @param int $fieldid Id
|
* @param int $fieldid Id
|
||||||
* @return int 0
|
* @return int 0
|
||||||
@ -1420,7 +1420,7 @@ class ActionsTicketsup
|
|||||||
/**
|
/**
|
||||||
* Copy files into ticket directory
|
* Copy files into ticket directory
|
||||||
* Used for files linked into messages
|
* Used for files linked into messages
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copyFilesForTicket()
|
public function copyFilesForTicket()
|
||||||
@ -1467,7 +1467,7 @@ class ActionsTicketsup
|
|||||||
/**
|
/**
|
||||||
* Print html navbar with link to set ticket status
|
* 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'
|
* $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted'
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function viewStatusActions()
|
public function viewStatusActions()
|
||||||
@ -1506,17 +1506,17 @@ class ActionsTicketsup
|
|||||||
print '</div></div><br />';
|
print '</div></div><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deleteObjectLinked
|
* deleteObjectLinked
|
||||||
*
|
*
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function deleteObjectLinked()
|
public function deleteObjectLinked()
|
||||||
{
|
{
|
||||||
return $this->dao->deleteObjectLinked();
|
return $this->dao->deleteObjectLinked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook to add email element template
|
* Hook to add email element template
|
||||||
*
|
*
|
||||||
@ -1529,13 +1529,13 @@ class ActionsTicketsup
|
|||||||
public function emailElementlist($parameters, &$object, &$action, $hookmanager)
|
public function emailElementlist($parameters, &$object, &$action, $hookmanager)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (in_array('admin', explode(':', $parameters['context']))) {
|
if (in_array('admin', explode(':', $parameters['context']))) {
|
||||||
$this->results = array('ticketsup_send' => $langs->trans('MailToSendTicketsupMessage'));
|
$this->results = array('ticketsup_send' => $langs->trans('MailToSendTicketsupMessage'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
return 0; // or return 1 to replace standard code
|
return 0; // or return 1 to replace standard code
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -303,7 +303,7 @@ class Ticketsups extends DolibarrApi
|
|||||||
public function post($request_data = null)
|
public function post($request_data = null)
|
||||||
{
|
{
|
||||||
$ticketstatic = new Ticketsup($this->db);
|
$ticketstatic = new Ticketsup($this->db);
|
||||||
if (! DolibarrApiAccess::$user->rights->ticketsup->create) {
|
if (! DolibarrApiAccess::$user->rights->ticketsup->write) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
@ -334,7 +334,7 @@ class Ticketsups extends DolibarrApi
|
|||||||
public function postNewMessage($request_data = null)
|
public function postNewMessage($request_data = null)
|
||||||
{
|
{
|
||||||
$ticketstatic = new Ticketsup($this->db);
|
$ticketstatic = new Ticketsup($this->db);
|
||||||
if (! DolibarrApiAccess::$user->rights->ticketsup->create) {
|
if (! DolibarrApiAccess::$user->rights->ticketsup->write) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
@ -365,7 +365,7 @@ class Ticketsups extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function put($id, $request_data = null)
|
public function put($id, $request_data = null)
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->ticketsup->create) {
|
if (! DolibarrApiAccess::$user->rights->ticketsup->write) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ class Ticketsups extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->ticketsup->supprimer) {
|
if (! DolibarrApiAccess::$user->rights->ticketsup->delete) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->ticketsup->fetch($id);
|
$result = $this->ticketsup->fetch($id);
|
||||||
|
|||||||
@ -159,7 +159,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -175,7 +175,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Ticketsup';
|
$objectclass='Ticketsup';
|
||||||
$objectlabel='Ticketsup';
|
$objectlabel='Ticketsup';
|
||||||
@ -285,14 +285,14 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ foreach($object->fields as $key => $val)
|
|||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
$object->printSelectStatus(dol_escape_htmltag($search[$key]));
|
$object->printSelectStatus(dol_escape_htmltag($search[$key]));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
} elseif ($key == 'type_code') {
|
} elseif ($key == 'type_code') {
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
$formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1);
|
$formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1);
|
||||||
@ -527,7 +527,7 @@ foreach($object->fields as $key => $val)
|
|||||||
$formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1);
|
$formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 2, 1, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,14 +586,14 @@ while ($i < min($num, $limit))
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if (empty($obj)) break; // Should not happen
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$object->id = $obj->rowid;
|
$object->id = $obj->rowid;
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (isset($obj->$key)) $object->$key = $obj->$key;
|
if (isset($obj->$key)) $object->$key = $obj->$key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show here line of result
|
// Show here line of result
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
@ -633,9 +633,9 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,18 +691,18 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
|
|||||||
{
|
{
|
||||||
$hidegeneratedfilelistifempty=1;
|
$hidegeneratedfilelistifempty=1;
|
||||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
|
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
// Show list of available documents
|
// Show list of available documents
|
||||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||||
$urlsource.=str_replace('&','&',$param);
|
$urlsource.=str_replace('&','&',$param);
|
||||||
|
|
||||||
$filedir=$diroutputmassaction;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->ticketsup->read;
|
$genallowed=$user->rights->ticketsup->read;
|
||||||
$delallowed=$user->rights->ticketsup->create;
|
$delallowed=$user->rights->ticketsup->write;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_ticketsup','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
|
print $formfile->showdocuments('massfilesarea_ticketsup','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $notnotifytiersatcreate = !empty($notNotifyTiers);
|
|||||||
$action = GETPOST('action', 'alpha', 3);
|
$action = GETPOST('action', 'alpha', 3);
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if (!$user->rights->ticketsup->read || !$user->rights->ticketsup->create) {
|
if (!$user->rights->ticketsup->read || !$user->rights->ticketsup->write) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user