Skip to content

Commit afbdc63

Browse files
committed
Fix bad label of discount
1 parent 9788caa commit afbdc63

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

htdocs/core/tpl/object_discounts.tpl.php

+12-9
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,41 @@
3939
$absolute_creditnote = 0;
4040
}
4141

42+
4243
// Relative and absolute discounts
43-
$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'&action=create&token='.newToken().'">'.$langs->trans("EditRelativeDiscount").'</a>';
44-
$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'&action=create&token='.newToken().'">'.$langs->trans("EditGlobalDiscounts").'</a>';
45-
$viewabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'">'.$langs->trans("ViewAvailableGlobalDiscounts").'</a>';
44+
$addrelativediscount = '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'&action=create&token='.newToken().(!empty($discount_type) ? '&discount_type=1' : '').'">'.img_edit($langs->trans("EditRelativeDiscount")).'</a>';
45+
$addabsolutediscount = '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'&action=create&token='.newToken().'">'.img_edit($langs->trans("EditGlobalDiscounts")).'</a>';
46+
$viewabsolutediscount = '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.((int) $thirdparty->id).'&backtopage='.urlencode($backtopage).'">'.$langs->trans("ViewAvailableGlobalDiscounts").'</a>';
4647

4748
$fixedDiscount = $thirdparty->remise_percent;
4849
if (!empty($discount_type)) {
4950
$fixedDiscount = $thirdparty->remise_supplier_percent;
5051
}
5152

5253
if ($fixedDiscount > 0) {
53-
$translationKey = (!empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
54+
$translationKey = (empty($discount_type)) ? 'CompanyHasRelativeDiscount' : 'HasRelativeDiscountFromSupplier';
5455
print $langs->trans($translationKey, $fixedDiscount).'.';
5556
} else {
56-
$translationKey = (!empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
57+
$translationKey = (empty($discount_type)) ? 'CompanyHasNoRelativeDiscount' : 'HasNoRelativeDiscountFromSupplier';
5758
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans($translationKey).'.</span>';
5859
}
5960
if ($isNewObject) {
60-
print ' ('.$addrelativediscount.')';
61+
print ' '.$addrelativediscount;
6162
}
6263

64+
6365
// Is there is commercial discount or down payment available ?
6466
if ($absolute_discount > 0) {
6567
if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
66-
$translationKey = !empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
68+
$translationKey = empty($discount_type) ? 'CompanyHasDownPaymentOrCommercialDiscount' : 'HasDownPaymentOrCommercialDiscountFromSupplier';
6769
$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency".$conf->currency)).'.';
6870

6971
if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
7072
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
7173
}
7274

7375
if ($isNewObject) {
74-
$text .= ' ('.$addabsolutediscount.')';
76+
$text .= $addabsolutediscount;
7577
}
7678

7779
if ($isNewObject) {
@@ -81,11 +83,12 @@
8183
}
8284
} else {
8385
// Discount available of type fixed amount (not credit note)
84-
$more = '('.$addabsolutediscount.')';
86+
$more = $addabsolutediscount;
8587
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
8688
}
8789
}
8890

91+
8992
// Is there credit notes availables ?
9093
if ($absolute_creditnote > 0) {
9194
// If validated, we show link "add credit note to payment"

0 commit comments

Comments
 (0)