diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3166e004e11..d14e164034a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -115,7 +115,7 @@ class Expedition extends CommonObject $sql.= ", date_expedition"; $sql.= ", date_delivery"; $sql.= ", fk_soc"; - $sql.= ", fk_adresse_livraison"; + $sql.= ", fk_address"; $sql.= ", fk_expedition_methode"; $sql.= ", tracking_number"; $sql.= ", weight"; @@ -253,7 +253,7 @@ class Expedition extends CommonObject $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.fk_user_author, e.fk_statut"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; - $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_adresse_livraison, e.date_delivery"; + $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; $sql.= ", e.fk_expedition_methode, e.tracking_number"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; @@ -280,7 +280,7 @@ class Expedition extends CommonObject $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO obsolete $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed - $this->fk_delivery_address = $obj->fk_adresse_livraison; + $this->fk_delivery_address = $obj->fk_address; $this->modelpdf = $obj->model_pdf; $this->expedition_method_id = $obj->fk_expedition_methode; $this->tracking_number = $obj->tracking_number; @@ -614,7 +614,7 @@ class Expedition extends CommonObject $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; $sql.= " date_expedition=".(strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; $sql.= " date_delivery=".(strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; - $sql.= " fk_adresse_livraison=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").","; + $sql.= " fk_address=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").","; $sql.= " fk_expedition_methode=".(isset($this->expedition_method_id)?$this->expedition_method_id:"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".addslashes($this->tracking_number)."'":"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql index fa551045381..3dded5a29d2 100755 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql @@ -135,9 +135,11 @@ ALTER TABLE llx_product_stock add column location varchar(32); ALTER TABLE llx_expedition ADD COLUMN ref_customer varchar(30) AFTER entity; ALTER TABLE llx_expedition ADD COLUMN date_delivery date DEFAULT NULL AFTER date_expedition; +ALTER TABLE llx_expedition CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL; ALTER TABLE llx_livraison change ref_client ref_customer varchar(30); ALTER TABLE llx_livraison change date_livraison date_delivery date DEFAULT NULL; +ALTER TABLE llx_livraison CHANGE COLUMN fk_adresse_livraison fk_address integer DEFAULT NULL; ALTER TABLE llx_c_actioncomm MODIFY libelle varchar(48) NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 2a17e2b0b76..09d5dddfc98 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -56,6 +56,6 @@ create table llx_commande fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement date_livraison date default NULL, - fk_adresse_livraison integer, -- adresse de livraison + fk_adresse_livraison integer, -- delivery address (deprecated) import_key varchar(14) )type=innodb; diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index eab8a49037c..2afc82d6601 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -34,7 +34,7 @@ create table llx_expedition fk_user_valid integer, -- valideur date_expedition date, -- shipping date date_delivery date DEFAULT NULL, -- delivery date - fk_address integer DEFAULT NULL, -- adresse de livraison + fk_address integer DEFAULT NULL, -- delivery address (deprecated) fk_expedition_methode integer, tracking_number varchar(50), fk_statut smallint DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_livraison.sql index a0c1b8f15e4..912407b8d67 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_livraison.sql @@ -33,7 +33,7 @@ create table llx_livraison date_valid datetime, -- date de validation fk_user_valid integer, -- valideur du bon de livraison date_delivery date DEFAULT NULL, -- delivery date - fk_address integer, -- adresse de livraison + fk_address integer, -- delivery address (deprecated) fk_statut smallint DEFAULT 0, total_ht double(24,8) DEFAULT 0, note text, diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index a57cfcf3bf2..6685e77959a 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -55,5 +55,5 @@ create table llx_propal note_public text, model_pdf varchar(50), date_livraison date DEFAULT NULL, -- delivery date - fk_adresse_livraison integer -- adresse de livraison + fk_adresse_livraison integer -- delivery address (deprecated) )type=innodb; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 8407e349f69..0c5ce1dbd81 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2290,6 +2290,7 @@ function migrate_menus($db,$langs,$conf) /* * Migration du champ fk_adresse_livraison dans expedition + * 2.6 -> 2.7 */ function migrate_commande_deliveryaddress($db,$langs,$conf) { diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index e9bce6bc060..cd4235c7680 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -104,7 +104,7 @@ class Livraison extends CommonObject $sql.= ", date_creation"; $sql.= ", fk_user_author"; $sql.= ", date_delivery"; - $sql.= ", fk_adresse_livraison"; + $sql.= ", fk_address"; $sql.= ") VALUES ("; $sql.= "'(PROV)'"; $sql.= ", ".$conf->entity; @@ -244,7 +244,7 @@ class Livraison extends CommonObject $sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_customer, l.fk_user_author,"; $sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note, l.note_public"; - $sql.= ", l.date_delivery, l.fk_adresse_livraison, l.model_pdf"; + $sql.= ", l.date_delivery, l.fk_address, l.model_pdf"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->element."'"; @@ -268,7 +268,7 @@ class Livraison extends CommonObject $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; - $this->fk_delivery_address = $obj->fk_adresse_livraison; + $this->fk_delivery_address = $obj->fk_address; $this->note = $obj->note; $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf;