Fix navigation on stock

This commit is contained in:
Laurent Destailleur 2017-12-24 15:02:15 +01:00
parent fdac3078e2
commit 644e8b5a05
3 changed files with 21 additions and 14 deletions

View File

@ -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 '<div class="fichecenter">';
print '<div class="fichehalfleft">';

View File

@ -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&oacute;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 = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">'.$langs->trans("BackToList").'</a>';
@ -57,7 +60,7 @@ $morehtmlref.='</div>';
$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 '<div class="fichecenter">';

View File

@ -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 '<div class="fichecenter">';