From 1b559355776147798eceec97db55976bd39a02b7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 5 Feb 2021 10:39:46 +0100 Subject: [PATCH 1/2] Add critical price patch from 12 to 11. --- htdocs/product/price.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3f6a89cbddb..c364cd464fc 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1442,11 +1442,11 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul // Il doit au moins y avoir la ligne de prix initial. // On l'ajoute donc pour remettre a niveau (pb vieilles versions) //$object->updatePrice($object->price, $object->price_base_type, $user, $object->tva_tx, $object->price_min); - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice($object->multiprices[1], $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), $object->multiprices_min[1], 1); - } else { - $object->updatePrice($object->price, $object->price_base_type, $user, $object->tva_tx, $object->price_min); - } + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + } else { + $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + } $result = $db->query($sql); $num = $db->num_rows($result); From 3f862bf43ee33cfc16ce7a193312efcebae092a9 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 5 Feb 2021 11:34:39 +0100 Subject: [PATCH 2/2] FIX 10.0 - before crediting a withdrawal receipt, check whether it has been credited already --- htdocs/compta/prelevement/card.php | 44 ++++++++++++++++++----------- htdocs/langs/en_US/withdrawals.lang | 1 + htdocs/langs/fr_FR/withdrawals.lang | 1 + 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index bf95a35f1fd..1e3f1f49d23 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -85,16 +85,21 @@ if (empty($reshook)) } } - // Seems to no be used and replaced with $action == 'infocredit' - if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') - { - $res=$object->set_credite(); - if ($res >= 0) - { - header("Location: card.php?id=".$id); - exit; - } - } + // Seems to no be used and replaced with $action == 'infocredit' + if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') + { + if ($object->statut == 2) { + $res = -1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $res=$object->set_credite(); + } + if ($res >= 0) + { + header("Location: card.php?id=".$id); + exit; + } + } if ($action == 'infotrans' && $user->rights->prelevement->bons->send) { @@ -135,14 +140,19 @@ if (empty($reshook)) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $error = $object->set_infocredit($user, $dt); + if ($object->statut == 2) { + $error = 1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $error = $object->set_infocredit($user, $dt); + } - if ($error) - { - header("Location: card.php?id=".$id."&error=$error"); - exit; - } - } + if ($error) + { + header("Location: card.php?id=".$id."&error=$error"); + exit; + } + } } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index cbca2b2f103..45cf89c8592 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -27,6 +27,7 @@ MakeWithdrawRequest=Make a direct debit payment request WithdrawRequestsDone=%s direct debit payment requests recorded ThirdPartyBankCode=Third-party bank code NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. +WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries. ClassCredited=Classify credited ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account? TransData=Transmission date diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index 468cdd8b9f3..ea8fadeedba 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -27,6 +27,7 @@ MakeWithdrawRequest=Faire une demande de prélèvement WithdrawRequestsDone=%s demandes de prélèvements enregistrées ThirdPartyBankCode=Code banque du tiers NoInvoiceCouldBeWithdrawed=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide et que le BAN a un RUM avec le mode %s . +WithdrawalCantBeCreditedTwice=Ce bon de prélèvement est déjà classé crédité ; cette opération ne peut pas être réalisée deux fois, car cela pourrait engendrer des doublons dans les paiements et les écritures bancaires. ClassCredited=Classer crédité ClassCreditedConfirm=Êtes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ? TransData=Date de transmission