From 8729b9f2dd9fb5d565be342467980f3e5e9d0a18 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Mon, 13 Jun 2022 13:34:18 +0200 Subject: [PATCH 1/8] array instead of string in @param pfx() function --- htdocs/core/class/evalmath.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index ccd495bb623..2259cfde06f 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -368,7 +368,7 @@ class EvalMath /** * evaluate postfix notation * - * @param string $tokens Expression + * @param array $tokens Expression * @param array $vars Array * @return string Output */ From c71fe009dfc5ba4e2830e6c17fbf056179a457d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jun 2022 16:07:03 +0200 Subject: [PATCH 2/8] Fix signature delete --- htdocs/compta/deplacement/card.php | 2 +- htdocs/compta/deplacement/class/deplacement.class.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 59c2b373d1a..029c5b5f223 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -84,7 +84,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) { } } } elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { - $result = $object->delete($id); + $result = $object->delete($user); if ($result >= 0) { header("Location: index.php"); exit; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index c09943540bc..91631c173a5 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -1,4 +1,6 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin @@ -310,13 +312,15 @@ class Deplacement extends CommonObject /** * Delete record * - * @param int $id Id of record to delete + * @param User $user USer that Delete * @return int <0 if KO, >0 if OK */ - public function delete($id) + public function delete($user) { $this->db->begin(); + $id = $this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".((int) $id); dol_syslog(get_class($this)."::delete", LOG_DEBUG); From 0a26ac33db2a4fdbda1f0da82dc1f806af997c48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jun 2022 16:09:32 +0200 Subject: [PATCH 3/8] Fix error management --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index d7e46749de3..102e7c50db5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -634,7 +634,7 @@ if (empty($reshook)) { exit; } } else { - $errmesg = $object->error; + setEventMessages($object->error, null, 'errors'); } } From 6bcb5abce579960ec31da7110d8017b5aa17b0ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Jun 2022 16:14:31 +0200 Subject: [PATCH 4/8] Fix doxygen --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 56990effeb2..df2cd57ca05 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4784,7 +4784,7 @@ class Form * @param int $outputmode 0=HTML select string, 1=Array * @param int $include [=0] Removed or 1=Keep only * @param string $morecss More CSS - * @return string + * @return string|array * @see select_categories() */ public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0, $morecss = '') From 92e9b550cd93c7fcb60b4e52304421ab8c34c7b6 Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami Date: Thu, 23 Jun 2022 17:56:17 +0200 Subject: [PATCH 5/8] removing one empty line --- htdocs/core/class/evalmath.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index d1792d61e39..44873703cbb 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -368,7 +368,6 @@ class EvalMath /** * Evaluate postfix notation * - * @param array $tokens Expression * @param array $vars Array * @return string Output From a681ae728307e6f919991a85389251942c9199d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2022 10:23:31 +0200 Subject: [PATCH 6/8] css --- htdocs/theme/eldy/global.inc.php | 5 ++++- htdocs/theme/md/style.css.php | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 614b3134e5c..4c22ede0b59 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3091,7 +3091,10 @@ a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { margin: 1px 1px 1px 6px; } span.vsmenudisabled, font.vsmenudisabled { - font-family: ; text-align: ; color: #aaa; + font-family: ; + text-align: ; + color: #aaa; + white-space: nowrap; } a.vsmenu:link, a.vsmenu:visited { color: var(--colortextbackvmenu); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index aaee7e13f8a..8b288cdf307 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3055,6 +3055,7 @@ span.vsmenudisabled, font.vsmenudisabled { text-align: ; font-weight: normal; color: #aaa; + white-space: nowrap; } a.vsmenu:link, a.vsmenu:visited { color: var(--colortextbackvmenu); @@ -7293,20 +7294,20 @@ div.clipboardCPValue.hidewithsize { .a-mesure, .a-mesure-disabled { text-align: center; } - - + + .underbanner.underbanner-before-box { border-bottom: none; } - + div.divButAction { margin-bottom: 0.5em; } - + div#card-errors { max-width: unset; } - + #dolpaymenttable { padding: 5px; } From 770a160b8baa92d261ff57e0f826dc69d69c31e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2022 14:31:21 +0200 Subject: [PATCH 7/8] Debug v16 --- htdocs/admin/multicurrency.php | 15 ++++++++--- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/html.form.class.php | 12 ++++++--- htdocs/core/lib/functions.lib.php | 3 ++- .../core/modules/modMultiCurrency.class.php | 2 +- htdocs/multicurrency/multicurrency_rate.php | 27 ++++++++++++++----- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index c91af2fcc36..d6487093e41 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -76,10 +76,15 @@ if ($action == 'add_currency') { $currency->code = $code; $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; + if (empty($currency->code) || $currency->code == '-1') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Currency")), null, 'errors'); + $error++; + } if (empty($rate)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors'); $error++; } + if (!$error) { if ($currency->create($user) > 0) { if ($currency->addRate($rate)) { @@ -296,7 +301,7 @@ print ''; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; print ''; @@ -304,17 +309,19 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 0a996018e97..1345d2116f6 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -51,7 +51,7 @@ class Conf public $use_javascript_ajax; //! To store if javascript/ajax is enabked public $disable_compute; - //! Used to store current currency (ISO code like 'USD', 'EUR', ...) + //! Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs->getCurrencySymbol($this->currency) public $currency; //! Used to store current css (from theme) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 88f7f7aaa9a..3f8205f899e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5848,12 +5848,13 @@ class Form /** * Retourne la liste des devises, dans la langue de l'utilisateur * - * @param string $selected preselected currency code - * @param string $htmlname name of HTML select list - * @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code + * @param string $selected preselected currency code + * @param string $htmlname name of HTML select list + * @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code + * @param string $useempty '1'=Allow empty value * @return string */ - public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0) + public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0, $useempty = '') { global $conf, $langs, $user; @@ -5866,6 +5867,9 @@ class Form } $out .= ''; print ''; - print ' '; + print ' '; print ' '; print '\n"; if (! $i) $totalarray['nbfield']++; From 09449ece2641c5b51100526b045f232928abb49a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2022 15:51:39 +0200 Subject: [PATCH 8/8] css --- htdocs/exports/export.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 4f001238134..f06e83f4c40 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -883,9 +883,9 @@ if ($step == 4 && $datatoexport) { if (isset($objexport->array_export_fields[0][$code])) { $list .= ($list ? ', ' : ''); if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) { - $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); + $list .= ''.$langs->trans($objexport->array_export_fields[0][$code]).''.(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); } else { - $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; + $list .= ''.$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; } } } @@ -1163,9 +1163,9 @@ if ($step == 5 && $datatoexport) { if (isset($objexport->array_export_fields[0][$code])) { $list .= ($list ? ', ' : ''); if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) { - $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); + $list .= ''.$langs->trans($objexport->array_export_fields[0][$code]).''.(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); } else { - $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; + $list .= ''.$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; } } }
'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).''.$langs->trans("Rate").''.$langs->trans("Rate").' / '.$langs->getCurrencySymbol($conf->currency).'
'.$form->selectCurrency('', 'code', 1).''.$form->selectCurrency('', 'code', 1, '1').''; print ' '; -print ''; +print ''; print '
'.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).''.$conf->currency; +print ' ('.$langs->getCurrencySymbol($conf->currency).')'; +print $form->textwithpicto(' ', $langs->trans("BaseCurrency")).'1
'.$langs->trans('Currency').''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 1, " code != '".$db->escape($conf->currency)."'", true).''.$langs->trans('Rate').''.$langs->trans('Rate').' / '.$langs->getCurrencySymbol($conf->currency).''; @@ -280,7 +292,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { -$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name '; +$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name'; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -496,7 +508,8 @@ if ($resql) { // code if (! empty($arrayfields['m.code']['checked'])) { print ''; - print $obj->code." ".$obj->name; + print $obj->code; + print ' - '.$obj->name.''; print "