Work on website module

This commit is contained in:
Laurent Destailleur 2017-11-03 13:52:03 +01:00
parent fa1fbe7db7
commit 55386a3ae2
9 changed files with 105 additions and 25 deletions

View File

@ -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'

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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/>.
--
-- ===================================================================
ALTER TABLE llx_website_account_extrafields ADD INDEX idx_website_account_extrafields (fk_object);

View File

@ -0,0 +1,23 @@
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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;

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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/>.
--
-- ===================================================================
ALTER TABLE llx_website_extrafields ADD INDEX idx_website_extrafields (fk_object);

View File

@ -1,4 +1,4 @@
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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,

View File

@ -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;