Skip to content

Commit

Permalink
Fix: error message was not enough to understand
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 24, 2016
1 parent 2767df2 commit f97b67d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion htdocs/comm/propal/class/propal.class.php
Expand Up @@ -438,7 +438,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0
$product_type=$product->type;

if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref);
$this->db->rollback();
return -3;
}
Expand Down
6 changes: 4 additions & 2 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -1278,7 +1278,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f

if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
Expand Down Expand Up @@ -2642,7 +2643,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocalt

if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
unset($_POST['productid']);
Expand Down
6 changes: 4 additions & 2 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -2314,7 +2314,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f
$product_type=$product->type;

if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
$this->db->rollback();
return -3;
}
Expand Down Expand Up @@ -2552,7 +2553,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $dat
$product_type=$product->type;

if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
$this->db->rollback();
return -3;
}
Expand Down
6 changes: 4 additions & 2 deletions htdocs/expedition/class/expedition.class.php
Expand Up @@ -896,7 +896,8 @@ function addline($entrepot_id, $id, $qty,$array_options=0)
$product_type=$product->type;
if ($product_type == 0 && $product_stock < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
$this->db->rollback();
return -3;
}
Expand Down Expand Up @@ -952,7 +953,8 @@ function addline_batch($dbatch,$array_options=0)

if ($prod_batch->qty < $linebatch->dluo_qty)
{
$this->errors[] = $langs->trans('ErrorStockIsNotEnough');
$langs->load("errors");
$this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product);
dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR);
$this->db->rollback();
return -1;
Expand Down
4 changes: 4 additions & 0 deletions htdocs/langs/en_US/errors.lang
Expand Up @@ -170,6 +170,10 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
ErrorFileMustHaveFormat=File must have format %s
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order.
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice.
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.

# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
Expand Down

0 comments on commit f97b67d

Please sign in to comment.