diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 1167c3568f351b2de646626bdd98de881fcfac78..35eb06bae5407deabaf4b04baf06ee33d05d4f0b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -51,6 +51,7 @@ class Don extends CommonObject var $fk_projet; var $fk_typepayment; var $num_payment; + var $date_valid; /** * @deprecated @@ -156,6 +157,8 @@ class Don extends CommonObject { global $conf, $user,$langs; + $now = dol_now(); + // Charge tableau des id de societe socids $socids = array(); @@ -186,7 +189,8 @@ class Don extends CommonObject $this->lastname = 'Doe'; $this->firstname = 'John'; $this->socid = 1; - $this->date = dol_now(); + $this->date = $now; + $this->date_valid = $now; $this->amount = 100; $this->public = 1; $this->societe = 'The Company'; @@ -454,6 +458,7 @@ class Don extends CommonObject $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql .= ",datedon='".$this->db->idate($this->date)."'"; + $sql .= ",date_valid=".($this->date_valid?"'".$this->db->idate($this->date)."'":"null"); $sql .= ",email='".$this->email."'"; $sql .= ",phone='".$this->phone."'"; $sql .= ",phone_mobile='".$this->phone_mobile."'"; @@ -593,7 +598,7 @@ class Don extends CommonObject { global $conf; - $sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,"; + $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; $sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; $sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, "; $sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,"; @@ -624,6 +629,7 @@ class Don extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->datec = $this->db->jdate($obj->datec); + $this->date_valid = $this->db->jdate($obj->date_valid); $this->datem = $this->db->jdate($obj->datem); $this->date = $this->db->jdate($obj->datedon); $this->firstname = $obj->firstname; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 5c78d7aacc9f4bf0e25b3a8bedcb88830cb4f96c..c1fc706339da85addd0f7b1eb8c7ef5231082c0a 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -27,6 +27,8 @@ ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL; +ALTER TABLE llx_don ADD COLUMN date_valid datetime; + DELETE FROM llx_menu where module='expensereport'; ALTER TABLE llx_user DROP COLUMN phenix_login; diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql index 809627a6eb5d68fc324c1d194661650c56548de2..b7b7c89f9cd220ce4dee3f2bfdaed786fdee560d 100644 --- a/htdocs/install/mysql/tables/llx_don.sql +++ b/htdocs/install/mysql/tables/llx_don.sql @@ -27,7 +27,6 @@ create table llx_don entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate - datec datetime, -- Create date datedon datetime, -- Date of the donation/promise amount real DEFAULT 0, fk_payment integer, @@ -43,9 +42,11 @@ create table llx_don email varchar(255), phone varchar(24), phone_mobile varchar(24), - public smallint DEFAULT 1 NOT NULL, -- Donation is public ? (0,1) - fk_projet integer NULL, -- Donation is given for a project ? + public smallint DEFAULT 1 NOT NULL, -- Donation is public ? (0,1) + fk_projet integer NULL, -- Donation is given for a project ? + datec datetime, -- Create date fk_user_author integer NOT NULL, + date_valid datetime, -- date de validation fk_user_valid integer NULL, note_private text, note_public text,