mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-14 20:14:11 +01:00
allow to optional specify a database object (to access addressbooks in other databases)
This commit is contained in:
parent
39d1c63517
commit
b01231a5cf
@ -7,7 +7,7 @@
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @author Joerg Lehrke <jlehrke@noc.de>
|
||||
* @package addressbook
|
||||
* @copyright (c) 2005-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005/6 by Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
@ -144,9 +144,15 @@ class addressbook_bo extends addressbook_so
|
||||
*/
|
||||
protected $delete_history = '';
|
||||
|
||||
function __construct($contact_app='addressbook')
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $contact_app='addressbook' used for acl->get_grants()
|
||||
* @param egw_db $db=null
|
||||
*/
|
||||
function __construct($contact_app='addressbook',egw_db $db=null)
|
||||
{
|
||||
parent::__construct($contact_app);
|
||||
parent::__construct($contact_app,$db);
|
||||
if ($this->log)
|
||||
{
|
||||
$this->logfile = $GLOBALS['egw_info']['server']['temp_dir'].'/log-addressbook_bo';
|
||||
@ -1207,6 +1213,7 @@ class addressbook_bo extends addressbook_so
|
||||
if($options['start'] || $options['num_rows']) {
|
||||
$limit = array($options['start'], $options['num_rows']);
|
||||
}
|
||||
$filter = (array)$options['filter'];
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
||||
if (($contacts = parent::search($criteria,false,'org_name,n_family,n_given,cat_id','','%',false,'OR', $limit, $filter)))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @author Cornelius Weiss <egw-AT-von-und-zu-weiss.de>
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package addressbook
|
||||
* @copyright (c) 2005-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005/6 by Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
@ -205,9 +205,15 @@ class addressbook_so
|
||||
var $sodistrib_list;
|
||||
var $backend;
|
||||
|
||||
function __construct($contact_app='addressbook')
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $contact_app='addressbook' used for acl->get_grants()
|
||||
* @param egw_db $db=null
|
||||
*/
|
||||
function __construct($contact_app='addressbook',egw_db $db=null)
|
||||
{
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
$this->db = is_null($db) ? $GLOBALS['egw']->db : $db;
|
||||
|
||||
$this->user = $GLOBALS['egw_info']['user']['account_id'];
|
||||
$this->memberships = $GLOBALS['egw']->accounts->memberships($this->user,true);
|
||||
@ -244,7 +250,7 @@ class addressbook_so
|
||||
{
|
||||
$this->contact_repository = 'sql-ldap';
|
||||
}
|
||||
$this->somain = new addressbook_sql();
|
||||
$this->somain = new addressbook_sql($db);
|
||||
|
||||
if ($this->user) // not set eg. in setup
|
||||
{
|
||||
@ -303,7 +309,7 @@ class addressbook_so
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->soextra = new addressbook_sql();
|
||||
$this->soextra = new addressbook_sql($db);
|
||||
}
|
||||
|
||||
$this->customfields = config::get_customfields('addressbook');
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package addressbook
|
||||
* @copyright (c) 2006-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2006-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -54,9 +54,15 @@ class addressbook_sql extends so_sql_cf
|
||||
*/
|
||||
var $ab2list_table = 'egw_addressbook2list';
|
||||
|
||||
function __construct()
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param egw_db $db=null
|
||||
*/
|
||||
function __construct(egw_db $db=null)
|
||||
{
|
||||
parent::__construct('phpgwapi','egw_addressbook','egw_addressbook_extra','contact_');
|
||||
parent::__construct('phpgwapi','egw_addressbook','egw_addressbook_extra','contact_',
|
||||
$extra_key='_name',$extra_value='_value',$extra_id='_id',$db);
|
||||
|
||||
// Get custom fields from addressbook instead of phpgwapi
|
||||
$this->customfields = config::get_customfields('addressbook');
|
||||
|
Loading…
Reference in New Issue
Block a user