diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 038c2f9cd3e..faf5ec35394 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -47,7 +47,7 @@ class Categorie var $description; var $socid; var $statut; - var $type; // 0=Produit, 1=Tiers fournisseur, 2=Tiers client/prospect + var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member var $cats=array(); // Tableau en memoire des categories var $motherof = array(); // Tableau des correspondances id_fille -> id_mere @@ -904,18 +904,23 @@ class Categorie /** * Return list of categories linked to element of type $type with id $typeid * @param id Id of element - * @param type Type of link ('customer','fournisseur','societe'...) - * @param typeid Type id of link (0,1,2...) + * @param typeid Type id of link (0,1,2,3...) * @return array List of category objects */ - function containing ($id,$type,$typeid) + function containing($id,$typeid) { $cats = array (); + $table=''; $type=''; + if ($typeid == 0) { $table='product'; $type='product'; } + if ($typeid == 1) { $table='societe'; $type='fournisseur'; } + if ($typeid == 2) { $table='societe'; $type='societe'; } + if ($typeid == 3) { $table='member'; $type='member'; } + $sql = "SELECT ct.fk_categorie"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON ct.fk_categorie = c.rowid"; - $sql.= " WHERE ct.fk_".($type=='fournisseur'?'societe':$type)." = ".$id." AND c.type = ".$typeid; + $sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid; $res = $this->db->query ($sql); if ($res) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 4d3b980979b..a7beeb47f7f 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -23,7 +23,7 @@ /** * \file htdocs/categories/categorie.php * \ingroup category - * \brief Page de l'onglet categories + * \brief Page to show category tab * \version $Id$ */ @@ -35,27 +35,51 @@ $langs->load("categories"); $mesg=isset($_GET["mesg"])?'
'.$_GET["mesg"].'
':''; $dbtablename = ''; -if ($_REQUEST["socid"]) -{ - if ($_REQUEST["typeid"] == 1) { $type = 'fournisseur'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; } - if ($_REQUEST["typeid"] == 2) { $type = 'societe'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; } - $objecttype = 'societe&categorie'; - $objectid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; - $fieldid = 'rowid'; + + +// For categories on third parties +if (! empty($_REQUEST["socid"])) { + $_REQUEST["id"]=$_REQUEST["socid"]; } -else if ($_REQUEST["id"] || $_REQUEST["ref"]) +if (! isset($_REQUEST["typeid"])) $_REQUEST["typeid"]=0; +if ($_REQUEST["typeid"] == 1) $_GET["socid"]=$_REQUEST["id"]; +if ($_REQUEST["typeid"] == 2) $_GET["socid"]=$_REQUEST["id"]; + +if ($_REQUEST["id"] || $_REQUEST["ref"]) { - $type = 'produit'; - $objecttype = 'produit|service&categorie'; - $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["ref"])?$_REQUEST["ref"]:''); - $dbtablename = 'product'; - $fieldid = isset($_REQUEST["ref"])?'ref':'rowid'; + if ($_REQUEST["typeid"] == 0) { + $type = 'member'; + $objecttype = 'adherent&categorie'; + $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["ref"])?$_REQUEST["ref"]:''); + $dbtablename = 'adherent'; + $fieldid = isset($_REQUEST["ref"])?'ref':'rowid'; + } + if ($_REQUEST["typeid"] == 1) { + $type = 'fournisseur'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; + $objecttype = 'societe&categorie'; + $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["socid"])?$_REQUEST["socid"]:''); + $fieldid = 'rowid'; + } + if ($_REQUEST["typeid"] == 2) { + $type = 'societe'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; + $objecttype = 'societe&categorie'; + $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["socid"])?$_REQUEST["socid"]:''); + $fieldid = 'rowid'; + } + if ($_REQUEST["typeid"] == 3) { + $type = 'member'; + $objecttype = 'produit|service&categorie'; + $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["ref"])?$_REQUEST["ref"]:''); + $dbtablename = 'product'; + $fieldid = isset($_REQUEST["ref"])?'ref':'rowid'; + } } // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid); + /* * Actions */ @@ -63,38 +87,64 @@ $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid //Suppression d'un objet d'une categorie if ($_REQUEST["removecat"]) { - if ($_REQUEST["socid"] && $user->rights->societe->creer) - { - $object = new Societe($db); - $result = $object->fetch($_REQUEST["socid"]); - } - else if (($_REQUEST["id"] || $_REQUEST["ref"]) && ($user->rights->produit->creer || $user->rights->service->creer)) + if ($_REQUEST["typeid"]==0 && ($user->rights->produit->creer || $user->rights->service->creer)) { $object = new Product($db); if ($_REQUEST["ref"]) $result = $object->fetch('',$_REQUEST["ref"]); if ($_REQUEST["id"]) $result = $object->fetch($_REQUEST["id"]); $type = 'product'; } - $cat = new Categorie($db,$_REQUEST["removecat"]); + if ($_REQUEST["typeid"]==1 && $user->rights->societe->creer) + { + $object = new Societe($db); + $result = $object->fetch($objectid); + } + if ($_REQUEST["typeid"]==2 && $user->rights->societe->creer) + { + $object = new Societe($db); + $result = $object->fetch($objectid); + } + if ($_REQUEST["typeid"] == 3 && $user->rights->adherent->creer) + { + $object = new Adherent($db); + $result = $object->fetch($objectid); + } + $cat = new Categorie($db); + $result=$cat->fetch($_REQUEST["removecat"]); + $result=$cat->del_type($object,$type); } -//Ajoute d'un objet dans une categorie +// Add object into a category if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0) { - if ($_REQUEST["socid"] && $user->rights->societe->creer) - { - $object = new Societe($db); - $result = $object->fetch($_REQUEST["socid"]); - } - else if (($_REQUEST["id"] || $_REQUEST["ref"]) && ($user->rights->produit->creer || $user->rights->service->creer)) + $_GET["id"]=$_REQUEST["id"]; + + if ($_REQUEST["typeid"]==0 && ($user->rights->produit->creer || $user->rights->service->creer)) { $object = new Product($db); if ($_REQUEST["ref"]) $result = $object->fetch('',$_REQUEST["ref"]); if ($_REQUEST["id"]) $result = $object->fetch($_REQUEST["id"]); $type = 'product'; } - + if ($_REQUEST["typeid"]==1 && $user->rights->societe->creer) + { + $object = new Societe($db); + $result = $object->fetch($objectid); + $type = 'fournisseur'; + } + if ($_REQUEST["typeid"]==2 && $user->rights->societe->creer) + { + $object = new Societe($db); + $result = $object->fetch($objectid); + $type = 'societe'; + } + if ($_REQUEST["typeid"]==3 && $user->rights->adherent->creer) + { + $object = new Adherent($db); + $result = $object->fetch($objectid); + $type = 'member'; + } $cat = new Categorie($db); $result=$cat->fetch($_REQUEST["catMere"]); @@ -208,11 +258,11 @@ if ($_GET["socid"]) if ($mesg) print($mesg); - if ($soc->client) formCategory($db,$soc,'societe',2); + if ($soc->client) formCategory($db,$soc,2); if ($soc->client && $soc->fournisseur) print '

'; - if ($soc->fournisseur) formCategory($db,$soc,'fournisseur',1); + if ($soc->fournisseur) formCategory($db,$soc,1); } else if ($_GET["id"] || $_GET["ref"]) { @@ -259,35 +309,29 @@ else if ($_GET["id"] || $_GET["ref"]) if ($mesg) print($mesg); - formCategory($db,$product,'product',0); + formCategory($db,$product,0); } /** * Fonction Barre d'actions */ -function formCategory($db,$object,$type,$typeid) +function formCategory($db,$object,$typeid) { global $user,$langs,$html,$bc; if ($typeid == 0) $title = $langs->trans("ProductsCategoriesShort"); if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort"); if ($typeid == 2) $title = $langs->trans("CustomersProspectsCategoriesShort"); - if ($type == 'societe' || $type == 'fournisseur') - { - $nameId = 'socid'; - } - else if ($type == 'product') - { - $nameId = 'id'; - } + if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); // Formulaire ajout dans une categorie print '
'; print_fiche_titre($title,'',''); - print '
'; + print ''; print ''; print ''; + print ''; print ''; print ''; } print ''; @@ -305,13 +351,15 @@ function formCategory($db,$object,$type,$typeid) $c = new Categorie($db); - $cats = $c->containing($object->id,$type,$typeid); + $cats = $c->containing($object->id,$typeid); if (sizeof($cats) > 0) { if ($typeid == 0) $title=$langs->trans("ProductIsInCategories"); if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories"); if ($typeid == 2) $title=$langs->trans("CompanyIsInCustomersCategories"); + if ($typeid == 3) $title=$langs->trans("MemberIsInCustomersCategories"); + print "\n"; print '
'; print $langs->trans("ClassifyInCategory").' '; @@ -295,7 +339,9 @@ function formCategory($db,$object,$type,$typeid) if ($user->rights->categorie->creer) { print ''; - print ''.$langs->trans("NewCat").''; + print "id.'&type='.$typeid)."'>"; + print img_picto($langs->trans("Create"),'filenew'); + print ""; print '
'; print ''; @@ -333,12 +381,13 @@ function formCategory($db,$object,$type,$typeid) // Lien supprimer print '\n"; - print "\t\t\n"; + print "\t\t\n"; print "\t\t\n"; print "\t\n"; } diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 2dd08098762..cea6591a7fa 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -111,8 +111,9 @@ if ($_GET["id"] || $_GET["ref"]) $title=$langs->trans("ProductsCategoryShort"); if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); - if ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); - if ($type == 2) $title=$langs->trans("CustomersCategoryShort"); + elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); + elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); + elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); dol_fiche_head($head, 'photos', $title, 0, 'category'); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 0fd6a979135..9dd42e9f466 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -22,7 +22,7 @@ /** * \file htdocs/categories/viewcat.php * \ingroup category - * \brief Page de visualisation de categorie produit + * \brief Page to show a category card * \version $Revision$ */ @@ -99,8 +99,10 @@ $head[$h][2] = 'photos'; $h++; if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); -if ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); -if ($type == 2) $title=$langs->trans("CustomersCategoryShort"); +elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); +elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); +elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); +else $title=$langs->trans("Category"); dol_fiche_head($head, 'card', $title, 0, 'category'); @@ -133,51 +135,6 @@ print $langs->trans("Description").''; -// Visibility -/* -if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) -{ - if ($c->socid) - { - $soc = new Societe($db); - $soc->fetch($c->socid); - - print ''; - - $catsMeres = $c->get_meres (); - - if ($catsMeres < 0) - { - dol_print_error(); - } - else if (count($catsMeres) > 0) - { - print ''; - } - } - else - { - print ''; - } -} -else -{ - print ''; -} -*/ - print '
'.$title.':
'; $permission=0; - if ($type == 'fournisseur') $permission=$user->rights->societe->creer; - if ($type == 'societe') $permission=$user->rights->societe->creer; - if ($type == 'product') $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == 1) $permission=$user->rights->societe->creer; + if ($typeid == 2) $permission=$user->rights->societe->creer; + if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($permission) { - print ""; + print ""; print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat").""; } @@ -362,6 +411,7 @@ function formCategory($db,$object,$type,$typeid) if ($typeid == 0) $title=$langs->trans("ProductHasNoCategory"); if ($typeid == 1) $title=$langs->trans("CompanyHasNoCategory"); if ($typeid == 2) $title=$langs->trans("CompanyHasNoCategory"); + if ($typeid == 3) $title=$langs->trans("MemberHasNoCategory"); print $title; print "
"; } diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 62265838efa..8eb51645b80 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -55,13 +55,14 @@ if ($_REQUEST['origin']) if ($_GET['type'] == 0) $idProdOrigin = $_REQUEST['origin']; if ($_GET['type'] == 1) $idSupplierOrigin = $_REQUEST['origin']; if ($_GET['type'] == 2) $idCompanyOrigin = $_REQUEST['origin']; + if ($_GET['type'] == 3) $idMemberOrigin = $_REQUEST['origin']; } if ($_REQUEST['catorigin']) { if ($_GET['type'] == 0) $idCatOrigin = $_REQUEST['catorigin']; } - +$urlfrom=isset($_REQUEST["urlfrom"])?$_REQUEST["urlfrom"]:''; /* @@ -73,7 +74,12 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) // Action ajout d'une categorie if ($_POST["cancel"]) { - if ($idProdOrigin) + if ($urlfrom) + { + header("Location: ".$urlfrom); + exit; + } + else if ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&type='.$_GET["type"]); exit; @@ -88,6 +94,11 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&type='.$_GET["type"]); exit; } + else if ($idMemberOrigin) + { + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$_GET["type"]); + exit; + } else if ($idCatOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&type='.$_GET["type"]); @@ -139,22 +150,32 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) // Action confirmation de creation categorie if ($_GET["action"] == 'confirmed') { - if ($idProdOrigin) + if ($urlfrom) + { + header("Location: ".$urlfrom); + exit; + } + else if ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - if ($idCompanyOrigin) + else if ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - if ($idSupplierOrigin) + else if ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - if ($idCatOrigin) + else if ($idMemberOrigin) + { + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$_GET["type"]); + exit; + } + else if ($idCatOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; @@ -182,10 +203,10 @@ if ($user->rights->categorie->creer) { print ''; print ''; + print ''; print ''; print ''; - //print ''; Mis dans origin - //print ''; Mis dans origin + print ''; print ''; if ($_REQUEST['origin']) { @@ -195,7 +216,7 @@ if ($user->rights->categorie->creer) { print ''; } - print ''; + print ''; print_fiche_titre($langs->trans("CreateCat")); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 0a9844b5c70..a643d86220c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2006-2010 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2009 Regis Houssin * @@ -46,9 +46,10 @@ $categstatic = new Categorie($db); $html = new Form($db); if ($type == 0) $title=$langs->trans("ProductsCategoriesArea"); -if ($type == 1) $title=$langs->trans("SuppliersCategoriesArea"); -if ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); - +elseif ($type == 1) $title=$langs->trans("SuppliersCategoriesArea"); +elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); +elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea"); +else $title=$langs->trans("CategoriesArea"); llxHeader("","",$title); @@ -101,7 +102,13 @@ if($_POST['catname'] || $_REQUEST['id']) { $var = ! $var; print "\t
".$cat->label.""; + $categstatic->id=$cat->id; + $categstatic->ref=$cat->label; + $categstatic->label=$cat->label; + $categstatic->type=$cat->type; + print $categstatic->getNomUrl(1,''); + print "".$cat->description."
'; print nl2br($c->description); print '
'; - print $langs->trans("AssignedToTheCustomer").''; - print $soc->getNomUrl(1); - print '
'; - print $langs->trans("CategoryContents").''; - print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; - print $langs->trans("CategoryContents").''; - print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; - print $langs->trans("CategoryContents").''; - print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); - print '
'; print ''; @@ -214,7 +171,15 @@ else { print "
"; print "\n"; - print "\n"; + print ""; + print "\n"; if (sizeof ($cats) > 0) { $var=true; @@ -226,7 +191,7 @@ else print "\t\t\n"; - print "\t\t\n"; + print "\t\t".'\n"; /* if ($cat->visible == 1) @@ -247,24 +212,9 @@ else print ""; } print "
".$langs->trans("SubCats")."
".$langs->trans("SubCats").''; + if ($user->rights->categorie->creer) + { + print ""; + print img_picto($langs->trans("Create"),'filenew'); + print ""; + } + print "
"; print "".$cat->label.""; print "".$cat->description."'.$cat->description."
".$langs->trans("NoSubCat")."
\n"; - - /* - * Boutons actions - */ - if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) - { - print "
\n"; - - if ($user->rights->categorie->creer) - { - print "".$langs->trans("Create").""; - } - - print "
"; - } } - +// List of products if ($c->type == 0) { @@ -379,6 +329,46 @@ if($c->type == 2) } } +// List of members +if ($c->type == 3) +{ + + $prods = $c->get_type ("member","Member"); + if ($prods < 0) + { + dol_print_error($db,$c->error); + } + else + { + print "
"; + print "\n"; + print "\n"; + + if (sizeof ($prods) > 0) + { + $i = 0; + $var=true; + foreach ($prods as $prod) + { + $i++; + $var=!$var; + print "\t\n"; + print '\n"; + print '\n"; + print '\n"; + print "\n"; + } + } + else + { + print ""; + } + print "
".$langs->trans("Member")."
'; + print img_object($langs->trans("ShowMember"),"member"); + print " ".$prod->ref."'.$prod->libelle."'.$prod->description."
".$langs->trans("ThisCategoryHasNoMember")."
\n"; + } +} + $db->close(); llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/fourn/product/categorie.php b/htdocs/fourn/product/categorie.php index 381f1d7ae6a..486ac3c84a2 100644 --- a/htdocs/fourn/product/categorie.php +++ b/htdocs/fourn/product/categorie.php @@ -120,7 +120,7 @@ if ($_GET["id"]) print "
\n"; $c = new Categorie($db); - $cats = $c->containing($_REQUEST['id'],"product"); + $cats = $c->containing($_REQUEST['id'],0); if (sizeof($cats) > 0) { diff --git a/htdocs/fourn/product/fourn.php b/htdocs/fourn/product/fourn.php index 3a17c8a6deb..16cba392c30 100644 --- a/htdocs/fourn/product/fourn.php +++ b/htdocs/fourn/product/fourn.php @@ -87,10 +87,10 @@ if ($_GET["id"]) print ''; print ''; $cat = new Categorie ($db); - $way = $cat->print_primary_way($product->id," > ",'fourn/product/liste.php'); + $way = $cat->print_primary_way($product->id," > ",'fourn/product/liste.php', 1); if ($way == "") { - print "Ce produit n'appartient � aucune cat�gorie"; + print "Ce produit n'appartient a aucune categorie"; } else { diff --git a/htdocs/includes/menus/barre_left/eldy.lib.php b/htdocs/includes/menus/barre_left/eldy.lib.php index e63f34b58f4..06797f69f4e 100644 --- a/htdocs/includes/menus/barre_left/eldy.lib.php +++ b/htdocs/includes/menus/barre_left/eldy.lib.php @@ -821,6 +821,18 @@ function print_left_eldy_menu($db,$menu_array) $newmenu->add(DOL_URL_ROOT."/adherents/liste.php?leftmenu=members&statut=-1,1&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add(DOL_URL_ROOT."/adherents/cotisations.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire); + + if ($conf->categorie->enabled) + { + $langs->load("categories"); + $newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire); + if ($user->societe_id == 0) + { + $newmenu->add(DOL_URL_ROOT."/categories/fiche.php?action=create&type=3", $langs->trans("NewCat"), 1, $user->rights->categorie->creer); + } + //if ($leftmenu=="cat") $newmenu->add(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + } + if ($conf->banque->enabled) { $langs->load("bills"); @@ -846,6 +858,8 @@ function print_left_eldy_menu($db,$menu_array) $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=setup&mainmenu=members",$langs->trans("Setup"),0,$user->rights->adherent->configurer); $newmenu->add(DOL_URL_ROOT."/adherents/type.php?leftmenu=setup&",$langs->trans("MembersTypes"),1,$user->rights->adherent->configurer); $newmenu->add(DOL_URL_ROOT."/adherents/options.php?leftmenu=setup&",$langs->trans("MembersAttributes"),1,$user->rights->adherent->configurer); + + } } diff --git a/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN b/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN index be5e95a6334..fbf2263d55f 100644 --- a/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN +++ b/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN @@ -277,7 +277,7 @@ class InterfaceEcotax } $c = new Categorie($this->db); $cats = array(); - $cats = $c->containing($product_id); + $cats = $c->containing($product_id,0); $found=0; if (count($cats)==0) { return 0; diff --git a/htdocs/install/mysql/tables/llx_categorie_member.key.sql b/htdocs/install/mysql/tables/llx_categorie_member.key.sql new file mode 100644 index 00000000000..7e12e06beb7 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_member.key.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2005 Brice Davoleau +-- Copyright (C) 2005 Matthieu Valleton +-- Copyright (C) 2005-2010 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + +ALTER TABLE llx_categorie_member ADD PRIMARY KEY (fk_categorie, fk_member); +ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_member ADD INDEX idx_categorie_member_fk_member (fk_member); + +ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_member ADD CONSTRAINT fk_categorie_member_member_rowid FOREIGN KEY (fk_member) REFERENCES llx_adherent (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_member.sql b/htdocs/install/mysql/tables/llx_categorie_member.sql new file mode 100644 index 00000000000..b0d2fca86ae --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_member.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2005 Brice Davoleau +-- Copyright (C) 2005-2010 Matthieu Valleton +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + +create table llx_categorie_member +( + fk_categorie integer NOT NULL, + fk_member integer NOT NULL +)type=innodb; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 52b78fec724..d8b5e957811 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -16,6 +16,7 @@ ProductsCategoriesArea=Products/Services' categories area SuppliersCategoriesArea=Suppliers' categories area CustomersCategoriesArea=Customers' categories area ThirdPartyCategoriesArea=Third parties' categories area +MembersCategoriesArea=Members' categories area MainCats=Main categories SubCats=Subcategories CatStatistics=Statistics @@ -69,13 +70,16 @@ NoCategoriesDefined=No category defined SuppliersCategoryShort=Suppliers category CustomersCategoryShort=Customers category ProductsCategoryShort=Products category +MembersCategoryShort=Members category SuppliersCategoriesShort=Suppliers categories CustomersCategoriesShort=Customers categories CustomersProspectsCategoriesShort=Custo./Prosp. categories ProductsCategoriesShort=Products categories +MembersCategoriesShort=Members categories ThisCategoryHasNoProduct=This category does not contain any product. ThisCategoryHasNoSupplier=This category does not contain any supplier. ThisCategoryHasNoCustomer=This category does not contain any customer. +ThisCategoryHasNoMember=This category does not contain any member. AssignedToCustomer=Assigned to a customer AssignedToTheCustomer=Assigned to the customer InternalCategory=Internal category diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index c0d636f1a6e..c45bbf532d5 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -16,6 +16,7 @@ ProductsCategoriesArea=Espace des catégories de produits et services SuppliersCategoriesArea=Espace des catégories de tiers fournisseurs CustomersCategoriesArea=Espace des catégories de tiers clients ou prospects ThirdPartyCategoriesArea=Espace des catégories de tiers +MembersCategoriesArea=Espace des catégories d'adhérents MainCats=Catégories principales SubCats=Sous-catégories CatStatistics=Statistiques @@ -69,13 +70,16 @@ NoCategoriesDefined=Aucune catégorie définie SuppliersCategoryShort=Catégorie fournisseurs CustomersCategoryShort=Catégorie clients ProductsCategoryShort=Catégorie produits +MembersCategoryShort=Catégorie adhérent SuppliersCategoriesShort=Catégories fournisseurs CustomersCategoriesShort=Catégories clients CustomersProspectsCategoriesShort=Catégories clients/prospects ProductsCategoriesShort=Catégories produits +MembersCategoriesShort=Catégories adhérents ThisCategoryHasNoProduct=Cette catégorie ne contient aucun produit. ThisCategoryHasNoSupplier=Cette catégorie ne contient aucun fournisseur. ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. +ThisCategoryHasNoMember=Cette catégorie ne contient aucun adhérent. AssignedToCustomer=Attribuer à un client AssignedToTheCustomer=Attribué au client InternalCategory=Catégorie interne diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 196f563a001..50bd4eaa829 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -806,11 +806,11 @@ class Societe extends CommonObject // Fill $toute_categs array with an array of (type => array of ("Categorie" instance)) if ($this->client || $this->prospect) { - $toute_categs ['societe'] = $static_cat->containing($this->id,'societe',2); + $toute_categs ['societe'] = $static_cat->containing($this->id,2); } if ($this->fournisseur) { - $toute_categs ['fournisseur'] = $static_cat->containing($this->id,'fournisseur',1); + $toute_categs ['fournisseur'] = $static_cat->containing($this->id,1); } // Remove each "Categorie" diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php index 0762cc221dc..592edf08b6f 100644 --- a/htdocs/theme/eldy/eldy.css.php +++ b/htdocs/theme/eldy/eldy.css.php @@ -449,7 +449,7 @@ a.help:hover { font-size:px; font-family: div.blockvmenupair { - width:160px; + width:164px; border-right: 1px solid #555555; border-bottom: 1px solid #555555; font-family: helvetica, verdana, arial, sans-serif; @@ -469,7 +469,7 @@ div.blockvmenupair div.blockvmenuimpair { - width:160px; + width:164px; border-right: 1px solid #555555; border-bottom: 1px solid #555555; font-family: helvetica, verdana, arial, sans-serif; @@ -489,7 +489,7 @@ div.blockvmenuimpair div.help { - width:160px; + width:164px; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background: #f0f0f0;