Fix: Liste de stock non affiché suite a pb register_globals=off

This commit is contained in:
Laurent Destailleur 2005-09-12 23:39:20 +00:00
parent 3a93a0ef08
commit 944df95f35
2 changed files with 192 additions and 170 deletions

View File

@ -166,7 +166,6 @@ else
{ {
if ($_GET["id"]) if ($_GET["id"])
{ {
if ($mesg) print $mesg; if ($mesg) print $mesg;
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
@ -221,22 +220,51 @@ else
print $entrepot->nb_products(); print $entrepot->nb_products();
print "</td></tr>"; print "</td></tr>";
// Dernier mouvement
$sql = "SELECT max( ".$db->pdate("m.datem").") as datem"; $sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
$sql .= " FROM llx_stock_mouvement as m"; $sql .= " FROM llx_stock_mouvement as m";
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';"; $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
} }
else
{
dolibarr_print_error($db);
}
print '<tr><td valign="top"><a href="mouvement.php">'.$langs->trans("DernierMouvement").'</a></td><td colspan="3">'; print '<tr><td valign="top"><a href="mouvement.php">'.$langs->trans("LastMovement").'</a></td><td colspan="3">';
print strftime("%e %B %Y",$row[0]); print dolibarr_print_date($row[0]);
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
//affichage de la liste des produits de l\'entrepot print '</div>';
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
print "<a class=\"tabAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Edit")."</a>";
}
print "</div>";
/* ************************************************************************** */
/* */
/* Affichage de la liste des produits de l'entrepot */
/* */
/* ************************************************************************** */
print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -247,13 +275,14 @@ else
$sql = "SELECT p.rowid as rowid, p.label as produit, ps.reel as value "; $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 .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
$sql .= " WHERE ps.fk_product = p.rowid "; $sql .= " WHERE ps.fk_product = p.rowid ";
$sql .= " AND ps.reel >0 AND ps.fk_entrepot = $id"; $sql .= " AND ps.reel >0 AND ps.fk_entrepot = ".$entrepot->id;
//$sql .= $db->plimit($limit + 1 ,$offset); //$sql .= $db->plimit($limit + 1 ,$offset);
$resql = $db->query($sql) ; $resql = $db->query($sql) ;
if ($resql) if ($resql)
{$num = $db->num_rows($resql); {
$num = $db->num_rows($resql);
$i = 0; $i = 0;
$var=True; $var=True;
while ($i < $num) while ($i < $num)
@ -274,6 +303,10 @@ else
} }
$db->free($resql); $db->free($resql);
} }
else
{
dolibarr_print_error($db);
}
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
@ -328,20 +361,6 @@ else
} }
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
print "<a class=\"tabAction\" href=\"fiche.php?action=edit&id=$entrepot->id\">".$langs->trans("Edit")."</a>";
}
print "</div>";
$db->close(); $db->close();

View File

@ -158,7 +158,11 @@ if ($_GET["id"])
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; $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++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
@ -193,8 +197,7 @@ if ($_GET["id"])
// Stock // Stock
if ($product->type == 0 && $conf->stock->enabled) if ($product->type == 0 && $conf->stock->enabled)
{ {
print '<tr><td><a print '<tr><td><a href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs->trans("Stock").'</a></td>';
href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs->trans("Stock").'</a></td>';
if ($product->no_stock) if ($product->no_stock)
{ {
print "<td>Pas de définition de stock pour ce produit"; print "<td>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 '<option value="1">'.$langs->trans("Delete").'</option>'; print '<option value="1">'.$langs->trans("Delete").'</option>';
print '</select></td>'; print '</select></td>';
print '<td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>'; print '<td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
print '<tr><td colspan="5" align="center"><input type="submit" value="'.$langs->trans('Save').'">&nbsp;'; print '<tr><td colspan="5" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
@ -333,8 +336,8 @@ href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs->
} }
print '</select></td>'; print '</select></td>';
print '<td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>'; print '<td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
print '<tr><td colspan="6" align="center"><input type="submit" value="'.$langs->trans('Save').'">&nbsp;'; print '<tr><td colspan="6" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
@ -367,8 +370,8 @@ href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'">'.$langs->
} }
} }
print '</select></td><td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>'; print '</select></td><td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans('Save').'">&nbsp;'; print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} }