New: Enhancement in category module
This commit is contained in:
parent
2337235f7e
commit
5a58b6b6ea
@ -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)
|
||||
|
||||
@ -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"])?'<div class="ok">'.$_GET["mesg"].'</div>':'';
|
||||
|
||||
$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 '<br><br>';
|
||||
|
||||
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 '<br>';
|
||||
print_fiche_titre($title,'','');
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php?'.$nameId.'='.$object->id.'">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("ClassifyInCategory").' ';
|
||||
@ -295,7 +339,9 @@ function formCategory($db,$object,$type,$typeid)
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&origin='.$object->id.'&type='.$typeid.'">'.$langs->trans("NewCat").'</a>';
|
||||
print "<a href='".DOL_URL_ROOT."/categories/fiche.php?action=create&origin=".$object->id."&type=".$typeid."&urlfrom=".urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid)."'>";
|
||||
print img_picto($langs->trans("Create"),'filenew');
|
||||
print "</a>";
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
@ -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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$title.':</td></tr>';
|
||||
|
||||
@ -333,12 +381,13 @@ function formCategory($db,$object,$type,$typeid)
|
||||
// Lien supprimer
|
||||
print '<td align="right">';
|
||||
$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 "<a href= '".DOL_URL_ROOT."/categories/categorie.php?".$nameId."=".$object->id."&typeid=".$typeid."&removecat=".$cat->id."'>";
|
||||
print "<a href= '".DOL_URL_ROOT."/categories/categorie.php?".(empty($_REQUEST["socid"])?'id':'socid')."=".$object->id.(empty($_REQUEST["socid"])?"&typeid=".$typeid:'')."&removecat=".$cat->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
@ -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 "<br/>";
|
||||
}
|
||||
|
||||
@ -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 '<form action="'.$_SERVER['PHP_SELF'].'?type='.$_GET['type'].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="urlfrom" value="'.$urlfrom.'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="addcat" value="addcat">';
|
||||
//print '<input type="hidden" name="id" value="'.$_GET['id'].'">'; Mis dans origin
|
||||
//print '<input type="hidden" name="socid" value="'.$_GET['socid'].'">'; Mis dans origin
|
||||
print '<input type="hidden" name="id" value="'.$_REQUEST['origin'].'">';
|
||||
print '<input type="hidden" name="type" value="'.$_GET['type'].'">';
|
||||
if ($_REQUEST['origin'])
|
||||
{
|
||||
@ -195,7 +216,7 @@ if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<input type="hidden" name="catorigin" value="'.$_REQUEST['catorigin'].'">';
|
||||
}
|
||||
print '<input type="hidden" name="nom" value="'.$nom.'">';
|
||||
print '<input type="hidden" name="nom" value="'.dol_escape_htmltag($nom).'">';
|
||||
|
||||
print_fiche_titre($langs->trans("CreateCat"));
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
@ -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<tr ".$bc[$var].">\n";
|
||||
print "\t\t<td><a href='viewcat.php?id=".$cat->id."&type=".$type."'>".$cat->label."</a></td>\n";
|
||||
print "\t\t<td>";
|
||||
$categstatic->id=$cat->id;
|
||||
$categstatic->ref=$cat->label;
|
||||
$categstatic->label=$cat->label;
|
||||
$categstatic->type=$cat->type;
|
||||
print $categstatic->getNomUrl(1,'');
|
||||
print "</td>\n";
|
||||
print "\t\t<td>".$cat->description."</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
|
||||
@ -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").'</td><td>';
|
||||
print nl2br($c->description);
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
/*
|
||||
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
if ($c->socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($c->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
$catsMeres = $c->get_meres ();
|
||||
|
||||
if ($catsMeres < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
}
|
||||
else if (count($catsMeres) > 0)
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
@ -214,7 +171,15 @@ else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print "<tr class='liste_titre'><td colspan='3'>".$langs->trans("SubCats")."</td></tr>\n";
|
||||
print "<tr class='liste_titre'><td colspan='2'>".$langs->trans("SubCats").'</td><td align="right">';
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print "<a href='".DOL_URL_ROOT."/categories/fiche.php?action=create&catorigin=".$c->id."&socid=".$c->socid."&type=".$type."&urlfrom=".urlencode($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type)."'>";
|
||||
print img_picto($langs->trans("Create"),'filenew');
|
||||
print "</a>";
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
if (sizeof ($cats) > 0)
|
||||
{
|
||||
$var=true;
|
||||
@ -226,7 +191,7 @@ else
|
||||
print "\t\t<td nowrap=\"nowrap\">";
|
||||
print "<a href='viewcat.php?id=".$cat->id."&type=".$type."'>".$cat->label."</a>";
|
||||
print "</td>\n";
|
||||
print "\t\t<td>".$cat->description."</td>\n";
|
||||
print "\t\t".'<td colspan="2">'.$cat->description."</td>\n";
|
||||
|
||||
/*
|
||||
if ($cat->visible == 1)
|
||||
@ -247,24 +212,9 @@ else
|
||||
print "<tr><td>".$langs->trans("NoSubCat")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
print "<div class='tabsAction'>\n";
|
||||
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print "<a class='butAction' href='fiche.php?action=create&catorigin=".$c->id."&socid=".$c->socid."&type=".$type."'>".$langs->trans("Create")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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 "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print "<tr class='liste_titre'><td colspan='3'>".$langs->trans("Member")."</td></tr>\n";
|
||||
|
||||
if (sizeof ($prods) > 0)
|
||||
{
|
||||
$i = 0;
|
||||
$var=true;
|
||||
foreach ($prods as $prod)
|
||||
{
|
||||
$i++;
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td nowrap="nowrap" valign="top">';
|
||||
print img_object($langs->trans("ShowMember"),"member");
|
||||
print " <a href='".DOL_URL_ROOT."/adherent/fiche.php?id=".$prod->id."'>".$prod->ref."</a></td>\n";
|
||||
print '<td valign="top">'.$prod->libelle."</td>\n";
|
||||
print '<td valign="top">'.$prod->description."</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr><td>".$langs->trans("ThisCategoryHasNoMember")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -120,7 +120,7 @@ if ($_GET["id"])
|
||||
print "</table><br>\n";
|
||||
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($_REQUEST['id'],"product");
|
||||
$cats = $c->containing($_REQUEST['id'],0);
|
||||
|
||||
if (sizeof($cats) > 0)
|
||||
{
|
||||
|
||||
@ -87,10 +87,10 @@ if ($_GET["id"])
|
||||
print '<tr id="ways">';
|
||||
print '<td colspan="3">';
|
||||
$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 <EFBFBD> aucune cat<61>gorie";
|
||||
print "Ce produit n'appartient a aucune categorie";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
28
htdocs/install/mysql/tables/llx_categorie_member.key.sql
Normal file
28
htdocs/install/mysql/tables/llx_categorie_member.key.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
|
||||
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
-- Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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);
|
||||
26
htdocs/install/mysql/tables/llx_categorie_member.sql
Normal file
26
htdocs/install/mysql/tables/llx_categorie_member.sql
Normal file
@ -0,0 +1,26 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
|
||||
-- Copyright (C) 2005-2010 Matthieu Valleton <mv@seeschloss.org>
|
||||
--
|
||||
-- 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;
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -449,7 +449,7 @@ a.help:hover { font-size:<?php print $fontsizesmaller ?>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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user