forked from extern/egroupware
allow to optional specify a database object (to access addressbooks in other databases)
This commit is contained in:
parent
3dc949d08e
commit
49db0c8838
@ -7,7 +7,7 @@
|
|||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @author Joerg Lehrke <jlehrke@noc.de>
|
* @author Joerg Lehrke <jlehrke@noc.de>
|
||||||
* @package addressbook
|
* @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>
|
* @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
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -144,9 +144,15 @@ class addressbook_bo extends addressbook_so
|
|||||||
*/
|
*/
|
||||||
protected $delete_history = '';
|
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)
|
if ($this->log)
|
||||||
{
|
{
|
||||||
$this->logfile = $GLOBALS['egw_info']['server']['temp_dir'].'/log-addressbook_bo';
|
$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']) {
|
if($options['start'] || $options['num_rows']) {
|
||||||
$limit = array($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 ($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)))
|
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 Cornelius Weiss <egw-AT-von-und-zu-weiss.de>
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @package addressbook
|
* @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>
|
* @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
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -205,9 +205,15 @@ class addressbook_so
|
|||||||
var $sodistrib_list;
|
var $sodistrib_list;
|
||||||
var $backend;
|
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->user = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
$this->memberships = $GLOBALS['egw']->accounts->memberships($this->user,true);
|
$this->memberships = $GLOBALS['egw']->accounts->memberships($this->user,true);
|
||||||
@ -244,7 +250,7 @@ class addressbook_so
|
|||||||
{
|
{
|
||||||
$this->contact_repository = 'sql-ldap';
|
$this->contact_repository = 'sql-ldap';
|
||||||
}
|
}
|
||||||
$this->somain = new addressbook_sql();
|
$this->somain = new addressbook_sql($db);
|
||||||
|
|
||||||
if ($this->user) // not set eg. in setup
|
if ($this->user) // not set eg. in setup
|
||||||
{
|
{
|
||||||
@ -303,7 +309,7 @@ class addressbook_so
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->soextra = new addressbook_sql();
|
$this->soextra = new addressbook_sql($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->customfields = config::get_customfields('addressbook');
|
$this->customfields = config::get_customfields('addressbook');
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @package addressbook
|
* @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
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@ -54,9 +54,15 @@ class addressbook_sql extends so_sql_cf
|
|||||||
*/
|
*/
|
||||||
var $ab2list_table = 'egw_addressbook2list';
|
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
|
// Get custom fields from addressbook instead of phpgwapi
|
||||||
$this->customfields = config::get_customfields('addressbook');
|
$this->customfields = config::get_customfields('addressbook');
|
||||||
|
Loading…
Reference in New Issue
Block a user