diff --git a/htdocs/product/categorie/index.php b/htdocs/product/categorie/index.php index dd0fc809e42..2a2e42378f1 100644 --- a/htdocs/product/categorie/index.php +++ b/htdocs/product/categorie/index.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ require("./pre.inc.php"); @@ -28,135 +27,135 @@ llxHeader(); if ($id) { - $title = title_url($id, $db); + $title = title_url($id, $db); - print_barre_liste($title, $page, "index.php"); + print_barre_liste($title, $page, "index.php"); - $sql = "SELECT products_id FROM ".OSC_DB_NAME.".products_to_categories WHERE categories_id = $id"; - - if ( $db->query($sql) ) + $sql = "SELECT products_id FROM ".OSC_DB_NAME.".products_to_categories WHERE categories_id = $id"; + + if ( $db->query($sql) ) { - $numprod = $db->num_rows(); - $i = 0; - $wc = "("; - while ($i < $numprod) - { - $objp = $db->fetch_object( $i); - $wc .= $objp->products_id; - if ($i < $numprod -1) - { - $wc .= ","; - } - $i++; - } - $wc .=")"; - $db->free(); + $numprod = $db->num_rows(); + $i = 0; + $wc = "("; + while ($i < $numprod) + { + $objp = $db->fetch_object( $i); + $wc .= $objp->products_id; + if ($i < $numprod -1) + { + $wc .= ","; + } + $i++; + } + $wc .=")"; + $db->free(); } - else + else { - print $db->error(); + dolibarr_print_error($db); } - // print $wc ; + // print $wc ; - if ($numprod) + if ($numprod) { - $sql = "SELECT l.rowid, l.title, l.oscid, l.ref, l.status FROM ".MAIN_DB_PREFIX."livre as l"; - $sql .= " WHERE l.oscid in $wc"; + $sql = "SELECT l.rowid, l.title, l.oscid, l.ref, l.status FROM ".MAIN_DB_PREFIX."livre as l"; + $sql .= " WHERE l.oscid in $wc"; - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - $i = 0; - print ""; - print ""; - print_liste_field_titre("Titre","index.php", "l.title"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print ''; - print ''; - - if ($objp->status == 1) - { - print ''; - print ''; - } - else - { - print ''; - print ''; - } - - print ''; - print "\n"; - $i++; - } - print "
".$langs->trans("Ref")." 
'.$objp->ref.''.$objp->title.''; - print ''; - print ''; - print ''; - print ''; - print 'Fiche en ligne
"; - $db->free(); - } - else - { - print $db->error(); - } + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print ""; + print ""; + print_liste_field_titre("Titre","index.php", "l.title"); + print ''; + print "\n"; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print ''; + print ''; + + if ($objp->status == 1) + { + print ''; + print ''; + } + else + { + print ''; + print ''; + } + + print ''; + print "\n"; + $i++; + } + print "
".$langs->trans("Ref")." 
'.$objp->ref.''.$objp->title.''; + print ''; + print ''; + print ''; + print ''; + print 'Fiche en ligne
"; + $db->free(); + } + else + { + dolibarr_print_error($db); + } } - else + else { - print "Aucun produits dans cette catégorie"; + print "Aucun produits dans cette catégorie"; } } else { - print_barre_liste("Liste des catégories", $page, "index.php"); + print_barre_liste("Liste des catégories", $page, "index.php"); - $sql = "SELECT c.categories_id, cd.categories_name "; - $sql .= " FROM ".OSC_DB_NAME.".categories as c,".OSC_DB_NAME.".categories_description as cd"; - $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; - $sql .= " AND c.parent_id = 0"; - $sql .= " ORDER BY cd.categories_name ASC "; - - if ( $db->query($sql) ) + $sql = "SELECT c.categories_id, cd.categories_name "; + $sql .= " FROM ".OSC_DB_NAME.".categories as c,".OSC_DB_NAME.".categories_description as cd"; + $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID; + $sql .= " AND c.parent_id = 0"; + $sql .= " ORDER BY cd.categories_name ASC "; + + if ( $db->query($sql) ) { - $num = $db->num_rows(); - $i = 0; - print ""; - print ""; - print_liste_field_titre("Titre","index.php", "a.title"); - print ""; - print "\n"; + $num = $db->num_rows(); + $i = 0; + print "
 
"; + print ""; + print_liste_field_titre("Titre","index.php", "a.title"); + print ""; + print "\n"; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object( $i); - $var=!$var; - - printc($objp->categories_id,$db, 0); - - $i++; - } - print "
 
"; - $db->free(); + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + + printc($objp->categories_id,$db, 0); + + $i++; + } + print ""; + $db->free(); } - else + else { - print $db->error(); + dolibarr_print_error($db); } } $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); /* @@ -166,45 +165,45 @@ llxFooter("Dernière modification $Date$ révision $Revision$fetch($id); + $cat = new Categorie($db); + $cat->fetch($id); - print ""; + print ""; - for ($i = 0 ; $i < $level ; $i++) + for ($i = 0 ; $i < $level ; $i++) { - print "  |--"; + print "  |--"; } - print ''.$cat->name."\n"; - print "\n"; + print ''.$cat->name."\n"; + print "\n"; - $childs = array(); - $childs = $cat->liste_childs_array(); - if (sizeof($childs)) - { - foreach($childs as $key => $value) - { - printc($key,$db, $level+1); - } - } + $childs = array(); + $childs = $cat->liste_childs_array(); + if (sizeof($childs)) + { + foreach($childs as $key => $value) + { + printc($key,$db, $level+1); + } + } } function title_url($id, $db) { - $cat = new Categorie($db); - $cat->fetch($id); + $cat = new Categorie($db); + $cat->fetch($id); - $title = $title . ''. $cat->name .""; + $title = $title . ''. $cat->name .""; - if (sizeof($cat->parent_id)) - { - $title = title_url($cat->parent_id, $db) . " / ".$title; - } + if (sizeof($cat->parent_id)) + { + $title = title_url($cat->parent_id, $db) . " / ".$title; + } - return $title; + return $title; } ?> diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 1221d657690..4c7805db7a2 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -41,11 +41,11 @@ if (!$user->rights->produit->lire) llxHeader("","",$langs->trans("ProductsAndServices")); -print_titre($langs->trans("ProductsAndServicesArea")); +print_fiche_titre($langs->trans("ProductsAndServicesArea")); -print ''; +print '
'; -print '
'; +print '
'; /* * Zone recherche produit/service @@ -65,6 +65,8 @@ print "

"; * Nombre de produits et/ou services */ $prodser = array(); +$prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0; + $sql = "SELECT count(*), fk_product_type, envente FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type, envente"; if ($db->query($sql)) { @@ -101,7 +103,7 @@ if ($conf->service->enabled) } print ''; -print ''; +print ''; /*