forked from extern/egroupware
Fixes a problem where holidays in the following year are not loaded correctly.
This commit is contained in:
parent
99bf9a1305
commit
5e24b7bf9d
@ -724,6 +724,7 @@
|
||||
'readsess' => 1
|
||||
)
|
||||
);
|
||||
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||
}
|
||||
|
||||
if($event['id'])
|
||||
@ -801,10 +802,14 @@
|
||||
}
|
||||
|
||||
/* Private functions */
|
||||
function read_holidays()
|
||||
function read_holidays($year=0)
|
||||
{
|
||||
if(!$year)
|
||||
{
|
||||
$year = $this->year;
|
||||
}
|
||||
$holiday = CreateObject('calendar.boholiday');
|
||||
$holiday->prepare_read_holidays($this->year,$this->owner);
|
||||
$holiday->prepare_read_holidays($year,$this->owner);
|
||||
$this->cached_holidays = $holiday->read_holiday();
|
||||
unset($holiday);
|
||||
}
|
||||
|
@ -174,9 +174,14 @@
|
||||
function prepare_read_holidays($year=0,$owner=0)
|
||||
{
|
||||
$datetime = CreateObject('phpgwapi.datetime');
|
||||
$this->year = ($year?$year:$GLOBALS['phpgw']->common->show_date(time() - $datetime->tz_offset,'Y'));
|
||||
$this->year = (isset($year) && $year > 0?$year:$GLOBALS['phpgw']->common->show_date(time() - $datetime->tz_offset,'Y'));
|
||||
$this->owner = ($owner?$owner:$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'Setting Year to : '.$this->year.'<br>'."\n";
|
||||
}
|
||||
|
||||
if(@$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
|
||||
{
|
||||
$this->locales[] = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
|
||||
|
@ -102,6 +102,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if($params['month'] == 0)
|
||||
{
|
||||
$params['month'] = 12;
|
||||
$params['year'] = $params['year'] - 1;
|
||||
}
|
||||
elseif($params['month'] == 13)
|
||||
{
|
||||
$params['month'] = 1;
|
||||
$params['year'] = $params['year'] + 1;
|
||||
}
|
||||
|
||||
$this->bo->store_to_cache(
|
||||
Array(
|
||||
'smonth' => $params['month'],
|
||||
@ -114,7 +125,7 @@
|
||||
$params['buttons'] = (!isset($params['buttons'])?'none':$params['buttons']);
|
||||
$params['outside_month'] = (!isset($params['outside_month'])?True:$params['outside_month']);
|
||||
|
||||
$this->bo->read_holidays();
|
||||
$this->bo->read_holidays($params['year']);
|
||||
|
||||
$date = $this->bo->datetime->makegmttime(0,0,0,$params['month'],$params['day'],$params['year']);
|
||||
$month_ago = intval(date('Ymd',mktime(0,0,0,$params['month'] - 1,$params['day'],$params['year'])));
|
||||
@ -261,8 +272,6 @@
|
||||
|
||||
function get_month()
|
||||
{
|
||||
$this->bo->read_holidays();
|
||||
|
||||
$m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
|
||||
|
||||
if (!$this->bo->printer_friendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals']))
|
||||
@ -275,6 +284,7 @@
|
||||
'link' => 'day'
|
||||
)
|
||||
);
|
||||
|
||||
$minical_next = $this->mini_calendar(
|
||||
Array(
|
||||
'day' => 1,
|
||||
@ -303,6 +313,8 @@
|
||||
$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
|
||||
}
|
||||
|
||||
$this->bo->read_holidays();
|
||||
|
||||
$var = Array(
|
||||
'printer_friendly' => $printer,
|
||||
'bg_text' => $this->theme['bg_text'],
|
||||
|
Loading…
Reference in New Issue
Block a user