From 6e676f4aee6f3ac6e2a9584475c9535c50dbf4ee Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 22 Nov 2004 08:06:13 +0000 Subject: [PATCH] Modif ordre de tri des fournisseurs dans la requete SQL --- htdocs/product/fournisseurs.php | 306 ++++++++++++++++---------------- 1 file changed, 152 insertions(+), 154 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index df796c5a943..ef34dd01718 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -69,170 +69,168 @@ if ($_POST["cancel"] == $langs->trans("Cancel")) llxHeader("","",$langs->trans("CardProduct".$product->type)); - - - /* - * Fiche produit - */ - if ($_GET["id"]) +/* + * Fiche produit + */ +if ($_GET["id"]) +{ + + if ($_GET["action"] <> 're-edit') { - - if ($_GET["action"] <> 're-edit') + $product = new Product($db); + $result = $product->fetch($_GET["id"]); + } + + if ( $result ) + { + + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') { - $product = new Product($db); - $result = $product->fetch($_GET["id"]); - } - - if ( $result ) - { - - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + /* + * En mode visu + */ + + // Zone recherche + print '
'; + print '
'; + print ''; + print $langs->trans("Ref").':    '; + print $langs->trans("Label").':  '; + print '
'; + + $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) { - /* - * En mode visu - */ - - // Zone recherche - print '
'; - print '
'; - print ''; - print $langs->trans("Ref").':    '; - print $langs->trans("Label").':  '; - print '
'; - - $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) + if ($conf->stock->enabled) { - if ($conf->stock->enabled) - { - $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/fournisseurs.php?id=".$product->id; - $head[$h][1] = 'Fournisseurs'; - $hselected = $h; - + $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/fournisseurs.php?id=".$product->id; + $head[$h][1] = 'Fournisseurs'; + $hselected = $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); - - - print($mesg); - print ''; - print ""; - print ''; - print ''; - print ''; - print ''; - if ($product->type == 0) - { - $nblignefour=4; - } - else - { - $nblignefour=4; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - - $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur as pf"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; - $sql .=" ON pf.fk_soc = pfp.fk_soc AND pf.fk_product = pfp.fk_product"; - $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id; - $sql .= " ORDER BY lower(s.nom)"; - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - $i = 0; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object(); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - - print '"; - print ''; - - if ($_GET["action"] == 'add_price' - && $user->rights->produit->creer - && $_GET["qty"] == $objp->quantity - && $_GET["id_fourn"] == $objp->idp) - { - $langs->load("suppliers"); - - - print ''; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - print ''; - } - $i++; - } - - $db->free(); - } - - print ''; - print "
'.$langs->trans("Ref").''.$product->ref.''; - if ($product->envente) - { - print $langs->trans("OnSell"); - } - else - { - print $langs->trans("NotOnSell"); - } - print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").''.price($product->price).'
'; - print $langs->trans("Suppliers").''.$langs->trans("Ref").''.$langs->trans("Qty").'Prix d\'achat
'.$objp->nom.''.$objp->ref_fourn.''; - print $objp->quantity; - print ''; - print price($objp->price); - print ''; - print img_edit(). "
Modifier le prix
  '; - print '

\n"; - print "\n"; + } + + $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); + + + print($mesg); + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + if ($product->type == 0) + { + $nblignefour=4; + } + else + { + $nblignefour=4; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + + $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur as pf"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; + $sql .=" ON pf.fk_soc = pfp.fk_soc AND pf.fk_product = pfp.fk_product"; + $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id; + $sql .= " ORDER BY lower(s.nom), pfp.quantity"; + + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object(); + $var=!$var; + print ""; + print ''; + print ''; + print ''; + + print '"; + print ''; + + if ($_GET["action"] == 'add_price' + && $user->rights->produit->creer + && $_GET["qty"] == $objp->quantity + && $_GET["id_fourn"] == $objp->idp) + { + $langs->load("suppliers"); + + + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + } + $i++; + } + + $db->free(); + } + + print ''; + print "
'.$langs->trans("Ref").''.$product->ref.''; + if ($product->envente) + { + print $langs->trans("OnSell"); + } + else + { + print $langs->trans("NotOnSell"); + } + print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").''.price($product->price).'
'; + print $langs->trans("Suppliers").''.$langs->trans("Ref").''.$langs->trans("Qty").'Prix d\'achat
'.$objp->nom.''.$objp->ref_fourn.''; + print $objp->quantity; + print ''; + print price($objp->price); + print ''; + print img_edit(). "
Modifier le prix
  '; + print '

\n"; + print "\n"; } } - else - { - print $langs->trans("ErrorUnknown"); - } +} +else +{ + print $langs->trans("ErrorUnknown"); +} /* ************************************************************************** */