From 55386a3ae22dcd279d27df58e19c38987e141948 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Nov 2017 13:52:03 +0100 Subject: [PATCH] Work on website module --- ..._modBlockedlog_ActionsBlockedLog.class.php | 4 +-- .../install/mysql/migration/6.0.0-7.0.0.sql | 35 ++++++++++++++----- ...nt.key.sql => llx_website_account.key.sql} | 14 ++++---- ...iteaccount.sql => llx_website_account.sql} | 2 +- .../llx_website_account_extrafields.key.sql | 20 +++++++++++ .../llx_website_account_extrafields.sql | 23 ++++++++++++ .../tables/llx_website_extrafields.key.sql | 20 +++++++++++ ...fields.sql => llx_website_extrafields.sql} | 4 +-- htdocs/website/class/websiteaccount.class.php | 8 +++-- 9 files changed, 105 insertions(+), 25 deletions(-) rename htdocs/install/mysql/tables/{llx_websiteaccount.key.sql => llx_website_account.key.sql} (54%) rename htdocs/install/mysql/tables/{llx_websiteaccount.sql => llx_website_account.sql} (97%) create mode 100644 htdocs/install/mysql/tables/llx_website_account_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_website_account_extrafields.sql create mode 100644 htdocs/install/mysql/tables/llx_website_extrafields.key.sql rename htdocs/install/mysql/tables/{llx_websiteaccount_extrafields.sql => llx_website_extrafields.sql} (89%) diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 520e02f1810..348aeb4dcc8 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -48,13 +48,11 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers { if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - - // Test if event/record is qualified $listofqualifiedelement = array('payment', 'facture'); if (! in_array($object->element, $listofqualifiedelement)) return 1; + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Event/record is qualified if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 75edcab3c9b..84c248c3642 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -173,7 +173,18 @@ ALTER TABLE llx_menu MODIFY fk_mainmenu varchar(100); ALTER TABLE llx_menu MODIFY fk_leftmenu varchar(100); -CREATE TABLE llx_websiteaccount( +CREATE TABLE llx_website_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_website_extrafields ADD INDEX idx_website_extrafields (fk_object); + + +CREATE TABLE llx_website_account( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, login varchar(64) NOT NULL, pass_encoding varchar(24) NOT NULL, @@ -181,6 +192,7 @@ CREATE TABLE llx_websiteaccount( pass_temp varchar(128), -- temporary password when asked for forget password fk_soc integer, fk_website integer NOT NULL, + note_private text, date_last_login datetime, date_previous_login datetime, date_creation datetime NOT NULL, @@ -192,17 +204,17 @@ CREATE TABLE llx_websiteaccount( ) ENGINE=innodb; -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_import_key (import_key); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc); -ALTER TABLE llx_websiteaccount ADD UNIQUE INDEX uk_websiteaccount_login_website_soc(login, fk_website, fk_soc); +ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc); -ALTER TABLE llx_websiteaccount ADD CONSTRAINT llx_websiteaccount_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid); +ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid); -create table llx_websiteaccount_extrafields +CREATE TABLE llx_website_account_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, @@ -210,6 +222,11 @@ create table llx_websiteaccount_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; +ALTER TABLE llx_website_account_extrafields ADD INDEX idx_website_account_extrafields (fk_object); + + + + alter table llx_user add column pass_encoding varchar(24) NULL; diff --git a/htdocs/install/mysql/tables/llx_websiteaccount.key.sql b/htdocs/install/mysql/tables/llx_website_account.key.sql similarity index 54% rename from htdocs/install/mysql/tables/llx_websiteaccount.key.sql rename to htdocs/install/mysql/tables/llx_website_account.key.sql index 7b455be2df4..1302ec50d2c 100644 --- a/htdocs/install/mysql/tables/llx_websiteaccount.key.sql +++ b/htdocs/install/mysql/tables/llx_website_account.key.sql @@ -15,14 +15,14 @@ -- BEGIN MODULEBUILDER INDEXES -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_website (fk_website); -ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc); -- END MODULEBUILDER INDEXES -ALTER TABLE llx_websiteaccount ADD UNIQUE INDEX uk_websiteaccount_login_website_soc(login, fk_website, fk_soc); +ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc); -ALTER TABLE llx_websiteaccount ADD CONSTRAINT llx_websiteaccount_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid); +ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid); diff --git a/htdocs/install/mysql/tables/llx_websiteaccount.sql b/htdocs/install/mysql/tables/llx_website_account.sql similarity index 97% rename from htdocs/install/mysql/tables/llx_websiteaccount.sql rename to htdocs/install/mysql/tables/llx_website_account.sql index f48d3f31845..373ba53f484 100644 --- a/htdocs/install/mysql/tables/llx_websiteaccount.sql +++ b/htdocs/install/mysql/tables/llx_website_account.sql @@ -14,7 +14,7 @@ -- along with this program. If not, see http://www.gnu.org/licenses/. -CREATE TABLE llx_websiteaccount( +CREATE TABLE llx_website_account( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, login varchar(64) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_website_account_extrafields.key.sql b/htdocs/install/mysql/tables/llx_website_account_extrafields.key.sql new file mode 100644 index 00000000000..9970f8bc680 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_website_account_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2017 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_website_account_extrafields ADD INDEX idx_website_account_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_website_account_extrafields.sql b/htdocs/install/mysql/tables/llx_website_account_extrafields.sql new file mode 100644 index 00000000000..7bec7e958d9 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_website_account_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) 2017 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + +CREATE TABLE llx_website_account_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_website_extrafields.key.sql b/htdocs/install/mysql/tables/llx_website_extrafields.key.sql new file mode 100644 index 00000000000..1963744b701 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_website_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2017 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_website_extrafields ADD INDEX idx_website_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_websiteaccount_extrafields.sql b/htdocs/install/mysql/tables/llx_website_extrafields.sql similarity index 89% rename from htdocs/install/mysql/tables/llx_websiteaccount_extrafields.sql rename to htdocs/install/mysql/tables/llx_website_extrafields.sql index fd4d4e3653f..7ca3b94c713 100644 --- a/htdocs/install/mysql/tables/llx_websiteaccount_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_website_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2017 Laurent Destailleur -- -- 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 @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. -create table llx_websiteaccount_extrafields +CREATE TABLE llx_website_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, diff --git a/htdocs/website/class/websiteaccount.class.php b/htdocs/website/class/websiteaccount.class.php index 5e3a80fff81..c5cd4ffe788 100644 --- a/htdocs/website/class/websiteaccount.class.php +++ b/htdocs/website/class/websiteaccount.class.php @@ -42,7 +42,7 @@ class WebsiteAccount extends CommonObject /** * @var string Name of table without prefix where object is stored */ - public $table_element = 'websiteaccount'; + public $table_element = 'website_account'; /** * @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ @@ -77,8 +77,9 @@ class WebsiteAccount extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',), - 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), - 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>30, 'notnull'=>-1,), + 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-1, 'enabled'=>1, 'position'=>30), + 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1), + 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1), 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>1, 'index'=>1), 'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,), @@ -94,6 +95,7 @@ class WebsiteAccount extends CommonObject ); public $rowid; public $login; + public $pass_encoding; public $pass_crypted; public $date_last_login; public $date_previous_login;