Fix: dol_htmloutput_events() already loaded in footer
This commit is contained in:
parent
edbfd7d4f8
commit
71a4a2b7f9
@ -48,8 +48,6 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid);
|
$result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid);
|
||||||
|
|
||||||
$mesg = '';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -65,9 +63,7 @@ if ($action == 'setstocklimit')
|
|||||||
$product->seuil_stock_alerte=$stocklimit;
|
$product->seuil_stock_alerte=$stocklimit;
|
||||||
$result=$product->update($product->id,$user,1,0,1);
|
$result=$product->update($product->id,$user,1,0,1);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
setEventMessage($product->errors, 'errors');
|
||||||
$mesg=join(',',$product->errors);
|
|
||||||
}
|
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +72,7 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
{
|
{
|
||||||
if (! (GETPOST("id_entrepot") > 0))
|
if (! (GETPOST("id_entrepot") > 0))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action='correction';
|
$action='correction';
|
||||||
}
|
}
|
||||||
@ -86,7 +82,7 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
$error++;
|
$error++;
|
||||||
$action='correction';
|
$action='correction';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$priceunit=price2num(GETPOST("price"));
|
$priceunit=price2num(GETPOST("price"));
|
||||||
@ -94,7 +90,7 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$result=$product->fetch($id);
|
$result=$product->fetch($id);
|
||||||
|
|
||||||
$result=$product->correct_stock(
|
$result=$product->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot"),
|
GETPOST("id_entrepot"),
|
||||||
@ -103,7 +99,7 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
GETPOST("label"),
|
GETPOST("label"),
|
||||||
$priceunit
|
$priceunit
|
||||||
); // We do not change value of stock for a correction
|
); // We do not change value of stock for a correction
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
||||||
@ -128,7 +124,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
$error++;
|
$error++;
|
||||||
$action='transfert';
|
$action='transfert';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if (GETPOST("id_entrepot_source") <> GETPOST("id_entrepot_destination"))
|
if (GETPOST("id_entrepot_source") <> GETPOST("id_entrepot_destination"))
|
||||||
@ -137,18 +133,18 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$result=$product->fetch($id);
|
$result=$product->fetch($id);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$product->load_stock(); // Load array product->stock_warehouse
|
$product->load_stock(); // Load array product->stock_warehouse
|
||||||
|
|
||||||
// Define value of products moved
|
// Define value of products moved
|
||||||
$pricesrc=0;
|
$pricesrc=0;
|
||||||
if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
|
if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
|
||||||
$pricedest=$pricesrc;
|
$pricedest=$pricesrc;
|
||||||
|
|
||||||
//print 'price src='.$pricesrc.', price dest='.$pricedest;exit;
|
//print 'price src='.$pricesrc.', price dest='.$pricedest;exit;
|
||||||
|
|
||||||
// Remove stock
|
// Remove stock
|
||||||
$result1=$product->correct_stock(
|
$result1=$product->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
@ -158,7 +154,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
GETPOST("label"),
|
GETPOST("label"),
|
||||||
$pricesrc
|
$pricesrc
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add stock
|
// Add stock
|
||||||
$result2=$product->correct_stock(
|
$result2=$product->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
@ -168,7 +164,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
GETPOST("label"),
|
GETPOST("label"),
|
||||||
$pricedest
|
$pricedest
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result1 >= 0 && $result2 >= 0)
|
if ($result1 >= 0 && $result2 >= 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -177,7 +173,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$product->error;
|
setEventMessage($product->error, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,9 +207,6 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($mesg) print($mesg);
|
|
||||||
dol_htmloutput_events();
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -373,8 +366,8 @@ if ($id > 0 || $ref)
|
|||||||
init_price();
|
init_price();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
print_titre($langs->trans("StockCorrection"));
|
print_titre($langs->trans("StockCorrection"));
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user