diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 6e1d411d55e..a56dc6cd5ac 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2038,8 +2038,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Relative and absolute discounts
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
- // invoice
+ $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
@@ -2056,8 +2055,8 @@ if ($action == 'create' && $user->rights->commande->creer)
else
print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
- $absolute_discount = $soc->getAvailableDiscounts('', 'fk_facture_source IS NULL');
- $absolute_creditnote = $soc->getAvailableDiscounts('', 'fk_facture_source IS NOT NULL');
+ $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
+ $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 81ea1a0f951..5c632530a8e 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1477,6 +1477,29 @@ if ($action=='create')
}
print '';
+ if ($societe->id > 0)
+ {
+ // Discounts for third party
+ print '
';
print '';
+ // Relative and absolute discounts
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ } else {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (fk_invoice_supplier_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
+ }
+
+ $addrelativediscount = 'id . '">' . $langs->trans("EditRelativeDiscounts") . '';
+ $addabsolutediscount = 'id . '">' . $langs->trans("EditGlobalDiscounts") . '';
+ $addcreditnote = 'id . '">' . $langs->trans("AddCreditNote") . '';
+
+ print '