From ff76e60c49685c71d034f2739609bdb8d08e615c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 10:13:20 +0200 Subject: [PATCH] Fix: some bugs and warnings --- htdocs/core/class/commonobject.class.php | 27 ++++++++++--------- .../core/class/html.formticketsup.class.php | 4 +-- htdocs/ticketsup/card.php | 11 +++++--- htdocs/ticketsup/class/ticketsup.class.php | 4 +-- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 70342919792..1b750e59503 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3923,23 +3923,26 @@ abstract class CommonObject $var = true; $i = 0; - foreach ($this->lines as $line) + if (! empty($this->lines)) { - if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) + foreach ($this->lines as $line) { - if (empty($line->fk_parent_line)) + if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) { - $parameters=array('line'=>$line,'var'=>$var,'i'=>$i); - $action=''; - $hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($line->fk_parent_line)) + { + $parameters=array('line'=>$line,'var'=>$var,'i'=>$i); + $action=''; + $hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + } + } + else + { + $this->printOriginLine($line, $var, $restrictlist); } - } - else - { - $this->printOriginLine($line, $var, $restrictlist); - } - $i++; + $i++; + } } } diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 9cc9a09dbc6..a7f1b7a8d34 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -858,7 +858,7 @@ class FormTicketsup // Destinataires print '' . $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(); @@ -881,7 +881,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/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 5a4f71e81e3..8f967ecb09f 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