From 010c5af2457b5a9263cff9488da02aa771c06777 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 19 Jul 2018 16:48:20 +0200 Subject: [PATCH 1/8] Clean and update code --- htdocs/projet/tasks/contact.php | 7 +------ htdocs/ticket/class/actions_ticket.class.php | 20 ++++++++------------ htdocs/user/param_ihm.php | 12 ++++++------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 1ca25090876..4d78aad4764 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -352,8 +352,6 @@ if ($id > 0 || ! empty($ref)) print ' '; print "\n"; - $var = false; - print '
'; print ''; print ''; @@ -436,7 +434,6 @@ if ($id > 0 || ! empty($ref)) print "\n"; $companystatic = new Societe($db); - $var = true; foreach(array('internal','external') as $source) { @@ -446,9 +443,7 @@ if ($id > 0 || ! empty($ref)) $i = 0; while ($i < $num) { - $var = !$var; - - print ''; + print ''; // Source print ''; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 6dc946ebad3..f49325a5bc5 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -1001,7 +1001,7 @@ class ActionsTicket */ public function viewTicketLogs($show_user = true) { - global $conf, $langs, $bc; + global $conf, $langs; // Load logs in cache $ret = $this->dao->loadCacheLogsTicket(); @@ -1021,11 +1021,8 @@ class ActionsTicket print ''; } - $var = true; - foreach ($this->dao->cache_logs_ticket as $id => $arraylogs) { - $var = !$var; - print ""; + print ''; print ''; print dol_print_date($arraylogs['datec'], 'dayhour'); print ''; @@ -1042,7 +1039,7 @@ class ActionsTicket print ''; } print ''; - print ""; + print ''; print ''; print dol_nl2br($arraylogs['message']); @@ -1064,7 +1061,7 @@ class ActionsTicket */ public function viewTimelineTicketLogs($show_user = true, $object = true) { - global $conf, $langs, $bc; + global $conf, $langs; // Load logs in cache $ret = $object->loadCacheLogsTicket(); @@ -1171,7 +1168,7 @@ class ActionsTicket */ public function viewTicketMessages($show_private, $show_user = true) { - global $conf, $langs, $user, $bc; + global $conf, $langs, $user; global $object; // Load logs in cache @@ -1202,8 +1199,7 @@ class ActionsTicket || ($arraymsgs['private'] == "1" && $show_private) ) { //print ''; - $var = !$var; - print ""; + print ''; print ''; print dol_print_date($arraymsgs['datec'], 'dayhour'); print ''; @@ -1221,7 +1217,7 @@ class ActionsTicket print ''; } print ''; - print ""; + print ''; print ''; print $arraymsgs['message']; print ''; @@ -1244,7 +1240,7 @@ class ActionsTicket */ public function viewTicketTimelineMessages($show_private, $show_user, Ticket $object) { - global $conf, $langs, $user, $bc; + global $conf, $langs, $user; // Load logs in cache $ret = $object->loadCacheMsgsTicket(); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 76b25751806..1bf0dbbe785 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -244,7 +244,7 @@ if ($action == 'edit') print ''; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print ''; - print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -259,7 +259,7 @@ if ($action == 'edit') print $s?$s.' ':''; print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print ''; - print 'conf->MAIN_LANG_DEFAULT)?" checked":""); + print 'conf->MAIN_LANG_DEFAULT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -269,7 +269,7 @@ if ($action == 'edit') // Taille max des listes print ''.$langs->trans("MaxSizeList").''; print ''.$conf->global->MAIN_SIZE_LISTE_LIMIT.''; - print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); + print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -306,7 +306,7 @@ else print ''; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print ''; - print 'conf->MAIN_LANDING_PAGE)?" checked":""); + print 'conf->MAIN_LANDING_PAGE)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -326,7 +326,7 @@ else print ($s?$s.' ':''); print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print ''; - print 'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; + print 'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; print ''; $s=(isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : ''); print ($s?$s.' ':''); @@ -336,7 +336,7 @@ else print ''.$langs->trans("MaxSizeList").''; print ''.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').''; - print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; + print 'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; print '' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:' ') . ''; print '
'; From 22d94a570a8a56983c58c2eb5e52d20aa63cf84d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 19 Jul 2018 18:59:24 +0200 Subject: [PATCH 2/8] Allow to enter a timespent with a numeric value --- htdocs/core/js/timesheet.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index ae7d839919c..de8b24af96c 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -45,11 +45,16 @@ function regexEvent(objet,evt,type) case 'hours': var regex= /^[0-9]{1,2}:[0-9]{2}$/; var regex2=/^[0-9]{1,2}$/; + var regex3= /^[0-9]{1}([.,]{1}[0-9]{1,2})?$/; if(!regex.test(objet.value)) { if(regex2.test(objet.value)) objet.value=objet.value+':00'; - else + else if(regex3.test(objet.value)) { + var tmp=parseFloat(objet.value.replace(',','.')); + var rnd=Math.trunc(tmp); + objet.value=rnd+':'+ Math.round(60*(tmp-rnd)); + } else objet.value=''; } /* alert(jQuery("#"+id).val()); */ From b697307bac125959cf8dbd3409018c70c6fe0db4 Mon Sep 17 00:00:00 2001 From: fappels Date: Sun, 22 Jul 2018 10:41:39 +0200 Subject: [PATCH 3/8] Fix chromephp firephp Syslog infinite loop. When chromephp/firephp not found ->trans causes infinite loop. Can happen when files moved to other server or location. --- htdocs/core/modules/syslog/mod_syslog_chromephp.php | 5 +++-- htdocs/core/modules/syslog/mod_syslog_firephp.php | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index a9b9ccd5836..7523588ac15 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -121,13 +121,14 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) { + $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop if (is_object($langs)) // $langs may not be defined yet. { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); } else { - $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; + $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; } } diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php index 69bc98230af..f502022c4f6 100644 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php @@ -122,7 +122,15 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) { - $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); + $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop + if (is_object($langs)) // $langs may not be defined yet. + { + $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); + } + else + { + $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; + } } return $errors; From 1dd39a4c5c6522d2582ef06e77bca36ebc5bb7a0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 23 Jul 2018 17:21:51 +0200 Subject: [PATCH 4/8] clean and update code --- .../thirdparty_lettrage_supplier.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index cf278c26903..61452230902 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ */ /** - * \file accounting/bookkeeping/thirdparty_lettrage.php + * \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php * \ingroup Advanced accountancy * \brief Tab to setup lettering */ @@ -86,8 +86,9 @@ $socid = GETPOST("socid", 'int'); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result<0) { - setEventMessage($object->error,'errors'); +if ($result<0) +{ + setEventMessages($object->error, $object->errors, 'errors'); } $form = new Form($db); @@ -133,7 +134,7 @@ if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref; /* - * Affichage onglets + * Display tabs */ $head = societe_prepare_head($object); @@ -272,7 +273,6 @@ if ($resql) { print ''; print ''; - $var = false; $solde = 0; $tmp = ''; while ($obj = $db->fetch_object($resql)) { @@ -281,11 +281,10 @@ if ($resql) { $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($obj->lettering_code)) - $var = ! $var; $solde += ($obj->credit - $obj->debit); - print ""; + print ''; if (empty($obj->lettering_code)) { print ''; @@ -320,7 +319,7 @@ if ($resql) { print ''; print "\n"; - print ""; + print ''; print 'Solde Comptable' . "\n"; print '' . price($credit - $debit) . ''; print ''; From 365ed9c5ded207ac9b3c065998e40b6ae58f0477 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 23 Jul 2018 17:28:19 +0200 Subject: [PATCH 5/8] clean and update code --- .../bookkeeping/thirdparty_lettrage.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index 9bf287bf3c9..c4084b600eb 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ */ /** - * \file accounting/bookkeeping/thirdparty_lettrage.php + * \file accountancy/bookkeeping/thirdparty_lettrage.php * \ingroup Advanced accountancy * \brief Onglet de gestion de parametrages des ventilations */ @@ -82,8 +82,9 @@ $socid = GETPOST("socid", 'int'); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result < 0) { - setEventMessage($object->error, 'errors'); +if ($result < 0) +{ + setEventMessages($object->error, $object->errors, 'errors'); } $form = new Form($db); @@ -252,7 +253,6 @@ if ($resql) { print ''; print ''; - $var = false; $solde = 0; $tmp = ''; while ( $obj = $db->fetch_object($resql) ) { @@ -261,11 +261,10 @@ if ($resql) { $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($obj->lettering_code)) - $var = ! $var; $solde += ($obj->credit - $obj->debit); - print ""; + print ''; if (empty($obj->lettering_code)) { print ''; @@ -293,14 +292,13 @@ if ($resql) { } print ''; - print 'Mouvement totaux' . "\n"; print '' . price($debit) . ''; print '' . price($credit) . ''; print ''; print "\n"; - print ""; + print ''; print 'Solde Comptable' . "\n"; print '' . price($credit - $debit) . ''; print ''; From e755fde52a78e0c921485041b955357cf995a85a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 23 Jul 2018 17:35:30 +0200 Subject: [PATCH 6/8] clean and update code --- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 18e23826314..4191243e412 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -89,7 +89,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 49b20730eef..47a6f15e8c6 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -86,7 +86,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 334fd347a58..3a6af92e41b 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -87,7 +87,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } From 3297554102a54dc99649de0f95621f41f69d88da Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 23 Jul 2018 17:45:38 +0200 Subject: [PATCH 7/8] clean and update code --- htdocs/admin/system/filecheck.php | 4 ++-- htdocs/admin/ticket.php | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 3cef158c2ea..9a9e2297cba 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -366,11 +366,11 @@ if (! $error && $xml) // Show warning if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) { - setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference")); + setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); } else { - setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings'); + setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); } } else diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 742f966e4cc..95af411b813 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -54,10 +54,13 @@ if ($action == 'updateMask') { $error++; } - if (!$error) { - setEventMessage($langs->trans("SetupSaved")); - } else { - setEventMessage($langs->trans("Error"), 'errors'); + if (!$error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active From 442ffb95bacab9f6ad81db67c57cc0eaacefd8df Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 23 Jul 2018 17:57:11 +0200 Subject: [PATCH 8/8] clean and update code --- htdocs/api/class/api_setup.class.php | 8 +++--- htdocs/blockedlog/admin/blockedlog_list.php | 4 +-- htdocs/cashdesk/validation_verif.php | 2 +- htdocs/comm/mailing/advtargetemailing.php | 27 ++++++++++++--------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index ef2b4c8bb6d..fe4c73e91fd 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1,8 +1,8 @@ * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2017 Regis Houssin - * Copyright (C) 2017 Neil Orley + * Copyright (C) 2017 Regis Houssin + * Copyright (C) 2017 Neil Orley * * * This program is free software; you can redistribute it and/or modify @@ -863,11 +863,11 @@ class Setup extends DolibarrApi // Show warning if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) { - //setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference")); + //setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); } else { - //setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings'); + //setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); } } else diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index dbb0affdbdf..8f5d47bf704 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -138,7 +138,7 @@ else if (GETPOST('downloadcsv','alpha')) else { $error++; - setEventMessage($db->lasterror, 'errors'); + setEventMessages($db->lasterror, null, 'errors'); } } @@ -243,7 +243,7 @@ else if (GETPOST('downloadcsv','alpha')) } else { - setEventMessage($db->lasterror, 'errors'); + setEventMessages($db->lasterror, null, 'errors'); } } } diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 431f921a1fb..cdf9873e791 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -253,7 +253,7 @@ switch ($action) } else { - setEventMessage($invoice->error, $invoice->errors, 'errors'); + setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 1c886e2ba2c..b63ffac6efd 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -84,9 +84,12 @@ if (empty($template_id)) { $result = $advTarget->fetch($template_id); } -if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); -} else { +if ($result < 0) +{ + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); +} +else +{ if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } @@ -101,7 +104,7 @@ if ($action == 'loadfilter') { if (! empty($template_id)) { $result = $advTarget->fetch($template_id); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } else { if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); @@ -202,7 +205,7 @@ if ($action == 'add') { // if ($array_query ['type_of_target'] == 1 || $array_query ['type_of_target'] == 3) { $result = $advTarget->query_thirdparty($array_query); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } /*} else { $advTarget->thirdparty_lines = array (); @@ -211,7 +214,7 @@ if ($action == 'add') { if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2 || $array_query['type_of_target'] == 4)) { $result = $advTarget->query_contact($array_query, 1); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } // If use contact but no result use artefact to so not use socid into add_to_target if (count($advTarget->contact_lines) == 0) { @@ -241,10 +244,10 @@ if ($action == 'add') { exit(); } if ($result == 0) { - setEventMessage($langs->trans("WarningNoEMailsAdded"), 'warnings'); + setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings'); } if ($result < 0) { - setEventMessage($obj->error, 'errors'); + setEventMessages($obj->error, $obj->errors, 'errors'); } } @@ -264,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { $error = 0; if ($action == 'createfilter' && empty($template_name)) { - setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors'); $error ++; } @@ -353,13 +356,13 @@ if ($action == 'savefilter' || $action == 'createfilter') { $advTarget->name = $template_name; $result = $advTarget->create($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } } elseif ($action == 'savefilter') { $result = $advTarget->update($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } } $template_id = $advTarget->id; @@ -369,7 +372,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { if ($action == 'deletefilter') { $result = $advTarget->delete($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit();