From 352bdaf9c45e808366978dca42fc936048b5a91d Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:33:31 +0200 Subject: [PATCH 1/6] FIX : Extrafield following between rec invoice and classic invoice (#31445) --- htdocs/compta/facture/class/facture-rec.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 22ea97feb6d..5b377edaee4 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1338,6 +1338,14 @@ class FactureRec extends CommonInvoice $facture->multicurrency_tx = $facturerec->multicurrency_tx; } + if (isset($facture->array_options) && isset($facturerec->array_options)) { + foreach ($facturerec->array_options as $key => $value) { + if (isset($facture->array_options[$key])) { + $facture->array_options[$key] = $value; + } + } + } + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; From abefce7ae2215ed7230a0b48e0ef35b7a724223f Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:55:58 +0200 Subject: [PATCH 2/6] FIX 17.0: supplier invoice template card: buyer and seller swapped in VAT-related function calls (probably a copy-paste from customer invoice templates) (#31446) --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/fourn/facture/card-rec.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dfaba07f663..8a0b73e8b2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4917,8 +4917,8 @@ abstract class CommonObject * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * * @param string $action Action code - * @param string $seller Object of seller third party - * @param string $buyer Object of buyer third party + * @param Societe $seller Object of seller third party + * @param Societe $buyer Object of buyer third party * @param int $selected Object line selected * @param int $dateSelector 1=Show also date range input fields * @param string $defaulttpldir Directory where to find the template diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 525b5e9123a..8ba6c8be50e 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -535,8 +535,8 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $prod->id); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; } @@ -544,7 +544,7 @@ if (empty($reshook)) { // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = (GETPOST('pbq', 'int') ? GETPOST('pbq', 'int') : 0); - $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + $datapriceofproduct = $prod->getSellPrice($object->thirdparty, $mysoc, $pqp); $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; @@ -659,8 +659,8 @@ if (empty($reshook)) { $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $info_bits = 0; if ($tva_npr) { $info_bits |= 0x01; @@ -1080,7 +1080,7 @@ if ($action == 'create') { $disableedit = 1; $disablemove = 1; $disableremove = 1; - $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } print "\n"; @@ -1569,7 +1569,7 @@ if ($action == 'create') { $canchangeproduct = 0; $object->statut = $object->suspended; - $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } // Form to add new line From b0c7b8750a429f99e955cde3880a6734bfc8afad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Oct 2024 00:10:54 +0200 Subject: [PATCH 3/6] fix overwritten value (#31470) --- htdocs/commande/list_det.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 9fc9e4059a7..86a30b9cfc9 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -2016,7 +2016,7 @@ if ($resql) { $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { From c48b035a1552fd05f589607c70947e5e82d91699 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:59:46 +0200 Subject: [PATCH 4/6] =?UTF-8?q?FIX=20issue=20on=20action=20set=20condition?= =?UTF-8?q?=20in=20particular=20when=20you=20set=20a=20deposi=E2=80=A6=20(?= =?UTF-8?q?#31518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix issue on action set condition in particular when you set a deposit cond on propal * fix some identation issues * fix retour github actions pre commit * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/card.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 97ed893601d..63dd1ae7436 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -146,7 +146,6 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; @@ -1614,7 +1613,20 @@ if (empty($reshook)) { $result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payment - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha')); + $sql = "SELECT code "; + $sql .= "FROM " . $db->prefix() . "c_payment_term"; + $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + if ($obj->code == 'DEP30PCTDEL') { + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha')); + } else { + $object->deposit_percent = 0; + $object->update($user); + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), $object->deposit_percent); + } + } } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { From b37b2ba76fad3a66f4de914c66dd366c1287ff3d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 23 Oct 2024 23:08:05 +0200 Subject: [PATCH 5/6] fix: test on const with space.... (#31505) --- 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 804451777b8..90555b00b0c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -321,7 +321,7 @@ if (empty($reshook)) { $object->date = dol_now(); } - if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { + if (!empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { $last_of_type = $object->willBeLastOfSameType(true); if (empty($object->date_validation) && !$last_of_type[0]) { setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors'); From 39afafc5859ffa5534171732315a4ff7a35ba8d2 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:11:02 +0200 Subject: [PATCH 6/6] FIX: If you have no stock of your product, an error is displayed when you delete the reception. (#31504) * fix * delete * f * indent * indent --- htdocs/reception/class/reception.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ca1d87b076f..cc8c0923e85 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1058,6 +1058,11 @@ class Reception extends CommonObject $mouvS->origin = null; $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) { + $error++; + $this->error = $mouvS->error; + $this->errors = $mouvS->errors; + } } } else { $error++; $this->errors[] = "Error ".$this->db->lasterror();