diff --git a/calendar/inc/class.soholiday.inc.php b/calendar/inc/class.soholiday.inc.php
new file mode 100755
index 0000000000..3f65f1b11a
--- /dev/null
+++ b/calendar/inc/class.soholiday.inc.php
@@ -0,0 +1,194 @@
+ *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
+ class soholiday
+ {
+ var $debug = False;
+ var $db;
+
+ function soholiday()
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ $this->table = 'phpgw_cal_holidays';
+ $this->table_definition = $this->db->get_table_definitions('calendar',$this->table);
+ $this->db->set_column_definitions($this->table_definition['fd']);
+ }
+
+ /* Begin Holiday functions */
+ function save_holiday($holiday)
+ {
+ // observance_rule is either "True" or unset !
+ $holiday['observance_rule'] = @$holiday['observance_rule'] ? 1 : 0;
+ $holiday['locale'] = strtoupper($holiday['locale']);
+
+ if(@$holiday['hol_id'])
+ {
+ if($this->debug)
+ {
+ echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")
\n";
+ }
+ $sql = "UPDATE $this->table SET ".$this->db->column_data_implode(',',$holiday,True,True).' WHERE hol_id='.(int)$holiday['hol_id'];
+ }
+ else
+ {
+ if($this->debug)
+ {
+ echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")
\n";
+ }
+ unset($holiday['hol_id']); // in case its 0
+ $sql = "INSERT INTO $this->table ".$this->db->column_data_implode(',',$holiday,'VALUES',True);
+ }
+ //echo "
soholiday::save_holiday(".print_r($holiday,True).") sql='$sql'
\n"; + $this->db->query($sql,__LINE__,__FILE__); + } + + function store_to_array(&$holidays) + { + while($this->db->next_record()) + { + $holidays[] = Array( + 'index' => $this->db->f('hol_id'), + 'locale' => $this->db->f('locale'), + 'name' => $GLOBALS['phpgw']->strip_html($this->db->f('name')), + 'day' => (int)$this->db->f('mday'), + 'month' => (int)$this->db->f('month_num'), + 'occurence' => (int)$this->db->f('occurence'), + 'dow' => (int)$this->db->f('dow'), + 'observance_rule' => $this->db->f('observance_rule') + ); + if($this->debug) + { + echo 'Holiday ID: '.$this->db->f('hol_id').'