From 503924fbbc7260266f600a86610919106f90918b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 May 2014 21:56:31 +0200 Subject: [PATCH] Fix: Missing cleaning orphelins for contact categories. --- htdocs/categories/class/categorie.class.php | 4 ++-- htdocs/install/mysql/migration/3.4.0-3.5.0.sql | 1 - htdocs/install/mysql/migration/repair.sql | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index dbbfc83b8ea..b7e2ed030ab 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -46,7 +46,7 @@ class Categorie var $label; var $description; var $socid; - var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member + var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member, 4=Contact var $import_key; var $cats=array(); // Tableau en memoire des categories @@ -296,7 +296,7 @@ class Categorie if (! $error) { $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; - $sql.= " SET fk_parent = ".$this->fk_parent; + $sql.= " SET fk_parent = ".$this->fk_parent; $sql.= " WHERE fk_parent = ".$this->id; if (!$this->db->query($sql)) diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 7a06eafb16a..bf48ab3207f 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -117,7 +117,6 @@ create table llx_links objectid INTEGER NOT NULL )ENGINE=innodb; - ALTER TABLE llx_categorie_contact ADD PRIMARY KEY pk_categorie_contact (fk_categorie, fk_socpeople); ALTER TABLE llx_categorie_contact ADD INDEX idx_categorie_contact_fk_categorie (fk_categorie); ALTER TABLE llx_categorie_contact ADD INDEX idx_categorie_contact_fk_socpeople (fk_socpeople); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 41b230516d5..5525a80c6f7 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -65,6 +65,7 @@ drop table tmp_categorie; delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0); delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2)); delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3); +delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4); -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.