Extention de la gestion des catégories

This commit is contained in:
cdelambert 2007-04-30 10:53:58 +00:00
parent b641ea0c2e
commit 1db6129e02
16 changed files with 973 additions and 131 deletions

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 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
* it under the terms of the GNU General Public License as published by
@ -24,6 +25,7 @@
*/
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php");
class Categorie
@ -34,6 +36,7 @@ class Categorie
var $label;
var $description;
var $statut;
var $type;
var $cats=array(); // Tableau en memoire des categories
var $motherof = array(); // Tableau des correspondances id_fille -> id_mere
@ -60,7 +63,7 @@ class Categorie
*/
function fetch($id)
{
$sql = "SELECT rowid, label, description, visible";
$sql = "SELECT rowid, label, description, visible, type";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie WHERE rowid = ".$id;
$resql = $this->db->query ($sql);
@ -73,6 +76,7 @@ class Categorie
$this->label = $res['label'];
$this->description = stripslashes($res['description']);
$this->visible = $res['visible'];
$this->type = $res['type'];
$this->db->free($resql);
}
@ -115,8 +119,8 @@ class Categorie
return -1;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible) ";
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."', '".$this->visible."')";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible,type) ";
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."', '".$this->visible."',".$this->type.")";
$res = $this->db->query ($sql);
@ -303,15 +307,15 @@ class Categorie
* -1 : erreur SQL
* -2 : id non renseign
*/
function add_product($prod)
function add_type($obj,$type)
{
if ($this->id == -1)
{
return -2;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_product (fk_categorie, fk_product)";
$sql .= " VALUES (".$this->id.", ".$prod->id.")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$type.")";
$sql .= " VALUES (".$this->id.", ".$obj->id.")";
if ($this->db->query($sql))
{
@ -330,11 +334,11 @@ class Categorie
* retour : 1 : OK
* -1 : erreur SQL
*/
function del_product($prod)
function del_type($obj,$type)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_product";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type;
$sql .= " WHERE fk_categorie = ".$this->id;
$sql .= " AND fk_product = ".$prod->id;
$sql .= " AND fk_".$type." = ".$obj->id;
if ($this->db->query($sql))
{
@ -350,23 +354,23 @@ class Categorie
/**
* Retourne les produits de la catégorie
*/
function get_products()
function get_type($type,$class)
{
$sql = "SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product ";
$sql = "SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type." ";
$sql .= "WHERE fk_categorie = ".$this->id;
$res = $this->db->query($sql);
if ($res)
{
$prods = array();
$obj = array();
while ($rec = $this->db->fetch_array ($res))
{
$prod = new Product ($this->db, $rec['fk_product']);
$prod->fetch ($prod->id);
$prods[] = $prod;
$obj = new $class ($this->db, $rec['fk_'.$type]);
$obj->fetch ($obj->id);
$objs[] = $obj;
}
return $prods;
return $objs;
}
else
{
@ -374,6 +378,10 @@ class Categorie
return -1;
}
}
/**
* Retourne les filles de la catégorie
*/
@ -444,7 +452,7 @@ class Categorie
* fullpath = chemin complet compose des id
* \return array Tableau de array
*/
function get_full_arbo()
function get_full_arbo($type)
{
// Charge tableau des meres
$sql = "SELECT fk_categorie_mere as id_mere, fk_categorie_fille as id_fille";
@ -468,6 +476,7 @@ class Categorie
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
$sql.= " ON c.rowid=ca.fk_categorie_mere";
$sql.= " WHERE c.type = ".$type;
$sql.= " ORDER BY c.label, c.rowid";
$res = $this->db->query ($sql);
if ($res)
@ -476,9 +485,11 @@ class Categorie
$i=0;
while ($obj = $this->db->fetch_object($res))
{
$this->cats[$obj->rowid]['id'] = $obj->rowid;
$this->cats[$obj->rowid]['id_mere'] = $this->motherof[$obj->rowid];
$this->cats[$obj->rowid]['label'] = $obj->label;
if ($obj->rowid_fille)
{
if (is_array($this->cats[$obj->rowid]['id_children']))
@ -494,6 +505,7 @@ class Categorie
}
}
$i++;
}
}
else
@ -820,12 +832,12 @@ class Categorie
/**
* Retourne les catégories contenant le produit $id
*/
function containing ($id)
function containing ($id,$type)
{
$cats = array ();
$sql = "SELECT fk_categorie FROM ".MAIN_DB_PREFIX."categorie_product ";
$sql .= "WHERE fk_product = ".$id;
$sql = "SELECT fk_categorie FROM ".MAIN_DB_PREFIX."categorie_".$type." ";
$sql .= "WHERE fk_".$type." = ".$id;
$res = $this->db->query ($sql);
@ -848,13 +860,13 @@ class Categorie
/**
* Retourne les catégories contenant le produit $ref
*/
function containing_ref ($ref)
function containing_ref ($ref,$type)
{
$cats = array ();
$sql = "SELECT c.fk_categorie, c.fk_product, p.rowid, p.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as c, ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.ref = '".$ref."' AND c.fk_product = p.rowid";
$sql = "SELECT c.fk_categorie, c.fk_".$type.", p.rowid, p.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as c, ".MAIN_DB_PREFIX.$type." as p";
$sql.= " WHERE p.ref = '".$ref."' AND c.fk_".$type." = p.rowid";
$res = $this->db->query ($sql);
@ -873,28 +885,34 @@ class Categorie
return -1;
}
}
/**
* \brief Retourne les catégories dont l'id ou le nom correspond
* ajoute des wildcards au nom sauf si $exact = true
*/
function rechercher($id, $nom, $exact = false)
function rechercher($id, $nom, $type, $exact = false)
{
$cats = array ();
// Generation requete recherche
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie ";
$sql .= "WHERE type = ".$type." ";
if ($nom)
{
if (! $exact)
{
$nom = '%'.str_replace ('*', '%', $nom).'%';
}
$sql.= "WHERE label LIKE '".$nom."'";
$sql.= "AND label LIKE '".$nom."'";
}
if ($id)
{
$sql.="WHERE rowid = '".$id."'";
$sql.="AND rowid = '".$id."'";
}
$res = $this->db->query ($sql);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@ -117,7 +118,7 @@ else
print '</td></tr>';
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $html->select_all_categories($categorie->id_mere);
print $html->select_all_categories($categorie->type,$categorie->id_mere);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ContentsVisibleByAll").'</td><td>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@ -43,7 +44,10 @@ else
if ($_REQUEST['origin'])
{
$idprodorigin = $_REQUEST['origin'];
if($_GET['type'] == 0)$idprodorigin = $_REQUEST['origin'];
if($_GET['type'] == 1)$idSupplierorigin = $_REQUEST['origin'];
if($_GET['type'] == 2)$idCompanyorigin = $_REQUEST['origin'];
}
@ -60,6 +64,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
$categorie->label = $_POST["nom"];
$categorie->description = $_POST["description"];
$categorie->visible = $_POST["visible"];
$categorie->type = $_POST["type"];
if($_POST['catMere'] != "-1")
$categorie->id_mere = $_POST['catMere'];
@ -97,11 +102,18 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
print '<div class="ok">'.$langs->trans("CategorySuccessfullyCreated",$categorie->label).'</div>';
if ($_REQUEST['idprodorigin'])
if ($idprodorigin)
{
$idprodorigin = $_REQUEST['idprodorigin'];
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/categorie.php?id='.$idprodorigin.'">'.$langs->trans("ReturnInProduct").'</a>';
}
if ($idSupplierorigin)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/categorie.php?socid='.$idSupplierorigin.'">'.$langs->trans("ReturnInSupplier").'</a>';
}
if ($idCompanyorigin)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/categorie.php?socid='.$idCompanyorigin.'">'.$langs->trans("ReturnInCompany").'</a>';
}
print '</td></tr></table>';
}
@ -121,14 +133,16 @@ if ($user->rights->categorie->creer)
print $categorie->error;
print '</div>';
}
print '<form action="fiche.php" method="post">';
print '<form action="fiche.php?type='.$_GET['type'].'" method="post">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="addcat" value="addcat">';
if ($idprodorigin)
print '<input type="hidden" name="type" value='.$_GET['type'].'>';
if ($_REQUEST['origin'])
{
print '<input type="hidden" name="idprodorigin" value='.$idprodorigin.'>';
print '<input type="hidden" name="origin" value='.$_REQUEST['origin'].'>';
}
print '<input type="hidden" name="nom" value="'.$nom.'">';
print '<input type="hidden" name="description" value="'.$description.'">';
print_fiche_titre($langs->trans("CreateCat"));
print '<table class="border" width="100%" class="notopnoleftnoright">';
@ -152,7 +166,7 @@ if ($user->rights->categorie->creer)
print '</td></tr>';
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
print $html->select_all_categories();
print $html->select_all_categories($_GET['type']);
print '</td></tr>';
print '<tr><td>'.$langs->trans ("ContentsVisibleByAll").'</td><td>';
print $html->selectyesnonum("visible", 1);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 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
* it under the terms of the GNU General Public License as published by
@ -32,6 +33,7 @@ require "./pre.inc.php";
if (!$user->rights->categorie->lire) accessforbidden();
/**
* Affichage page accueil
*/
@ -50,7 +52,8 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Zone recherche produit/service
*/
print '<form method="post" action="index.php">';
print '<form method="post" action="index.php?type='.$_GET['type'].'">';
print '<input type="hidden" name="type" value="'.$_GET['type'].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>';
@ -77,7 +80,7 @@ print '</td><td valign="top" width="70%">';
*/
if($_POST['catname'] || $_REQUEST['id'])
{
$cats = $c->rechercher($_REQUEST['id'],$_POST['catname']);
$cats = $c->rechercher($_REQUEST['id'],$_POST['catname'],$_POST['type']);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
@ -101,7 +104,7 @@ print '<br>';
// Charge tableau des categories
$cate_arbo = $c->get_full_arbo();
$cate_arbo = $c->get_full_arbo($_GET['type']);
/*
@ -157,7 +160,6 @@ if ($conf->use_javascript)
$i++;
$nodeparent=ereg_replace('_[0-9]+$','',$cate_arbo[$key]['fullpath']);
if (! $nodeparent) $nodeparent=$rootnode;
// Definition du nouvel element a ajouter dans l'arbre
$newelement=array(
'text' => $cate_arbo[$key]['label'],
@ -179,8 +181,8 @@ if ($conf->use_javascript)
$newelement['expanded']=false;
}
}
//print 'x'.$cate_arbo[$key]['fullpath'].' ' expand='.$newelement['expanded'].'<br>';
//echo $nodeparent."|";
//print 'x'.$cate_arbo[$key]['fullpath'].' expand='.$newelement['expanded'].'<br>';
$node[$cate_arbo[$key]['fullpath']]=&$node[$nodeparent]->addItem(new HTML_TreeNode($newelement));
//print 'Resultat: noeud '.$cate_arbo[$key]['fullpath']." créé<br>\n";
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* 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
* it under the terms of the GNU General Public License as published by
@ -183,42 +184,119 @@ else
}
$prods = $c->get_products ();
if ($prods < 0)
if($c->type == 0)
{
dolibarr_print_error();
}
else
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td colspan='3'>".$langs->trans("ProductsAndServices")."</td></tr>\n";
if (sizeof ($prods) > 0)
$prods = $c->get_type ("product","Product");
if ($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">';
if ($prod->type == 1) print img_object($langs->trans("ShowService"),"service");
else print img_object($langs->trans("ShowProduct"),"product");
print " <a href='".DOL_URL_ROOT."/product/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";
}
dolibarr_print_error();
}
else
{
print "<tr><td>".$langs->trans ("NoProd")."</td></tr>";
print "<br>";
print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td colspan='3'>".$langs->trans("ProductsAndServices")."</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">';
if ($prod->type == 1) print img_object($langs->trans("ShowService"),"service");
else print img_object($langs->trans("ShowProduct"),"product");
print " <a href='".DOL_URL_ROOT."/product/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 ("NoProd")."</td></tr>";
}
print "</table>\n";
}
print "</table>\n";
}
if($c->type == 1)
{
$socs = $c->get_type ("societe","Fournisseur");
if ($socs < 0)
{
dolibarr_print_error();
}
else
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n";
if (sizeof ($socs) > 0)
{
$i = 0;
$var=true;
foreach ($socs as $soc)
{
$i++;
$var=!$var;
print "\t<tr ".$bc[$var].">\n";
print '<td nowrap="nowrap" valign="top">';
print img_object($langs->trans("ShowSuppliers"),"company");
print " <a href='".DOL_URL_ROOT."/fourn/fiche.php?socid=".$soc->id."'>".$soc->nom."</a></td>\n";
print "</tr>\n";
}
}
else
{
print "<tr><td>".$langs->trans ("NoProd")."</td></tr>";
}
print "</table>\n";
}
}
if($c->type == 2)
{
$socs = $c->get_type ("societe","Societe");
if ($socs < 0)
{
dolibarr_print_error();
}
else
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print "<tr class='liste_titre'><td>".$langs->trans("Commercial")."</td></tr>\n";
if (sizeof ($socs) > 0)
{
$i = 0;
$var=true;
foreach ($socs as $soc)
{
$i++;
$var=!$var;
print "\t<tr ".$bc[$var].">\n";
print '<td nowrap="nowrap" valign="top">';
print img_object($langs->trans("ShowCompany"),"company");
print " <a href='".DOL_URL_ROOT."/fourn/fiche.php?socid=".$soc->id."'>".$soc->nom."</a></td>\n";
print "</tr>\n";
}
}
else
{
print "<tr><td>".$langs->trans ("NoProd")."</td></tr>";
}
print "</table>\n";
}
}
$db->close();

372
htdocs/comm/categorie.php Normal file
View File

@ -0,0 +1,372 @@
<?php
/* 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) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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$
* $Source$
*/
/**
\file htdocs/product/categorie.php
\ingroup product
\brief Page de l'onglet categories de produits
\version $Revision$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
$langs->load("categories");
$langs->load("companies");
if (!$user->rights->societe->lire) accessforbidden();
$mesg = '';
/*
* Actions
*/
//on veut supprimer une catégorie
if ($_REQUEST["removecat"] && $user->rights->societe->creer)
{
$soc = new Societe($db);
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
$cat = new Categorie($db,$_REQUEST["removecat"]);
$result=$cat->del_type($soc,"societe");
}
//on veut ajouter une catégorie
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->societe->creer)
{
$soc = new Societe($db);
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
$cat = new Categorie($db,$_REQUEST["catMere"]);
$result=$cat->add_type($soc,"societe");
if ($result >= 0)
{
$mesg='<div class="ok">'.$langs->trans("Added").'</div>';
}
else
{
$mesg='<div class="error">'.$langs->trans("Error").' '.$cat->error.'</div>';
}
}
/*
* Creation de l'objet fournisseur correspondant à l'id
*/
if ($_GET["socid"] || $_GET["ref"])
{
$soc = new Societe($db);
if ($_GET["socid"]) $result = $soc->fetch($_GET["socid"]);
llxHeader("","",$langs->trans("CardCompany".$soc->type));
}
$html = new Form($db);
/*
* Fiche produit
*/
if ($_GET["socid"] || $_GET["ref"])
{
/*
* Affichage onglets
*/
$head = societe_prepare_head($soc);
dolibarr_fiche_head($head, 'category', $soc->nom);
print '<table width="100%" border="0">';
print '<tr><td valign="top">';
print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("Name").'</td><td width="70%" colspan="3">';
print $soc->nom;
print '</td></tr>';
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
if ($soc->client)
{
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $soc->code_client;
if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
print '</td></tr>';
}
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>";
print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$soc->cp."</td>";
print '<td>'.$langs->trans('Town').'</td><td>'.$soc->ville."</td></tr>";
if ($soc->pays) {
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td></tr>';
}
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel,$soc->pays_code).'</td>';
print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax,$soc->pays_code).'</td></tr>';
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$soc->url\" target=\"_blank\">".$soc->url."</a>&nbsp;</td></tr>";
// Assujeti à TVA ou pas
print '<tr>';
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
print yn($soc->tva_assuj);
print '</td>';
print '</tr>';
// Conditions de réglement par défaut
$langs->load('bills');
$html = new Form($db);
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans('PaymentConditions');
print '<td>';
if (($_GET['action'] != 'editconditions') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;socid='.$soc->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($_GET['action'] == 'editconditions')
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->cond_reglement,'cond_reglement_id',-1,1);
}
else
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->cond_reglement,'none');
}
print "</td>";
print '</tr>';
// Mode de règlement
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans('PaymentMode');
print '<td>';
if (($_GET['action'] != 'editmode') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;socid='.$soc->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($_GET['action'] == 'editmode')
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->mode_reglement,'mode_reglement_id');
}
else
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->mode_reglement,'none');
}
print "</td>";
print '</tr>';
// Réductions relative (Remises-Ristournes-Rabbais)
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td colspan="3">'.($soc->remise_client?$soc->remise_client.'%':$langs->trans("DiscountNone")).'</td>';
print '</tr>';
// Réductions absolues (Remises-Ristournes-Rabbais)
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding">';
print '<tr><td nowrap>';
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
$amount_discount=$soc->getcurrentDiscount();
if ($amount_discount < 0) dolibarr_print_error($db,$societe->error);
if ($amount_discount > 0) print $amount_discount.'&nbsp;'.$langs->trans("Currency".$conf->monnaie);
else print $langs->trans("DiscountNone");
print '</td>';
print '</tr>';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
{
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("PriceLevel");
print '<td><td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$soc->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td colspan="3">'.$soc->price_level."</td>";
print '</tr>';
}
// Adresse de livraison
if ($conf->expedition->enabled)
{
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("DeliveriesAddress");
print '<td><td align="right">';
if ($user->rights->societe->creer)
{
print '<a href="'.DOL_URL_ROOT.'/comm/adresse_livraison.php?socid='.$soc->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td colspan="3">';
$sql = "SELECT count(rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison";
$sql.= " WHERE fk_societe =".$soc->id;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$objal = $db->fetch_object($resql);
print $objal->nb?($objal->nb):$langs->trans("NoOtherDeliveryAddress");
}
else
{
dolibarr_print_error($db);
}
print '</td>';
print '</tr>';
}
print "</table>";
print '</div>';
if ($mesg) print($mesg);
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
if ($user->rights->categorie->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$soc->id.'&type=2">'.$langs->trans("NewCat").'</a>';
}
print '</div>';
// Formulaire ajout dans une categorie
if ($user->rights->societe->creer)
{
print '<br>';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/categorie.php?socid='.$soc->id.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>';
print $langs->trans("ClassifyInCategory").' ';
print $html->select_all_categories(2,$categorie->id_mere).' <input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br/>';
}
$c = new Categorie($db);
if ($_GET["socid"])
{
$cats = $c->containing($_REQUEST["socid"],"societe");
}
if (sizeof($cats) > 0)
{
print_fiche_titre($langs->trans("CompanyIsInCategories"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Categories").'</td></tr>';
$var = true;
foreach ($cats as $cat)
{
$ways = $cat->print_all_ways ();
foreach ($ways as $way)
{
$var = ! $var;
print "<tr ".$bc[$var].">";
// Categorie
print "<td>".$way."</td>";
// Lien supprimer
print '<td align="right">';
if ($user->rights->societe->creer)
{
print "<a href= '".DOL_URL_ROOT."/comm/categorie.php?socid=".$soc->id."&amp;removecat=".$cat->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' ';
print $langs->trans("DeleteFromCat")."</a>";
}
else
{
print '&nbsp;';
}
print "</td>";
print "</tr>\n";
}
}
print "</table><br/>\n";
}
else if($cats < 0)
{
print $langs->trans("ErrorUnknown");
}
else
{
print $langs->trans("CompanyHasNoCategory")."<br/>";
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

242
htdocs/fourn/categorie.php Normal file
View File

@ -0,0 +1,242 @@
<?php
/* 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) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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$
* $Source$
*/
/**
\file htdocs/product/categorie.php
\ingroup product
\brief Page de l'onglet categories de produits
\version $Revision$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php");
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
$langs->load("categories");
$langs->load("companies");
if (!$user->rights->societe->lire) accessforbidden();
$mesg = '';
/*
* Actions
*/
//on veut supprimer une catégorie
if ($_REQUEST["removecat"] && $user->rights->societe->creer)
{
$soc = new Fournisseur($db);
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
$cat = new Categorie($db,$_REQUEST["removecat"]);
$result=$cat->del_type($soc,"societe");
}
//on veut ajouter une catégorie
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->societe->creer)
{
$soc = new Fournisseur($db);
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
$cat = new Categorie($db,$_REQUEST["catMere"]);
$result=$cat->add_type($soc,"societe");
if ($result >= 0)
{
$mesg='<div class="ok">'.$langs->trans("Added").'</div>';
}
else
{
$mesg='<div class="error">'.$langs->trans("Error").' '.$cat->error.'</div>';
}
}
/*
* Creation de l'objet fournisseur correspondant à l'id
*/
if ($_GET["socid"] || $_GET["ref"])
{
$soc = new Fournisseur($db);
if ($_GET["socid"]) $result = $soc->fetch($_GET["socid"]);
llxHeader("","",$langs->trans("CardSupplier".$soc->type));
}
$html = new Form($db);
/*
* Fiche produit
*/
if ($_GET["socid"] || $_GET["ref"])
{
/*
* Affichage onglets
*/
$head = societe_prepare_head($soc);
dolibarr_fiche_head($head, 'category', $soc->nom);
print '<table width="100%">';
print '<tr><td valign="top" width="50%">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$soc->nom.'</td></tr>';
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
if ($soc->fournisseur)
{
print '<tr><td nowrap="nowrap">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $soc->code_fournisseur;
if ($soc->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
print '</td></tr>';
}
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($soc->adresse).'</td></tr>';
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$soc->cp.'</td>';
print '<td>'.$langs->trans("Town").'</td><td>'.$soc->ville.'</td></tr>';
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'.$soc->pays.'</td></tr>';
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dolibarr_print_phone($soc->tel).'&nbsp;</td><td>'.$langs->trans("Fax").'</td><td>'.dolibarr_print_phone($soc->fax).'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$soc->url\">$soc->url</a>&nbsp;</td></tr>";
// Assujeti à TVA ou pas
print '<tr>';
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
print yn($soc->tva_assuj);
print '</td>';
print '</tr>';
print '</table>';
print '</div>';
if ($mesg) print($mesg);
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
if ($user->rights->categorie->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$soc->id.'&type=1">'.$langs->trans("NewCat").'</a>';
}
print '</div>';
// Formulaire ajout dans une categorie
if ($user->rights->societe->creer)
{
print '<br>';
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/categorie.php?socid='.$soc->id.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>';
print $langs->trans("ClassifyInCategory").' ';
print $html->select_all_categories(1,$categorie->id_mere).' <input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br/>';
}
$c = new Categorie($db);
if ($_GET["socid"])
{
$cats = $c->containing($_REQUEST["socid"],"societe");
}
if (sizeof($cats) > 0)
{
print_fiche_titre($langs->trans("SupplierIsInCategories"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Categories").'</td></tr>';
$var = true;
foreach ($cats as $cat)
{
$ways = $cat->print_all_ways ();
foreach ($ways as $way)
{
$var = ! $var;
print "<tr ".$bc[$var].">";
// Categorie
print "<td>".$way."</td>";
// Lien supprimer
print '<td align="right">';
if ($user->rights->societe->creer)
{
print "<a href= '".DOL_URL_ROOT."/fourn/categorie.php?socid=".$soc->id."&amp;removecat=".$cat->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' ';
print $langs->trans("DeleteFromCat")."</a>";
}
else
{
print '&nbsp;';
}
print "</td>";
print "</tr>\n";
}
}
print "</table><br/>\n";
}
else if($cats < 0)
{
print $langs->trans("ErrorUnknown");
}
else
{
print $langs->trans("SupplierHasNoCategory")."<br/>";
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -8,6 +8,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Marc Barilley/Océbo <marc@ocebo.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@ -1350,7 +1351,7 @@ class Form
* du nombre choisi
* \param selected nombre de catégorie à créer
*/
function select_all_categories($selected='',$select_name="")
function select_all_categories($type,$selected='',$select_name="")
{
global $langs;
$langs->load("categorie");
@ -1358,7 +1359,7 @@ class Form
if ($select_name=="") $select_name="catMere";
$cat = new Categorie ($this -> db);
$cate_arbo = $cat->get_full_arbo();
$cate_arbo = $cat->get_full_arbo($type);
$output = '<select name="'.$select_name.'">';
$output.= '<option value="-1" id="choix">&nbsp;</option>';
@ -2868,7 +2869,7 @@ class Form
print '<form action="'.$urlsource.'#builddoc" method="post">';
print '<input type="hidden" name="action" value="builddoc">';
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@ -62,6 +63,26 @@ function societe_prepare_head($objsoc)
$head[$h][2] = 'supplier';
$h++;
}
//affichage onglet catégorie
if ($conf->categorie->enabled)
{
if ($objsoc->fournisseur)
{
$head[$h][0] = DOL_URL_ROOT.'/fourn/categorie.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
}
else
{
$head[$h][0] = DOL_URL_ROOT.'/comm/categorie.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
}
}
if ($conf->facture->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled)
{

View File

@ -1250,7 +1250,12 @@ function dol_loginfunction($notused,$pearstatus)
}
print '</div></td></tr></table></center>';
}
if (defined("MAIN_HOME") && strlen(trim(MAIN_HOME)))
{
print '<table cellpadding="0" cellspacing="0" border="0" align="center" width="750"><tr><td>';
print nl2br(MAIN_HOME);
print '</td></tr></table><br>';
}
print "\n</body>\n</html>";
}

View File

@ -3,6 +3,7 @@
* 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) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@ -53,7 +54,7 @@ if ($_REQUEST["removecat"] && $user->rights->produit->creer)
if ($_REQUEST["id"]) $result = $product->fetch($_REQUEST["id"]);
$cat = new Categorie($db,$_REQUEST["removecat"]);
$result=$cat->del_product($product);
$result=$cat->del_type($product,"product");
}
//on veut ajouter une catégorie
@ -64,7 +65,7 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->pr
if ($_REQUEST["id"]) $result = $product->fetch($_REQUEST["id"]);
$cat = new Categorie($db,$_REQUEST["catMere"]);
$result=$cat->add_product($product);
$result=$cat->add_type($product,"product");
if ($result >= 0)
{
$mesg='<div class="ok">'.$langs->trans("Added").'</div>';
@ -144,7 +145,7 @@ if ($_GET["id"] || $_GET["ref"])
print '<div class="tabsAction">';
if ($user->rights->categorie->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$product->id.'">'.$langs->trans("NewCat").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&amp;origin='.$product->id.'&type=0">'.$langs->trans("NewCat").'</a>';
}
print '</div>';
@ -152,12 +153,12 @@ if ($_GET["id"] || $_GET["ref"])
// Formulaire ajout dans une categorie
if ($user->rights->produit->creer)
{
print '<br>';
print '<form method="post" action="'.DOL_URL_ROOT.'/product/categorie.php?id='.$product->id.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>';
print $langs->trans("ClassifyInCategory").' ';
print $html->select_all_categories($categorie->id_mere).' <input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
print $html->select_all_categories(0,$categorie->id_mere).' <input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
@ -169,12 +170,12 @@ if ($_GET["id"] || $_GET["ref"])
if ($_GET["id"])
{
$cats = $c->containing($_REQUEST["id"]);
$cats = $c->containing($_REQUEST["id"],"product");
}
if ($_GET["ref"])
{
$cats = $c->containing_ref($_REQUEST["ref"]);
$cats = $c->containing_ref($_REQUEST["ref"],"product");
}
if (sizeof($cats) > 0)

View File

@ -153,57 +153,61 @@ if ( $soc->fetch($soc->id) )
print "\n";
print_fiche_titre($langs->trans("AddNewNotification"));
if(count($soc->contact_email_array()) > 0)
{
print_fiche_titre($langs->trans("AddNewNotification"));
print '<form action="fiche.php?socid='.$socid.'" method="post">';
print '<form action="fiche.php?socid='.$socid.'" method="post">';
// Ligne de titres
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield);
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield);
print '<td>&nbsp;</td>';
print '</tr>';
// Charge tableau $actions
$sql = "SELECT a.rowid, a.code, a.titre";
$sql.= " FROM ".MAIN_DB_PREFIX."action_def as a";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$libelle=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->titre);
$actions[$obj->rowid] = $libelle;
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
$var=false;
echo count($soc->contact_email_array());
// Ligne de titres
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield);
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield);
print '<td>&nbsp;</td>';
print '</tr>';
// Charge tableau $actions
$sql = "SELECT a.rowid, a.code, a.titre";
$sql.= " FROM ".MAIN_DB_PREFIX."action_def as a";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$libelle=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->titre);
$actions[$obj->rowid] = $libelle;
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
$var=false;
print '<input type="hidden" name="action" value="add">';
print '<tr '.$bc[$var].'><td>';
$html->select_array("contactid",$soc->contact_email_array());
print '</td>';
print '<td>';
$html->select_array("actionid",$actions);
print '</td>';
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
print '<input type="hidden" name="action" value="add">';
print '<tr '.$bc[$var].'><td>';
$html->select_array("contactid",$soc->contact_email_array());
print '</td>';
print '<td>';
$html->select_array("actionid",$actions);
print '</td>';
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
}
print_fiche_titre($langs->trans("ListOfActiveNotifications"));

View File

@ -27,5 +27,6 @@ create table llx_categorie
rowid integer AUTO_INCREMENT PRIMARY KEY,
label VARCHAR(255), -- nom de la catégorie
description text, -- description de la catégorie
visible tinyint DEFAULT 1 NOT NULL -- determine si les produits sont visible ou pas
visible tinyint DEFAULT 1 NOT NULL, -- determine si les produits sont visible ou pas
type tinyint DEFAULT 1 NOT NULL -- Type de catégorie (product, supplier, societe)
)type=innodb;

View File

@ -0,0 +1,25 @@
-- ============================================================================
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
--
-- 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.
--
-- ============================================================================
ALTER TABLE llx_categorie_societe ADD PRIMARY KEY (fk_categorie, fk_societe);
ALTER TABLE llx_categorie_societe ADD INDEX idx_categorie_societe_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_societe ADD INDEX idx_categorie_societe_fk_societe (fk_societe);
ALTER TABLE llx_categorie_societe ADD CONSTRAINT fk_categorie_societe_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_societe ADD CONSTRAINT fk_categorie_societe_societe_rowid FOREIGN KEY (fk_societe) REFERENCES llx_societe (rowid);

View File

@ -0,0 +1,24 @@
-- ============================================================================
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
--
-- 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.
--
-- ============================================================================
create table llx_categorie_societe
(
fk_categorie integer NOT NULL,
fk_societe integer NOT NULL
)type=innodb;

View File

@ -0,0 +1,33 @@
-- ========================================================================
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
--
-- 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$
-- $Source$
--
-- ========================================================================
CREATE TABLE `llx_droitpret_rapport` (
`rowid` int(11) NOT NULL auto_increment,
`date_envoie` datetime NOT NULL,
`format` varchar(10) NOT NULL,
`date_debut` datetime NOT NULL,
`date_fin` datetime NOT NULL,
`fichier` varchar(255) NOT NULL,
`nbfact` int(11) NOT NULL,
PRIMARY KEY (`rowid`)
) type=innodb;