diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d4c616d09ac26..4b5da68f8a293 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -358,7 +358,7 @@ function create($user,$notrigger=0,$forceduedate=0) $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL'); $sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL'); $sql.= ", '".$this->db->idate($this->date)."'"; - $sql.= ", '".$this->db->idate($this->date_pointoftax)."'"; + $sql.= ", ".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null'); $sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index c20ef305c3974..935f8a04917b2 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -111,7 +111,7 @@ ALTER TABLE llx_cronjob ADD COLUMN test varchar(255) DEFAULT '1'; ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut); -ALTER TABLE llx_facture ADD COLUMN date_pointoftax date; +ALTER TABLE llx_facture ADD COLUMN date_pointoftax date DEFAULT NULL; UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_status as cls WHERE cls.rowid = p.fk_opp_status) WHERE p.opp_percent IS NULL AND p.fk_opp_status IS NOT NULL; @@ -506,4 +506,4 @@ CREATE TABLE llx_oauth_state ( entity integer )ENGINE=InnoDB; -ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50); \ No newline at end of file +ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50); diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index b8e97f4dc1e7c..f62d845295305 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -38,7 +38,7 @@ create table llx_facture fk_soc integer NOT NULL, datec datetime, -- date de creation de la facture datef date, -- date invoice - date_pointoftax date, -- date point of tax (for GB) + date_pointoftax date DEFAULT NULL, -- date point of tax (for GB) date_valid date, -- date validation tms timestamp, -- date creation/modification paye smallint DEFAULT 0 NOT NULL,