diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 4b2ea3e93c0..b924b9c442c 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -97,11 +97,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
//$result = restrictedArea($user, 'mymodule', $id);
//Parameters Page
-$param = '&id='.$object->id;
+$paramwithsearch = '';
if ($limit > 0 && $limit != $conf->liste_limit) {
- $param .= '&limit='.urlencode($limit);
+ $paramwithsearch .= '&limit='.((int) $limit);
}
-$paramwithsearch = $param;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
@@ -265,6 +264,7 @@ if (empty($reshook)) {
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
+ $sql .= $db->order('id.rowid', 'ASC');
$sql .= $db->plimit($limit, $offset);
$db->begin();
@@ -297,7 +297,7 @@ if (empty($reshook)) {
$inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS');
$resultupdate = $inventoryline->update($user);
}
- } else {
+ } elseif (GETPOSTISSET('id_' . $lineid)) {
// Delete record
$result = $inventoryline->fetch($lineid);
if ($result > 0) {
@@ -415,7 +415,6 @@ if (empty($reshook)) {
-
/*
* View
*/
@@ -459,7 +458,7 @@ if ($action == 'clone') {
// Confirmation to close
if ($action == 'record') {
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
$action = 'view';
}
@@ -494,7 +493,7 @@ $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $
// Thirdparty
$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
// Project
-if (!empty($conf->project->enabled))
+if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='
'.$langs->trans('Project') . ' ';
@@ -583,13 +582,13 @@ if ($action != 'record') {
// Save
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
- print 'id.'&action=record&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").''."\n";
+ print 'id.'&action=record&page='.$page.$paramwithsearch.'&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").''."\n";
} else {
print ''.$langs->trans('MakeMovementsAndClose').''."\n";
}
if ($permissiontoadd) {
- print 'id.'&action=confirm_cancel&token='.newToken().'">'.$langs->trans("Cancel").''."\n";
+ print 'id.'&action=confirm_cancel&page='.$page.$paramwithsearch.'&token='.newToken().'">'.$langs->trans("Cancel").''."\n";
}
}
}
@@ -990,7 +989,7 @@ if ($resql) {
$num = $db->num_rows($resql);
if (!empty($limit != 0) || $num > $limit || $page) {
- print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '