Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line

This commit is contained in:
Marcos García de La Fuente 2014-05-23 03:00:46 +02:00
parent 9ae9f062ac
commit a705d4e333
2 changed files with 6 additions and 5 deletions

View File

@ -113,6 +113,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar.
New: Added es_CL language New: Added es_CL language
Fix: Margin tabs bad data show Fix: Margin tabs bad data show
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice. Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line
***** ChangeLog for 3.5 compared to 3.4.* ***** ***** ChangeLog for 3.5 compared to 3.4.* *****
For users: For users:

View File

@ -617,27 +617,27 @@ else if ($action == 'addline' && $user->rights->commande->creer)
if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0))
{ {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
$error++; $error = true;
} }
if (empty($idprod) && GETPOST('type') < 0) if (empty($idprod) && GETPOST('type') < 0)
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
$error++; $error = true;
} }
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 ''
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++; $error = true;
} }
if ($qty == '') if ($qty == '')
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
$error++; $error = true;
} }
if (empty($idprod) && empty($product_desc)) if (empty($idprod) && empty($product_desc))
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
$error++; $error = true;
} }
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))