Better fix for type of discount

This commit is contained in:
Laurent Destailleur 2019-02-28 11:44:10 +01:00
parent 92259810c1
commit 855aaaffd8
2 changed files with 51 additions and 43 deletions

View File

@ -377,7 +377,11 @@ if ($object->id > 0)
print '</tr>'; print '</tr>';
} }
$isCustomer = ($object->client == 1 || $object->client == 3);
// Relative discounts (Discounts-Drawbacks-Rebates) // Relative discounts (Discounts-Drawbacks-Rebates)
if ($isCustomer)
{
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort"); print $langs->trans("CustomerRelativeDiscountShort");
@ -409,6 +413,7 @@ if ($object->id > 0)
//else print $langs->trans("DiscountNone"); //else print $langs->trans("DiscountNone");
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
// Max outstanding bill // Max outstanding bill
if ($object->client) if ($object->client)

View File

@ -106,7 +106,7 @@ if ($socid > 0)
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
$isCustomer = $object->client == 1 || $object->client == 3; $isCustomer = ($object->client == 1 || $object->client == 3);
$isSupplier = $object->fournisseur == 1; $isSupplier = $object->fournisseur == 1;
print '<form method="POST" action="remise.php?id='.$object->id.'">'; print '<form method="POST" action="remise.php?id='.$object->id.'">';
@ -155,24 +155,27 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
/*if (! ($isCustomer && $isSupplier))
{
if ($isCustomer && ! $isSupplier) { if ($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />'; print '<input type="hidden" name="discount_type" value="0" />';
} }
if (! $isCustomer && $isSupplier) { if (! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />'; print '<input type="hidden" name="discount_type" value="1" />';
} }
}*/
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if($isCustomer || $isSupplier) { if ($isCustomer || $isSupplier)
{
// Discount type // Discount type
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>'; print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
if ($isCustomer) { if ($isCustomer) {
print '<input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>'; print '<input type="radio" name="discount_type" id="discount_type_0" checked value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
} }
if ($isSupplier) { if ($isSupplier) {
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>'; print ' <input type="radio" name="discount_type" id="discount_type_1"'.($isCustomer?'':' checked').' value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
} }
print '</td></tr>'; print '</td></tr>';
} }