Fix: Error on page when going from some link
This commit is contained in:
parent
a8fba4277f
commit
fd23d97793
@ -48,13 +48,12 @@ $langs->load('stocks');
|
|||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$langs->load('propal');
|
$langs->load('propal');
|
||||||
|
|
||||||
$origin = "expedition";
|
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
|
||||||
$origin_id = isset($_REQUEST["id"])?$_REQUEST["id"]:'';
|
$origin_id = isset($_REQUEST["id"])?$_REQUEST["id"]:'';
|
||||||
|
if (empty($origin_id)) $origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal
|
||||||
|
if (empty($origin_id)) $origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
|
||||||
$id = $origin_id;
|
$id = $origin_id;
|
||||||
|
|
||||||
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
|
|
||||||
$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal
|
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -539,58 +538,53 @@ if ($_GET["action"] == 'create')
|
|||||||
$quantityAsked = $line->qty;
|
$quantityAsked = $line->qty;
|
||||||
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;
|
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;
|
||||||
|
|
||||||
if ($conf->stock->enabled
|
$defaultqty=0;
|
||||||
//&& $line->product_type == 0
|
if ($_REQUEST["entrepot_id"])
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$defaultqty=0;
|
//var_dump($product);
|
||||||
if ($_REQUEST["entrepot_id"])
|
$stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real;
|
||||||
{
|
$stock+=0; // Convertit en numerique
|
||||||
//var_dump($product);
|
$defaultqty=min($quantityToBeDelivered, $stock);
|
||||||
$stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real;
|
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
|
||||||
$stock+=0; // Convertit en numerique
|
}
|
||||||
$defaultqty=min($quantityToBeDelivered, $stock);
|
|
||||||
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quantity to send
|
// Quantity to send
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
|
{
|
||||||
|
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||||
|
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
|
||||||
|
}
|
||||||
|
else print '0';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Stock
|
||||||
|
if ($conf->stock->enabled)
|
||||||
|
{
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
{
|
{
|
||||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
// Show warehous
|
||||||
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
|
if ($_REQUEST["entrepot_id"])
|
||||||
}
|
|
||||||
else print '0';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Stock
|
|
||||||
if ($conf->stock->enabled)
|
|
||||||
{
|
|
||||||
print '<td align="left">';
|
|
||||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
|
||||||
{
|
{
|
||||||
// Show warehous
|
$formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||||
if ($_REQUEST["entrepot_id"])
|
//print $stock.' '.$quantityToBeDelivered;
|
||||||
|
//if ($stock >= 0 && $stock < $quantityToBeDelivered)
|
||||||
|
if ($stock < $quantityToBeDelivered)
|
||||||
{
|
{
|
||||||
$formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||||
//print $stock.' '.$quantityToBeDelivered;
|
|
||||||
//if ($stock >= 0 && $stock < $quantityToBeDelivered)
|
|
||||||
if ($stock < $quantityToBeDelivered)
|
|
||||||
{
|
|
||||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Service");
|
$formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Service");
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
/*else
|
/*else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user