From 27d6f340bfae4a1e114635cdc1e3f02a633239df Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 7 Apr 2002 14:28:43 +0000 Subject: [PATCH] GNU Patch #127 - create_defaults being called twice. --- phpgwapi/inc/class.accounts_ldap.inc.php | 13 ++++--------- phpgwapi/inc/class.accounts_sql.inc.php | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 0599d3f839..130c61b23a 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -556,7 +556,7 @@ return $in; } - function create($account_info) + function create($account_info,$default_prefs=True) { /* echo '
in create for account_lid: "'.$account_lid.'"'; */ if(empty($account_info['account_id']) || !$account_info['account_id']) @@ -688,11 +688,11 @@ } /* print ldap_error($this->ds); */ - if($account_id && is_object($GLOBALS['phpgw']->preferences)) + if($account_id && is_object($GLOBALS['phpgw']->preferences) && $default_prefs) { $GLOBALS['phpgw']->preferences->create_defaults($account_id); - return $account_id; } + return $account_id; } function auto_add($accountname, $passwd, $default_prefs = False, $default_acls = False, $expiredate = 0, $account_status = 'A') @@ -734,15 +734,10 @@ 'account_status' => $account_status, 'account_expires' => $expires ); - $this->create($acct_info); + $this->create($acct_info,$default_prefs); $accountid = $this->name2id($accountname); $this->db->transaction_begin(); - if($default_prefs) - { - $GLOBALS['phpgw']->preferences->create_defaults($accountid); - } - if($default_acls == False) { $default_group_lid = $GLOBALS['phpgw_info']['server']['default_group_lid']; diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 590922b9a7..647b098641 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -282,7 +282,7 @@ return $ret_val; } - function create($account_info) + function create($account_info,$default_prefs=True) { $this->db->query("insert into phpgw_accounts (account_lid, account_type, account_pwd, " . "account_firstname, account_lastname, account_status, account_expires) values ('" @@ -292,11 +292,11 @@ . "'," . $account_info['account_expires'] . ")",__LINE__,__FILE__); $accountid = $this->db->get_last_insert_id('phpgw_accounts','account_id'); - if($accountid && is_object($GLOBALS['phpgw']->preferences)) + if($accountid && is_object($GLOBALS['phpgw']->preferences) && $default_prefs) { $GLOBALS['phpgw']->preferences->create_defaults($accountid); - return $accountid; } + return $accountid; } function auto_add($accountname, $passwd, $default_prefs = False, $default_acls = False, $expiredate = 0, $account_status = 'A') @@ -338,14 +338,9 @@ ); $this->db->transaction_begin(); - $this->create($acct_info); + $this->create($acct_info,$default_prefs); $accountid = $this->name2id($accountname); - if($default_prefs) - { - $GLOBALS['phpgw']->preferences->create_defaults($accountid); - } - if ($default_acls == False) { $default_group_lid = $GLOBALS['phpgw_info']['server']['default_group_lid'];