mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
FIX false error message in shipment card
This commit is contained in:
@@ -243,8 +243,8 @@ if (empty($reshook))
|
||||
while (isset($_POST[$batch]))
|
||||
{
|
||||
// save line of detail into sub_qty
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
|
||||
$subtotalqty+=$sub_qty[$j]['q'];
|
||||
|
||||
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
|
||||
@@ -262,9 +262,14 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case we dont use the list of available qty for each warehouse/lot
|
||||
// GUI does not allow this yet
|
||||
setEventMessage('StockRequiredToChooseWhichLotToUse', 'errors');
|
||||
// No detail were provided for lots
|
||||
if (! empty($_POST[$qty]))
|
||||
{
|
||||
// We try to set an amount
|
||||
// Case we dont use the list of available qty for each warehouse/lot
|
||||
// GUI does not allow this yet
|
||||
setEventMessage('StockIsRequiredToChooseWhichLotToUse', 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isset($_POST[$stockLocation]))
|
||||
@@ -810,7 +815,7 @@ if ($action == 'create')
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
// Lecture des expeditions deja effectuees
|
||||
// Load shipments already done for same order
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ($numAsked)
|
||||
@@ -919,6 +924,7 @@ if ($action == 'create')
|
||||
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
||||
print '</td>';
|
||||
|
||||
// Qty to ship
|
||||
$quantityAsked = $line->qty;
|
||||
if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
@@ -938,7 +944,7 @@ if ($action == 'create')
|
||||
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
|
||||
$deliverableQty=min($quantityToBeDelivered, $stock);
|
||||
if ($deliverableQty < 0) $deliverableQty = 0;
|
||||
if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() && is_object($product->stock_warehouse[$warehouse_id])))
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
// Quantity to send
|
||||
print '<td align="center">';
|
||||
@@ -1009,21 +1015,32 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
// Product need lot
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
|
||||
$staticwarehouse=new Entrepot($db);
|
||||
if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id);
|
||||
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
{
|
||||
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
if (count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
{
|
||||
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
|
||||
{
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>';
|
||||
print '<td colspan="3" ></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
@@ -1045,8 +1062,8 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<!-- Case -->';
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<!-- Case there is no details of lot at all -->';
|
||||
print '<tr '.$bc[$var].'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
|
||||
print '</td>';
|
||||
|
||||
@@ -1066,6 +1083,15 @@ if ($action == 'create')
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
if ($stock_warehouse->real > 0)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
@@ -1076,7 +1102,8 @@ if ($action == 'create')
|
||||
$deliverableQty = min($quantityToBeDelivered,$stock);
|
||||
$deliverableQty = max(0, $deliverableQty);
|
||||
// Quantity to send
|
||||
print '<tr><td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>';
|
||||
print '<td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
@@ -1146,16 +1173,27 @@ if ($action == 'create')
|
||||
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$productlotObject=new Productlot($db);
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
{
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
@@ -1185,10 +1223,14 @@ if ($action == 'create')
|
||||
if ($subj == 0) // Line not shown yet, we show it
|
||||
{
|
||||
print '<!-- line not shown yet, we show it -->';
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" ></td><td align="center">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
//$disabled='disabled="disabled"';
|
||||
$disabled='';
|
||||
if (! empty($conf->productbatch->enabled) && $product->hasbatch())
|
||||
{
|
||||
$disabled='disabled="disabled"';
|
||||
}
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled?' '.$disabled:'').'> ';
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user