From 2886c688f0f77c23b23802d2f9333b21d740f98e Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Thu, 25 Jan 2024 11:52:35 +0100 Subject: [PATCH 1/6] 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 da625fc8472c5d7b324e3bb262a242f2ac553fa1 Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Thu, 25 Jan 2024 12:06:13 +0100 Subject: [PATCH 2/6] fix: propal use devise changes --- htdocs/comm/propal/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1bc57c89698..1156df8a2c6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1171,6 +1171,10 @@ if (empty($reshook)) { if (!empty($price_ht) || (string) $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + } elseif (!empty($price_ht_devise) || (string) $price_ht_devise === '0') { + $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht = ''; + $pu_ttc = ''; } elseif (!empty($price_ttc) || (string) $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); From 505841b1948b42cf02af6a4968ddc659e5ed1299 Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Thu, 25 Jan 2024 12:38:06 +0100 Subject: [PATCH 3/6] 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 fe7140304699a917db1d490c05dccd1bfabb38b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2024 23:08:46 +0100 Subject: [PATCH 4/6] 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 5/6] 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; From 8dce4e711409be5d449ec2c0179b2a8e5645bee8 Mon Sep 17 00:00:00 2001 From: Alban Durrheimer Date: Fri, 26 Jan 2024 10:00:51 +0100 Subject: [PATCH 6/6] Fix port in Docker MailDev --- build/docker/Dockerfile | 2 +- build/docker/docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 69f4d27b26f..5cd4c60673b 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -50,7 +50,7 @@ RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini # set up sendmail config, to use maildev RUN echo "account default" > /etc/msmtprc RUN echo "auth off" >> /etc/msmtprc -RUN echo "port 25" >> /etc/msmtprc +RUN echo "port 1025" >> /etc/msmtprc RUN echo "host mail" >> /etc/msmtprc RUN echo "from local@localdomain.com" >> /etc/msmtprc RUN echo "domain localhost.localdomain" >> /etc/msmtprc diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index ddcdc58560a..cc2988a67d1 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -55,8 +55,8 @@ services: mail: image: maildev/maildev ports: - - "8081:80" - - "25:25" + - "8081:1080" + - "25:1025" networks: - internal-pod - external-pod