mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-30 17:58:39 +01:00
Added a new field to the holiday table for observance rules.
This commit is contained in:
parent
158c78afb6
commit
c8f940a8ee
@ -98,7 +98,7 @@ class calendar_holiday
|
||||
{
|
||||
// echo 'Line #'.$i.' : '.$lines[$i]."<br>\n";
|
||||
$holiday = explode("\t",$lines[$i]);
|
||||
if(count($holiday) == 6)
|
||||
if(count($holiday) == 7)
|
||||
{
|
||||
$loc = $holiday[0];
|
||||
$name = addslashes($holiday[1]);
|
||||
@ -106,8 +106,9 @@ class calendar_holiday
|
||||
$month = intval($holiday[3]);
|
||||
$occurence = intval($holiday[4]);
|
||||
$dow = intval($holiday[5]);
|
||||
$observ_rule = intval($holidays[6]);
|
||||
// echo "Inserting LOCALE='".$loc."' NAME='".$name."' extra=(".$day.'/'.$month.'/'.$occurence.'/'.$dow.'/'.")<br>\n";
|
||||
$sql = "INSERT INTO phpgw_cal_holidays(locale,name,mday,month_num,occurence,dow) VALUES('$loc','$name',$day,$month,$occurence,$dow)";
|
||||
$sql = "INSERT INTO phpgw_cal_holidays(locale,name,mday,month_num,occurence,dow,observance_rule) VALUES('$loc','$name',$day,$month,$occurence,$dow,$observ_rule)";
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
@ -134,31 +135,36 @@ class calendar_holiday
|
||||
else
|
||||
{
|
||||
$day = $holiday['day'];
|
||||
$dow = $phpgw->calendar->day_of_week($this->year,$holiday['month'],$day);
|
||||
// This now calulates Observed holidays and creates a new entry for them.
|
||||
if($dow == 0)
|
||||
if($holiday['observance_rule'] == True)
|
||||
{
|
||||
$i++;
|
||||
$this->holidays[$i]['locale'] = $holiday['locale'].' (Observed)';
|
||||
$this->holidays[$i]['name'] = $holiday['name'];
|
||||
$this->holidays[$i]['day'] = $holiday['day'] + 1;
|
||||
$this->holidays[$i]['month'] = $holiday['month'];
|
||||
$this->holidays[$i]['occurence'] = $holiday['occurence'];
|
||||
$this->holidays[$i]['dow'] = $holiday['dow'];
|
||||
$this->holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$this->year) - $this->tz_offset;
|
||||
// echo 'Calculating for year('.$this->year.') month('.$this->holidays[$i]['month'].') dow('.$this->holidays[$i]['dow'].') occurence('.$this->holidays[$i]['occurence'].') datetime('.$this->holidays[$i]['date'].') DATE('.date('Y.m.d H:i:s',$this->holidays[$i]['date']).')<br>'."\n";
|
||||
}
|
||||
elseif($dow == 6)
|
||||
{
|
||||
$i++;
|
||||
$this->holidays[$i]['locale'] = $holiday['locale'].' (Observed)';
|
||||
$this->holidays[$i]['name'] = $holiday['name'];
|
||||
$this->holidays[$i]['day'] = $holiday['day'] - 1;
|
||||
$this->holidays[$i]['month'] = $holiday['month'];
|
||||
$this->holidays[$i]['occurence'] = $holiday['occurence'];
|
||||
$this->holidays[$i]['dow'] = $holiday['dow'];
|
||||
$this->holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$this->year) - $this->tz_offset;
|
||||
// echo 'Calculating for year('.$this->year.') month('.$this->holidays[$i]['month'].') dow('.$this->holidays[$i]['dow'].') occurence('.$this->holidays[$i]['occurence'].') datetime('.$this->holidays[$i]['date'].') DATE('.date('Y.m.d H:i:s',$this->holidays[$i]['date']).')<br>'."\n";
|
||||
$dow = $phpgw->calendar->day_of_week($this->year,$holiday['month'],$day);
|
||||
// This now calulates Observed holidays and creates a new entry for them.
|
||||
if($dow == 0)
|
||||
{
|
||||
$i++;
|
||||
$this->holidays[$i]['locale'] = $holiday['locale'].' (Observed)';
|
||||
$this->holidays[$i]['name'] = $holiday['name'];
|
||||
$this->holidays[$i]['day'] = $holiday['day'] + 1;
|
||||
$this->holidays[$i]['month'] = $holiday['month'];
|
||||
$this->holidays[$i]['occurence'] = $holiday['occurence'];
|
||||
$this->holidays[$i]['dow'] = $holiday['dow'];
|
||||
$this->holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$this->year) - $this->tz_offset;
|
||||
$this->holidays[$i]['obervance_rule'] = 0;
|
||||
// echo 'Calculating for year('.$this->year.') month('.$this->holidays[$i]['month'].') dow('.$this->holidays[$i]['dow'].') occurence('.$this->holidays[$i]['occurence'].') datetime('.$this->holidays[$i]['date'].') DATE('.date('Y.m.d H:i:s',$this->holidays[$i]['date']).')<br>'."\n";
|
||||
}
|
||||
elseif($dow == 6)
|
||||
{
|
||||
$i++;
|
||||
$this->holidays[$i]['locale'] = $holiday['locale'].' (Observed)';
|
||||
$this->holidays[$i]['name'] = $holiday['name'];
|
||||
$this->holidays[$i]['day'] = $holiday['day'] - 1;
|
||||
$this->holidays[$i]['month'] = $holiday['month'];
|
||||
$this->holidays[$i]['occurence'] = $holiday['occurence'];
|
||||
$this->holidays[$i]['dow'] = $holiday['dow'];
|
||||
$this->holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$this->year) - $this->tz_offset;
|
||||
$this->holidays[$i]['obervance_rule'] = 0;
|
||||
// echo 'Calculating for year('.$this->year.') month('.$this->holidays[$i]['month'].') dow('.$this->holidays[$i]['dow'].') occurence('.$this->holidays[$i]['occurence'].') datetime('.$this->holidays[$i]['date'].') DATE('.date('Y.m.d H:i:s',$this->holidays[$i]['date']).')<br>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$datetime = mktime(0,0,0,$holiday['month'],$day,$this->year) - $this->tz_offset;
|
||||
@ -186,6 +192,7 @@ class calendar_holiday
|
||||
$this->holidays[$i]['month'] = intval($this->db->f('month_num'));
|
||||
$this->holidays[$i]['occurence'] = intval($this->db->f('occurence'));
|
||||
$this->holidays[$i]['dow'] = intval($this->db->f('dow'));
|
||||
$this->holidays[$i]['observance_rule'] = intval($this->db->f('observance_rule'));
|
||||
if(count($this->users) == 2 && $this->users[0] != $this->users[1])
|
||||
{
|
||||
if($this->holidays[$i]['locale'] == $this->users[1])
|
||||
|
@ -1,5 +1,5 @@
|
||||
CA Quebec Civic Holiday 3 1 0 0
|
||||
CA Canadian Civic Holiday 0 8 1 1
|
||||
CA Rememberence Day 11 11 0 0
|
||||
CA Christmas Day 25 12 0 0
|
||||
CA Boxing Day 26 12 0 0
|
||||
CA Quebec Civic Holiday 3 1 0 0 1
|
||||
CA Canadian Civic Holiday 0 8 1 1 0
|
||||
CA Rememberence Day 11 11 0 0 1
|
||||
CA Christmas Day 25 12 0 0 1
|
||||
CA Boxing Day 26 12 0 0 1
|
||||
|
@ -1,13 +1,13 @@
|
||||
US New Years 1 1 0 0
|
||||
US Martin Luther King's Birthday 0 1 3 1
|
||||
US Inaugeration Day 20 1 0 0
|
||||
US Presidents Day 0 2 3 1
|
||||
US Armed Forces Day 0 5 3 6
|
||||
US Memorial Day 0 5 99 1
|
||||
US Flag Day 14 6 0 0
|
||||
US Independence Day 4 7 0 0
|
||||
US Labor Day 0 9 1 1
|
||||
US Columbus Day 0 10 2 1
|
||||
US Veterans Day 11 11 0 0
|
||||
US Thanksgiving Day 0 11 4 4
|
||||
US Christmas Day 25 12 0 0
|
||||
US New Years 1 1 0 0 1
|
||||
US Martin Luther King's Birthday 0 1 3 1 0
|
||||
US Inaugeration Day 20 1 0 0 0
|
||||
US Presidents Day 0 2 3 1 0
|
||||
US Armed Forces Day 0 5 3 6 0
|
||||
US Memorial Day 0 5 99 1 0
|
||||
US Flag Day 14 6 0 0 0
|
||||
US Independence Day 4 7 0 0 1
|
||||
US Labor Day 0 9 1 1 0
|
||||
US Columbus Day 0 10 2 1 0
|
||||
US Veterans Day 11 11 0 0 1
|
||||
US Thanksgiving Day 0 11 4 4 0
|
||||
US Christmas Day 25 12 0 0 1
|
||||
|
@ -242,6 +242,7 @@
|
||||
month_num int DEFAULT '0' NOT NULL,
|
||||
occurence int DEFAULT '0' NOT NULL,
|
||||
dow int DEFAULT '0' NOT NULL,
|
||||
observance_rule int DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (hol_id)
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
@ -1660,6 +1660,18 @@
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.009';
|
||||
}
|
||||
|
||||
$test[] = '0.9.11.009';
|
||||
function upgrade0_9_11_009()
|
||||
{
|
||||
global $phpgw_info,$phpgw_setup;
|
||||
|
||||
$phpgw_setup->db->query("alter table phpgw_cal_holidays add column observance_rule int DEFAULT '0' NOT NULL",__LINE__,__TABLE__);
|
||||
$phpgw_setup->db->query("delete from phpgw_cal_holidays",__LINE__,__FILE__);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.010';
|
||||
}
|
||||
|
||||
|
||||
reset ($test);
|
||||
while (list ($key, $value) = each ($test)){
|
||||
if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {
|
||||
|
@ -215,7 +215,9 @@
|
||||
mday int DEFAULT 0,
|
||||
month_num int DEFAULT 0,
|
||||
occurence int DEFAULT 0,
|
||||
dow int DEFAULT 0
|
||||
dow int DEFAULT 0,
|
||||
observance_rule int DEFAULT 0
|
||||
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
||||
|
@ -2180,6 +2180,17 @@
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.009';
|
||||
}
|
||||
|
||||
$test[] = '0.9.11.009';
|
||||
function upgrade0_9_11_009()
|
||||
{
|
||||
global $phpgw_info,$phpgw_setup;
|
||||
|
||||
$phpgw_setup->db->query("alter table phpgw_holidays add column observance_rule int default 0",__LINE__,__TABLE__);
|
||||
$phpgw_setup->db->query("delete from phpgw_cal_holidays",__LINE__,__FILE__);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.010';
|
||||
}
|
||||
|
||||
reset ($test);
|
||||
while (list ($key, $value) = each ($test)){
|
||||
if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {
|
||||
|
@ -11,5 +11,5 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['server']['versions']['phpgwapi'] = '0.9.11.009';
|
||||
$phpgw_info['server']['versions']['phpgwapi'] = '0.9.11.010';
|
||||
$phpgw_info['server']['versions']['current_header'] = '1.12';
|
||||
|
Loading…
Reference in New Issue
Block a user