From 95ab3a091939a18324bdf9bb79d7142320cfe667 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 16 Jun 2007 20:46:31 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20suppression=20de=20la=20cle=20unique=20s?= =?UTF-8?q?ur=20le=20champs=20label=20afin=20de=20pouvoir=20cr=E9er=20une?= =?UTF-8?q?=20cat=E9gorie=20de=20soci=E9t=E9=20ayant=20le=20m=EAme=20nom?= =?UTF-8?q?=20qu'une=20cat=E9gorie=20de=20produit=20par=20exemple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/categories/categorie.class.php | 2 +- htdocs/categories/viewcat.php | 2 +- mysql/migration/2.1.0-2.2.0.sql | 2 ++ mysql/tables/llx_categorie.key.sql | 20 -------------------- 4 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 mysql/tables/llx_categorie.key.sql diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index c391b31c831..130bf90f9ec 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -657,7 +657,7 @@ class Categorie { $sql = "SELECT count(c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_association as ca"; - $sql.= " WHERE c.label = '".addslashes($this -> label)."'"; + $sql.= " WHERE c.label = '".addslashes($this -> label)."' AND type=".$this->type; if($this -> id_mere != "") { $sql.= " AND c.rowid = ca.fk_categorie_fille"; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 2ede508b314..4488971eb62 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -57,7 +57,7 @@ if ($user->rights->categorie->supprimer && $_POST["action"] == 'confirm_delete' { if ($c->remove() >= 0) { - header("Location: ".DOL_URL_ROOT.'/categories/index.php?type=0'); + header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type); exit; } else diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index 36a0aea29f4..8a778592857 100644 --- a/mysql/migration/2.1.0-2.2.0.sql +++ b/mysql/migration/2.1.0-2.2.0.sql @@ -658,3 +658,5 @@ ALTER TABLE `llx_osc_product` ADD UNIQUE KEY `fk_product` (`fk_product`); -- V4 ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_soc_facture) REFERENCES llx_societe(rowid); -- V4 ALTER TABLE llx_telephonie_tarif_client ADD FOREIGN KEY (fk_client) REFERENCES llx_societe (rowid); -- fin du changement idp en rowid + +-- V4 ALTER TABLE llx_categorie DROP INDEX uk_categorie_ref; \ No newline at end of file diff --git a/mysql/tables/llx_categorie.key.sql b/mysql/tables/llx_categorie.key.sql deleted file mode 100644 index 9c2617ab70d..00000000000 --- a/mysql/tables/llx_categorie.key.sql +++ /dev/null @@ -1,20 +0,0 @@ --- ============================================================================ --- Copyright (C) 2007 Laurent Destailleur --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- ============================================================================ - -ALTER TABLE llx_categorie ADD UNIQUE INDEX uk_categorie_ref (label);