better check for unicity
This commit is contained in:
parent
863ba52b15
commit
acea36acf2
@ -25,4 +25,4 @@ ShowCurrentStockOfLot=Show current stock for couple product/lot
|
||||
ShowLogOfMovementIfLot=Show log of movements for couple product/lot
|
||||
StockDetailPerBatch=Stock detail per lot
|
||||
SerialNumberAlreadyInUse=Serial number %s is already used for product %s
|
||||
|
||||
TooManyQtyForSerialNumber=You can only have one product %s for serial number %S
|
||||
|
||||
@ -25,4 +25,4 @@ ShowCurrentStockOfLot=Afficher le stock actuel pour le couple produit / lot
|
||||
ShowLogOfMovementIfLot=Afficher l'historique des mouvements de couple produit / lot
|
||||
StockDetailPerBatch=Stock détaillé par lot
|
||||
SerialNumberAlreadyInUse=Le numéro de série %s est déjà utilisé pour le produit %s
|
||||
|
||||
TooManyQtyForSerialNumber=Vous ne pouvez avoir qu'un produit %s avec le numéro de série %s
|
||||
|
||||
@ -569,10 +569,18 @@ class MouvementStock extends CommonObject
|
||||
if (!$error && !empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch)
|
||||
{
|
||||
// check unicity for serial numbered equipments ( different for lots managed products)
|
||||
if ( $product->status_batch == 2 && $qty > 0 && $this->getBatchCount($fk_product, $batch) > 0 )
|
||||
if ( $product->status_batch == 2 && $qty > 0 )
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans("SerialNumberAlreadyInUse", $batch, $product->ref);
|
||||
if ( $this->getBatchCount($fk_product, $batch) > 0 )
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans("SerialNumberAlreadyInUse", $batch, $product->ref);
|
||||
}
|
||||
elseif { $qty > 1 }
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans("TooManyQtyForSerialNumber", $product->ref, $batch);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $error )
|
||||
|
||||
Loading…
Reference in New Issue
Block a user