allow to use nextmatch filters in calendar list-view

This commit is contained in:
Ralf Becker 2015-08-18 09:07:12 +00:00
parent 16598a21ca
commit 59ca017000
2 changed files with 22 additions and 4 deletions

View File

@ -687,7 +687,7 @@ class calendar_so
* Please Note: a search never returns repeating events more then once AND does not honor start+end date !!!
* array: everything is directly used as $where
* @param string $params['order'] ='cal_start' column-names plus optional DESC|ASC separted by comma
* @param string $params['sql_filter'] sql to be and'ed into query (fully quoted)
* @param string|array $params['sql_filter'] sql to be and'ed into query (fully quoted), or usual filter array
* @param string|array $params['cols'] what to select, default "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date",
* if specified and not false an iterator for the rows is returned
* @param string $params['append'] SQL to append to the query before $order, eg. for a GROUP BY clause
@ -746,10 +746,17 @@ class calendar_so
$private_filter = '(cal_public=1 OR cal_public=0 AND '.$this->db->expression($this->cal_table, array('cal_owner' => $params['private_grants'])) . ')';
$where[] = $private_filter;
}
if (!empty($params['sql_filter']) && is_string($params['sql_filter']))
if (!empty($params['sql_filter']))
{
if (is_string($params['sql_filter']))
{
$where[] = $params['sql_filter'];
}
elseif(is_array($params['sql_filter']))
{
$where = array_merge($where, $params['sql_filter']);
}
}
if ($users)
{
$users_by_type = array();

View File

@ -378,9 +378,20 @@ class calendar_uilist extends calendar_ui
{
$search_params['users'] = explode(',',$this->owner);
}
if ($params['col_filter'])
{
$col_filter = array();
foreach($params['col_filter'] as $name => $val)
{
if ($name != 'participants' && (string)$val !== '')
{
$col_filter[$name] = $val;
}
}
}
$rows = $js_integration_data = array();
foreach((array) $this->bo->search($search_params) as $event)
foreach((array) $this->bo->search($search_params, !empty($col_filter) ? $col_filter : null) as $event)
{
$this->to_client($event);