From f30f2bef79f15b1e89244dc7ae8559b7140346bc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 3 Sep 2011 15:27:23 +0000 Subject: [PATCH] change for external module --- htdocs/core/class/conf.class.php | 2 +- .../triggers/interface_all_Demo.class.php-NORUN | 2 +- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 5 ++++- htdocs/install/mysql/tables/llx_user.sql | 14 +++----------- htdocs/main.inc.php | 2 +- htdocs/user/class/user.class.php | 15 ++++++++------- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e33db60cb78..ceeb37ad94c 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -148,7 +148,7 @@ class Conf elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_LOGIN_METHOD$/i',$key,$reg)) { $modulename = strtolower($reg[1]); - $this->login_method_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/includes/login/'; + $this->login_method_modules[] = dol_buildpath('/'.$modulename.'/includes/login/'); } // If this is constant for hook activated by a module. Value is list of hooked tabs separated with : elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg)) diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index 65b19e71bdd..1a83196a930 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -130,7 +130,7 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } - elseif ($action == 'USER_DISABLE') + elseif ($action == 'USER_ENABLEDISABLE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index bc6d62bc74d..aac272cb45a 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -14,4 +14,7 @@ UPDATE llx_c_paper_format SET active=1 WHERE active=0; ALTER TABLE llx_product_fournisseur_price ADD COLUMN fk_availability integer AFTER fk_product_fournisseur; ALTER TABLE llx_element_element MODIFY COLUMN sourcetype varchar(32) NOT NULL; -ALTER TABLE llx_element_element MODIFY COLUMN targettype varchar(32) NOT NULL; \ No newline at end of file +ALTER TABLE llx_element_element MODIFY COLUMN targettype varchar(32) NOT NULL; + +ALTER TABLE llx_user MODIFY ref_ext varchar(50); +ALTER TABLE llx_user ADD COLUMN ref_int varchar(50) AFTER ref_ext; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 24c04283ecf..006b0cc993e 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -1,7 +1,7 @@ -- ============================================================================ -- Copyright (C) 2001-2003 Rodolphe Quiedeville -- Copyright (C) 2006-2011 Laurent Destailleur --- Copyright (C) 2007-2009 Regis Houssin +-- Copyright (C) 2007-2011 Regis Houssin -- -- 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 @@ -23,7 +23,8 @@ create table llx_user rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - ref_ext varchar(30), -- reference into an external system (not used by dolibarr) + ref_ext varchar(50), -- reference into an external system (not used by dolibarr) + ref_int varchar(50), -- reference into an internal system (used by dolibarr) datec datetime, tms timestamp, @@ -58,12 +59,3 @@ create table llx_user photo varchar(255), -- filename or url of photo lang varchar(6) )ENGINE=innodb; - --- --- List of codes for the field entity --- --- 0 : superadmin or global user --- 1 : first company user --- 2 : second company user --- 3 : etc... --- \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3df25cf7117..c98166657f9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -510,7 +510,7 @@ if (! defined('NOLOGIN')) } else { - if (! empty($conf->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default + if (! empty($conf->global->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default { // Call triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4fd65fa3106..78285c8d9a1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -142,7 +142,8 @@ class User extends CommonObject $sql.= " u.datelastlogin as datel,"; $sql.= " u.datepreviouslogin as datep,"; $sql.= " u.photo as photo,"; - $sql.= " u.openid as openid"; + $sql.= " u.openid as openid,"; + $sql.= " u.ref_int, u.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; if(! empty($conf->multicompany->enabled) && $conf->entity == 1) @@ -176,6 +177,9 @@ class User extends CommonObject { $this->id = $obj->rowid; $this->ref = $obj->rowid; + + $this->ref_int = $obj->ref_int; + $this->ref_ext = $obj->ref_ext; $this->ldap_sid = $obj->ldap_sid; $this->nom = $obj->name; // TODO deprecated @@ -602,16 +606,14 @@ class User extends CommonObject $error=0; // Check parameters - if ($this->statut == $statut) - { - return 0; - } + if ($this->statut == $statut) return 0; + else $this->statut = $statut; $this->db->begin(); // Desactive utilisateur $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql.= " SET statut = ".$statut; + $sql.= " SET statut = ".$this->statut; $sql.= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); @@ -634,7 +636,6 @@ class User extends CommonObject else { $this->db->commit(); - $this->statut=$statut; return 1; } }