diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php index 3987a2102e..4f8bd2eaae 100755 --- a/calendar/edit_entry_handler.php +++ b/calendar/edit_entry_handler.php @@ -108,15 +108,15 @@ $private = 'public'; } + $is_public = ($private == 'public'?1:0); $cal_stream = $phpgw->calendar->open('INBOX',intval($owner),''); $phpgw->calendar->event_init($cal_stream); -// $cat = $phpgw->categories->return_single($category); $phpgw->calendar->event_set_category($cal_stream,$category); $phpgw->calendar->event_set_title($cal_stream,$title); $phpgw->calendar->event_set_description($cal_stream,$description); $phpgw->calendar->event_set_start($cal_stream,$start[year],$start[month],$start[mday],$start[hour],$start[min],0); $phpgw->calendar->event_set_end($cal_stream,$end[year],$end[month],$end[mday],$end[hour],$end[min],0); - $phpgw->calendar->event_set_class($cal_stream,($private == 'public')); + $phpgw->calendar->event_set_class($cal_stream,$is_public); if($id != 0) { diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 18d3260b85..38dc39d1ad 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -212,7 +212,7 @@ class calendar extends calendar_ { global $phpgw_info; - $weekday = date('w',mktime(2,0,0,$month,$day,$year)); + $weekday = intval(date('w',mktime(2,0,0,$month,$day,$year))); if ($phpgw_info['user']['preferences']['calendar']['weekdaystarts'] == 'Monday') { @@ -327,7 +327,7 @@ class calendar extends calendar_ if($phpgw_info['server']['calendar_type'] == 'sql') { $this->stream->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__); - $this->stream->query('UPDATE phpgw_cal_user SET login='.$new_owner.' WHERE login='.$account_id); + $this->stream->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_login='.$account_id); } } @@ -337,8 +337,8 @@ class calendar extends calendar_ $this->set_filter(); $owner = $owner == 0?$phpgw_info['user']['account_id']:$owner; - $sql = "AND (phpgw_cal.type='M') " - . 'AND (phpgw_cal_user.login='.$owner.' ' + $sql = "AND (phpgw_cal.cal_type='M') " + . 'AND (phpgw_cal_user.cal_login='.$owner.' ' . 'AND ((phpgw_cal_repeats.recur_enddate >= '.$this->end_repeat_day.') OR (phpgw_cal_repeats.recur_enddate=0))'; // Private @@ -519,11 +519,11 @@ class calendar extends calendar_ $this->set_filter(); $owner = !$owner?$phpgw_info['user']['account_id']:$owner; $repeating_events_matched = $this->check_repeating_entries($datetime - $this->tz_offset); - $sql = "AND (phpgw_cal.type != 'M') " + $sql = "AND (phpgw_cal.cal_type != 'M') " . 'AND ((phpgw_cal.datetime >= '.$datetime.' AND phpgw_cal.datetime <= '.($datetime + 86399).') ' . 'OR (phpgw_cal.datetime <= '.$datetime.' AND phpgw_cal.edatetime >= '.($datetime + 86399).') ' . 'OR (phpgw_cal.edatetime >= '.$datetime.' AND phpgw_cal.edatetime <= '.($datetime + 86399).')) ' - . 'AND (phpgw_cal_user.login='.$owner; + . 'AND (phpgw_cal_user.cal_login='.$owner; // Private if(strpos($this->filter,'private')) @@ -791,7 +791,7 @@ class calendar extends calendar_ { $p_g .= ' OR '; } - $p_g .= 'phpgw_cal_user.login='.$participants[$i]; + $p_g .= 'phpgw_cal_user.cal_login='.$participants[$i]; } } if($p_g) @@ -802,7 +802,7 @@ class calendar extends calendar_ if($id) { - $sql .= ' AND phpgw_cal.id <> '.$id; + $sql .= ' AND phpgw_cal.cal_id <> '.$id; } $db2 = $phpgw->db; @@ -814,7 +814,7 @@ class calendar extends calendar_ } for($i=0;$iquery('SELECT recur_type FROM phpgw_cal_repeats WHERE id='.$events[$i],__LINE__,__FILE__); + $db2->query('SELECT recur_type FROM phpgw_cal_repeats WHERE cal_id='.$events[$i],__LINE__,__FILE__); if($db2->num_rows() == 0) { $retval[] = $events[$i]; @@ -1570,9 +1570,10 @@ class calendar extends calendar_ if ($event->category) { + $cat = $phpgw->categories->return_single($event->category); $var = Array( 'field' => lang('Category'), - 'data' => $event->category + 'data' => $cat[0]['name'] ); $p->set_var($var); $p->parse('output','list',True); @@ -1698,7 +1699,10 @@ class calendar extends calendar_ $recur_end = mktime($event->recur_enddate->hour,$event->recur_enddate->min,$event->recur_enddate->sec,$event->recur_enddate->month,$event->recur_enddate->mday,$event->recur_enddate->year); if($recur_end != 0) { - $str .= lang('ends').': '.$phpgw->common->show_date($recur_end,'l, F d, Y').' '; + $recur_end -= $this->tz_offset; + $str .= lang('ends').': '.lang($phpgw->common->show_date($recur_end,'l')); + $str .= ', '.lang($phpgw->common->show_date($recur_end,'F')); + $str .= ' '.$phpgw->common->show_date($recur_end,'d, Y').' '; } } if($event->recur_type == RECUR_WEEKLY || $event->recur_type == RECUR_DAILY) @@ -1942,7 +1946,7 @@ class calendar extends calendar_ $index = ($hour + (($m * $increment) * 100)); $time_slice[$index]['marker'] = '-'; $time_slice[$index]['color'] = $phpgw_info['theme']['bg01']; - $time_display = $phpgw->common->show_date($eventstart['raw'],$$this->users_timeformat).'-'.$phpgw->common->show_date($eventend['raw'],$this->user_timeformat); + $time_display = $phpgw->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$phpgw->common->show_date($eventend['raw'],$this->user_timeformat); $time_slice[$index]['description'] = '('.$time_display.') '.$this->is_private($event,$participants[$i],'title').$this->display_status($event->users_status); } } diff --git a/calendar/inc/class.calendar_item.inc.php b/calendar/inc/class.calendar_item.inc.php index fbe0fb9517..0bcc86d60e 100755 --- a/calendar/inc/class.calendar_item.inc.php +++ b/calendar/inc/class.calendar_item.inc.php @@ -32,7 +32,7 @@ class calendar_item var $category = 0; var $title = "Unnamed Event"; var $description = "Unnamed Event"; - var $public = 0; + var $public = 1; var $alarm = 0; var $start; var $end; diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index ff27bcb485..d14b68da05 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -77,17 +77,17 @@ class calendar_ extends calendar__ function delete_calendar($stream='',$calendar='') { - $this->stream->query('SELECT id FROM phpgw_cal WHERE owner='.$calendar,__LINE__,__FILE__); + $this->stream->query('SELECT cal_id FROM phpgw_cal WHERE owner='.$calendar,__LINE__,__FILE__); if($this->stream->num_rows()) { while($this->stream->next_record()) { - $this->delete_event($stream,intval($this->stream->f('id'))); + $this->delete_event($stream,intval($this->stream->f('cal_id'))); } $this->expunge($stream); } $this->stream->lock(array('phpgw_cal_user')); - $this->stream->query('DELETE FROM phpgw_cal_user WHERE login='.$calendar,__LINE__,__FILE__); + $this->stream->query('DELETE FROM phpgw_cal_user WHERE cal_login='.$calendar,__LINE__,__FILE__); $this->stream->unlock(); return $calendar; @@ -104,7 +104,7 @@ class calendar_ extends calendar__ $this->stream->lock(array('phpgw_cal','phpgw_cal_user','phpgw_cal_repeats')); - $this->stream->query('SELECT * FROM phpgw_cal WHERE id='.$event_id,__LINE__,__FILE__); + $this->stream->query('SELECT * FROM phpgw_cal WHERE cal_id='.$event_id,__LINE__,__FILE__); if($this->stream->num_rows() > 0) { @@ -119,7 +119,7 @@ class calendar_ extends calendar__ // Use http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference $this->event->owner = $this->stream->f('owner'); - $this->event->id = intval($this->stream->f('id')); + $this->event->id = intval($this->stream->f('cal_id')); $this->event->public = intval($this->stream->f('is_public')); $this->event->category = intval($this->stream->f('category')); $this->event->title = $phpgw->strip_html($this->stream->f('title')); @@ -172,7 +172,7 @@ class calendar_ extends calendar__ } } - $this->stream->query('SELECT * FROM phpgw_cal_repeats WHERE id='.$event_id,__LINE__,__FILE__); + $this->stream->query('SELECT * FROM phpgw_cal_repeats WHERE cal_id='.$event_id,__LINE__,__FILE__); if($this->stream->num_rows()) { $this->stream->next_record(); @@ -205,17 +205,17 @@ class calendar_ extends calendar__ } //Legacy Support - $this->stream->query('SELECT * FROM phpgw_cal_user WHERE id='.$event_id,__LINE__,__FILE__); + $this->stream->query('SELECT * FROM phpgw_cal_user WHERE cal_id='.$event_id,__LINE__,__FILE__); if($this->stream->num_rows()) { while($this->stream->next_record()) { if($this->stream->f('cal_login') == $this->user) { - $this->event->users_status = $this->stream->f('status'); + $this->event->users_status = $this->stream->f('cal_status'); } - $this->event->participants[] = $this->stream->f('login'); - $this->event->status[] = $this->stream->f('status'); + $this->event->participants[] = $this->stream->f('cal_login'); + $this->event->status[] = $this->stream->f('cal_status'); } } } @@ -535,7 +535,7 @@ class calendar_ extends calendar__ for($k=0;$kstream->query('DELETE FROM '.$locks[$k].' WHERE id='.$event_id,__LINE__,__FILE__); + $this->stream->query('DELETE FROM '.$locks[$k].' WHERE cal_id='.$event_id,__LINE__,__FILE__); } } $this->stream->unlock(); @@ -551,7 +551,7 @@ class calendar_ extends calendar__ if($search_repeats == True) { $repeats_from = ', phpgw_cal_repeats '; - $repeats_where = 'AND (phpgw_cal_repeats.id = phpgw_cal.id) '; + $repeats_where = 'AND (phpgw_cal_repeats.cal_id = phpgw_cal.cal_id) '; } else { @@ -559,12 +559,12 @@ class calendar_ extends calendar__ $repeats_where = ''; } - $sql = 'SELECT DISTINCT phpgw_cal.id,' + $sql = 'SELECT DISTINCT phpgw_cal.cal_id,' . 'phpgw_cal.datetime,phpgw_cal.edatetime,' . 'phpgw_cal.priority ' . 'FROM phpgw_cal, phpgw_cal_user' . $repeats_from - . 'WHERE (phpgw_cal_user.id = phpgw_cal.id) ' + . 'WHERE (phpgw_cal_user.cal_id = phpgw_cal.cal_id) ' . $repeats_where . $extra; $this->stream->query($sql,__LINE__,__FILE__); @@ -578,7 +578,7 @@ class calendar_ extends calendar__ while($this->stream->next_record()) { - $retval[] = intval($this->stream->f('id')); + $retval[] = intval($this->stream->f('cal_id')); } return $retval; @@ -603,9 +603,9 @@ class calendar_ extends calendar__ $temp_name = tempnam($phpgw_info['server']['temp_dir'],'cal'); $this->stream->query('INSERT INTO phpgw_cal(title,owner,category,priority,is_public) ' . "values('".$temp_name."',".$event->owner.",'".$category."',".$event->priority.",".$event->public.")"); - $this->stream->query("SELECT id FROM phpgw_cal WHERE title='".$temp_name."'"); + $this->stream->query("SELECT cal_id FROM phpgw_cal WHERE title='".$temp_name."'"); $this->stream->next_record(); - $event->id = $this->stream->f('id'); + $event->id = $this->stream->f('cal_id'); } $tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset'])); @@ -628,15 +628,15 @@ class calendar_ extends calendar__ . 'mdatetime='.$today.', ' . 'edatetime='.$enddate.', ' . 'priority='.$event->priority.', ' - . "type='".$type."', " - . 'is_public='.$event->access.', ' - . "title='".addslashes($event->name)."', " + . "cal_type='".$type."', " + . 'is_public='.$event->public.', ' + . "title='".addslashes($event->title)."', " . "description='".addslashes($event->description)."' " - . 'WHERE id='.$event->id; + . 'WHERE cal_id='.$event->id; $this->stream->query($sql,__LINE__,__FILE__); - $this->stream->query('DELETE FROM phpgw_cal_user WHERE id='.$event->id,__LINE__,__FILE__); + $this->stream->query('DELETE FROM phpgw_cal_user WHERE cal_id='.$event->id,__LINE__,__FILE__); reset($event->participants); while (list($key,$value) = each($event->participants)) @@ -649,7 +649,7 @@ class calendar_ extends calendar__ { $status = $event->status[$key]; } - $this->stream->query('INSERT INTO phpgw_cal_user(id,login,status) ' + $this->stream->query('INSERT INTO phpgw_cal_user(cal_id,cal_login,cal_status) ' . 'VALUES('.$event->id.','.$value.",'".$status."')",__LINE__,__FILE__); } @@ -664,26 +664,26 @@ class calendar_ extends calendar__ $end = '0'; } - $this->stream->query('SELECT count(id) FROM phpgw_cal_repeats WHERE id='.$event->id,__LINE__,__FILE__); + $this->stream->query('SELECT count(cal_id) FROM phpgw_cal_repeats WHERE cal_id='.$event->id,__LINE__,__FILE__); $this->stream->next_record(); $num_rows = $this->stream->f(0); if($num_rows == 0) { - $this->stream->query('INSERT INTO phpgw_cal_repeats(id,recur_type,recur_enddate,recur_data,recur_interval) ' - .'VALUES('.$event->id.",'".$event->recur_type."',".$end.','.$event->recur_data.','.$event->recur_interval.')',__LINE__,__FILE__); + $this->stream->query('INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_enddate,recur_data,recur_interval) ' + .'VALUES('.$event->id.','.$event->recur_type.','.$end.','.$event->recur_data.','.$event->recur_interval.')',__LINE__,__FILE__); } else { $this->stream->query('UPDATE phpgw_cal_repeats ' - ."SET recur_type='".$event->rpt_type."', " - ."recur_end='".$end."', " - ."recur_data='".$event->recur_data."', recur_interval=".$event->recur_interval.' ' - .'WHERE id='.$event->id,__LINE__,__FILE__); + .'SET recur_type='.$event->recur_type.', ' + .'recur_enddate='.$end.', ' + .'recur_data='.$event->recur_data.', recur_interval='.$event->recur_interval.' ' + .'WHERE cal_id='.$event->id,__LINE__,__FILE__); } } else { - $this->stream->query('DELETE FROM phpgw_cal_repeats WHERE id='.$event->id,__LINE__,__FILE__); + $this->stream->query('DELETE FROM phpgw_cal_repeats WHERE cal_id='.$event->id,__LINE__,__FILE__); } $this->stream->unlock(); @@ -706,7 +706,7 @@ class calendar_ extends calendar__ TENTATIVE => 'T', ACCEPTED => 'A' ); - $this->stream->query("UPDATE phpgw_cal_user SET status='".$status_code_short[$status]."' WHERE id=".$id." AND login=".$owner,__LINE__,__FILE__); + $this->stream->query("UPDATE phpgw_cal_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__); return True; } diff --git a/setup/sql/mysql_droptables.inc.php b/setup/sql/mysql_droptables.inc.php index ebbb995706..b46e18ecad 100644 --- a/setup/sql/mysql_droptables.inc.php +++ b/setup/sql/mysql_droptables.inc.php @@ -25,6 +25,9 @@ $phpgw_setup->db->query("DROP TABLE phpgw_addressbook"); $phpgw_setup->db->query("DROP TABLE phpgw_addressbook_extra"); $phpgw_setup->db->query("DROP TABLE phpgw_todo"); + @$phpgw_setup->db->query("DROP TABLE phpgw_cal"); + @$phpgw_setup->db->query("DROP TABLE phpgw_cal_repeats"); + @$phpgw_setup->db->query("DROP TABLE phpgw_cal_user"); $phpgw_setup->db->query("DROP TABLE newsgroups"); $phpgw_setup->db->query("DROP TABLE news_msg"); $phpgw_setup->db->query("DROP TABLE lang"); @@ -40,9 +43,6 @@ $phpgw_setup->db->query("DROP TABLE calendar_entry"); $phpgw_setup->db->query("DROP TABLE calendar_entry_user"); $phpgw_setup->db->query("DROP TABLE calendar_entry_repeats"); - $phpgw_setup->db->query("DROP TABLE calendar_entry"); - $phpgw_setup->db->query("DROP TABLE calendar_entry_repeats"); - $phpgw_setup->db->query("DROP TABLE calendar_entry_user"); /* Legacy tables */ diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index ff6465aa6b..2f0e8e4b46 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -211,7 +211,7 @@ $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal ( - id int(11) DEFAULT '0' NOT NULL auto_increment, + cal_id int(11) DEFAULT '0' NOT NULL auto_increment, owner int(11) DEFAULT '0' NOT NULL, category int(11) DEFAULT '0' NOT NULL , groups varchar(255), @@ -219,16 +219,16 @@ mdatetime int(11), edatetime int(11), priority int(11) DEFAULT '2' NOT NULL, - type varchar(10), + cal_type varchar(10), is_public int DEFAULT '1' NOT NULL, title varchar(80) NOT NULL, description text, - PRIMARY KEY (id) + PRIMARY KEY (cal_id) )"; $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal_repeats ( - id int(11) DEFAULT '0' NOT NULL, + cal_id int(11) DEFAULT '0' NOT NULL, recur_type int DEFAULT '0' NOT NULL, recur_use_end int DEFAULT '0', recur_enddate int(11) DEFAULT '0', @@ -238,9 +238,9 @@ $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal_user ( - id int(11) DEFAULT '0' NOT NULL, - login int(11) DEFAULT '0' NOT NULL, - status char(1) DEFAULT 'A', + cal_id int(11) DEFAULT '0' NOT NULL, + cal_login int(11) DEFAULT '0' NOT NULL, + cal_status char(1) DEFAULT 'A', PRIMARY KEY (cal_id, cal_login) )"; $phpgw_setup->db->query($sql); diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index c77230ca96..e0df408280 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -1507,7 +1507,7 @@ $phpgw_setup->db->query("UPDATE calendar_entry SET cal_access='0' WHERE cal_access='private'",__LINE__,__FILE__); $phpgw_setup->db->query("UPDATE calendar_entry SET cal_access='1' WHERE cal_access='public'",__LINE__,__FILE__); $phpgw_setup->db->query("UPDATE calendar_entry SET cal_access='2' WHERE cal_access='group'",__LINE__,__FILE__); - $phpgw_setup->db->query("alter table calendar_entry change cal_id id int(11) DEFAULT '0' NOT NULL auto_increment",__LINE__,__FILE__); +// $phpgw_setup->db->query("alter table calendar_entry change cal_id cal_id int(11) DEFAULT '0' NOT NULL auto_increment",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_owner owner int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry add column category int(11) DEFAULT '0' NOT NULL after owner",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_group groups varchar(255)",__LINE__,__FILE__); @@ -1515,7 +1515,7 @@ $phpgw_setup->db->query("alter table calendar_entry change cal_mdatetime mdatetime int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_edatetime edatetime int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_priority priority int(11) DEFAULT '2' NOT NULL",__LINE__,__FILE__); - $phpgw_setup->db->query("alter table calendar_entry change cal_type type varchar(10)",__LINE__,__FILE__); +// $phpgw_setup->db->query("alter table calendar_entry change cal_type cal_type varchar(10)",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_access is_public int DEFAULT '1' NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_name title varchar(80) NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry change cal_description description text",__LINE__,__FILE__); @@ -1538,7 +1538,7 @@ $new_days += (substr($days,6,1)=='Y'?M_SATURDAY:0); $temp_db->query("UPDATE calendar_entry_repeats SET cal_days = '".$new_days."' WHERE cal_id=".$id,__LINE__,__FILE__); } - $phpgw_setup->db->query("alter table calendar_entry_repeats change cal_id id int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); +// $phpgw_setup->db->query("alter table calendar_entry_repeats change cal_id cal_id int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry_repeats change cal_type recur_type int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); // I'm thinking I can delete the use_end field and just check to see if the end is != 0.... // $phpgw_setup->db->query("alter table calendar_entry_repeats drop recur_use_end",__LINE__,__FILE__); @@ -1550,12 +1550,12 @@ while(list($key,$value) = each($rpt_type)) { - $phpgw_setup->db->query("UPDATE phpgw_cal_repeats SET recur_type=".$value." WHERE id=".$key,__LINE__,__FILE__); + $phpgw_setup->db->query("UPDATE phpgw_cal_repeats SET recur_type=".$value." WHERE cal_id=".$key,__LINE__,__FILE__); } - $phpgw_setup->db->query("alter table calendar_entry_user change cal_id id int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); - $phpgw_setup->db->query("alter table calendar_entry_user change cal_login login int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); - $phpgw_setup->db->query("alter table calendar_entry_user change cal_status status char(1) DEFAULT 'A'",__LINE__,__FILE__); + $phpgw_setup->db->query("alter table calendar_entry_user change cal_id cal_id int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); + $phpgw_setup->db->query("alter table calendar_entry_user change cal_login cal_login int(11) DEFAULT '0' NOT NULL",__LINE__,__FILE__); + $phpgw_setup->db->query("alter table calendar_entry_user change cal_status cal_status char(1) DEFAULT 'A'",__LINE__,__FILE__); $phpgw_setup->db->query("alter table calendar_entry_user rename phpgw_cal_user",__LINE__,__FILE__); $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.002'; diff --git a/setup/sql/pgsql_droptables.inc.php b/setup/sql/pgsql_droptables.inc.php index 37066e26c2..d91b9fe234 100644 --- a/setup/sql/pgsql_droptables.inc.php +++ b/setup/sql/pgsql_droptables.inc.php @@ -32,7 +32,10 @@ $phpgw_setup->db->query("drop sequence phpgw_addressbook_id_seq"); $phpgw_setup->db->query("DROP TABLE phpgw_addressbook"); $phpgw_setup->db->query("DROP TABLE phpgw_addressbook_extra"); - + $phpgw_setup->db->query("DROP TABLE phpgw_cal"); + $phpgw_setup->db->query("DROP TABLE phpgw_cal_user"); + $phpgw_setup->db->query("DROP TABLE phpgw_cal_repeats"); + $phpgw_setup->db->query("drop sequence phpgw_cal_cal_id_seq"); $phpgw_setup->db->query("DROP TABLE phpgw_nextid"); $phpgw_setup->db->query("drop sequence todo_todo_id_seq"); @@ -49,7 +52,7 @@ $phpgw_setup->db->query("DROP TABLE calendar_entry_repeats"); $phpgw_setup->db->query("DROP sequence phpgw_cal_id_seq"); $phpgw_setup->db->query("drop sequence calendar_entry_cal_id_seq"); - + $phpgw_setup->db->query("drop sequence newsgroups_con_seq"); $phpgw_setup->db->query("DROP TABLE newsgroups"); $phpgw_setup->db->query("DROP TABLE lang"); diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index f89f473796..49f3233947 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -186,7 +186,7 @@ $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal ( - id serial, + cal_id serial, owner int DEFAULT 0 NOT NULL, category int DEFAULT 0 NOT NULL, groups varchar(255), @@ -194,7 +194,7 @@ mdatetime int4, edatetime int4, priority int DEFAULT 2 NOT NULL, - type varchar(10), + cal_type varchar(10), is_public int DEFAULT 1 NOT NULL, title varchar(80) NOT NULL, desription text @@ -202,14 +202,14 @@ $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal_user ( - id int DEFAULT 0 NOT NULL, - login int DEFAULT 0 NOT NULL, - status char(1) DEFAULT 'A' + cal_id int DEFAULT 0 NOT NULL, + cal_login int DEFAULT 0 NOT NULL, + cal_status char(1) DEFAULT 'A' )"; $phpgw_setup->db->query($sql); $sql = "CREATE TABLE phpgw_cal_repeats ( - id int DEFAULT 0 NOT NULL, + cal_id int DEFAULT 0 NOT NULL, recur_type int DEFAULT 0 NOT NULL, recur_use_end int DEFAULT 0, recur_enddate int4 DEFAULT 0, diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index b864fe7a98..234e0e1a15 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -1897,7 +1897,7 @@ $temp_db = $phpgw_setup->db; $sql = "CREATE TABLE phpgw_cal ( - id serial, + cal_id serial, owner int DEFAULT 0 NOT NULL, category int DEFAULT 0 NOT NULL, groups varchar(255), @@ -1905,7 +1905,7 @@ mdatetime int4, edatetime int4, priority int DEFAULT 2 NOT NULL, - type varchar(10), + cal_type varchar(10), is_public int DEFAULT 1 NOT NULL, title varchar(80) NOT NULL, desription text @@ -1930,7 +1930,7 @@ $public = $phpgw_setup->db->f('cal_access'); $title = $phpgw_setup->db->f('cal_name'); $description = $phpgw_setup->db->f('cal_description'); - $temp_db->query("INSERT INTO phpgw_cal(id,owner,category,groups,datetime,mdatetime,edatetime,priority,type,is_public,title,description) + $temp_db->query("INSERT INTO phpgw_cal(cal_id,owner,category,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) values($id,$owner,0,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$public,'$title','$description')",__LINE__,__FILE__); } @@ -1938,7 +1938,7 @@ $phpgw_setup->db->query("drop sequence calender_entry_cal_id_seq",__LINE__,__FILE__); $sql = "CREATE TABLE phpgw_cal_repeats ( - id int DEFAULT 0 NOT NULL, + cal_id int DEFAULT 0 NOT NULL, recur_type int DEFAULT 0 NOT NULL, recur_use_end int DEFAULT 0, recur_enddate int4 DEFAULT 0, @@ -1964,15 +1964,15 @@ $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); - $temp_db->query("INSERT INTO phpgw_cal_repeats(id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) + $temp_db->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) VALUES($id,$recur_type,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); } $phpgw_setup->db->query("drop table calendar_entry_repeats",__LINE__,__FILE__); $sql = "CREATE TABLE phpgw_cal_user ( - id int DEFAULT 0 NOT NULL, - login int DEFAULT 0 NOT NULL, - status char(1) DEFAULT 'A' + cal_id int DEFAULT 0 NOT NULL, + cal_login int DEFAULT 0 NOT NULL, + cal_status char(1) DEFAULT 'A' )"; $phpgw_setup->db->query($sql); @@ -1982,7 +1982,7 @@ $id = $phpgw_setup->db->f('cal_id'); $login = $phpgw_setup->db->f('cal_login'); $status = $phpgw_setup->db->f('cal_status'); - $temp_db->query("INSERT INTO phpgw_cal_user(id,login,status) VALUES($id,$login,'$status')",__LINE__,__FILE__); + $temp_db->query("INSERT INTO phpgw_cal_user(cal_id,cal_login,cal_status) VALUES($id,$login,'$status')",__LINE__,__FILE__); } $phpgw_setup->db->query("drop table calendar_entry_user",__LINE__,__FILE__);