mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-10 15:30:21 +01:00
fix to control the existence of content start_time/end_time before trying to construct a dateobject; changes from nathan for extended search options
This commit is contained in:
parent
410ab6a6a2
commit
e4a105db84
@ -666,20 +666,28 @@ class timesheet_bo extends so_sql_cf
|
|||||||
* Is called as hook to participate in the linking
|
* Is called as hook to participate in the linking
|
||||||
*
|
*
|
||||||
* @param string $pattern pattern to search
|
* @param string $pattern pattern to search
|
||||||
|
* @param array $options Array of options for the search
|
||||||
* @return array with ts_id - title pairs of the matching entries
|
* @return array with ts_id - title pairs of the matching entries
|
||||||
*/
|
*/
|
||||||
function link_query( $pattern )
|
function link_query( $pattern, Array &$options = array() )
|
||||||
{
|
{
|
||||||
$criteria = array();
|
$criteria = array();
|
||||||
|
$limit = false;
|
||||||
|
$need_count = false;
|
||||||
foreach(array('ts_project','ts_title','ts_description') as $col)
|
foreach(array('ts_project','ts_title','ts_description') as $col)
|
||||||
{
|
{
|
||||||
$criteria[$col] = $pattern;
|
$criteria[$col] = $pattern;
|
||||||
}
|
}
|
||||||
|
if($options['start'] || $options['num_rows']) {
|
||||||
|
$limit = array($options['start'], $options['num_rows']);
|
||||||
|
$need_count = true;
|
||||||
|
}
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach((array) $this->search($criteria,false,'','','%',false,'OR') as $ts )
|
foreach((array) $this->search($criteria,false,'','','%',false,'OR', $limit, null, '', $need_count) as $ts )
|
||||||
{
|
{
|
||||||
if ($ts) $result[$ts['ts_id']] = $this->link_title($ts);
|
if ($ts) $result[$ts['ts_id']] = $this->link_title($ts);
|
||||||
}
|
}
|
||||||
|
$options['total'] = $need_count ? $this->total : count($result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class timesheet_hooks
|
|||||||
),
|
),
|
||||||
'view_id' => 'ts_id',
|
'view_id' => 'ts_id',
|
||||||
'view_popup' => '600x400',
|
'view_popup' => '600x400',
|
||||||
|
'view_list' => 'timesheet.timesheet_ui.index',
|
||||||
'add' => array(
|
'add' => array(
|
||||||
'menuaction' => TIMESHEET_APP.'.timesheet_ui.edit',
|
'menuaction' => TIMESHEET_APP.'.timesheet_ui.edit',
|
||||||
),
|
),
|
||||||
|
@ -112,7 +112,7 @@ class timesheet_ui extends timesheet_bo
|
|||||||
$content['start_time']=$content['end_time']='00:00';
|
$content['start_time']=$content['end_time']='00:00';
|
||||||
}
|
}
|
||||||
// we only need 2 out of 3 values from start-, end-time or duration (the date in ts_start is always required!)
|
// we only need 2 out of 3 values from start-, end-time or duration (the date in ts_start is always required!)
|
||||||
if ($content['start_time'] != '00:00') // start-time specified
|
if (isset($content['start_time']) && $content['start_time'] != '00:00') // start-time specified
|
||||||
{
|
{
|
||||||
//$content['ts_start'] += $content['start_time'];
|
//$content['ts_start'] += $content['start_time'];
|
||||||
$start = new egw_time($content['ts_start']);
|
$start = new egw_time($content['ts_start']);
|
||||||
@ -120,7 +120,7 @@ class timesheet_ui extends timesheet_bo
|
|||||||
$start->setTime($start_time[0],$start_time[1]);
|
$start->setTime($start_time[0],$start_time[1]);
|
||||||
$content['ts_start'] = $start->format('ts');
|
$content['ts_start'] = $start->format('ts');
|
||||||
}
|
}
|
||||||
if ($content['end_time'] != '00:00') // end-time specified
|
if (isset($content['end_time']) && $content['end_time'] != '00:00') // end-time specified
|
||||||
{
|
{
|
||||||
$end = new egw_time($content['ts_start']);
|
$end = new egw_time($content['ts_start']);
|
||||||
$end_time = explode(':',$content['end_time']);
|
$end_time = explode(':',$content['end_time']);
|
||||||
@ -793,6 +793,9 @@ class timesheet_ui extends timesheet_bo
|
|||||||
'filter2' => (int)$GLOBALS['egw_info']['user']['preferences'][TIMESHEET_APP]['show_details'],
|
'filter2' => (int)$GLOBALS['egw_info']['user']['preferences'][TIMESHEET_APP]['show_details'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if($_GET['search']) {
|
||||||
|
$content['nm']['search'] = $_GET['search'];
|
||||||
|
}
|
||||||
$read_grants = $this->grant_list(EGW_ACL_READ);
|
$read_grants = $this->grant_list(EGW_ACL_READ);
|
||||||
$content['nm']['no_owner_col'] = count($read_grants) == 1;
|
$content['nm']['no_owner_col'] = count($read_grants) == 1;
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'];
|
if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'];
|
||||||
|
Loading…
Reference in New Issue
Block a user