Debug MRP
This commit is contained in:
parent
2eb2feff04
commit
0802df78b5
@ -97,10 +97,12 @@ if (empty($reshook))
|
|||||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||||
|
|
||||||
if (empty($backtopage) || ($cancel && empty($id))) {
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
//var_dump($backurlforlist);exit;
|
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
// Actions cancel, add, update, delete or clone
|
// Actions cancel, add, update, delete or clone
|
||||||
@ -169,6 +171,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unset($_POST['idprod']);
|
||||||
|
unset($_POST['qty']);
|
||||||
unset($_POST['qty_frozen']);
|
unset($_POST['qty_frozen']);
|
||||||
unset($_POST['disable_stock_change']);
|
unset($_POST['disable_stock_change']);
|
||||||
}
|
}
|
||||||
@ -207,6 +211,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unset($_POST['idprod']);
|
||||||
|
unset($_POST['qty']);
|
||||||
unset($_POST['qty_frozen']);
|
unset($_POST['qty_frozen']);
|
||||||
unset($_POST['disable_stock_change']);
|
unset($_POST['disable_stock_change']);
|
||||||
}
|
}
|
||||||
@ -644,7 +650,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
{
|
{
|
||||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
|
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,12 @@ if ($cancel)
|
|||||||
{
|
{
|
||||||
/*var_dump($cancel);
|
/*var_dump($cancel);
|
||||||
var_dump($backtopage);exit;*/
|
var_dump($backtopage);exit;*/
|
||||||
if (!empty($backtopage))
|
if (!empty($backtopageforcancel))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopageforcancel);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
elseif (!empty($backtopage))
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -54,6 +54,7 @@ ToConsume=To consume
|
|||||||
ToProduce=To produce
|
ToProduce=To produce
|
||||||
QtyAlreadyConsumed=Qty already consumed
|
QtyAlreadyConsumed=Qty already consumed
|
||||||
QtyAlreadyProduced=Qty already produced
|
QtyAlreadyProduced=Qty already produced
|
||||||
|
ConsumeOrProduce=Consume or Produce
|
||||||
ConsumeAndProduceAll=Consume and Produce All
|
ConsumeAndProduceAll=Consume and Produce All
|
||||||
Manufactured=Manufactured
|
Manufactured=Manufactured
|
||||||
TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce.
|
TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce.
|
||||||
|
|||||||
@ -143,6 +143,7 @@ InventoryCode=Movement or inventory code
|
|||||||
IsInPackage=Contained into package
|
IsInPackage=Contained into package
|
||||||
WarehouseAllowNegativeTransfer=Stock can be negative
|
WarehouseAllowNegativeTransfer=Stock can be negative
|
||||||
qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks.
|
qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks.
|
||||||
|
qtyToTranferLotIsNotEnough=You don't have enough stock, for this lot number, from your source warehouse and your setup does not allow negative stocks (Qty for product '%s' with lot '%s' is %s in warehouse '%s').
|
||||||
ShowWarehouse=Show warehouse
|
ShowWarehouse=Show warehouse
|
||||||
MovementCorrectStock=Stock correction for product %s
|
MovementCorrectStock=Stock correction for product %s
|
||||||
MovementTransferStock=Stock transfer of product %s into another warehouse
|
MovementTransferStock=Stock transfer of product %s into another warehouse
|
||||||
|
|||||||
@ -62,6 +62,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$cancel = GETPOST('cancel', 'aZ09');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||||
//$lineid = GETPOST('lineid', 'int');
|
//$lineid = GETPOST('lineid', 'int');
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
@ -135,6 +136,10 @@ if (empty($reshook))
|
|||||||
else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($cancel && ! empty($backtopageforcancel)) {
|
||||||
|
$backtopage = $backtopageforcancel;
|
||||||
|
}
|
||||||
|
|
||||||
$triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
|
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
|
||||||
@ -202,7 +207,8 @@ if ($action == 'create')
|
|||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
||||||
|
|
||||||
dol_fiche_head(array(), '');
|
dol_fiche_head(array(), '');
|
||||||
|
|
||||||
@ -304,8 +310,9 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
|
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,7 @@ if (empty($reshook))
|
|||||||
$result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN');
|
$result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($action, array('confirm_consume', 'confirm_produce', 'confirm_consumeandproduceall'))) {
|
if (in_array($action, array('confirm_consumeorproduce', 'confirm_consumeandproduceall'))) {
|
||||||
$stockmove = new MouvementStock($db);
|
$stockmove = new MouvementStock($db);
|
||||||
|
|
||||||
$labelmovement = GETPOST('inventorylabel', 'alphanohtml');
|
$labelmovement = GETPOST('inventorylabel', 'alphanohtml');
|
||||||
@ -256,13 +256,13 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var_dump(GETPOST('batchtoproduce-'.$line->id.'-'.$i));
|
||||||
$idstockmove = 0;
|
$idstockmove = 0;
|
||||||
if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) {
|
if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) {
|
||||||
// Record stock movement
|
// Record stock movement
|
||||||
$id_product_batch = 0;
|
$id_product_batch = 0;
|
||||||
$stockmove->origin = $object;
|
$stockmove->origin = $object;
|
||||||
$idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement);
|
$idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), dol_now(), $id_product_batch, $codemovement);
|
||||||
if ($idstockmove < 0) {
|
if ($idstockmove < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
|
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
|
||||||
@ -516,7 +516,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
if (! in_array($action, array('consume', 'produce', 'consumeandproduceall')))
|
if (! in_array($action, array('consumeorproduce', 'consumeandproduceall')))
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
@ -524,27 +524,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Note that $action and $object may be modified by hook
|
// Note that $action and $object may be modified by hook
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Consume
|
// Consume or produce
|
||||||
|
|
||||||
if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
|
if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
|
||||||
if ($permissiontoproduce) {
|
if ($permissiontoproduce) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=consume">'.$langs->trans('Consume').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=consumeorproduce">'.$langs->trans('ConsumeOrProduce').'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Consume').'</a>';
|
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('ConsumeOrProduce').'</a>';
|
||||||
}
|
}
|
||||||
} elseif ($object->status == Mo::STATUS_DRAFT) {
|
} elseif ($object->status == Mo::STATUS_DRAFT) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ValidateBefore").'">'.$langs->trans('Consume').'</a>';
|
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ValidateBefore").'">'.$langs->trans('ConsumeOrProduce').'</a>';
|
||||||
}
|
|
||||||
|
|
||||||
// Produce
|
|
||||||
if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
|
|
||||||
if ($permissiontoproduce) {
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=produce">'.$langs->trans('Produce').'</a>';
|
|
||||||
} else {
|
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Produce').'</a>';
|
|
||||||
}
|
|
||||||
} elseif ($object->status == Mo::STATUS_DRAFT) {
|
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ValidateBefore").'">'.$langs->trans('Produce').'</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeAndProduceAll
|
// ConsumeAndProduceAll
|
||||||
@ -571,7 +559,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall')))
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall')))
|
||||||
{
|
{
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -620,11 +608,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<td>'.$langs->trans("Qty").'</td>';
|
print '<td>'.$langs->trans("Qty").'</td>';
|
||||||
print '<td>'.$langs->trans("QtyAlreadyConsumed").'</td>';
|
print '<td>'.$langs->trans("QtyAlreadyConsumed").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse");
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->productbatch->enabled) {
|
if ($conf->productbatch->enabled) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch");
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -678,12 +666,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Show detailed of already consumed with js code to collapse
|
// Show detailed of already consumed with js code to collapse
|
||||||
//$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
|
//$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
|
||||||
|
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) {
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
|
||||||
$i = 1;
|
$i = 1;
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ToConsume").'</td>';
|
print '<td>'.$langs->trans("ToConsume").'</td>';
|
||||||
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
|
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
|
||||||
if ($action == 'produce') $preselected = 0;
|
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
|
||||||
print '<td><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
print '<td><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -747,11 +735,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<td>'.$langs->trans("Qty").'</td>';
|
print '<td>'.$langs->trans("Qty").'</td>';
|
||||||
print '<td>'.$langs->trans("QtyAlreadyProduced").'</td>';
|
print '<td>'.$langs->trans("QtyAlreadyProduced").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse");
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->productbatch->enabled) {
|
if ($conf->productbatch->enabled) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch");
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -793,11 +781,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) {
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ToProduce").'</td>';
|
print '<td>'.$langs->trans("ToProduce").'</td>';
|
||||||
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
|
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
|
||||||
if ($action == 'consume') $preselected = 0;
|
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
|
||||||
print '<td><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
print '<td><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -829,7 +817,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($action, array('consume', 'produce', 'consumeandproduceall')))
|
if (in_array($action, array('consumeorproduce', 'consumeandproduceall')))
|
||||||
{
|
{
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,14 +317,18 @@ class MouvementStock extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($batch != $batchcursor) continue;
|
if ($batch != $batchcursor) continue;
|
||||||
$foundforbatch=1;
|
$foundforbatch=1;
|
||||||
if ($prodbatch->qty < abs($qty)) $qtyisnotenough=1;
|
if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (! $foundforbatch || $qtyisnotenough)
|
if (! $foundforbatch || $qtyisnotenough)
|
||||||
{
|
{
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
$this->error = $langs->trans('qtyToTranferLotIsNotEnough').' : '.$product->ref;
|
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
$this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough').' : '.$product->ref;
|
$tmpwarehouse = new Entrepot($this->db);
|
||||||
|
$tmpwarehouse->fetch($entrepot_id);
|
||||||
|
|
||||||
|
$this->error = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref);
|
||||||
|
$this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user