Fix: Le gestion des categories fournisseurs etait en double dans 2 tables diffrentes.

This commit is contained in:
Laurent Destailleur 2007-11-11 21:31:43 +00:00
parent 50f1f17d0a
commit 20eb923486
9 changed files with 45 additions and 109 deletions

View File

@ -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 "<br>";
@ -340,6 +339,9 @@ closedir($handle);
print '</table><br/>';
/* 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$');
?>

View File

@ -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

View File

@ -66,47 +66,32 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* 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 '<table class="liste" width="100%">';
print '<tr class="liste_titre"><td colspan="2">';
print $langs->trans("Category");
print "</td></tr>\n";
$var=True;
while ($obj = $db->fetch_object($resql))
foreach ($companystatic->SupplierCategories as $rowid => $label)
{
$var=!$var;
print "<tr $bc[$var]>\n";
print '<td><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a>';
print '<td><a href="liste.php?cat='.$rowid.'">'.stripslashes($label).'</a>';
print '</td><td align="right">';
print '<a href="stats.php?cat='.$obj->rowid.'">('.$langs->trans("Stats").')</a>';
print '<a href="stats.php?cat='.$rowid.'">('.$langs->trans("Stats").')</a>';
print "</tr>\n";
}
print "</table>\n";
print "<br>\n";
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
/*
*
*/

View File

@ -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

View File

@ -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)

View File

@ -1,28 +0,0 @@
-- ============================================================================
-- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.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$
-- $Source$
--
-- ============================================================================
create table llx_fournisseur_categorie
(
rowid integer IDENTITY PRIMARY KEY,
label varchar(255)
);

View File

@ -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
(

View File

@ -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';

View File

@ -1,28 +0,0 @@
-- ============================================================================
-- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.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$
-- $Source$
--
-- ============================================================================
create table llx_fournisseur_categorie
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(255)
)type=innodb;