From 512dd9c983fd1130ddd72f98b81bfbd92b1cd0a0 Mon Sep 17 00:00:00 2001 From: jengo Date: Wed, 1 Nov 2000 10:44:47 +0000 Subject: [PATCH] Merging in patch for addressbook --- setup/createtables_mysql.inc.php | 3 +- setup/createtables_pgsql.inc.php | 50 +++++++++------ setup/upgradetables_mysql.inc.php | 32 ++++++---- setup/upgradetables_pgsql.inc.php | 100 ++++++++++++++++++------------ version.inc.php | 2 +- 5 files changed, 112 insertions(+), 75 deletions(-) diff --git a/setup/createtables_mysql.inc.php b/setup/createtables_mysql.inc.php index 98b3380a81..e09556cc9c 100644 --- a/setup/createtables_mysql.inc.php +++ b/setup/createtables_mysql.inc.php @@ -125,8 +125,9 @@ ab_notes text, ab_company varchar(255), ab_company_id int(10) unsigned, - ab_title varchar(60), + ab_title varchar(60), ab_address2 varchar(60), + ab_url varchar(255), PRIMARY KEY (ab_id) )"; $db->query($sql); diff --git a/setup/createtables_pgsql.inc.php b/setup/createtables_pgsql.inc.php index e2e70401dd..2ef32ba522 100644 --- a/setup/createtables_pgsql.inc.php +++ b/setup/createtables_pgsql.inc.php @@ -102,28 +102,29 @@ $db->query($sql); $sql = "create table addressbook ( - ab_id serial, - ab_owner varchar(25), - ab_access varchar(10), - ab_firstname varchar(255), - ab_lastname varchar(255), - ab_email varchar(255), - ab_hphone varchar(255), - ab_wphone varchar(255), - ab_fax varchar(255), - ab_pager varchar(255), - ab_mphone varchar(255), - ab_ophone varchar(255), - ab_street varchar(255), - ab_city varchar(255), - ab_state varchar(255), - ab_zip varchar(255), - ab_bday varchar(255), - ab_notes varchar(255), - ab_company varchar(255), + ab_id serial, + ab_owner varchar(25), + ab_access varchar(10), + ab_firstname varchar(255), + ab_lastname varchar(255), + ab_email varchar(255), + ab_hphone varchar(255), + ab_wphone varchar(255), + ab_fax varchar(255), + ab_pager varchar(255), + ab_mphone varchar(255), + ab_ophone varchar(255), + ab_street varchar(255), + ab_city varchar(255), + ab_state varchar(255), + ab_zip varchar(255), + ab_bday varchar(255), + ab_notes varchar(255), + ab_company varchar(255), ab_company_id int, - ab_title varchar(60), + ab_title varchar(60), ab_address2 varchar(60) + ab_url varchar(255), )"; $db->query($sql); @@ -198,4 +199,13 @@ )"; $db->query($sql); + $sql = "CREATE TABLE categories ( + cat_id serial, + account_id int DEFAULT '0' NOT NULL, + app_name varchar(25) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description text NOT NULL + )"; + $db->query($sql); + ?> diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php index cba5eb9401..afead754d5 100644 --- a/setup/upgradetables_mysql.inc.php +++ b/setup/upgradetables_mysql.inc.php @@ -259,7 +259,7 @@ global $currentver, $phpgw_info, $db; // The 0.9.3pre1 is only temp until release - if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4") { + if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4" || $currentver == "0.9.3pre5" || $currentver == "0.9.3pre6") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { v0_9_2to0_9_3update_owner("addressbook","ab_owner"); v0_9_2to0_9_3update_owner("todo","todo_owner"); @@ -301,20 +301,28 @@ $currentver = "0.9.3pre5"; update_version_table(); } + if ($currentver == "0.9.3pre5") { - $db->query("CREATE TABLE categories ( - cat_id int(9) DEFAULT '0' NOT NULL auto_increment, - account_id int(11) DEFAULT '0' NOT NULL, - app_name varchar(25) NOT NULL, - cat_name varchar(150) NOT NULL, - cat_description text NOT NULL, - PRIMARY KEY (cat_id))" - ); - $currentver = "0.9.3pre6"; - update_version_table(); + $db->query("CREATE TABLE categories ( + cat_id int(9) DEFAULT '0' NOT NULL auto_increment, + account_id int(11) DEFAULT '0' NOT NULL, + app_name varchar(25) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description text NOT NULL, + PRIMARY KEY (cat_id))" + ); + $currentver = "0.9.3pre6"; + update_version_table(); } + + if ($currentver == "0.9.3pre6") { + $db->query("alter table addressbook add ab_url varchar(255)"); + $currentver = "0.9.3pre7"; + update_version_table(); + } + echo " \n"; - echo " Upgrade from 0.9.2 to 0.9.3pre6 is completed.\n"; + echo " Upgrade from 0.9.2 to $currentver is completed.\n"; echo " \n"; } } diff --git a/setup/upgradetables_pgsql.inc.php b/setup/upgradetables_pgsql.inc.php index 02e4032ee5..3ca9b16795 100644 --- a/setup/upgradetables_pgsql.inc.php +++ b/setup/upgradetables_pgsql.inc.php @@ -245,54 +245,72 @@ $db->query("alter table $table change $field $field int(11) NOT NULL"); } - function v0_9_2to0_9_3pre5(){ + function v0_9_2to0_9_3() + { global $currentver, $phpgw_info, $db; $didupgrade = True; // The 0.9.3pre1 is only temp until release - if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4") { - if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { - update_owner("addressbook","ab_owner"); - update_owner("todo","todo_owner"); - update_owner("webcal_entry","cal_create_by"); - update_owner("webcal_entry_user","cal_login"); - $currentver = "0.9.3pre2"; + if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4" || $currentver == "0.9.3pre5" || $currentver == "0.9.3pre6") { + if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { + update_owner("addressbook","ab_owner"); + update_owner("todo","todo_owner"); + update_owner("webcal_entry","cal_create_by"); + update_owner("webcal_entry_user","cal_login"); + $currentver = "0.9.3pre2"; } - if ($currentver == "0.9.3pre2") { - $db->query("select owner, newsgroup from users_newsgroups"); - if($db->num_rows()) { - while($db->next_record()) { - $owner[count($owner)] = $db->f("owner"); - $newsgroup[count($newsgroup)] = $db->f("newsgroup"); - } - for($i=0;$iquery("insert into preferences (preference_owner,preference_name," - ."preference_value,preference_appname) values ('".$owner[$i]."','".$newsgroup[$i]."','True'," - ."'nntp')"); - } - $db->query("drop table users_newsgroups"); - $db->query("update applications set app_tables='newsgroups' where app_name='nntp'"); - } + if ($currentver == "0.9.3pre2") { + $db->query("select owner, newsgroup from users_newsgroups"); + if ($db->num_rows()) { + while($db->next_record()) { + $owner[count($owner)] = $db->f("owner"); + $newsgroup[count($newsgroup)] = $db->f("newsgroup"); + } + for ($i=0;$iquery("insert into preferences (preference_owner,preference_name," + ."preference_value,preference_appname) values ('".$owner[$i]."','".$newsgroup[$i]."','True'," + ."'nntp')"); + } + $db->query("drop table users_newsgroups"); + $db->query("update applications set app_tables='newsgroups' where app_name='nntp'"); + } $currentver = "0.9.3pre3"; - } - if ($currentver == "0.9.3pre3") { - $db->query("alter table todo add todo_id_parent int DEFAULT 0 NOT NULL"); - $currentver = "0.9.3pre4"; - } + } - if ($currentver == "0.9.3pre4") { - $db->query("create table temp as select * from config"); - $db->query("drop table config"); - $db->query("create table config config_name varchar(255) NOT NULL UNIQUE, config_value varchar(100) NOT NULL"); - $db->query("insert into config select * from temp"); - $db->query("drop table config"); - $currentver = "0.9.3pre5"; - } + if ($currentver == "0.9.3pre3") { + $db->query("alter table todo add todo_id_parent int DEFAULT 0 NOT NULL"); + $currentver = "0.9.3pre4"; + } + + if ($currentver == "0.9.3pre4") { + $db->query("create table temp as select * from config"); + $db->query("drop table config"); + $db->query("create table config config_name varchar(255) NOT NULL UNIQUE, config_value varchar(100) NOT NULL"); + $db->query("insert into config select * from temp"); + $db->query("drop table config"); + $currentver = "0.9.3pre5"; + } + + if ($currentver == "0.9.3pre5") { + $db->query("CREATE TABLE categories ( + cat_id serial, + account_id int DEFAULT '0' NOT NULL, + app_name varchar(25) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description text NOT NULL)" + ); + $currentver = "0.9.3pre6"; + update_version_table(); + } + + if ($currentver == "0.9.3pre6") { + $db->query("alter table addressbook add ab_url varchar(255)"); + $currentver = "0.9.3pre7"; + } - - echo " \n"; - echo " Upgrade from 0.9.2 to $currentver is completed.\n"; - echo " \n"; + echo " \n"; + echo " Upgrade from 0.9.2 to $currentver is completed.\n"; + echo " \n"; } } @@ -307,7 +325,7 @@ v9052000to9072000(); v9072000to0_9_1(); v0_9_1to0_9_2(); - v0_9_2to0_9_3pre5(); + v0_9_2to0_9_3(); $db->query("update applications set app_version='".$phpgw_info["server"]["version"]."' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps')"); $db->query("update config set config_value='" . $phpgw_info["server"]["version"] . "' where " diff --git a/version.inc.php b/version.inc.php index 1b848b39f4..36956e55f2 100644 --- a/version.inc.php +++ b/version.inc.php @@ -1 +1 @@ - +