diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index 88de2a3ba45..eafd55a4548 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
- * $Source$
*/
/**
@@ -151,7 +150,7 @@ llxHeader();
$dir = "../fourn/commande/modules/pdf/";
$html=new Form($db);
-print_fiche_titre($langs->trans("OrdersSetup"),'','setup');
+print_fiche_titre($langs->trans("SuppliersSetup"),'','setup');
print "
";
@@ -340,6 +339,9 @@ closedir($handle);
print '
';
+/* Obsolete. Les categories de fournisseurs sont gerees dans la table llx_categories
+sur le meme principe que les categories clients et produits
+
print_titre($langs->trans("Categories"));
$sql = "SELECT rowid, label";
@@ -380,6 +382,7 @@ else
{
dolibarr_print_error($db);
}
+*/
llxFooter('$Date$ - $Revision$');
?>
diff --git a/htdocs/fourn/fournisseur.class.php b/htdocs/fourn/fournisseur.class.php
index 3c1a2264946..fc7496f4e46 100644
--- a/htdocs/fourn/fournisseur.class.php
+++ b/htdocs/fourn/fournisseur.class.php
@@ -216,31 +216,34 @@ class Fournisseur extends Societe
}
}
- /**
- * \brief Créé une categorie fournsseur
- * \param user Utilisateur qui crée
- * \return int <0 si ko, 0 si ok
- */
- function CreateCategory($user, $name)
- {
- dolibarr_syslog("Fournisseur::CreateCategory");
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."fournisseur_categorie (label) VALUES ";
- $sql .=" ('".addslashes($name)."');";
+ /**
+ * \brief Créé une categorie fournisseur
+ * \param user Utilisateur qui crée
+ * \param name Nom categorie
+ * \return int <0 si ko, 0 si ok
+ */
+ function CreateCategory($user, $name)
+ {
+ dolibarr_syslog("Fournisseur::CreateCategory");
- $result = $this->db->query($sql);
-
- if ($result == 1)
- {
- dolibarr_syslog("Fournisseur::CreateCategory : Success");
- return 0;
- }
- else
- {
- dolibarr_syslog("Fournisseur::CreateCategory : Failed (".$this->db->error().")");
- return -1;
- }
- }
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)";
+ $sql.= " VALUES ";
+ $sql.= " ('".addslashes($name)."',1,1)";
+
+ $result = $this->db->query($sql);
+
+ if ($result == 1)
+ {
+ dolibarr_syslog("Fournisseur::CreateCategory : Success");
+ return 0;
+ }
+ else
+ {
+ dolibarr_syslog("Fournisseur::CreateCategory : Failed (".$this->db->error().")");
+ return -1;
+ }
+ }
/**
* Retourne la liste des fournisseurs
diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php
index 320364dc2f6..be2512bd581 100644
--- a/htdocs/fourn/index.php
+++ b/htdocs/fourn/index.php
@@ -66,47 +66,32 @@ print '
';
/*
* Liste des categories
- * \TODO Il n'y a aucun écran pour les saisir !
*/
-$sql = "SELECT rowid, label";
-$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
-$sql.= " ORDER BY label ASC";
+$companystatic->LoadSupplierCateg();
-$resql = $db->query($sql);
-if ($resql)
+if (sizeof($companystatic->SupplierCategories))
{
- $num = $db->num_rows($resql);
- $i = 0;
-
- if ($num)
- {
print '\n";
print " \n";
- }
-
- $db->free($resql);
-}
-else
-{
- dolibarr_print_error($db);
}
+
/*
*
*/
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 66eab30d67c..5ece246921b 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -703,6 +703,8 @@ ViewProductDescInFormAbility=Visualisation des descriptions produits dans les fo
UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choix d'un produit (plutôt que liste déroulante)
UseEcoTaxeAbility=Prise en charge des éco-taxes (DEEE)
SetDefaultBarcodeType=Type de code barre utilisé par défaut pour les produits
+##### Suppliers #####
+SuppliersSetup=Configuration du module Fournisseur
##### Syslog #####
SyslogSetup=Configuration du module Syslog
SyslogOutput=Sortie des log
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 49906c91bb7..aef5ef6ef50 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -1838,7 +1838,8 @@ class Societe
{
$this->SupplierCategories = array();
$sql = "SELECT rowid, label";
- $sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie;";
+ $sql.= " FROM ".MAIN_DB_PREFIX."categorie";
+ $sql.= " WHERE type = 1";
$resql=$this->db->query($sql);
if ($resql)
diff --git a/mssql/tables/llx_fournisseur_categorie.sql b/mssql/tables/llx_fournisseur_categorie.sql
deleted file mode 100644
index d618a77a9f3..00000000000
--- a/mssql/tables/llx_fournisseur_categorie.sql
+++ /dev/null
@@ -1,28 +0,0 @@
--- ============================================================================
--- Copyright (C) 2006 Rodolphe Quiedeville
---
--- 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_fournisseur_categorie
-(
- rowid integer IDENTITY PRIMARY KEY,
- label varchar(255)
-
-);
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index cbe664be738..2b971fa7044 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -834,12 +834,6 @@ create table llx_categorie_fournisseur
UNIQUE (fk_categorie, fk_societe)
)type=innodb;
-create table llx_fournisseur_categorie
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- label varchar(255)
-
-)type=innodb;
create table llx_fournisseur_ca
(
diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql
index 52b3b74fb95..677b0e6b2ac 100644
--- a/mysql/migration/2.1.0-2.2.0.sql
+++ b/mysql/migration/2.1.0-2.2.0.sql
@@ -8,6 +8,10 @@
-- sans AUCUNE erreur ni warning
--
+-- On migre les categorie fournisseur dans table des categories
+-- V4 INSERT into llx_categorie (label, description, visible, type) (select distinct label, label, 1, 1 from llx_fournisseur_categorie);
+-- Ne pas faire UPDATE llx_categorie_fournisseur as cf SET cf.fk_categorie = (SELECT rowid from llx_categorie as c, llx_fournisseur_categorie as fc where c.type = 1 AND c.label = fc.label);
+
-- Corrige mauvaise insertion du a champ trop court
alter table llx_action_def modify code varchar(28) UNIQUE NOT NULL;
update llx_action_def set code = 'NOTIFY_VAL_ORDER_SUPPLIER' where code = 'NOTIFY_VAL_ORDER_SUUPLIE';
diff --git a/mysql/tables/llx_fournisseur_categorie.sql b/mysql/tables/llx_fournisseur_categorie.sql
deleted file mode 100644
index ea4d6182c8a..00000000000
--- a/mysql/tables/llx_fournisseur_categorie.sql
+++ /dev/null
@@ -1,28 +0,0 @@
--- ============================================================================
--- Copyright (C) 2006 Rodolphe Quiedeville
---
--- 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_fournisseur_categorie
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- label varchar(255)
-
-)type=innodb;
|