From 8213756c37c00c9f11bcf15d1d11ae371bb4776f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 24 May 2022 16:49:55 +0200 Subject: [PATCH 1/7] fix sql to avoid getting product_stock of another product with same batch --- htdocs/product/class/productbatch.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 05cfd7523e0..f81cf8f326a 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -534,6 +534,7 @@ class Productbatch extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock"; $sql .= " WHERE p.entity IN (".getEntity('product').")"; $sql .= " AND pl.fk_product = ".$fk_product; + $sql .= " AND ps.fk_product = ".$fk_product; if ($fk_warehouse > 0) { $sql .= " AND ps.fk_entrepot = ".$fk_warehouse; } From 6f83c8c6f33480ea5c6772e54ad998298ac8b64e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 May 2022 21:22:14 +0200 Subject: [PATCH 2/7] Update productbatch.class.php --- htdocs/product/class/productbatch.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index f81cf8f326a..3093403d813 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -531,12 +531,11 @@ class Productbatch extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."product_lot as pl"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pl.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch AS pb ON pl.batch = pb.batch"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock AND ps.fk_product = ".((int) $fk_product); $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND pl.fk_product = ".$fk_product; - $sql .= " AND ps.fk_product = ".$fk_product; + $sql .= " AND pl.fk_product = ".((int) $fk_product); if ($fk_warehouse > 0) { - $sql .= " AND ps.fk_entrepot = ".$fk_warehouse; + $sql .= " AND ps.fk_entrepot = ".((int) $fk_warehouse); } if ($qty_min !== null) { $sql .= " AND pb.qty > ".$qty_min; From 4696cd33d5afd45cdb137280345996e7cbc449a4 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 1 Jun 2022 10:42:29 +0200 Subject: [PATCH 3/7] fix for issue #16985 --- htdocs/supplier_proposal/contact.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index ce76b9d8bf7..56bc73903e4 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -58,7 +58,8 @@ if ($action == 'addcontact' && $permissiontoedit) if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); + $result = $object->add_contact($contactid, $typeid, GETPOST("source")); } if ($result >= 0) From 1dcd4d0ab6f6c47cd4b4c89cf30150fc81ac2276 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 1 Jun 2022 23:11:20 +0200 Subject: [PATCH 4/7] Typo in CSS class --- 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 0cfa5a93309..10a6c0ce32b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4612,7 +4612,7 @@ if ($action == 'create') { } if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2 print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; - print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).''; } // Revenue stamp From f582814c0fc3076212b4cd6f6ba71e7f038873c1 Mon Sep 17 00:00:00 2001 From: jyhere Date: Thu, 2 Jun 2022 09:46:26 +0200 Subject: [PATCH 5/7] Update bom.class.php --- htdocs/bom/class/bom.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0520c76dde2..68cd44dcf46 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -958,8 +958,8 @@ class BOM extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.((int) $this->id))); if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; From 10c101077ba05cb0f771e3e9cd9f7c3529efbd03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 19:28:18 +0200 Subject: [PATCH 6/7] Fix auto check --- 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 943214ebff7..559e49003c2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3174,7 +3174,7 @@ if ($action == 'create') { // Standard invoice print '
'; - $tmp = ' '; + $tmp = ' '; $tmp = $tmp.''; $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print ''; From ed5b8df385082b5a8d2e6eb32c1c079ff7dfea9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 19:34:16 +0200 Subject: [PATCH 7/7] FIX Bank account not set when creating invoice from order --- htdocs/compta/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5ef3079ae03..049ea5c3f88 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2843,7 +2843,8 @@ if ($action == 'create') { } $currency_code = $conf->currency; - + $fk_account = 0; + // Load objectsrc $remise_absolue = 0; if (!empty($origin) && !empty($originid)) { @@ -3580,7 +3581,7 @@ if ($action == 'create') { if (!empty($conf->banque->enabled)) { print ''; }
'.$langs->trans('BankAccount').''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print '