From 644e8b5a058149742826dcc98dcaacf04d7a187a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Dec 2017 15:02:15 +0100 Subject: [PATCH] Fix navigation on stock --- htdocs/product/stock/card.php | 15 +++++++++------ htdocs/product/stock/info.php | 11 +++++++---- htdocs/product/stock/mouvement.php | 9 +++++---- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 97924d330ae..8ab36de3428 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -42,9 +42,11 @@ $action=GETPOST('action','aZ09'); $cancel=GETPOST('cancel','alpha'); $confirm=GETPOST('confirm'); +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$id = GETPOST("id",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="DESC"; @@ -259,13 +261,14 @@ if ($action == 'create') else { $id=GETPOST("id",'int'); - if ($id) + if ($id > 0 || $ref) { $object = new Entrepot($db); - $result = $object->fetch($id); - if ($result < 0) + $result = $object->fetch($id, $ref); + if ($result <= 0) { - dol_print_error($db); + print 'No record found'; + exit; } /* @@ -305,7 +308,7 @@ else $shownav = 1; if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; - dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); print '
'; print '
'; diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index a088ac289b8..4d49a0c8514 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -28,6 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; $langs->load("stocks"); +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); + // Security check $result=restrictedArea($user,'stock'); @@ -40,12 +43,12 @@ $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("Stocks"),$help_url); $object = new Entrepot($db); -$object->fetch($_GET["id"]); -$object->info($_GET["id"]); +$object->fetch($id, $ref); +$object->info($object->id); $head = stock_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("Warehouse"), 0, 'stock'); +dol_fiche_head($head, 'info', $langs->trans("Warehouse"), -1, 'stock'); $linkback = ''.$langs->trans("BackToList").''; @@ -57,7 +60,7 @@ $morehtmlref.='
'; $shownav = 1; if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; -dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref); +dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index e1daefd3e19..e7329f1d44a 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -48,6 +48,7 @@ if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); $result=restrictedArea($user,'stock'); $id=GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); $msid=GETPOST('msid','int'); $product_id=GETPOST("product_id"); $action=GETPOST('action','aZ09'); @@ -487,9 +488,9 @@ if ($resql) { $product->fetch($idproduct); } - if ($id > 0) + if ($id > 0 || $ref) { - $result = $object->fetch($id); + $result = $object->fetch($id, $ref); if ($result < 0) { dol_print_error($db); @@ -514,7 +515,7 @@ if ($resql) /* * Show tab only if we ask a particular warehouse */ - if ($id) + if ($object->id > 0) { $head = stock_prepare_head($object); @@ -530,7 +531,7 @@ if ($resql) $shownav = 1; if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; - dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); print '
';