From 85c93c26a90eda3cd091c7043e6c5ff53a34ee26 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:27:54 +0200 Subject: [PATCH 1/5] Fix: dolibarrize --- htdocs/core/class/html.formticketsup.class.php | 13 +++++++------ htdocs/ticketsup/list.php | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 7248e2b9a8e..120d4c218be 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -148,7 +148,8 @@ class FormTicketsup } print ''; - print '
'; + dol_fiche_head(''); + print ''; @@ -181,7 +182,7 @@ class FormTicketsup print ''; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { $htmlname = 'socid'; @@ -436,7 +437,7 @@ class FormTicketsup $ticketstat->loadCacheTypesTickets(); - print ''; if ($empty) { print ''; } @@ -536,7 +537,7 @@ class FormTicketsup $ticketstat->loadCacheCategoriesTickets(); - print ''; if ($empty) { print ''; } @@ -605,7 +606,7 @@ class FormTicketsup print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - print ajax_combobox('select'.$htmlname); + print ajax_combobox('select'.$htmlname,'',0,0,'off'); } /** @@ -637,7 +638,7 @@ class FormTicketsup $ticketstat->loadCacheSeveritiesTickets(); - print ''; if ($empty) { print ''; } 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; From d841abd55ade6792f00448abed6e2401dfdfa5e8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:37:29 +0200 Subject: [PATCH 2/5] Fix: missing value when reload --- htdocs/core/class/html.formticketsup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 120d4c218be..9cc9a09dbc6 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -299,7 +299,7 @@ class FormTicketsup // Notify thirdparty at creation print ''; // TITLE From d6680b982a8ca775b295fa4fd70aeb5e415a8c1e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:42:29 +0200 Subject: [PATCH 3/5] Fix: file not physically removed --- htdocs/public/ticketsup/create_ticket.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php index 8c8a0dd2f60..56c81a8a530 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; From ff76e60c49685c71d034f2739609bdb8d08e615c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 10:13:20 +0200 Subject: [PATCH 4/5] 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("ThirdParty") . ''; $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events); + print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200'); print '
'; - print 'withnotifytiersatcreate?' checked="checked"':'').'>'; + print 'withnotifytiersatcreate?' checked="checked"':'')).'>'; print '