diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index c7dffe08691..f1fcdf4f0f8 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -386,7 +386,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); if (empty($noback)) { - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); + header('Location: '.((empty($backtopage)) ? $_SERVER["PHP_SELF"].'?id='.$object->id : $backtopage)); exit; } } else { diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index de9912cfac0..4718c066466 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -42,6 +42,15 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$listoffset = GETPOST('listoffset', 'alpha'); +$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); @@ -87,6 +96,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); +//Parameters Page +$param = '&id='.$object->id; +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +$paramwithsearch = $param; + + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; @@ -98,6 +115,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $now = dol_now(); + /* * Actions */ @@ -247,6 +265,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->plimit($limit, $offset); $db->begin(); @@ -297,7 +316,7 @@ if (empty($reshook)) { } } - // Update user that update quantities + // Update line with id of stock movement (and the start quantity if it has changed this last recording) if (! $error) { $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."inventory"; $sqlupdate .= " SET fk_user_modif = ".((int) $user->id); @@ -316,9 +335,8 @@ if (empty($reshook)) { } } - $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; - $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; + $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id.'&page='.$page.$paramwithsearch; // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -409,30 +427,6 @@ $help_url = ''; llxHeader('', $langs->trans('Inventory'), $help_url); - -// Disable button Generate movement if data were modified and not saved -print ''; - - // Part to show record if ($object->id > 0) { $res = $object->fetch_optionals(); @@ -448,7 +442,7 @@ if ($object->id > 0) { } // Confirmation to delete line if ($action == 'deleteline') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); } // Clone confirmation @@ -554,8 +548,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - - print '
'; + print ''; print ''; print ''; print ''; @@ -980,6 +973,7 @@ if ($object->id > 0) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= $db->plimit($limit, $offset); $cacheOfProducts = array(); $cacheOfWarehouses = array(); @@ -989,6 +983,10 @@ if ($object->id > 0) { if ($resql) { $num = $db->num_rows($resql); + if (!empty($limit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); + } + $i = 0; $hasinput = false; $totalarray = array(); @@ -1109,7 +1107,7 @@ if ($object->id > 0) { // Picto delete line print ''; - print ''.img_delete().''; + print ''.img_delete().''; $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; print ''; @@ -1194,6 +1192,48 @@ if ($object->id > 0) { } print '
'; + print ''; + if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { ?> diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d25ee868191..80656681015 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -685,7 +685,6 @@ if ($search_dateclose_end) { $param .= '&search_date_endmonth='.urlencode($tmparray['mon']); $param .= '&search_date_endyear='.urlencode($tmparray['year']); } - // List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),