| ' . $langs->trans('MailRecipients') . ' | ';
$ticketstat = new Ticketsup($this->db);
- $res = $ticketstat->fetch('', $this->track_id);
+ $res = $ticketstat->fetch('', '', $this->track_id);
if ($res) {
// Retrieve email of all contacts (internal and external)
$contacts = $ticketstat->getInfosTicketInternalContact();
@@ -887,7 +887,7 @@ class FormTicketsup
$ticketstat->socid = $ticketstat->fk_soc;
$ticketstat->fetch_thirdparty();
- if (!in_array($ticketstat->thirdparty->email, $sendto)) {
+ if (is_array($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
$sendto[] = $ticketstat->thirdparty->email . '(' . $langs->trans('Customer') . ')';
}
}
diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php
index 4852974ab3e..d57ff680dbf 100644
--- a/htdocs/public/ticketsup/create_ticket.php
+++ b/htdocs/public/ticketsup/create_ticket.php
@@ -93,9 +93,7 @@ if (GETPOST('addfile') && !GETPOST('add_ticket')) {
// Remove file
if (GETPOST('removedfile') && !GETPOST('add_ticket')) {
- ////$res = $object->fetch('','',GETPOST('track_id'));
- ////if($res > 0)
- ////{
+
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp directory
@@ -103,9 +101,8 @@ if (GETPOST('removedfile') && !GETPOST('add_ticket')) {
$upload_dir_tmp = $vardir . '/temp';
// TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'], 0);
+ dol_remove_file_process($_POST['removedfile'], 0, 0);
$action = 'create_ticket';
- ////}
}
if ($action == 'create_ticket' && GETPOST('add_ticket')) {
$error = 0;
diff --git a/htdocs/public/ticketsup/list.php b/htdocs/public/ticketsup/list.php
index 42cf6d3c573..9a930bc78b0 100644
--- a/htdocs/public/ticketsup/list.php
+++ b/htdocs/public/ticketsup/list.php
@@ -274,9 +274,7 @@ if ($action == "view_ticketlist")
$limit = $conf->liste_limit;
$page = GETPOST("page", 'int');
- if ($page == -1) {
- $page = 0;
- }
+ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/ticketsup/card.php b/htdocs/ticketsup/card.php
index 6d33a5cd9be..b85d53763bf 100644
--- a/htdocs/ticketsup/card.php
+++ b/htdocs/ticketsup/card.php
@@ -134,7 +134,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be inc
$userstat = new User($db);
$form = new Form($db);
$formticket = new FormTicketsup($db);
-$formproject = new FormProjets($db);
+
+if (! empty($conf->projet->enabled)) {
+ $formproject = new FormProjets($db);
+}
if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink')
@@ -631,15 +634,15 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print ' ';
- print dol_print_phone($tab[$i]['phone'], '', '', '', AC_TEL).' ';
+ print dol_print_phone($tab[$i]['phone'], '', '', '', 'AC_TEL').' ';
if (! empty($tab[$i]['phone_perso'])) {
//print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' ';
- print ' '.dol_print_phone($tab[$i]['phone_perso'], '', '', '', AC_TEL).' ';
+ print ' '.dol_print_phone($tab[$i]['phone_perso'], '', '', '', 'AC_TEL').' ';
}
if (! empty($tab[$i]['phone_mobile'])) {
//print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' ';
- print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', AC_TEL).' ';
+ print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', 'AC_TEL').' ';
}
print ' ';
diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php
index a0eef07cddf..d8922a94b24 100644
--- a/htdocs/ticketsup/class/ticketsup.class.php
+++ b/htdocs/ticketsup/class/ticketsup.class.php
@@ -1639,7 +1639,7 @@ class Ticketsup extends CommonObject
{
global $langs;
- if (count($this->cache_logs_ticket)) {
+ if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) {
return 0;
}
// Cache deja charge
@@ -1751,7 +1751,7 @@ class Ticketsup extends CommonObject
{
global $langs;
- if (count($this->cache_msgs_ticket)) {
+ if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) {
return 0;
}
// Cache deja charge
diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php
index a5552d854b1..61dcf45ba83 100644
--- a/htdocs/ticketsup/list.php
+++ b/htdocs/ticketsup/list.php
@@ -1,6 +1,7 @@
- * Copyright (C) 2016 Christophe Battarel
+/* Copyright (C) 2013-2018 Jean-François FERRY
+ * Copyright (C) 2016 Christophe Battarel
+ * Copyright (C) 2018 Regis Houssin
*
* 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
@@ -580,12 +581,13 @@ print ' |
'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
-foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
-{
- if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
+if (! empty($extrafields->attributes[$object->table_element]['computed'])) {
+ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
+ {
+ if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
+ }
}
-
// Loop on record
// --------------------------------------------------------------------
$i=0;