Uniformise fields in tables

This commit is contained in:
Laurent Destailleur 2016-09-23 10:04:27 +02:00
parent f1166f1898
commit 3eaec4d4b8
3 changed files with 14 additions and 5 deletions

View File

@ -51,6 +51,7 @@ class Don extends CommonObject
var $fk_projet; var $fk_projet;
var $fk_typepayment; var $fk_typepayment;
var $num_payment; var $num_payment;
var $date_valid;
/** /**
* @deprecated * @deprecated
@ -156,6 +157,8 @@ class Don extends CommonObject
{ {
global $conf, $user,$langs; global $conf, $user,$langs;
$now = dol_now();
// Charge tableau des id de societe socids // Charge tableau des id de societe socids
$socids = array(); $socids = array();
@ -186,7 +189,8 @@ class Don extends CommonObject
$this->lastname = 'Doe'; $this->lastname = 'Doe';
$this->firstname = 'John'; $this->firstname = 'John';
$this->socid = 1; $this->socid = 1;
$this->date = dol_now(); $this->date = $now;
$this->date_valid = $now;
$this->amount = 100; $this->amount = 100;
$this->public = 1; $this->public = 1;
$this->societe = 'The Company'; $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_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 .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql .= ",datedon='".$this->db->idate($this->date)."'"; $sql .= ",datedon='".$this->db->idate($this->date)."'";
$sql .= ",date_valid=".($this->date_valid?"'".$this->db->idate($this->date)."'":"null");
$sql .= ",email='".$this->email."'"; $sql .= ",email='".$this->email."'";
$sql .= ",phone='".$this->phone."'"; $sql .= ",phone='".$this->phone."'";
$sql .= ",phone_mobile='".$this->phone_mobile."'"; $sql .= ",phone_mobile='".$this->phone_mobile."'";
@ -593,7 +598,7 @@ class Don extends CommonObject
{ {
global $conf; 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.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.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,"; $sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,";
@ -624,6 +629,7 @@ class Don extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->datem = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem);
$this->date = $this->db->jdate($obj->datedon); $this->date = $this->db->jdate($obj->datedon);
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;

View File

@ -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; 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'; DELETE FROM llx_menu where module='expensereport';
ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_login;

View File

@ -27,7 +27,6 @@ create table llx_don
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp, tms timestamp,
fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate
datec datetime, -- Create date
datedon datetime, -- Date of the donation/promise datedon datetime, -- Date of the donation/promise
amount real DEFAULT 0, amount real DEFAULT 0,
fk_payment integer, fk_payment integer,
@ -43,9 +42,11 @@ create table llx_don
email varchar(255), email varchar(255),
phone varchar(24), phone varchar(24),
phone_mobile varchar(24), phone_mobile varchar(24),
public smallint DEFAULT 1 NOT NULL, -- Donation is public ? (0,1) public smallint DEFAULT 1 NOT NULL, -- Donation is public ? (0,1)
fk_projet integer NULL, -- Donation is given for a project ? fk_projet integer NULL, -- Donation is given for a project ?
datec datetime, -- Create date
fk_user_author integer NOT NULL, fk_user_author integer NOT NULL,
date_valid datetime, -- date de validation
fk_user_valid integer NULL, fk_user_valid integer NULL,
note_private text, note_private text,
note_public text, note_public text,