|
39 | 39 | $absolute_creditnote = 0;
|
40 | 40 | }
|
41 | 41 |
|
| 42 | + |
42 | 43 | // 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>'; |
46 | 47 |
|
47 | 48 | $fixedDiscount = $thirdparty->remise_percent;
|
48 | 49 | if (!empty($discount_type)) {
|
49 | 50 | $fixedDiscount = $thirdparty->remise_supplier_percent;
|
50 | 51 | }
|
51 | 52 |
|
52 | 53 | if ($fixedDiscount > 0) {
|
53 |
| - $translationKey = (!empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
| 54 | + $translationKey = (empty($discount_type)) ? 'CompanyHasRelativeDiscount' : 'HasRelativeDiscountFromSupplier'; |
54 | 55 | print $langs->trans($translationKey, $fixedDiscount).'.';
|
55 | 56 | } else {
|
56 |
| - $translationKey = (!empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
| 57 | + $translationKey = (empty($discount_type)) ? 'CompanyHasNoRelativeDiscount' : 'HasNoRelativeDiscountFromSupplier'; |
57 | 58 | print '<span class="opacitymedium hideonsmartphone">'.$langs->trans($translationKey).'.</span>';
|
58 | 59 | }
|
59 | 60 | if ($isNewObject) {
|
60 |
| - print ' ('.$addrelativediscount.')'; |
| 61 | + print ' '.$addrelativediscount; |
61 | 62 | }
|
62 | 63 |
|
| 64 | + |
63 | 65 | // Is there is commercial discount or down payment available ?
|
64 | 66 | if ($absolute_discount > 0) {
|
65 | 67 | 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'; |
67 | 69 | $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency".$conf->currency)).'.';
|
68 | 70 |
|
69 | 71 | if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
|
70 | 72 | $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
|
71 | 73 | }
|
72 | 74 |
|
73 | 75 | if ($isNewObject) {
|
74 |
| - $text .= ' ('.$addabsolutediscount.')'; |
| 76 | + $text .= $addabsolutediscount; |
75 | 77 | }
|
76 | 78 |
|
77 | 79 | if ($isNewObject) {
|
|
81 | 83 | }
|
82 | 84 | } else {
|
83 | 85 | // Discount available of type fixed amount (not credit note)
|
84 |
| - $more = '('.$addabsolutediscount.')'; |
| 86 | + $more = $addabsolutediscount; |
85 | 87 | $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
|
86 | 88 | }
|
87 | 89 | }
|
88 | 90 |
|
| 91 | + |
89 | 92 | // Is there credit notes availables ?
|
90 | 93 | if ($absolute_creditnote > 0) {
|
91 | 94 | // If validated, we show link "add credit note to payment"
|
|
0 commit comments