Qual: Utilisation du style formsearch pour tous les onglets de la fiche produit

Doc: Mise à jour doc doxygen.
This commit is contained in:
Laurent Destailleur 2004-08-29 15:22:57 +00:00
parent a59af248bd
commit dcdd320f7e
6 changed files with 202 additions and 88 deletions

View File

@ -21,6 +21,13 @@
* *
*/ */
/*!
\file htdocs/product/fiche.php
\ingroup product
\brief Page de la fiche produit
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
require("../propal.class.php"); require("../propal.class.php");
require("../facture.class.php"); require("../facture.class.php");
@ -38,6 +45,10 @@ if (!$user->rights->produit->lire)
} }
$types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service");
if ($_POST["action"] == 'add' && $user->rights->produit->creer) if ($_POST["action"] == 'add' && $user->rights->produit->creer)
{ {
$product = new Product($db); $product = new Product($db);
@ -301,23 +312,24 @@ else
*/ */
// Zone recherche // Zone recherche
print '<div class="formsearch">'; print '<div class="formsearch">';
print '<form action="liste.php" method="post">'; print '<form action="liste.php" method="post">';
print '<input type="hidden" name="type" value="'.$product->type.'">'; print '<input type="hidden" name="type" value="'.$product->type.'">';
print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go">'; print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go"> &nbsp;';
print $langs->trans("Label").': <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">';
print 'Libellé : <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">';
print '</form></div>'; print '</form></div>';
$h=0;
$head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[0][1] = 'Fiche'; $head[$h][1] = $langs->trans("Card");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[$h][1] = $langs->trans("Price");
$h++;
$head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[1][1] = $langs->trans("Price");
$h = 2;
if($product->type == 0) if($product->type == 0)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
@ -327,8 +339,11 @@ else
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans('Statistics'); $head[$h][1] = $langs->trans('Statistics');
$h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
dolibarr_fiche_head($head, 0, 'Fiche '.$types[$product->type].' : '.$product->ref);
print($mesg); print($mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,10 +20,16 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/pre.inc.php
\ingroup product,service
\brief Fichier gestionnaire du menu gauche des produits et services
\version $Revision$
*/
require("../main.inc.php"); require("../main.inc.php");
$types[0] = "produit";
$types[1] = "service";
function llxHeader($head = "", $urlp = "", $title="") function llxHeader($head = "", $urlp = "", $title="")
{ {

View File

@ -20,6 +20,14 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/product/price.php
\ingroup product
\brief Page de la fiche produit
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("products"); $langs->load("products");
@ -29,6 +37,11 @@ $user->getrights('produit');
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
$types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service");
if ($action == 'update') if ($action == 'update')
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET description='$desc' where rowid = $rowid"; $sql = "UPDATE ".MAIN_DB_PREFIX."product SET description='$desc' where rowid = $rowid";
@ -45,27 +58,40 @@ llxHeader("","","Prix");
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
// Zone recherche // Zone recherche
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">'; print '<div class="formsearch">';
print '<tr class="liste_titre">'; print '<form action="liste.php" method="post">';
print '<form action="liste.php?type='.$product->type.'" method="post"><td>'; print '<input type="hidden" name="type" value="'.$product->type.'">';
print $langs->trans("Ref").' : <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go">'; print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go"> &nbsp;';
print '</td></form><form action="liste.php" method="post"><td>'; print $langs->trans("Label").': <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">';
print 'Libellé : <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">'; print '</form></div>';
print '</td></form></tr></table>';
print '<br>';
$head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[0][1] = 'Fiche';
$head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[1][1] = $langs->trans("Price");
$head[2][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[2][1] = $langs->trans("Statistics");
dolibarr_fiche_head($head, 1, 'Fiche '.$types[$product->type].' : '.$product->ref); $h=0;
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[$h][1] = $langs->trans("Price");
$hselected=$h;
$h++;
if($product->type == 0)
{
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
$head[$h][1] = 'Stock';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics");
$h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
$sql = "SELECT p.rowid, p.price, ".$db->pdate("p.date_price")." as dp"; $sql = "SELECT p.rowid, p.price, ".$db->pdate("p.date_price")." as dp";

View File

@ -20,9 +20,23 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/product/product.php
\ingroup product
\brief Page des stats produits
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
require("../../propal.class.php"); require("../../propal.class.php");
$langs->load("products");
$types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service");
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -87,25 +101,39 @@ if ($_GET["id"])
} }
// Zone recherche // Zone recherche
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">'; print '<div class="formsearch">';
print '<tr class="liste_titre">'; print '<form action="liste.php" method="post">';
print '<form action="liste.php?type='.$product->type.'" method="post"><td>'; print '<input type="hidden" name="type" value="'.$product->type.'">';
print $langs->trans("Ref").' : <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go">'; print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go"> &nbsp;';
print '</td></form><form action="liste.php" method="post"><td>'; print $langs->trans("Label").': <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">';
print 'Libellé : <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">'; print '</form></div>';
print '</td></form></tr></table>';
print '<br>';
$head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[0][1] = 'Fiche';
$head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $h=0;
$head[1][1] = $langs->trans("Price");
$head[2][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[2][1] = $langs->trans("Statistics"); $head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[$h][1] = $langs->trans("Price");
$h++;
if($product->type == 0)
{
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
$head[$h][1] = 'Stock';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics");
$hselected=$h;
$h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
dolibarr_fiche_head($head, 2, 'Fiche '.$types[$product->type].' : '.$product->ref);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4"><tr>'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4"><tr>';
print '<td width="20%">'.$langs->trans("Ref").'</td><td width="40%"><a href="../fiche.php?id='.$product->id.'">'.$product->ref.'</a></td>'; print '<td width="20%">'.$langs->trans("Ref").'</td><td width="40%"><a href="../fiche.php?id='.$product->id.'">'.$product->ref.'</a></td>';
@ -179,12 +207,7 @@ if ($_GET["id"])
} }
print '<td align="center">[<a href="fiche.php?id='.$product->id.'&amp;action=recalcul">Re-calculer</a>]</td></tr>'; print '<td align="center">[<a href="fiche.php?id='.$product->id.'&amp;action=recalcul">Re-calculer</a>]</td></tr>';
print '</table>'; print '</table><br>';

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,8 +20,17 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/stock/pre.inc.php
\ingroup stock
\brief Fichier gestionnaire du menu gauche de stocks
\version $Revision$
*/
require("../../main.inc.php"); require("../../main.inc.php");
require("./entrepot.class.php"); require("./entrepot.class.php");
function llxHeader($head = "", $urlp = "", $title="") function llxHeader($head = "", $urlp = "", $title="")
{ {
/* /*

View File

@ -21,8 +21,17 @@
* *
*/ */
/*!
\file htdocs/product/stock/product.php
\ingroup product
\brief Page de la fiche produit
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("products");
$user->getrights('produit'); $user->getrights('produit');
$mesg = ''; $mesg = '';
@ -31,6 +40,11 @@ if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
} }
$types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service");
llxHeader("","","Fiche produit"); llxHeader("","","Fiche produit");
if ($_POST["action"] == "create_stock") if ($_POST["action"] == "create_stock")
@ -55,7 +69,7 @@ if ($_POST["action"] == "correct_stock" && $_POST["cancel"] <> "Annuler")
} }
/* /*
* * Fiche stock
* *
*/ */
if ($_GET["id"]) if ($_GET["id"])
@ -65,21 +79,39 @@ if ($_GET["id"])
if ( $product->fetch($_GET["id"])) if ( $product->fetch($_GET["id"]))
{ {
$head[0][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[0][1] = 'Fiche';
$head[1][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; // Zone recherche
$head[1][1] = $langs->trans("Price"); print '<div class="formsearch">';
$h = 2; print '<form action="liste.php" method="post">';
print '<input type="hidden" name="type" value="'.$product->type.'">';
print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go"> &nbsp;';
print $langs->trans("Label").': <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go">';
print '</form></div>';
$h=0;
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
$head[$h][1] = $langs->trans("Price");
$h++;
if($product->type == 0)
{
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
$head[$h][1] = 'Stock'; $head[$h][1] = 'Stock';
$hselected=$h;
$h++; $h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics"); $head[$h][1] = $langs->trans("Statistics");
$h++;
dolibarr_fiche_head($head, 2, 'Fiche '.$types[$product->type].' : '.$product->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
print($mesg); print($mesg);
@ -98,7 +130,7 @@ if ($_GET["id"])
print "<b>Cet article n'est pas en vente</b>"; print "<b>Cet article n'est pas en vente</b>";
} }
print '</td></tr>'; print '</td></tr>';
print "<tr><td>Libellé</td><td>$product->libelle</td>"; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$product->id.'">'.$langs->trans("Statistics").'</a></td></tr>'; print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$product->id.'">'.$langs->trans("Statistics").'</a></td></tr>';
print '<tr><td>Prix de vente</td><td>'.price($product->price).'</td>'; print '<tr><td>Prix de vente</td><td>'.price($product->price).'</td>';
print '<td valign="top" rowspan="2">'; print '<td valign="top" rowspan="2">';
@ -113,13 +145,13 @@ if ($_GET["id"])
{ {
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="../fourn/fiche.php?socid='.$objp->idp.'">'.$objp->nom.'</a></td></tr>'; print '<td><a href="../fourn/fiche.php?socid='.$objp->idp.'">'.$objp->nom.'</a></td></tr>';
$i++; $i++;
} }
@ -135,7 +167,7 @@ if ($_GET["id"])
* Contenu des stocks * Contenu des stocks
* *
*/ */
print '<br><table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<br><table class="border" width="100%" cellspacing="0" cellpadding="3">';
print '<tr class="liste_titre"><td width="40%">Entrepôt</td><td width="60%">Valeur du stock</td></tr>'; print '<tr class="liste_titre"><td width="40%">Entrepôt</td><td width="60%">Valeur du stock</td></tr>';
$sql = "SELECT e.rowid, e.label, ps.reel FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps"; $sql = "SELECT e.rowid, e.label, ps.reel FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= " WHERE ps.fk_entrepot = e.rowid AND ps.fk_product = $product->id"; $sql .= " WHERE ps.fk_entrepot = e.rowid AND ps.fk_product = $product->id";
@ -154,22 +186,23 @@ if ($_GET["id"])
} }
} }
print '<tr><td align="right">'.$langs->trans("Total").':</td><td>'.$total."</td></tr></table>"; print '<tr><td align="right">'.$langs->trans("Total").':</td><td>'.$total."</td></tr></table>";
print '<br>';
} }
print '</div>'; print '</div>';
/* /*
* Correction du stock * Correction du stock
* *
*
*/ */
if ($_GET["action"] == "correction") if ($_GET["action"] == "correction")
{ {
print_titre ("Correction du stock"); print_titre ("Correction du stock");
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n"; print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="correct_stock">'; print '<input type="hidden" name="action" value="correct_stock">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4"><tr>'; print '<table class="border" width="100%" cellspacing="0" cellpadding="3"><tr>';
print '<td width="20%">Entrepôt</td><td width="20%"><select name="id_entrepot">'; print '<td width="20%">Entrepôt</td><td width="20%"><select name="id_entrepot">';
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e WHERE statut = 1"; $sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e WHERE statut = 1";
@ -192,23 +225,23 @@ if ($_GET["id"])
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="Enregistrer">&nbsp;'; print '<tr><td colspan="5" align="center"><input type="submit" value="'.$langs->trans('Save').'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} }
/* /*
* Correction du stock * Correction du stock
* *
*
*/ */
if ($_GET["action"] == "definir") if ($_GET["action"] == "definir")
{ {
print_titre ("Créer un stock"); print_titre ("Créer un stock");
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n"; print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="create_stock">'; print '<input type="hidden" name="action" value="create_stock">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4"><tr>'; print '<table class="border" width="100%" cellspacing="0" cellpadding="3"><tr>';
print '<td width="20%">Entrepôt</td><td width="40%"><select name="id_entrepot">'; print '<td width="20%">Entrepôt</td><td width="40%"><select name="id_entrepot">';
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
@ -226,8 +259,8 @@ if ($_GET["id"])
} }
} }
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="Enregistrer">&nbsp;'; print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans('Save').'">&nbsp;';
print '<input type="submit" name="cancel" value="Annuler"></td></tr>'; print '<input type="submit" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} }