forked from extern/egroupware
fixed tz_offset and creating new entries with time 0:0
This commit is contained in:
parent
8bba3699b5
commit
8f355ef32c
@ -106,6 +106,8 @@
|
||||
$this->customfields = $this->config->config_data['customfields'];
|
||||
}
|
||||
}
|
||||
$this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
|
||||
$this->tz_offset_sec = 60*60*$this->tz_offset;
|
||||
|
||||
$this->read( $info_id);
|
||||
}
|
||||
@ -296,12 +298,13 @@
|
||||
$start = 0;
|
||||
$to_include = array();
|
||||
$date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']);
|
||||
while ($infos = $this->search('info_startdate','',"user$user".($do_events?'date':'opentoday').$date_wanted,'','','','','',$start,$total))
|
||||
while ($infos = $this->search('info_startdate'.($do_events?'':' DESC'),'',
|
||||
"user$user".($do_events?'date':'opentoday').$date_wanted,'','','','','',$start,$total))
|
||||
{
|
||||
foreach($infos as $info)
|
||||
{
|
||||
$time = intval(date('Hi',$info['info_startdate']));
|
||||
$date = date('Y/m/d',$info['info_startdate']);
|
||||
$time = intval(date('Hi',$info['info_startdate']+$this->tz_offset_sec));
|
||||
$date = date('Y/m/d',$info['info_startdate']+$this->tz_offset_sec);
|
||||
if ($do_events && !$time ||
|
||||
!$do_events && $time && $date == $date_wanted)
|
||||
{
|
||||
@ -312,7 +315,7 @@
|
||||
$GLOBALS['phpgw']->html = CreateObject('etemplate.html');
|
||||
$GLOBALS['phpgw']->translation->add_app('infolog');
|
||||
}
|
||||
$title = ($do_events?$GLOBALS['phpgw']->common->formattime(date('H',$info['info_startdate']),date('i',$info['info_startdate'])).' ':'').
|
||||
$title = ($do_events?$GLOBALS['phpgw']->common->formattime(date('H',$info['info_startdate']+$this->tz_offset_sec),date('i',$info['info_startdate']+$this->tz_offset_sec)).' ':'').
|
||||
$info['info_subject'];
|
||||
$view = $this->link->view('infolog',$info['info_id']);
|
||||
$content = '';
|
||||
@ -326,8 +329,8 @@
|
||||
$content = $GLOBALS['phpgw']->html->a_href($content.' '.$title,$view).'<br>';
|
||||
|
||||
$to_include[] = array(
|
||||
'starttime' => $info['info_startdate'],
|
||||
'endtime' => $info['info_enddate'] ? $info['info_enddate'] : $info['info_startdate'],
|
||||
'starttime' => $info['info_startdate']+$this->tz_offset_sec,
|
||||
'endtime' => ($info['info_enddate'] ? $info['info_enddate'] : $info['info_startdate'])+$this->tz_offset_sec,
|
||||
'title' => $title,
|
||||
'view' => $view,
|
||||
'icons' => $icons,
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
$this->links = CreateObject('infolog.solink');
|
||||
|
||||
$this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
|
||||
|
||||
$this->read( $info_id );
|
||||
}
|
||||
|
||||
@ -183,13 +185,13 @@
|
||||
|
||||
if (isset($vars[2]) && !empty($vars[2]) && ($date = split('[-/.]',$vars[2])))
|
||||
{
|
||||
$today = mktime(0,0,0,intval($date[1]),intval($date[2]),intval($date[0]));
|
||||
$tomorrow = mktime(0,0,0,intval($date[1]),intval($date[2])+1,intval($date[0]));
|
||||
$today = mktime(-$this->tz_offset,0,0,intval($date[1]),intval($date[2]),intval($date[0]));
|
||||
$tomorrow = mktime(-$this->tz_offset,0,0,intval($date[1]),intval($date[2])+1,intval($date[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = getdate(time());
|
||||
$tomorrow = mktime(0,0,0,$now['mon'],$now['mday']+1,$now['year']);
|
||||
$now = getdate(time()-60*60*$this->tz_offset);
|
||||
$tomorrow = mktime(-$this->tz_offset,0,0,$now['mon'],$now['mday']+1,$now['year']);
|
||||
}
|
||||
switch ($filter)
|
||||
{
|
||||
@ -305,7 +307,7 @@
|
||||
}
|
||||
}
|
||||
// set parent_id to 0 for all not deleted children
|
||||
$this->db->query("UPDATA phpgw_infolog SET info_parent_id=0 WHERE info_parent_id=$info_id",__LINE__,__FILE__);
|
||||
$this->db->query("UPDATE phpgw_infolog SET info_parent_id=0 WHERE info_parent_id=$info_id",__LINE__,__FILE__);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -77,6 +77,8 @@
|
||||
|
||||
$this->tmpl = CreateObject('etemplate.etemplate');
|
||||
$this->html = &$this->tmpl->html;
|
||||
|
||||
$this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
|
||||
}
|
||||
|
||||
function get_info($info,&$readonlys,$action='',$action_id='')
|
||||
@ -88,7 +90,7 @@
|
||||
$id = $info['info_id'];
|
||||
$done = $info['info_status'] == 'done' || $info['info_status'] == 'billed';
|
||||
$info['sub_class'] = $info['info_pri'] . ($done ? '_done' : '');
|
||||
if (!$done && $info['info_enddate'] < time()+(60*60)*$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])
|
||||
if (!$done && $info['info_enddate'] < time()+60*60*$this->tz_offset)
|
||||
{
|
||||
$info['end_class'] = 'overdue';
|
||||
}
|
||||
@ -346,13 +348,14 @@
|
||||
$action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
|
||||
$info_id = $content ? $content : get_var('info_id', array('POST','GET'));
|
||||
$type = $type ? $type : get_var('type', array('POST','GET'));
|
||||
$referer = $referer !== '' ? $referer :
|
||||
$referer = $referer !== '' ? $referer :
|
||||
ereg_replace('^.*'.$GLOBALS['phpgw_info']['server']['webserver_url'],'',
|
||||
get_var('HTTP_REFERER',Array('SERVER')));
|
||||
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
||||
|
||||
|
||||
$this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id );
|
||||
$content = $this->bo->so->data;
|
||||
$today = mktime(-$this->tz_offset,0,0,date('m'),date('d'),date('Y')); // time=00:00
|
||||
|
||||
if (intval($content['info_link_id']) > 0 && !$this->link->get_link($content['info_link_id']))
|
||||
{
|
||||
@ -383,7 +386,7 @@
|
||||
$content['info_lastmodified'] = '';
|
||||
if ($content['info_startdate'] < time()) // parent-startdate is in the past => today
|
||||
{
|
||||
$content['info_startdate'] = time();
|
||||
$content['info_startdate'] = $today;
|
||||
}
|
||||
if ($content['info_enddate'] < time()) // parent-enddate is in the past => empty
|
||||
{
|
||||
@ -408,7 +411,7 @@
|
||||
foreach($links as $link)
|
||||
{
|
||||
$link_id = $this->link->link('infolog',$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
|
||||
|
||||
|
||||
if ($parent['info_link_id'] == $link['link_id'])
|
||||
{
|
||||
$content['info_link_id'] = $link_id;
|
||||
@ -421,13 +424,15 @@
|
||||
case 'calendar':
|
||||
default: // to allow other apps to participate
|
||||
$content['info_link_id'] = $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
|
||||
$content['blur_title'] = $this->link->title($action,$action_id);
|
||||
|
||||
case '':
|
||||
if ($info_id)
|
||||
{
|
||||
break; // normal edit
|
||||
}
|
||||
case 'new': // new entry
|
||||
$content['info_startdate'] = time();
|
||||
$content['info_startdate'] = $today;
|
||||
if ($type != '')
|
||||
{
|
||||
$content['info_type'] = $type;
|
||||
@ -435,7 +440,7 @@
|
||||
break;
|
||||
}
|
||||
$content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : True;
|
||||
|
||||
|
||||
if (!isset($this->bo->enums['type'][$content['info_type']]))
|
||||
{
|
||||
$content['info_type'] = 'note';
|
||||
|
Loading…
Reference in New Issue
Block a user