Merge pull request #310 from marcosgdf/error-messages
Added missing error messages in supplier & customer's orders
This commit is contained in:
commit
7a30416124
@ -39,6 +39,7 @@ For users:
|
|||||||
- Fix: No images into product description lines as PDF generation does
|
- Fix: No images into product description lines as PDF generation does
|
||||||
not work with this.
|
not work with this.
|
||||||
- New: [ task #326 ]: Add a numbering module to suggest automatically a product ref
|
- New: [ task #326 ]: Add a numbering module to suggest automatically a product ref
|
||||||
|
- Fix: Errors weren't being shown in customer's & supplier's orders
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- New: Add webservice for thirdparty creation and list.
|
- New: Add webservice for thirdparty creation and list.
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -517,20 +518,36 @@ else if ($action == 'setnote' && $user->rights->commande->creer)
|
|||||||
*/
|
*/
|
||||||
else if ($action == 'addline' && $user->rights->commande->creer)
|
else if ($action == 'addline' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$result=0;
|
$langs->load('errors');
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
if ((GETPOST('np_price') < 0) && (GETPOST('qty') < 0))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
if (! GETPOST('idprod') && GETPOST('type') < 0)
|
if (! GETPOST('idprod') && GETPOST('type') < 0)
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||||
$result = -1 ;
|
$error = true;
|
||||||
}
|
}
|
||||||
if (! GETPOST('idprod') && GETPOST('np_price')=='') // Unit price can be 0 but not ''
|
if (! GETPOST('idprod') && GETPOST('np_price') == '') // Unit price can be 0 but not ''
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors');
|
||||||
$result = -1 ;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
if (! GETPOST('qty') && GETPOST('qty') == '')
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if (! GETPOST('idprod') && (GETPOST('np_desc') == '') && (GETPOST('dp_desc') == ''))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($result >= 0 && GETPOST('qty') && ((GETPOST('np_price') != '' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod')))
|
if (!$error && GETPOST('qty') && ((GETPOST('np_price') != '' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod')))
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$suffixe = GETPOST('idprod') ? '_predef' : '';
|
$suffixe = GETPOST('idprod') ? '_predef' : '';
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -169,7 +170,36 @@ else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
|
|||||||
*/
|
*/
|
||||||
else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
||||||
{
|
{
|
||||||
if (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice']))
|
$langs->load('errors');
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
if ($_POST['pu'] < 0 && $_POST['qty'] < 0)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if (empty($_POST['idprodfournprice']) && $_POST['type'] < 0)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if (empty($_POST['idprodfournprice']) && (! isset($_POST['pu']) || $_POST['pu']=='')) // Unit price can be 0 but not ''
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if (empty($_POST['idprodfournprice']) && empty($_POST['np_desc']) && empty($_POST['dp_desc']))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if ((! isset($_POST['qty']) || $_POST['qty'] == ''))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice'])))
|
||||||
{
|
{
|
||||||
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
||||||
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
||||||
@ -223,7 +253,6 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
if ($idprod == -1)
|
if ($idprod == -1)
|
||||||
{
|
{
|
||||||
// Quantity too low
|
// Quantity too low
|
||||||
$langs->load("errors");
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,9 +317,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
unset($localtax1_tx);
|
unset($localtax1_tx);
|
||||||
unset($localtax2_tx);
|
unset($localtax2_tx);
|
||||||
}
|
}
|
||||||
else if (empty($mesg))
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[] ='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1803,7 +1832,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user