Add field virtualhost for website module

This commit is contained in:
Laurent Destailleur 2016-07-14 15:54:46 +02:00
parent ec03ea8f70
commit ec6640af63
4 changed files with 52 additions and 3 deletions

View File

@ -392,7 +392,8 @@ else
array('from'=>'3.6.0', 'to'=>'3.7.0'),
array('from'=>'3.7.0', 'to'=>'3.8.0'),
array('from'=>'3.8.0', 'to'=>'3.9.0'),
array('from'=>'3.9.0', 'to'=>'4.0.0')
array('from'=>'3.9.0', 'to'=>'4.0.0'),
array('from'=>'4.0.0', 'to'=>'5.0.0')
);
$count=0;

View File

@ -0,0 +1,29 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 4.0.0 or higher.
--
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_home;

View File

@ -25,6 +25,7 @@ CREATE TABLE llx_website
description varchar(255),
status integer,
fk_default_home integer,
virtualhost varchar(255),
date_creation datetime,
date_modification datetime,
tms timestamp

View File

@ -85,6 +85,12 @@ class Website extends CommonObject
* @var integer
*/
public $fk_default_home;
/**
* @var string
*/
public $virtualhost;
public $records;
/**
@ -143,7 +149,8 @@ class Website extends CommonObject
$sql.= 'ref,';
$sql.= 'description,';
$sql.= 'status,';
$sql.= 'fk_default_home,';
$sql.= 'fk_default_home,';
$sql.= 'virtualhost,';
$sql.= 'date_creation,';
$sql.= 'date_modification';
@ -154,6 +161,7 @@ class Website extends CommonObject
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
$sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).',';
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").',';
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
@ -214,6 +222,7 @@ class Website extends CommonObject
$sql .= " t.description,";
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.date_creation,";
$sql .= " t.date_modification,";
$sql .= " t.tms";
@ -237,6 +246,7 @@ class Website extends CommonObject
$this->description = $obj->description;
$this->status = $obj->status;
$this->fk_default_home = $obj->fk_default_home;
$this->virtualhost = $obj->virtualhost;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->tms = $this->db->jdate($obj->tms);
@ -281,7 +291,8 @@ class Website extends CommonObject
$sql .= " t.ref,";
$sql .= " t.description,";
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.date_creation,";
$sql .= " t.date_modification,";
$sql .= " t.tms";
@ -321,6 +332,7 @@ class Website extends CommonObject
$line->description = $obj->description;
$line->status = $obj->status;
$line->fk_default_home = $obj->fk_default_home;
$line->virtualhost = $obj->virtualhost;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_modification = $this->db->jdate($obj->date_modification);
$line->tms = $this->db->jdate($obj->tms);
@ -380,6 +392,7 @@ class Website extends CommonObject
$sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").',';
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").',';
$sql .= ' virtualhost = '.(($this->virtualhost != '')?$this->virtualhost:"null").',';
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
$sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').',';
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'");
@ -627,6 +640,7 @@ class Website extends CommonObject
$this->description = 'A specimen website';
$this->status = '';
$this->fk_default_home = null;
$this->virtualhost = 'http://myvirtualhost';
$this->date_creation = dol_now();
$this->date_modification = dol_now();
$this->tms = dol_now();
@ -665,6 +679,10 @@ class WebsiteLine
* @var int
*/
public $fk_default_home;
/**
* @var string
*/
public $virtualhost;
/**
* @var mixed
*/