diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 071bd3afb4d..e29053add3b 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -119,6 +119,16 @@ ALTER TABLE llx_societe ADD COLUMN fk_barcode_type integer DEFAULT 0; UPDATE llx_menu SET leftmenu = NULL where leftmenu in ('', '0', '1'); +ALTER TABLE llx_categorie_societe DROP INDEX fk_categorie; +ALTER TABLE llx_categorie_societe DROP INDEX fk_societe; + +ALTER TABLE llx_categorie_fournisseur DROP INDEX fk_categorie; +ALTER TABLE llx_categorie_fournisseur ADD PRIMARY KEY pk_categorie_fournisseur (fk_categorie, fk_societe); +ALTER TABLE llx_categorie_fournisseur ADD INDEX idx_categorie_fournisseur_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_fournisseur ADD INDEX idx_categorie_fournisseur_fk_societe (fk_societe); +ALTER TABLE llx_categorie_fournisseur ADD CONSTRAINT fk_categorie_fournisseur_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_fournisseur ADD CONSTRAINT fk_categorie_fournisseur_fk_soc FOREIGN KEY (fk_societe) REFERENCES llx_societe (rowid); + -- Regions Venezuela (id country=232) INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23201, 232, 23201, '', 0, 'Los Andes', 1); INSERT INTO llx_c_regions (rowid, fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (23202, 232, 23202, '', 0, 'Capital', 1); diff --git a/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql b/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql index 0e5bde492d8..63f0e280a47 100644 --- a/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql +++ b/htdocs/install/mysql/tables/llx_categorie_fournisseur.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2012 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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 diff --git a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql index e8d39125e01..535972686c2 100644 --- a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql @@ -1,5 +1,7 @@ -- ============================================================================ --- Copyright (C) 2006 Rodolphe Quiedeville +-- Copyright (C) 2006 Rodolphe Quiedeville +-- Copyright (C) 2012 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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 @@ -19,6 +21,5 @@ create table llx_categorie_fournisseur ( fk_categorie integer NOT NULL, - fk_societe integer NOT NULL, - UNIQUE (fk_categorie, fk_societe) + fk_societe integer NOT NULL )ENGINE=innodb; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 51dba473862..d57ed5154a5 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -124,7 +124,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertLessThan($result, 0); return $result; } @@ -143,6 +143,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject=new Contact($this->savdb); $result=$localobject->fetch($id); + print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -169,7 +170,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject->zip='New zip'; $localobject->town='New town'; $localobject->country_id=2; - $localobject->status=0; + //$localobject->status=0; $localobject->phone_pro='New tel pro'; $localobject->phone_perso='New tel perso'; $localobject->phone_mobile='New tel mobile'; @@ -192,22 +193,39 @@ class ContactTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Contact::fetch error'); + print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n"; $this->assertEquals($localobject->note, $newobject->note); + //print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n"; //$this->assertEquals($localobject->note_public, $newobject->note_public); + print __METHOD__." old=".$localobject->lastname." new=".$newobject->lastname."\n"; $this->assertEquals($localobject->lastname, $newobject->lastname); + print __METHOD__." old=".$localobject->firstname." new=".$newobject->firstname."\n"; $this->assertEquals($localobject->firstname, $newobject->firstname); + print __METHOD__." old=".$localobject->address." new=".$newobject->address."\n"; $this->assertEquals($localobject->address, $newobject->address); + print __METHOD__." old=".$localobject->zip." new=".$newobject->zip."\n"; $this->assertEquals($localobject->zip, $newobject->zip); + print __METHOD__." old=".$localobject->town." new=".$newobject->town."\n"; $this->assertEquals($localobject->town, $newobject->town); + print __METHOD__." old=".$localobject->country_id." new=".$newobject->country_id."\n"; $this->assertEquals($localobject->country_id, $newobject->country_id); + print __METHOD__." old=BE new=".$newobject->country_code."\n"; $this->assertEquals('BE', $newobject->country_code); - $this->assertEquals($localobject->status, $newobject->status); + //print __METHOD__." old=".$localobject->status." new=".$newobject->status."\n"; + //$this->assertEquals($localobject->status, $newobject->status); + print __METHOD__." old=".$localobject->phone_pro." new=".$newobject->phone_pro."\n"; $this->assertEquals($localobject->phone_pro, $newobject->phone_pro); + print __METHOD__." old=".$localobject->phone_pro." new=".$newobject->phone_pro."\n"; $this->assertEquals($localobject->phone_perso, $newobject->phone_perso); + print __METHOD__." old=".$localobject->phone_mobile." new=".$newobject->phone_mobile."\n"; $this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile); + print __METHOD__." old=".$localobject->fax." new=".$newobject->fax."\n"; $this->assertEquals($localobject->fax, $newobject->fax); + print __METHOD__." old=".$localobject->email." new=".$newobject->email."\n"; $this->assertEquals($localobject->email, $newobject->email); + print __METHOD__." old=".$localobject->jabberid." new=".$newobject->jabberid."\n"; $this->assertEquals($localobject->jabberid, $newobject->jabberid); + print __METHOD__." old=".$localobject->default_lang." new=".$newobject->default_lang."\n"; $this->assertEquals($localobject->default_lang, $newobject->default_lang); return $localobject; diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index 5fed53054ae..0d71f2850a1 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -119,10 +119,11 @@ class ContratTest extends PHPUnit_Framework_TestCase $localobject=new Contrat($this->savdb); $localobject->initAsSpecimen(); - $result=$localobject->create($user,$langs,$conf); - - $this->assertLessThan($result, 0); + $result=$localobject->create($user); + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; } @@ -140,9 +141,10 @@ class ContratTest extends PHPUnit_Framework_TestCase $localobject=new Contrat($this->savdb); $result=$localobject->fetch($id); - - $this->assertLessThan($result, 0); + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; }