mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
if db-object passed to so_sql_cf, use that also for querying custom-fields
This commit is contained in:
parent
310c241ca4
commit
6110c34aaa
@ -164,7 +164,7 @@ class so_sql_cf extends so_sql
|
||||
$this->extra_join_order = " LEFT JOIN $extra_table extra_order ON $table.$this->autoinc_id=extra_order.$this->extra_id";
|
||||
$this->extra_join_filter = " JOIN $extra_table extra_filter ON $table.$this->autoinc_id=extra_filter.$this->extra_id";
|
||||
|
||||
$this->customfields = egw_customfields::get($app);
|
||||
$this->customfields = egw_customfields::get($app, false, null, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,9 +55,10 @@ class egw_customfields implements IteratorAggregate
|
||||
* @param string $only_type2 =null if given only return fields of type2 == $only_type2
|
||||
* @param int $start =0
|
||||
* @param int $num_rows =null
|
||||
* @param egw_db $db =null reference to database instance to use
|
||||
* @return array with customfields
|
||||
*/
|
||||
function __construct($app, $all_private_too=false, $only_type2=null, $start=0, $num_rows=null)
|
||||
function __construct($app, $all_private_too=false, $only_type2=null, $start=0, $num_rows=null, egw_db $db=null)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->all_private_too = $all_private_too;
|
||||
@ -75,7 +76,8 @@ class egw_customfields implements IteratorAggregate
|
||||
{
|
||||
$query[] = $this->commasep_match('cf_type2', $only_type2);
|
||||
}
|
||||
$this->iterator = self::$db->select(self::TABLE, '*', $query, __LINE__, __FILE__,
|
||||
if (!$db) $db = self::$db;
|
||||
$this->iterator = $db->select(self::TABLE, '*', $query, __LINE__, __FILE__,
|
||||
!isset($num_rows) ? false : $start, 'ORDER BY cf_order ASC', 'phpgwapi', $num_rows);
|
||||
}
|
||||
|
||||
@ -123,16 +125,17 @@ class egw_customfields implements IteratorAggregate
|
||||
* @param string $app
|
||||
* @param boolean $all_private_too =false should all the private fields be returned too, default no
|
||||
* @param string $only_type2 =null if given only return fields of type2 == $only_type2
|
||||
* @param egw_db $db =null reference to database to use
|
||||
* @return array with customfields
|
||||
*/
|
||||
public static function get($app, $all_private_too=false, $only_type2=null)
|
||||
public static function get($app, $all_private_too=false, $only_type2=null, egw_db $db=null)
|
||||
{
|
||||
$cache_key = $app.':'.($all_private_too?'all':$GLOBALS['egw_info']['user']['account_id']).':'.$only_type2;
|
||||
$cfs = egw_cache::getInstance(__CLASS__, $cache_key);
|
||||
|
||||
if (!isset($cfs))
|
||||
{
|
||||
$cfs = iterator_to_array(new egw_customfields($app, $all_private_too, $only_type2));
|
||||
$cfs = iterator_to_array(new egw_customfields($app, $all_private_too, $only_type2, 0, null, $db));
|
||||
|
||||
egw_cache::setInstance(__CLASS__, $cache_key, $cfs);
|
||||
$cached = egw_cache::getInstance(__CLASS__, $app);
|
||||
@ -401,7 +404,7 @@ class egw_customfields implements IteratorAggregate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
self::$db->$op(self::TABLE, array(
|
||||
'cf_label' => $cf['label'],
|
||||
'cf_type' => $cf['type'],
|
||||
|
Loading…
Reference in New Issue
Block a user