From ea7e7456a5884471c13e1c0c2c9b538bc84969f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 01:50:38 +0100 Subject: [PATCH 1/8] Fix cloning of projects --- htdocs/projet/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 801129da8e6..6bd1de90ffb 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -499,8 +499,11 @@ if (empty($reshook)) { $newobject->fetch_optionals(); $newobject->fetch_thirdparty(); // Load new object $object = $newobject; - $action = 'edit'; + $action = 'view'; $comefromclone = true; + + setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs'); + //var_dump($newobject); exit; } } From 2886c688f0f77c23b23802d2f9333b21d740f98e Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Thu, 25 Jan 2024 11:52:35 +0100 Subject: [PATCH 2/8] fix: invoice line save devise --- htdocs/compta/facture/card.php | 8 +++++--- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 810bba691c4..8e92b1c56dd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2284,8 +2284,10 @@ if (empty($reshook)) { $type = $prod->type; $fk_unit = $prod->fk_unit; } else { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($price_ttc, 'MU'); + if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU'); + else $pu_ht = ''; + if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU'); + else $pu_ttc = ''; $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); if (empty($tva_tx)) { @@ -2311,7 +2313,7 @@ if (empty($reshook)) { $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); + $pu_ht_devise = price2num($price_ht_devise, '', 2); $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); // Prepare a price equivalent for minimum price check diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6837d1dad9c..a9418197592 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1722,7 +1722,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_devise = price2num($price_devise, 'CU'); + $pu_devise = price2num($price_ht_devise, 'CU'); $result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier); } From 505841b1948b42cf02af6a4968ddc659e5ed1299 Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Thu, 25 Jan 2024 12:38:06 +0100 Subject: [PATCH 3/8] fix: save change from product too --- htdocs/compta/facture/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8e92b1c56dd..408a570656f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2193,6 +2193,10 @@ if (empty($reshook)) { if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } elseif (!empty($price_ht_devise) || $price_ht_devise === '0') { + $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht = ''; + $pu_ttc = ''; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); From 49b5c081d68b3caf3cb4fe094f09dcf50c816e34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 17:51:09 +0100 Subject: [PATCH 4/8] FIX HTML injection vulnerability in Dolibarr Application Home Page FIX #GHSA-7947-48q7-cp5m --- htdocs/filefunc.inc.php | 2 +- htdocs/main.inc.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index c3fd4705b6d..cba47566c2b 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '18.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '18.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ab78b4bd5f7..0c6ecd25933 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2164,6 +2164,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { + $key = preg_replace('/[^a-z0-9_\-\[\]/i', '', $key); if (in_array($key, array('action', 'massaction', 'password'))) { continue; } From 088c1606df38f9b48334be7bf45d8cefa8c20f64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 17:57:44 +0100 Subject: [PATCH 5/8] Clean url --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0c6ecd25933..6b20c79e37c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2170,12 +2170,12 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } if (!is_array($value)) { if ($value !== '') { - $qs .= '&'.$key.'='.urlencode($value); + $qs .= '&'.urlencode($key).'='.urlencode($value); } } else { foreach ($value as $value2) { if (($value2 !== '') && (!is_array($value2))) { - $qs .= '&'.$key.'[]='.urlencode($value2); + $qs .= '&'.urlencode($key).'[]='.urlencode($value2); } } } From 4d971a9c337b2919cf8197a8c5eb99561f368089 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 18:02:56 +0100 Subject: [PATCH 6/8] Fix regresion on print link --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6b20c79e37c..9aede3af25a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2164,7 +2164,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { - $key = preg_replace('/[^a-z0-9_\-\[\]/i', '', $key); + $key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key); if (in_array($key, array('action', 'massaction', 'password'))) { continue; } From fe7140304699a917db1d490c05dccd1bfabb38b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 23:08:46 +0100 Subject: [PATCH 7/8] Fix from #27807 added manually to fix one bug at time --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6837d1dad9c..a9418197592 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1722,7 +1722,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_devise = price2num($price_devise, 'CU'); + $pu_devise = price2num($price_ht_devise, 'CU'); $result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier); } From eb3a6e22972590f7cdf34ab4cd43da9291f8d31d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jan 2024 00:20:14 +0100 Subject: [PATCH 8/8] Clean code --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 408a570656f..a65358b7d58 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2318,7 +2318,7 @@ if (empty($reshook)) { $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); $pu_ht_devise = price2num($price_ht_devise, '', 2); - $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); + $pu_ttc_devise = price2num($price_ttc_devise, '', 2); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht;