From de5e6cf546bd0a1dd93d77b83d69e0ce076eb441 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 28 Sep 2020 17:04:45 +0200 Subject: [PATCH 1/6] Add 2 new field typeObject and ObjectId to website --- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ .../install/mysql/tables/llx_website_page.sql | 4 ++- htdocs/website/class/websitepage.class.php | 19 ++++++++++++++ htdocs/website/index.php | 25 ++++++++++++++++++- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..98413f39d82 --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,2 @@ +ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index 840e12e0141..156aff0b5a6 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -38,5 +38,7 @@ CREATE TABLE llx_website_page fk_user_modif integer, date_creation datetime, tms timestamp, - import_key varchar(14) -- import key + import_key varchar(14), -- import key + fk_typeobject varchar(255), + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index abdb8d323eb..a0297e11693 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -102,6 +102,15 @@ class WebsitePage extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; + /** + * @var string path type object + */ + public $fk_typeobject; + /** + * @var string path name object + */ + public $fk_object; + // BEGIN MODULEBUILDER PROPERTIES @@ -131,6 +140,8 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), + 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -197,6 +208,8 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level $sql .= ' WHERE 1 = 1'; @@ -244,6 +257,8 @@ class WebsitePage extends CommonObject $this->date_modification = $this->db->jdate($obj->date_modification); $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_typeobject = $obj->fk_typeobject; + $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -298,6 +313,8 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; // Manage filter @@ -349,6 +366,8 @@ class WebsitePage extends CommonObject $record->date_modification = $this->db->jdate($obj->date_modification); $record->fk_user_creat = $obj->fk_user_creat; $record->fk_user_modif = $obj->fk_user_modif; + $record->fk_typeobject = $obj->fk_typeobject; + $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 72fd6d0b70e..0d6df4694b2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -825,6 +825,12 @@ if ($action == 'addcontainer') if (!$error) { + if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + } + if (GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); + } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -1412,7 +1418,12 @@ if ($action == 'updatemeta') $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); - + if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'aZ09'); + } + if(GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); + } $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; @@ -3119,6 +3130,18 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print ''; + print ''; + print 'ObjectClass'; + print ''; + print ''; + print ''; + + print ''; + print 'ObjectID'; + print ''; + print ''; + print ''; + $fuser = new User($db); print ''; From bdb38da9d3370b4ab20fa532990ad7fdf577a01f Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 28 Sep 2020 18:17:23 +0200 Subject: [PATCH 2/6] Add 2 new field typeObject and ObjectId to website --- .../install/mysql/migration/11.0.0-12.0.0.sql | 3 +++ .../install/mysql/tables/llx_website_page.sql | 4 ++- htdocs/website/class/websitepage.class.php | 22 ++++++++++++++-- htdocs/website/index.php | 25 ++++++++++++++++++- 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 994e5d89495..23830014690 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -335,3 +335,6 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (72 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; + +ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index bacbc8e802b..ae339cfd119 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -39,5 +39,7 @@ CREATE TABLE llx_website_page author_alias varchar(64), date_creation datetime, tms timestamp, - import_key varchar(14) -- import key + import_key varchar(14), -- import k + fk_typeobject varchar(255), + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index b5e29e04176..a3563418873 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -104,6 +104,14 @@ class WebsitePage extends CommonObject */ public $author_alias; + /** + * @var string path type object + */ + public $fk_typeobject; + /** + * @var string path name object + */ + public $fk_object; const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; @@ -161,6 +169,8 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), + 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -260,7 +270,9 @@ class WebsitePage extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; - $sql .= " t.import_key"; + $sql .= " t.import_key,"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level $sql .= ' WHERE 1 = 1'; @@ -319,6 +331,8 @@ class WebsitePage extends CommonObject $this->author_alias = $obj->author_alias; $this->fk_user_modif = $obj->fk_user_modif; $this->import_key = $obj->import_key; + $this->fk_typeobject = $obj->fk_typeobject; + $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -374,7 +388,9 @@ class WebsitePage extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; - $sql .= " t.import_key"; + $sql .= " t.import_key,"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; // Manage filter @@ -443,6 +459,8 @@ class WebsitePage extends CommonObject $record->author_alias = $obj->author_alias; $record->fk_user_modif = $obj->fk_user_modif; $record->import_key = $obj->import_key; + $record->fk_typeobject = $obj->fk_typeobject; + $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index a36f33ee682..e62887407d6 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -981,6 +981,12 @@ if ($action == 'addcontainer') if (!$error) { + if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + } + if (GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); + } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -1657,7 +1663,12 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - + if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + } + if(GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); + } $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; @@ -3578,6 +3589,18 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ""; } + print ''; + print 'ObjectClass'; + print ''; + print ''; + print ''; + + print ''; + print 'ObjectID'; + print ''; + print ''; + print ''; + $fuser = new User($db); From dfba9a06ad59391489db79f88d3da2c1037c7976 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:39:02 +0200 Subject: [PATCH 3/6] NEW Field to link website page to an other object --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 3 --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_website_page.sql | 4 ++-- htdocs/website/class/websitepage.class.php | 8 +++++--- htdocs/website/index.php | 12 ++++-------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 23830014690..994e5d89495 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -335,6 +335,3 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (72 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; - -ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); -ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e76948808bb..e177d53d6cc 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -330,3 +330,6 @@ ALTER TABLE llx_bank ADD COLUMN origin_type varchar(64) NULL; ALTER TABLE llx_bank ADD COLUMN import_key varchar(14); ALTER TABLE llx_menu MODIFY COLUMN enabled text; + +ALTER TABLE llx_website_page ADD COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index ae339cfd119..ec2d6f4c72b 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -39,7 +39,7 @@ CREATE TABLE llx_website_page author_alias varchar(64), date_creation datetime, tms timestamp, - import_key varchar(14), -- import k + import_key varchar(14), -- import key fk_typeobject varchar(255), - fk_object varchar(255) + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index a3563418873..aa256960f0f 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaƫl Doursenaud + * Copyright (C) 2020 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -104,12 +105,13 @@ class WebsitePage extends CommonObject */ public $author_alias; - /** - * @var string path type object + /** + * @var string path of external object */ public $fk_typeobject; + /** - * @var string path name object + * @var string id of external object */ public $fk_object; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce3f41676a0..add9e07eff5 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -941,7 +942,8 @@ if ($action == 'addcontainer') $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); $objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'); - + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); @@ -981,12 +983,6 @@ if ($action == 'addcontainer') if (!$error) { - if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); - } - if (GETPOSTISSET('WEBSITE_OBJECTID')){ - $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); - } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -3592,7 +3588,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print 'ObjectClass'; print ''; - print ''; + print ''; print ''; print ''; From 848ee9decf4370f4be63faabb2ba996ecf517f09 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:49:51 +0200 Subject: [PATCH 4/6] FIX Stickler error --- htdocs/website/index.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index add9e07eff5..5de0f2c1007 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1659,12 +1659,9 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); - } - if(GETPOSTISSET('WEBSITE_OBJECTID')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); - } + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID','aZ09'); + $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; From e58d0d4af4eabba6f1197904035e551b00d0666a Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:56:19 +0200 Subject: [PATCH 5/6] FIX Stickler error --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 5de0f2c1007..29dd6c44929 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1660,7 +1660,7 @@ if ($action == 'updatemeta') $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); - $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID','aZ09'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID', 'aZ09'); $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; From c89f8b323b256e4c12fe6063c8f92c9d6394c073 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 1 Oct 2020 15:18:19 +0200 Subject: [PATCH 6/6] Rename fk_typeobject to type_object --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_website_page.sql | 2 +- htdocs/website/class/websitepage.class.php | 12 ++++++------ htdocs/website/index.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e177d53d6cc..cae368aea21 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -331,5 +331,5 @@ ALTER TABLE llx_bank ADD COLUMN import_key varchar(14); ALTER TABLE llx_menu MODIFY COLUMN enabled text; -ALTER TABLE llx_website_page ADD COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255); ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index ec2d6f4c72b..e2bec4a8a24 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -40,6 +40,6 @@ CREATE TABLE llx_website_page date_creation datetime, tms timestamp, import_key varchar(14), -- import key - fk_typeobject varchar(255), + object_type varchar(255), fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index aa256960f0f..8e9584a86ac 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -108,7 +108,7 @@ class WebsitePage extends CommonObject /** * @var string path of external object */ - public $fk_typeobject; + public $object_type; /** * @var string id of external object @@ -171,7 +171,7 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), - 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'object_type' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -273,7 +273,7 @@ class WebsitePage extends CommonObject $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key,"; - $sql .= " t.fk_typeobject,"; + $sql .= " t.object_type,"; $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level @@ -333,7 +333,7 @@ class WebsitePage extends CommonObject $this->author_alias = $obj->author_alias; $this->fk_user_modif = $obj->fk_user_modif; $this->import_key = $obj->import_key; - $this->fk_typeobject = $obj->fk_typeobject; + $this->object_type = $obj->object_type; $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -391,7 +391,7 @@ class WebsitePage extends CommonObject $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key,"; - $sql .= " t.fk_typeobject,"; + $sql .= " t.object_type,"; $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; @@ -461,7 +461,7 @@ class WebsitePage extends CommonObject $record->author_alias = $obj->author_alias; $record->fk_user_modif = $obj->fk_user_modif; $record->import_key = $obj->import_key; - $record->fk_typeobject = $obj->fk_typeobject; + $record->object_type = $obj->object_type; $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 29dd6c44929..db859573707 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -942,7 +942,7 @@ if ($action == 'addcontainer') $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); $objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'); - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + $objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS'); $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); @@ -1659,7 +1659,7 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + $objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID', 'aZ09'); $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int'));