Fix: Regression for negative proposal lines.

This commit is contained in:
Laurent Destailleur 2013-03-08 10:06:23 +01:00
parent 1e5c56642c
commit f041a8a95e

View File

@ -635,7 +635,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++; $error++;
} }
if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal.
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++; $error++;
@ -646,7 +646,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
$error++; $error++;
} }
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) if (! $error && (GETPOST('qty') != 0) && (! empty($product_desc) || ! empty($idprod))) // Price can be negative for proposal.
{ {
$pu_ht=0; $pu_ht=0;
$pu_ttc=0; $pu_ttc=0;
@ -1191,7 +1191,7 @@ if ($action == 'create')
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans("Draft").'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans("Draft").'</td></tr>';