Fix: When stock is empty, no information was visible to explain why

create button does not work.
This commit is contained in:
Laurent Destailleur 2015-08-14 20:37:20 +02:00
parent 10d3c41358
commit d408193657
2 changed files with 40 additions and 24 deletions

View File

@ -669,7 +669,8 @@ if ($action == 'create')
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>'; print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
print '<td align="center">'.$langs->trans("QtyShipped").'</td>'; print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
print '<td align="center">'.$langs->trans("QtyToShip"); print '<td align="center">'.$langs->trans("QtyToShip");
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled))
{
print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>'; print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)'; print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
} }
@ -848,20 +849,24 @@ if ($action == 'create')
else else
{ {
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
$staticwarehouse=new Entrepot($db);
$staticwarehouse->fetch($warehouse_id);
$subj=0; $subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
if (count($product->stock_warehouse[$warehouse_id]->detail_batch))
{
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
{ {
//var_dump($dbatch); //var_dump($dbatch);
$substock=$dbatch->qty +0 ; $substock=$dbatch->qty +0 ; // To get a numeric
print '<tr><td colspan="3" ></td><td align="center">'; print '<tr><td colspan="3" ></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.min($defaultqty,$substock).'">'; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.($substock > 0 ? min($defaultqty,$substock) : '0').'">';
print '</td>'; print '</td>';
print '<td align="left">'; print '<td align="left">';
$staticwarehouse=new Entrepot($db);
$staticwarehouse->fetch($warehouse_id);
print $staticwarehouse->getNomUrl(0).' / '; print $staticwarehouse->getNomUrl(0).' / ';
print '<!-- Show details of lot -->'; print '<!-- Show details of lot -->';
@ -875,6 +880,16 @@ if ($action == 'create')
$subj++; $subj++;
} }
} }
else
{
print '<tr><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>';
print '<td align="left">';
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
}
}
$indiceAsked++; $indiceAsked++;
} }

View File

@ -69,6 +69,7 @@ ProductQtyInCustomersOrdersRunning=Product quantity into opened customers orders
ProductQtyInSuppliersOrdersRunning=Product quantity into opened suppliers orders ProductQtyInSuppliersOrdersRunning=Product quantity into opened suppliers orders
ProductQtyInShipmentAlreadySent=Product quantity from opened customer order already sent ProductQtyInShipmentAlreadySent=Product quantity from opened customer order already sent
ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from opened supplier order already received ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from opened supplier order already received
NoProductToShipFoundIntoStock=No product to ship found into warehouse <b>%s</b>. Correct sotck or go back to choose another warehouse.
# Sending methods # Sending methods
SendingMethodCATCH=Catch by customer SendingMethodCATCH=Catch by customer