2
0
forked from Wavyzz/dolibarr

Fix: Si liste vide, on affiche "Aucune categorie defini". De plus on affiche toujours une ligne vide pour permettre creation categ sans mere.

This commit is contained in:
Laurent Destailleur
2007-08-26 18:52:03 +00:00
parent 3f452fdcf5
commit 6a569236df
7 changed files with 54 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ class Categorie
var $label;
var $description;
var $statut;
var $type;
var $type; // 0=Produit, 1=Fournisseur, 2=Tiers
var $cats=array(); // Tableau en memoire des categories
var $motherof = array(); // Tableau des correspondances id_fille -> id_mere
@@ -481,7 +481,7 @@ class Categorie
$res = $this->db->query ($sql);
if ($res)
{
$cats = array ();
$this->cats = array();
$i=0;
while ($obj = $this->db->fetch_object($res))
{

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -44,7 +44,8 @@ $c = new Categorie($db);
$html = new Form($db);
if (! $type) $title=$langs->trans("ProductsCategoriesArea");
if ($type == 1) $title=$langs->trans("ThirdPartyCategoriesArea");
if ($type == 1) $title=$langs->trans("SuppliersCategoriesArea");
if ($type == 2) $title=$langs->trans("ThirdPartyCategoriesArea");
llxHeader("","",$title);

View File

@@ -1546,9 +1546,11 @@ class Form
}
/**
* \brief Retourne la ou les listes d<>roulante des cat<61>gories en fonction
* du nombre choisi
* \param selected nombre de cat<EFBFBD>gorie <20> cr<63>er
* \brief Retourne la liste des cat<61>gories en fonction
* du nombre choisi.
* \param type Type de categories
* \param selected Id categorie preselectionnee
* \param select_name Nom formulaire HTML
*/
function select_all_categories($type,$selected='',$select_name="")
{
@@ -1557,28 +1559,30 @@ class Form
if ($select_name=="") $select_name="catMere";
$cat = new Categorie ($this -> db);
$cat = new Categorie($this->db);
$cate_arbo = $cat->get_full_arbo($type);
$output = '<select class="flat" name="'.$select_name.'">';
$output.= '<option value="-1" id="choix">'.$langs->trans("NoCategoriesDefined").'</option>';
if ($cate_arbo)
if (is_array($cate_arbo))
{
foreach($cate_arbo as $key => $value)
if (! sizeof($cate_arbo)) $output.= '<option value="-1" disabled="true">'.$langs->trans("NoCategoriesDefined").'</option>';
else
{
if ($cate_arbo[$key]['id'] == $selected)
$output.= '<option value="-1">&nbsp;</option>';
foreach($cate_arbo as $key => $value)
{
$add = "selected='true' ";
if ($cate_arbo[$key]['id'] == $selected)
{
$add = 'selected="true" ';
}
else
{
$add = '';
}
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.$cate_arbo[$key]['fulllabel'].'</option>';
}
else
{
$add = "";
}
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.$cate_arbo[$key]['fulllabel'].'</option>';
}
}
$output.= '</select>';
$output.= "\n";
return $output;

View File

@@ -231,6 +231,17 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/contact/fiche.php?leftmenu=contacts&amp;action=create", $langs->trans("NewContact"), 1, $user->rights->societe->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->lire);
if ($conf->categorie->enabled)
{
$langs->load("categories");
$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=2", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
if ($user->societe_id == 0)
{
$newmenu->add_submenu(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=2", $langs->trans("NewCat"), 1, $user->rights->categorie->creer);
}
//if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
}
}
/*
@@ -596,7 +607,7 @@ class MenuLeft {
$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
if ($user->societe_id == 0)
{
if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=0", $langs->trans("NewCat"), 1, $user->rights->categorie->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=0", $langs->trans("NewCat"), 1, $user->rights->categorie->creer);
}
//if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
}
@@ -646,6 +657,17 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/fourn/commande/liste.php?leftmenu=suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
}
if ($conf->categorie->enabled)
{
$langs->load("categories");
$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
if ($user->societe_id == 0)
{
$newmenu->add_submenu(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCat"), 1, $user->rights->categorie->creer);
}
//if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
}
}

View File

@@ -10,6 +10,8 @@ Classify=Classify
CategoriesArea=Categories area
ProductsCategoriesArea=Products/Services' categories area
SuppliersCategoriesArea=Suppliers' categories area
CustomersCategoriesArea=Customers' categories area
ThirdPartyCategoriesArea=Third parties' categories area
MainCats=Main categories
SubCats=Subcategories
CatStatistics=Statistics

View File

@@ -8,8 +8,10 @@ AddIn=Ajouter dans
modify=modifier
Classify=Classer
CategoriesArea=Espace cat<61>gories
ProductsCategoriesArea=Espace cat<61>gories de produits et services
SuppliersCategoriesArea=Espace cat<61>gories de fournisseurs
ProductsCategoriesArea=Espace des cat<EFBFBD>gories de produits et services
SuppliersCategoriesArea=Espace des cat<EFBFBD>gories fournisseurs
CustomersCategoriesArea=Espace des cat<61>gories clients
ThirdPartyCategoriesArea=Espace des cat<61>gories de tiers
MainCats=Cat<61>gories principales
SubCats=Sous-cat<61>gories
CatStatistics=Statistiques