From 5e402f667e091f955bbb50a01c1dfddde8406eea Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Mar 2012 10:13:52 +0100 Subject: [PATCH] Fix: php unit test warning --- htdocs/comm/addpropal.php | 3 +-- htdocs/comm/propal/class/propal.class.php | 2 ++ htdocs/commande/class/commande.class.php | 4 ++-- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 3 +++ htdocs/install/mysql/tables/llx_commande.sql | 2 +- htdocs/install/mysql/tables/llx_facture.sql | 2 +- htdocs/install/mysql/tables/llx_propal.sql | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 965e8344fa8..468c2181349 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -354,7 +354,6 @@ if ($action == 'create') print ""; } -llxFooter(); - $db->close(); +llxFooter(); ?> diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 717208b704e..a0dbd2f5a49 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -660,6 +660,7 @@ class Propal extends CommonObject $sql.= ", date_livraison"; $sql.= ", fk_availability"; $sql.= ", fk_demand_reason"; + $sql.= ", fk_project"; $sql.= ", entity"; $sql.= ") "; $sql.= " VALUES ("; @@ -684,6 +685,7 @@ class Propal extends CommonObject $sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null"); $sql.= ", ".$this->availability_id; $sql.= ", ".$this->demand_reason_id; + $sql.= ",".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$conf->entity; $sql.= ")"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c44f3bfa4ff..a828997f3a7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -612,7 +612,6 @@ class Commande extends CommonObject dol_syslog("Commande::create ".$this->error, LOG_ERR); return -1; } - if (! $this->fk_project) $this->fk_project = 0; // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); @@ -626,7 +625,8 @@ class Commande extends CommonObject $sql.= ", remise_absolue, remise_percent"; $sql.= ", entity"; $sql.= ")"; - $sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id.", ".$this->fk_project; + $sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id; + $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$this->db->idate($date); $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", '".$this->db->escape($this->note)."'"; 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 5144120f543..9e255ed3137 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 @@ -198,6 +198,7 @@ ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode F -- VMYSQL4.1 UPDATE llx_chargesociales set tms = date_creation WHERE tms = '0000-00-00 00:00:00'; +ALTER TABLE llx_propal MODIFY fk_projet integer DEFAULT NULL; ALTER TABLE llx_propal ADD COLUMN fk_account integer AFTER total; ALTER TABLE llx_propal ADD COLUMN fk_currency varchar(2) AFTER fk_account; ALTER TABLE llx_propal ADD INDEX idx_propal_fk_user_author (fk_user_author); @@ -213,6 +214,7 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_projet FOREIGN KEY (fk_proje ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code); ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_account; +ALTER TABLE llx_commande MODIFY fk_projet integer DEFAULT NULL; ALTER TABLE llx_commande ADD COLUMN fk_account integer AFTER facture; ALTER TABLE llx_commande ADD COLUMN fk_currency varchar(2) AFTER fk_account; ALTER TABLE llx_commande ADD INDEX idx_commande_fk_user_author (fk_user_author); @@ -228,6 +230,7 @@ ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_projet FOREIGN KEY (fk_p ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code); ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_account; +ALTER TABLE llx_facture MODIFY fk_projet integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN fk_account integer AFTER fk_projet; ALTER TABLE llx_facture ADD COLUMN fk_currency varchar(2) AFTER fk_account; ALTER TABLE llx_facture ADD INDEX idx_facture_fk_account (fk_account); diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index f72bae34f18..826c6dd9b9a 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -29,7 +29,7 @@ create table llx_commande ref_client varchar(255), -- reference for customer fk_soc integer NOT NULL, - fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande + fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande tms timestamp, date_creation datetime, -- date de creation diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index b35ce19f309..040e10c1f6a 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -59,7 +59,7 @@ create table llx_facture fk_user_valid integer, -- valideur de la facture fk_facture_source integer, -- facture origine si facture avoir - fk_projet integer, -- projet auquel est associee la facture + fk_projet integer DEFAULT NULL, -- projet auquel est associee la facture fk_account integer, -- bank account fk_currency varchar(2), -- currency code diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 4e433b27b90..6379fe101b6 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -30,7 +30,7 @@ create table llx_propal ref_client varchar(255), -- customer proposal number fk_soc integer, - fk_projet integer DEFAULT 0, -- projet auquel est rattache la propale + fk_projet integer DEFAULT NULL, -- projet auquel est rattache la propale tms timestamp, datec datetime, -- date de creation