From 944df95f35da644bf7beaced8b7fb62761de0d9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2005 23:39:20 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Liste=20de=20stock=20non=20affich=E9=20s?= =?UTF-8?q?uite=20a=20pb=20register=5Fglobals=3Doff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/stock/fiche.php | 341 ++++++++++++++++--------------- htdocs/product/stock/product.php | 21 +- 2 files changed, 192 insertions(+), 170 deletions(-) diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 5517d3d7cdc..35bba2519c0 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -164,184 +164,203 @@ if ($_GET["action"] == 'create') } else { - if ($_GET["id"]) + if ($_GET["id"]) { - - if ($mesg) print $mesg; - - $entrepot = new Entrepot($db); - $result = $entrepot->fetch($_GET["id"]); - if (! $result) + if ($mesg) print $mesg; + + $entrepot = new Entrepot($db); + $result = $entrepot->fetch($_GET["id"]); + if (! $result) { - dolibarr_print_error($db); + dolibarr_print_error($db); } - - /* - * Affichage fiche - */ - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + + /* + * Affichage fiche + */ + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') { - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("WarehouseCard"); - $hselected=$h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); - - print ''; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print '"; - - $sql = "SELECT max( ".$db->pdate("m.datem").") as datem"; - $sql .= " FROM llx_stock_mouvement as m"; - $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';"; - $resql = $db->query($sql); - if ($resql) - { - $row = $db->fetch_row($resql); - } + /* + * Affichage onglets + */ + $h = 0; - print '"; - print "
'.$langs->trans("Ref").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans('Address').''; - print $entrepot->address; - print '
'.$langs->trans('Zip').''.$entrepot->cp.''.$langs->trans('Town').''.$entrepot->ville.'
'.$langs->trans('Country').''; - $entrepot->pays; - print '
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("NumberOfProducts").''; - print $entrepot->nb_products(); - print "
'.$langs->trans("DernierMouvement").''; - print strftime("%e %B %Y",$row[0]); - print "
"; - - //affichage de la liste des produits de l\'entrepot - print ''; - print ""; + $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("WarehouseCard"); + $hselected=$h; + $h++; - print_liste_field_titre($langs->trans("Product"),"", "p.ref","","","",$sortfield); + $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Info"); + $h++; - print ""; - print "\n"; - $sql = "SELECT p.rowid as rowid, p.label as produit, ps.reel as value "; - $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p "; - $sql .= " WHERE ps.fk_product = p.rowid "; - $sql .= " AND ps.reel >0 AND ps.fk_entrepot = $id"; + dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); - //$sql .= $db->plimit($limit + 1 ,$offset); + print '
".$langs->trans("Units")."
'; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print '"; + + // Dernier mouvement + $sql = "SELECT max( ".$db->pdate("m.datem").") as datem"; + $sql .= " FROM llx_stock_mouvement as m"; + $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';"; + $resql = $db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + } + else + { + dolibarr_print_error($db); + } + + print '"; + print "
'.$langs->trans("Ref").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans('Address').''; + print $entrepot->address; + print '
'.$langs->trans('Zip').''.$entrepot->cp.''.$langs->trans('Town').''.$entrepot->ville.'
'.$langs->trans('Country').''; + $entrepot->pays; + print '
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("NumberOfProducts").''; + print $entrepot->nb_products(); + print "
'.$langs->trans("LastMovement").''; + print dolibarr_print_date($row[0]); + print "
"; + + print ''; + + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + + print "
\n"; + + if ($_GET["action"] == '') + { + print "id."\">".$langs->trans("Edit").""; + } + + print "
"; + + + /* ************************************************************************** */ + /* */ + /* Affichage de la liste des produits de l'entrepot */ + /* */ + /* ************************************************************************** */ + print '
'; + + print ''; + print ""; + + print_liste_field_titre($langs->trans("Product"),"", "p.ref","","","",$sortfield); + + print ""; + print "\n"; + $sql = "SELECT p.rowid as rowid, p.label as produit, ps.reel as value "; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p "; + $sql .= " WHERE ps.fk_product = p.rowid "; + $sql .= " AND ps.reel >0 AND ps.fk_entrepot = ".$entrepot->id; + + //$sql .= $db->plimit($limit + 1 ,$offset); + + $resql = $db->query($sql) ; + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + //print ''; + print "\n"; + print ''; + //print "\n"; + print "\n"; + $i++; + } + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } + print "
".$langs->trans("Units")."
'.dolibarr_print_date($objp->datem).'rowid\">"; + print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit; + print "'.$objp->value.'entrepot_id\">"; + //print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock; + //print "
\n"; + print "\n"; - $resql = $db->query($sql) ; - if ($resql) - {$num = $db->num_rows($resql); - $i = 0; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - //print ''.dolibarr_print_date($objp->datem).''; - print "rowid\">"; - print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit; - print "\n"; - print ''.$objp->value.''; - //print "entrepot_id\">"; - //print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock; - //print "\n"; - print "\n"; - $i++; - } - $db->free($resql); - } - print "\n"; - print "\n"; - } - - - /* - * Edition fiche - */ - if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) + + + /* + * Edition fiche + */ + if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) { - print_fiche_titre('Edition de la fiche entrepot', $mesg); - - print '
'; - print ''; - print ''; - - print ''; - print ''; - print '"; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("LocationSummary").'
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Country').''; - $form->select_pays($entrepot->pays_id,$entrepot->pays_code); - print '
'.$langs->trans("Status").''; - print ''; - print '
 '; - print '
'; - print '
'; - + print_fiche_titre('Edition de la fiche entrepot', $mesg); + + print '
'; + print ''; + print ''; + + print ''; + print ''; + print '"; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; + print '
'.$langs->trans("LocationSummary").'
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Country').''; + $form->select_pays($entrepot->pays_id,$entrepot->pays_code); + print '
'.$langs->trans("Status").''; + print ''; + print '
 '; + print '
'; + print '
'; + } } } -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "
\n"; - -if ($_GET["action"] == '') -{ - print "id\">".$langs->trans("Edit").""; -} - -print "
"; $db->close(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f778f88bb4d..dc66d8105b1 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -158,7 +158,11 @@ if ($_GET["id"]) $h++; $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Bills'); + $head[$h][1] = $langs->trans('Referers'); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; + $head[$h][1] = $langs->trans('Documents'); $h++; dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); @@ -193,8 +197,7 @@ if ($_GET["id"]) // Stock if ($product->type == 0 && $conf->stock->enabled) { - print ''.$langs->trans("Stock").''; + print ''.$langs->trans("Stock").''; if ($product->no_stock) { print "Pas de définition de stock pour ce produit"; @@ -277,8 +280,8 @@ href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs-> print ''; print ''; print 'Nb de pièce'; - print ' '; - print ''; + print ' '; + print ''; print ''; print ''; @@ -333,8 +336,8 @@ href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs-> } print ''; print 'Nb de pièce'; - print ' '; - print ''; + print ' '; + print ''; print ''; print ''; @@ -367,8 +370,8 @@ href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs-> } } print 'Nb de pièce'; - print ' '; - print ''; + print ' '; + print ''; print ''; print ''; }