Index: branches/2.2/phpgwapi/setup/setup.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/phpgwapi/setup/setup.inc.php	(revision 3031)
@@ -14,6 +14,6 @@
 	$setup_info['phpgwapi']['name']      = 'phpgwapi';
 	$setup_info['phpgwapi']['title']     = 'phpgwapi';
-	$setup_info['phpgwapi']['version']   = '2.1.000';
-	$setup_info['phpgwapi']['versions']['current_header'] = '2.0';
+	$setup_info['phpgwapi']['version']   = '2.2.000';
+	$setup_info['phpgwapi']['versions']['current_header'] = '2.2';
 	$setup_info['phpgwapi']['enable']    = 3;
 	$setup_info['phpgwapi']['app_order'] = 1;
@@ -33,28 +33,11 @@
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_nextid';
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_categories';
-	/*
-	$setup_info['phpgwapi']['tables'][]  = 'phpgw_addressbook';
-	$setup_info['phpgwapi']['tables'][]  = 'phpgw_addressbook_extra';
-	*/
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_log';
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_log_msg';
-	/*$setup_info['phpgwapi']['tables'][]  = 'phpgw_interserv';*/
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_vfs';
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_history_log';
 	$setup_info['phpgwapi']['tables'][]  = 'phpgw_async';
 
-	/* Basic information about this app */
-	/*
-	$setup_info['notifywindow']['name']      = 'notifywindow';
-	$setup_info['notifywindow']['title']     = 'Notify Window';
-	$setup_info['notifywindow']['version']   = '1.0.0';
-	$setup_info['notifywindow']['enable']    = 2;
-	$setup_info['notifywindow']['app_order'] = 1;
-	$setup_info['notifywindow']['tables']    = '';
-	$setup_info['notifywindow']['hooks'][]   = 'home';
-	*/
 
 
 
-
-
Index: branches/2.2/phpgwapi/setup/tables_update.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/tables_update.inc.php	(revision 1835)
+++ branches/2.2/phpgwapi/setup/tables_update.inc.php	(revision 3031)
@@ -10,1635 +10,5 @@
 	\**************************************************************************/
 
-
-	/* Include older phpGroupWare update support */
-	include('tables_update_0_9_9.inc.php');
-	include('tables_update_0_9_10.inc.php');
-	include('tables_update_0_9_12.inc.php');
-
-	/* This is since the last release */
-	$test[] = '0.9.12';
-	function phpgwapi_upgrade0_9_12()
-	{
-		global $setup_info,$phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.001';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.001';
-	function phpgwapi_upgrade0_9_13_001()
-	{
-		global $setup_info,$phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_categories','cat_access', array('type' => 'varchar', 'precision' => 7));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.002';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.002';
-	function phpgwapi_upgrade0_9_13_002()
-	{
-		global $setup_info,$phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_accounts','account_file_space', array ('type' => 'varchar', 'precision' => 25));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.003';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.003';
-	function phpgwapi_upgrade0_9_13_003()
-	{
-		global $setup_info,$phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_access_log','sessionid',array('type' => 'char', 'precision' => 32));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.004';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.004';
-	function phpgwapi_upgrade0_9_13_004()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_access_log','account_id',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False));
-
-		$phpgw_setup->setup_account_object();
-
-		$phpgw_setup->oProc->query("select * from phpgw_access_log");
-		while($phpgw_setup->oProc->next_record())
-		{
-			$lid         = explode('@',$phpgw_setup->oProc->f('loginid'));
-			$account_lid = $lid[0];
-			$account_id = $accounts->name2id($account_lid);
-
-			$phpgw_setup->db->query("update phpgw_access_log set account_id='" . $account_id
-				. "' where sessionid='" . $phpgw_setup->oProc->f('sessionid') . "'");
-		}
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.005';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.005';
-	function phpgwapi_upgrade0_9_13_005()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$newtbldef = array(
-			'fd' => array(
-				'account_id' => array('type' => 'auto', 'nullable' => false),
-				'account_lid' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
-				'account_pwd' => array('type' => 'varchar', 'precision' => 32, 'nullable' => false),
-				'account_firstname' => array('type' => 'varchar', 'precision' => 50),
-				'account_lastname' => array('type' => 'varchar', 'precision' => 50),
-				'account_permissions' => array('type' => 'text'),
-				'account_groups' => array('type' => 'varchar', 'precision' => 30),
-				'account_lastlogin' => array('type' => 'int', 'precision' => 4),
-				'account_lastloginfrom' => array('type' => 'varchar', 'precision' => 255),
-				'account_lastpwd_change' => array('type' => 'int', 'precision' => 4),
-				'account_status' => array('type' => 'char', 'precision' => 1, 'nullable' => false, 'default' => 'A'),
-				'account_expires' => array('type' => 'int', 'precision' => 4),
-				'account_type' => array('type' => 'char', 'precision' => 1, 'nullable' => true)
-			),
-			'pk' => array('account_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array('account_lid')
-		);
-
-		$phpgw_setup->oProc->DropColumn('phpgw_accounts',$newtbldef,'account_file_space');
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.006';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.006';
-	function phpgwapi_upgrade0_9_13_006()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_log', array(
-				'fd' => array(
-					'log_id' 	=> array('type' => 'auto',      'precision' => 4,  'nullable' => False),
-					'log_date' 	=> array('type' => 'timestamp', 'nullable' => False),
-					'log_user' 	=> array('type' => 'int',       'precision' => 4,  'nullable' => False),
-					'log_app' 	=> array('type' => 'varchar',   'precision' => 50, 'nullable' => False),
-					'log_severity' 	=> array('type' => 'char',  'precision' => 1,  'nullable' => False)
-				),
-				'pk' => array('log_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_log_msg', array(
-				'fd' => array(
-					'log_msg_log_id' 	=> array('type' => 'auto',      'precision' => 4,  'nullable' => False),
-					'log_msg_seq_no'	=> array('type' => 'int',       'precision' => 4,  'nullable' => False),
-					'log_msg_date'		=> array('type' => 'timestamp',	'nullable' => False),
-					'log_msg_tx_fid'	=> array('type' => 'varchar',   'precision' => 4,  'nullable' => True),
-					'log_msg_tx_id'		=> array('type' => 'varchar',   'precision' => 4,  'nullable' => True),
-					'log_msg_severity'	=> array('type' => 'char',      'precision' => 1,  'nullable' => False),
-					'log_msg_code' 		=> array('type' => 'varchar',   'precision' => 30, 'nullable' => False),
-					'log_msg_msg' 		=> array('type' => 'text', 'nullable' => False),
-					'log_msg_parms'		=> array('type' => 'text', 'nullable' => False)
-			 	),
-				'pk' => array('log_msg_log_id', 'log_msg_seq_no'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.007';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.007';
-	function phpgwapi_upgrade0_9_13_007()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_log_msg','log_msg_log_id',array('type' => 'int', 'precision' => 4, 'nullable'=> False));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.008';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.008';
-	function phpgwapi_upgrade0_9_13_008()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_file',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False));
-		$phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_line',array('type' => 'int', 'precision' => 4, 'nullable'=> False));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.009';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.009';
-	function phpgwapi_upgrade0_9_13_009()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_interserv', array(
-				'fd' => array(
-					'server_id'   => array('type' => 'auto', 'nullable' => False),
-					'server_name' => array('type' => 'varchar', 'precision' => 64,  'nullable' => True),
-					'server_host' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'server_url'  => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'trust_level' => array('type' => 'int',     'precision' => 4),
-					'trust_rel'   => array('type' => 'int',     'precision' => 4),
-					'username'    => array('type' => 'varchar', 'precision' => 64,  'nullable' => True),
-					'password'    => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'admin_name'  => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'admin_email' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'server_mode' => array('type' => 'varchar', 'precision' => 16,  'nullable' => False, 'default' => 'xmlrpc'),
-					'server_security' => array('type' => 'varchar', 'precision' => 16,'nullable' => True)
-				),
-				'pk' => array('server_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.010';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.010';
-	function phpgwapi_upgrade0_9_13_010()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_sessions','session_lid',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.011';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.011';
-	function phpgwapi_upgrade0_9_13_011()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_vfs', array(
-				'fd' => array(
-					'file_id' => array('type' => 'auto','nullable' => False),
-					'owner_id' => array('type' => 'int', 'precision' => 4,'nullable' => False),
-					'createdby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True),
-					'modifiedby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True),
-					'created' => array('type' => 'date','nullable' => False,'default' => '1970-01-01'),
-					'modified' => array('type' => 'date','nullable' => True),
-					'size' => array('type' => 'int', 'precision' => 4,'nullable' => True),
-					'mime_type' => array('type' => 'varchar', 'precision' => 150,'nullable' => True),
-					'deleteable' => array('type' => 'char', 'precision' => 1,'nullable' => True,'default' => 'Y'),
-					'comment' => array('type' => 'text','nullable' => True),
-					'app' => array('type' => 'varchar', 'precision' => 25,'nullable' => True),
-					'directory' => array('type' => 'text','nullable' => True),
-					'name' => array('type' => 'text','nullable' => False),
-					'link_directory' => array('type' => 'text','nullable' => True),
-					'link_name' => array('type' => 'text','nullable' => True),
-					'version' => array('type' => 'varchar', 'precision' => 30,'nullable' => False,'default' => '0.0.0.0')
-				),
-				'pk' => array('file_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.012';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.012';
-	function phpgwapi_upgrade0_9_13_012()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_applications', 'app_tables', array('type' => 'text'));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.013';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.013';
-	function phpgwapi_upgrade0_9_13_013()
-	{
-		$GLOBALS['phpgw_setup']->oProc->CreateTable(
-			'phpgw_history_log', array(
-				'fd' => array(
-					'history_id'        => array('type' => 'auto',      'precision' => 4,  'nullable' => False),
-					'history_record_id' => array('type' => 'int',       'precision' => 4,  'nullable' => False),
-					'history_appname'   => array('type' => 'varchar',   'precision' => 64, 'nullable' => False),
-					'history_owner'     => array('type' => 'int',       'precision' => 4,  'nullable' => False),
-					'history_status'    => array('type' => 'char',      'precision' => 2,  'nullable' => False),
-					'history_new_value' => array('type' => 'text',      'nullable' => False),
-					'history_timestamp' => array('type' => 'timestamp', 'nullable' => False, 'default' => 'current_timestamp')
-
-				),
-				'pk' => array('history_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.014';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.014';
-	function phpgwapi_upgrade0_9_13_014()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_applications SET app_order=100 WHERE app_order IS NULL");
-		$GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_applications");
-		while ($GLOBALS['phpgw_setup']->oProc->next_record())
-		{
-			$app_name[]	= $GLOBALS['phpgw_setup']->oProc->f('app_name');
-			$app_title[]	= $GLOBALS['phpgw_setup']->oProc->f('app_title');
-			$app_enabled[]	= $GLOBALS['phpgw_setup']->oProc->f('app_enabled');
-			$app_order[]	= $GLOBALS['phpgw_setup']->oProc->f('app_order');
-			$app_tables[]	= $GLOBALS['phpgw_setup']->oProc->f('app_tables');
-			$app_version[]	= $GLOBALS['phpgw_setup']->oProc->f('app_version');
-		}
-
-		$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_applications');
-
-		$GLOBALS['phpgw_setup']->oProc->CreateTable(
-			'phpgw_applications', array(
-				'fd' => array(
-					'app_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => false),
-					'app_name' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
-					'app_title' => array('type' => 'varchar', 'precision' => 50),
-					'app_enabled' => array('type' => 'int', 'precision' => 4),
-					'app_order' => array('type' => 'int', 'precision' => 4),
-					'app_tables' => array('type' => 'varchar', 'precision' => 255),
-					'app_version' => array('type' => 'varchar', 'precision' => 20, 'nullable' => false, 'default' => '0.0')
-				),
-				'pk' => array('app_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('app_name')
-			)
-		);
-
-		$rec_count = count($app_name);
-		for($rec_loop=0;$rec_loop<$rec_count;$rec_loop++)
-		{
-			$GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_applications(app_id,app_name,app_title,app_enabled,app_order,app_tables,app_version) '
-				. 'VALUES('.($rec_loop + 1).",'".$app_name[$rec_loop]."','".$app_title[$rec_loop]."',".$app_enabled[$rec_loop].','.$app_order[$rec_loop].",'".$app_tables[$rec_loop]."','".$app_version[$rec_loop]."')");
-		}
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.015';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.015';
-	function phpgwapi_upgrade0_9_13_015()
-	{
-		/* Skip this for mysql 3.22.X in php4 at least */
-		if(phpversion() >= '4.0.5' && @$GLOBALS['phpgw_setup']->db->Type == 'mysql')
-		{
-			$_ver_str = @mysql_get_server_info();
-			$_ver_arr = explode(".",$_ver_str);
-			$_ver = $_ver_arr[1];
-			if((int)$_ver < 23)
-			{
-				$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.016';
-				return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-			}
-		}
-
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn(
-			'lang',
-			'message_id',
-			array(
-				'type' => 'varchar',
-				'precision' => 255,
-				'nullable' => false,
-				'default' => ''
-			)
-		);
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.016';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.016';
-	function phpgwapi_upgrade0_9_13_016()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','acl_manager','hook_acl_manager.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','add_def_pref','hook_add_def_pref.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','after_navbar','hook_after_navbar.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','deleteaccount','hook_deleteaccount.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','config','hook_config.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','manual','hook_manual.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','view_user','hook_view_user.inc.php')");
-
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','admin_deleteaccount','hook_admin_deleteaccount.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','config','hook_config.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','manual','hook_manual.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','preferences','hook_preferences.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','settings','hook_settings.inc.php')");
-
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','about','hook_about.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','add_def_pref','hook_add_def_pref.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','config_validate','hook_config_validate.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','deleteaccount','hook_deleteaccount.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','home','hook_home.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','manual','hook_manual.inc.php')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','notifywindow','hook_notifywindow.inc.php')");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.017';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.017';
-	function phpgwapi_upgrade0_9_13_017()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_history_log','history_old_value',array('type' => 'text','nullable' => False));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.018';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.13.018';
-	function phpgwapi_upgrade0_9_13_018()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.000';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.000';
-	function phpgwapi_upgrade0_9_14_000()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.001';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.001';
-	function phpgwapi_upgrade0_9_14_001()
-	{
-		// Fix bug from update script in 0.9.11.004/5:
-		// column config_app was added to table phpgw_config (which places it as last column),
-		// but in the tables_current.inc.php it was added as first column.
-		// When setup / schemaproc wants to do the AlterColum it recreates the table for pgSql,
-		// as pgSql could not change the column-type. This recreation is can not be based on 
-		// tables_current, but on running tables_baseline throught all update-scripts.
-		// Which gives at the end two different versions of the table on new or updated installs.
-		// I fix it now in the (wrong) order of the tables_current, as some apps might depend on!
-
-		$confs = array();
-		$GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_config");
-		while ($GLOBALS['phpgw_setup']->oProc->next_record())
-		{
-			$confs[] = array(
-				'config_app' => $GLOBALS['phpgw_setup']->oProc->f('config_app'),
-				'config_name' => $GLOBALS['phpgw_setup']->oProc->f('config_name'),
-				'config_value' => $GLOBALS['phpgw_setup']->oProc->f('config_value')
-			);
-		}
-		$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_config');
-
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_config',array(
-			'fd' => array(
-				'config_app' => array('type' => 'varchar', 'precision' => 50),
-				'config_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
-				'config_value' => array('type' => 'text')
-			),
-			'pk' => array(),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array('config_name')
-		));
-
-		foreach($confs as $conf)
-		{
-			$GLOBALS['phpgw_setup']->oProc->query(
-				"INSERT INTO phpgw_config (config_app,config_name,config_value) VALUES ('".
-				$conf['config_app']."','".$conf['config_name']."','".$conf['config_value']."')");
-		}
-
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE languages SET available='Yes' WHERE lang_id='cs'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.002';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.002';
-	function phpgwapi_upgrade0_9_14_002()
-	{
-		// 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api)
-		// as 0.9.15.xxx are already used in HEAD
-		
-		// this is the 0.9.15.003 update, needed for the new filemanager and vfs-classes in the api
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_vfs','content', array ('type' => 'text', 'nullable' => True));
-
-		// this is the 0.9.15.004 update, needed for the polish translations
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE languages set available='Yes' WHERE lang_id='pl'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.500';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.003';
-	function phpgwapi_upgrade0_9_14_003()
-	{
-		// goes direct to 0.9.14.500
-		return phpgwapi_upgrade0_9_14_002();
-	}
-
-	$test[] = '0.9.14.004';
-	function phpgwapi_upgrade0_9_14_004()
-	{
-		// goes direct to 0.9.14.500
-		return phpgwapi_upgrade0_9_14_002();
-	}
-
-	$test[] = '0.9.14.005';
-	function phpgwapi_upgrade0_9_14_005()
-	{
-		// goes direct to 0.9.14.500
-		return phpgwapi_upgrade0_9_14_002();
-	}
-
-	$test[] = '0.9.14.006';
-	function phpgwapi_upgrade0_9_14_006()
-	{
-		// goes direct to 0.9.14.500
-		return phpgwapi_upgrade0_9_14_002();
-	}
-
-	$test[] = '0.9.14.007';
-	function phpgwapi_upgrade0_9_14_007()
-	{
-		// goes direct to 0.9.14.500
-		return phpgwapi_upgrade0_9_14_002();
-	}
-
-	$test[] = '0.9.14.500';
-	function phpgwapi_upgrade0_9_14_500()
-	{
-		// this is the 0.9.15.001 update
-		$GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang');
-		$GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages');
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.501';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.501';
-	function phpgwapi_upgrade0_9_14_501()
-	{
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_async',array(
-			'fd' => array(
-				'id' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'next' => array('type' => 'int','precision' => '4','nullable' => False),
-				'times' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'method' => array('type' => 'varchar','precision' => '80','nullable' => False),
-				'data' => array('type' => 'text','nullable' => False)
-			),
-			'pk' => array('id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_applications',array(
-			'fd' => array(
-				'app_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'app_name' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'app_enabled' => array('type' => 'int','precision' => '4'),
-				'app_order' => array('type' => 'int','precision' => '4'),
-				'app_tables' => array('type' => 'text'),
-				'app_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => '0.0')
-			),
-			'pk' => array('app_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array('app_name')
-		),'app_title');
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.502';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.502';
-	function phpgwapi_upgrade0_9_14_502()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_preferences','old_preferences');
-
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_preferences',array(
-			'fd' => array(
-				'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False),
-				'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'preference_value' => array('type' => 'text','nullable' => False)
-			),
-			'pk' => array('preference_owner','preference_app'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-		$db2 = $GLOBALS['phpgw_setup']->db;	// we need a 2. result-set
-		$GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM old_preferences");
-		while ($GLOBALS['phpgw_setup']->oProc->next_record())
-		{
-			$owner = (int)$GLOBALS['phpgw_setup']->oProc->f('preference_owner');
-			$prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value'));
-
-			if (is_array($prefs))
-			{
-				foreach ($prefs as $app => $pref)
-				{
-					if (!empty($app) && count($pref))
-					{
-						$app = addslashes($app);
-						$pref = serialize($pref);
-						$db2->query("INSERT INTO phpgw_preferences".
-							" (preference_owner,preference_app,preference_value)".
-							" VALUES ($owner,'$app','$pref')");
-					}
-				}
-			}
-		}
-		$GLOBALS['phpgw_setup']->oProc->DropTable('old_preferences');
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.503';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.503';
-	function phpgwapi_upgrade0_9_14_503()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_addressbook','last_mod',array(
-			'type' => 'int',
-			'precision' => '4',
-			'nullable' => False
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.504';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.504';
-	function phpgwapi_upgrade0_9_14_504()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_categories','last_mod',array(
-			'type' => 'int',
-			'precision' => '4',
-			'nullable' => False
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.505';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.505';
-	function phpgwapi_upgrade0_9_14_505()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_access_log','lo',array(
-			'type' => 'int',
-			'precision' => '4',
-			'nullable' => True,
-			'default' => '0'
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.506';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.506';
-	function phpgwapi_upgrade0_9_14_506()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_vfs','content',array(
-			'type' => 'text',
-			'nullable' => True
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.507';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.507';
-	function phpgwapi_upgrade0_9_14_507()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_async','account_id',array(
-			'type' => 'int',
-			'precision' => '4',
-			'nullable' => False,
-			'default' => '0'
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.14.508';
-	function phpgwapi_upgrade0_9_14_508()
-	{
-		// the following if detects if we come from a phpGW version after the fork
-		// (0.9.14.508 < currentversion < 0.9.99) and running only baseline-deltas
-		if ($GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$currentver = explode('.',$GLOBALS['phpgw_setup']->process->currentversion);
-			if ($currentver[0] == 0 && $currentver[1] == 9 && 
-				($currentver[2] == 14 && $currentver[3] > 508 || 
-				($currentver[2] > 14 && $currentver[2] < 99)))
-			{
-				// this is a phpGW update from a version after the fork
-				$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.509';
-				//echo "currentver=".print_r($currentver,true)." ==> following the phpGW update path ==> ".$GLOBALS['setup_info']['phpgwapi']['currentver']."<br>\n";
-				return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-			}
-		}					
-		// update to 0.9.10pre3 droped the columns account_permissions and account_groups
-		// unfortunally they are still in the tables_current of 0.9.14.508
-		// so it depends on having a new or an updated install, if one have them or not
-		// we now check if they are there and drop them if thats the case
-
-		$GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_accounts',$columns);
-		$columns = explode(',',$columns);
-		if (in_array('account_permissions',$columns))
-		{
-			$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array(
-				'fd' => array(
-					'account_id' => array('type' => 'auto','nullable' => False),
-					'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False),
-					'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False),
-					'account_firstname' => array('type' => 'varchar','precision' => '50'),
-					'account_lastname' => array('type' => 'varchar','precision' => '50'),
-					'account_groups' => array('type' => 'varchar','precision' => '30'),
-					'account_lastlogin' => array('type' => 'int','precision' => '4'),
-					'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'),
-					'account_lastpwd_change' => array('type' => 'int','precision' => '4'),
-					'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'),
-					'account_expires' => array('type' => 'int','precision' => '4'),
-					'account_type' => array('type' => 'char','precision' => '1','nullable' => True)
-				),
-				'pk' => array('account_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('account_lid')
-			),'account_permissions');
-		}
-		if (in_array('account_groups',$columns))
-		{
-			$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array(
-				'fd' => array(
-					'account_id' => array('type' => 'auto','nullable' => False),
-					'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False),
-					'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False),
-					'account_firstname' => array('type' => 'varchar','precision' => '50'),
-					'account_lastname' => array('type' => 'varchar','precision' => '50'),
-					'account_lastlogin' => array('type' => 'int','precision' => '4'),
-					'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'),
-					'account_lastpwd_change' => array('type' => 'int','precision' => '4'),
-					'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'),
-					'account_expires' => array('type' => 'int','precision' => '4'),
-					'account_type' => array('type' => 'char','precision' => '1','nullable' => True)
-				),
-				'pk' => array('account_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('account_lid')
-			),'account_groups');
-		}
-
-		// we add the person_id from the .16RC1, if its not already there
-		if (!in_array('person_id',$columns))
-		{
-			$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','person_id',array(
-				'type' => 'int',
-				'precision' => '4',
-				'nullable' => True
-			));
-		}
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_primary_group',array(
-			'type' => 'int',
-			'precision' => '4',
-			'nullable' => False,
-			'default' => '0'
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.002';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.002';
-	function phpgwapi_upgrade0_9_99_002()
-	{
-		// needed for the chinese(simplified) translations
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET lang_name='Chinese(simplified)',available='Yes' WHERE lang_id='zh'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.003';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	/*
-	 * Updates from phpGroupWare after the fork
-	 */
-
-	$test[] = '0.9.14.509';
-	function phpgwapi_upgrade0_9_14_509()
-	{
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.510';
-	}
-		
-	$test[] = '0.9.14.510';
-	function phpgwapi_upgrade0_9_14_510()
-	{
-		$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log_msg');
-		$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log');
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log',array(
-			'fd' => array(
-				'log_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'log_date' => array('type' => 'timestamp','nullable' => False),
-				'log_account_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'log_account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'log_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'log_severity' => array('type' => 'char','precision' => '1','nullable' => False),
-				'log_file' => array('type' => 'varchar','precision' => '255','nullable' => False, 'default' => ''),
-				'log_line' => array('type' => 'int','precision' => '4','nullable' => False, 'default' => '0'),
-				'log_msg' => array('type' => 'text','nullable' => False)
-			),
-			'pk' => array('log_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.511';
-	}
-		
-	$test[] = '0.9.14.511';
-	function phpgwapi_upgrade0_9_14_511()
-	{
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.512';
-	}
-		
-	$test[] = '0.9.14.512';
-	function phpgwapi_upgrade0_9_14_512()
-	{
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.513';
-	}
-		
-	$test[] = '0.9.14.513';
-	function phpgwapi_upgrade0_9_14_513()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_quota',array('type' => 'int','precision' => '4','default' => -1,'nullable' => True));
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.514';
-	}
-	
-	$test[] = '0.9.14.514';
-	function phpgwapi_upgrade0_9_14_514()
-	{
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.16.000';
-	}
-		
-	$test[] = '0.9.16.000';
-	function phpgwapi_upgrade0_9_16_000()
-	{
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.16.001';
-	}
-
-	$test[] = '0.9.16.001';
-	function phpgwapi_upgrade0_9_16_001()
-	{
-		foreach($GLOBALS['phpgw_setup']->db->table_names() as $tableinfo)
-		{
-			$tablenames[] = $tableinfo['table_name'];
-		}
-		// we need to redo the 0.9.14.510 update with the new phpgw_log table
-		// we just drop and recreate the table, as it contains no important data
-		$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log');
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log',array(
-			'fd' => array(
-				'log_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'log_date' => array('type' => 'timestamp','nullable' => False),
-				'log_user' => array('type' => 'int','precision' => '4','nullable' => False),
-				'log_app' => array('type' => 'varchar','precision' => '50','nullable' => False),
-				'log_severity' => array('type' => 'char','precision' => '1','nullable' => False)
-			),
-			'pk' => array('log_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-		if (in_array('phpgw_log_msg',$tablenames)) 
-		{
-			$GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log_msg');
-		}
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log_msg',array(
-			'fd' => array(
-				'log_msg_log_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'log_msg_seq_no' => array('type' => 'int','precision' => '4','nullable' => False),
-				'log_msg_date' => array('type' => 'timestamp','nullable' => False),
-				'log_msg_tx_fid' => array('type' => 'varchar','precision' => '4','nullable' => True),
-				'log_msg_tx_id' => array('type' => 'varchar','precision' => '4','nullable' => True),
-				'log_msg_severity' => array('type' => 'char','precision' => '1','nullable' => False),
-				'log_msg_code' => array('type' => 'varchar','precision' => '30','nullable' => False),
-				'log_msg_msg' => array('type' => 'text','nullable' => False),
-				'log_msg_parms' => array('type' => 'text','nullable' => False),
-				'log_msg_file' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'log_msg_line' => array('type' => 'int','precision' => '4','nullable' => False)
-			),
-			'pk' => array('log_msg_log_id','log_msg_seq_no'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-		
-		// now we need to drop phpgw_accounts.accounts_quota from the 0.9.14.513 update
-		$GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_accounts',$columns);
-		$columns = explode(',',$columns);
-		if (in_array('account_quota',$columns))
-		{
-			$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array(
-				'fd' => array(
-					'account_id' => array('type' => 'auto','nullable' => False),
-					'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False),
-					'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False),
-					'account_firstname' => array('type' => 'varchar','precision' => '50'),
-					'account_lastname' => array('type' => 'varchar','precision' => '50'),
-					'account_lastlogin' => array('type' => 'int','precision' => '4'),
-					'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'),
-					'account_lastpwd_change' => array('type' => 'int','precision' => '4'),
-					'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'),
-					'account_expires' => array('type' => 'int','precision' => '4'),
-					'account_type' => array('type' => 'char','precision' => '1','nullable' => True)
-				),
-				'pk' => array('account_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('account_lid')
-			),'account_quota');
-		}
-		/* we dont drop phpGW's new contacts tables for now ;-)
-		foreach(array(
-			'phpgw_contact',
-			'phpgw_contact_person',
-			'phpgw_contact_org',
-			'phpgw_contact_org_person',
-			'phpgw_contact_addr',
-			'phpgw_contact_note',
-			'phpgw_contact_others',
-			'phpgw_contact_comm',
-			'phpgw_contact_comm_descr',
-			'phpgw_contact_comm_type',
-			'phpgw_contact_types',
-			'phpgw_contact_addr_type',
-			'phpgw_contact_note_type'
-		) as $table)
-		{
-			$GLOBALS['phpgw_setup']->oProc->DropTable($table);
-		}*/
-		
-		// we need to check if we stil have the original addressbook-tables and create them again if not
-		if (!in_array('phpgw_addressbook',$tablenames))
-		{
-			$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_addressbook',array(
-				'fd' => array(
-					'id' => array('type' => 'auto','nullable' => False),
-					'lid' => array('type' => 'varchar','precision' => '32'),
-					'tid' => array('type' => 'char','precision' => '1'),
-					'owner' => array('type' => 'int','precision' => '8'),
-					'access' => array('type' => 'varchar','precision' => '7'),
-					'cat_id' => array('type' => 'varchar','precision' => '32'),
-					'fn' => array('type' => 'varchar','precision' => '64'),
-					'n_family' => array('type' => 'varchar','precision' => '64'),
-					'n_given' => array('type' => 'varchar','precision' => '64'),
-					'n_middle' => array('type' => 'varchar','precision' => '64'),
-					'n_prefix' => array('type' => 'varchar','precision' => '64'),
-					'n_suffix' => array('type' => 'varchar','precision' => '64'),
-					'sound' => array('type' => 'varchar','precision' => '64'),
-					'bday' => array('type' => 'varchar','precision' => '32'),
-					'note' => array('type' => 'text'),
-					'tz' => array('type' => 'varchar','precision' => '8'),
-					'geo' => array('type' => 'varchar','precision' => '32'),
-					'url' => array('type' => 'varchar','precision' => '128'),
-					'pubkey' => array('type' => 'text'),
-					'org_name' => array('type' => 'varchar','precision' => '64'),
-					'org_unit' => array('type' => 'varchar','precision' => '64'),
-					'title' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_street' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_locality' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_region' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_postalcode' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_countryname' => array('type' => 'varchar','precision' => '64'),
-					'adr_one_type' => array('type' => 'varchar','precision' => '32'),
-					'label' => array('type' => 'text'),
-					'adr_two_street' => array('type' => 'varchar','precision' => '64'),
-					'adr_two_locality' => array('type' => 'varchar','precision' => '64'),
-					'adr_two_region' => array('type' => 'varchar','precision' => '64'),
-					'adr_two_postalcode' => array('type' => 'varchar','precision' => '64'),
-					'adr_two_countryname' => array('type' => 'varchar','precision' => '64'),
-					'adr_two_type' => array('type' => 'varchar','precision' => '32'),
-					'tel_work' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_home' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_voice' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_fax' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_msg' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_cell' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_pager' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_bbs' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_modem' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_car' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_isdn' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_video' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-					'tel_prefer' => array('type' => 'varchar','precision' => '32'),
-					'email' => array('type' => 'varchar','precision' => '64'),
-					'email_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'),
-					'email_home' => array('type' => 'varchar','precision' => '64'),
-					'email_home_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'),
-					'last_mod' => array('type' => 'int','precision' => '8','nullable' => False)
-				),
-				'pk' => array('id'),
-				'fk' => array(),
-				'ix' => array(array('tid','owner','access','n_family','n_given','email'),array('tid','cat_id','owner','access','n_family','n_given','email')),
-				'uc' => array()
-			));
-			$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_addressbook_extra',array(
-				'fd' => array(
-					'contact_id' => array('type' => 'int','precision' => '4','nullable' => False),
-					'contact_owner' => array('type' => 'int','precision' => '8'),
-					'contact_name' => array('type' => 'varchar','precision' => '255','nullable' => False),
-					'contact_value' => array('type' => 'text')
-				),
-				'pk' => array('contact_id','contact_name'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			));
-		}
-		// now we return to the version of the fork
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508';
-	}
-	
-	/*
-	 * Updates / downgrades from phpGroupWare HEAD branch
-	 */
-
-	$test[] = '0.9.15.013';
-	function phpgwapi_upgrade0_9_15_013()
-	{
-		// is db-compatible to 0.9.14.507
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.507';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.15.014';
-	function phpgwapi_upgrade0_9_15_014()
-	{
-		// is db-compatible to 0.9.14.508
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	/*
-	 * More eGroupWare 0.9.99 updates
-	 */
-
-	$test[] = '0.9.99.003';
-	function phpgwapi_upgrade0_9_99_003()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_id',array(
-			'type' => 'auto'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lid',array(
-			'type' => 'varchar',
-			'precision' => '25'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_firstname',array(
-			'type' => 'varchar',
-			'precision' => '50'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastname',array(
-			'type' => 'varchar',
-			'precision' => '50'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastlogin',array(
-			'type' => 'int',
-			'precision' => '4'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastloginfrom',array(
-			'type' => 'varchar',
-			'precision' => '255'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastpwd_change',array(
-			'type' => 'int',
-			'precision' => '4'
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_expires',array(
-			'type' => 'int',
-			'precision' => '4'
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.004';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.004';
-	function phpgwapi_upgrade0_9_99_004()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_app_sessions','content',array(
-			'type' => 'longtext'
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.005';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.005';
-	function phpgwapi_upgrade0_9_99_005()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='sl'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.006';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.006';
-	function phpgwapi_upgrade0_9_99_006()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='pt'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.007';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.007';
-	function phpgwapi_upgrade0_9_99_007()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_languages', 'lang_id', array('type' => 'varchar','precision' => '5','nullable' => False));
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('pt-br','Brazil','Yes')");
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.008';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.008';
-	function phpgwapi_upgrade0_9_99_008()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('es-es','Spanish / Spain','Yes')");
-		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('es-mx','Spanish / Mexico','Yes')");
-		$GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_languages where lang_id='es'");
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.009';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.009';
-	function phpgwapi_upgrade0_9_99_009()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn(
-			'phpgw_accounts',
-			'account_pwd',
-			array('type' => 'varchar','precision' => '100','nullable' => False)
-		);
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.010';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.010';
-	function phpgwapi_upgrade0_9_99_010()
-	{
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='uk'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.011';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.011';
-	function phpgwapi_upgrade0_9_99_011()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_categories','last_mod',array(
-			'type' => 'int',
-			'precision' => '8',
-			'nullable' => False
-		));
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_addressbook','last_mod',array(
-			'type' => 'int',
-			'precision' => '8',
-			'nullable' => False
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.012';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.012';
-	function phpgwapi_upgrade0_9_99_012()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn(
-			'phpgw_accounts',
-			'account_lid',
-			array('type' => 'varchar','precision' => '25','nullable' => False)
-		);
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.013';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.013';
-	function phpgwapi_upgrade0_9_99_013()
-	{
-		// this update fixes the problem that some users cant change their password
-		// it was caused be 0 acl_rights values in groups (inserted by setup::add_acl which is fixed too)
-		$GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_appname='preferences' AND acl_location='changepassword' AND acl_rights=0");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.014';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.99.014';
-	function phpgwapi_upgrade0_9_99_014()
-	{
-		// enabeling russian language
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='ru'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.015';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	// the following series of upgrades create indices for the api tables, RalfBecker 2004/04/03
-
-	$test[] = '0.9.99.015';
-	function phpgwapi_upgrade0_9_99_015()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_acl',array(
-			'fd' => array(
-				'acl_appname' => array('type' => 'varchar','precision' => '50','nullable' => False),
-				'acl_location' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'acl_account' => array('type' => 'int','precision' => '4','nullable' => False),
-				'acl_rights' => array('type' => 'int','precision' => '4')
-			),
-			'pk' => array('acl_appname','acl_location','acl_account'),
-			'fk' => array(),
-			'ix' => array('acl_account',array('acl_location','acl_account'),array('acl_appname','acl_account')),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.016';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.016';
-	function phpgwapi_upgrade0_9_99_016()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_categories',array(
-			'fd' => array(
-				'cat_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'cat_main' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
-				'cat_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
-				'cat_level' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '0'),
-				'cat_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
-				'cat_access' => array('type' => 'varchar','precision' => '7'),
-				'cat_appname' => array('type' => 'varchar','precision' => '50','nullable' => False),
-				'cat_name' => array('type' => 'varchar','precision' => '150','nullable' => False),
-				'cat_description' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'cat_data' => array('type' => 'text'),
-				'last_mod' => array('type' => 'int','precision' => '8','nullable' => False)
-			),
-			'pk' => array('cat_id'),
-			'fk' => array(),
-			'ix' => array(array('cat_appname','cat_owner','cat_parent','cat_level')),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.017';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.017';
-	function phpgwapi_upgrade0_9_99_017()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_lang',array(
-			'fd' => array(
-				'lang' => array('type' => 'varchar','precision' => '5','nullable' => False,'default' => ''),
-				'app_name' => array('type' => 'varchar','precision' => '100','nullable' => False,'default' => 'common'),
-				'message_id' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => ''),
-				'content' => array('type' => 'text')
-			),
-			'pk' => array('lang','app_name','message_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.018';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.018';
-	function phpgwapi_upgrade0_9_99_018()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_config',array(
-			'fd' => array(
-				'config_app' => array('type' => 'varchar','precision' => '50','nullable' => False),
-				'config_name' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'config_value' => array('type' => 'text')
-			),
-			'pk' => array('config_app','config_name'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.019';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.019';
-	function phpgwapi_upgrade0_9_99_019()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_applications',array(
-			'fd' => array(
-				'app_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'app_name' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'app_enabled' => array('type' => 'int','precision' => '4','nullable' => False),
-				'app_order' => array('type' => 'int','precision' => '4','nullable' => False),
-				'app_tables' => array('type' => 'text','nullable' => False),
-				'app_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => '0.0')
-			),
-			'pk' => array('app_id'),
-			'fk' => array(),
-			'ix' => array(array('app_enabled','app_order')),
-			'uc' => array('app_name')
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.020';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.020';
-	function phpgwapi_upgrade0_9_99_020()
-	{
-		// at least for postgres we need to change the colum-type, else we get an error in RefreshTable
-		$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_app_sessions','loginid',array(
-			'type' => 'int','precision' => '4','nullable' => False
-		));
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_app_sessions',array(
-			'fd' => array(
-				'sessionid' => array('type' => 'varchar','precision' => '128','nullable' => False),
-				'loginid' => array('type' => 'int','precision' => '4','nullable' => False),
-				'app' => array('type' => 'varchar','precision' => '25','nullable' => False),
-				'location' => array('type' => 'varchar','precision' => '128','nullable' => False),
-				'content' => array('type' => 'longtext'),
-				'session_dla' => array('type' => 'int','precision' => '4')
-			),
-			'pk' => array('sessionid','loginid','location','app'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.021';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.021';
-	function phpgwapi_upgrade0_9_99_021()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_sessions',array(
-			'fd' => array(
-				'session_id' => array('type' => 'varchar','precision' => '128','nullable' => False),
-				'session_lid' => array('type' => 'varchar','precision' => '128'),
-				'session_ip' => array('type' => 'varchar','precision' => '32'),
-				'session_logintime' => array('type' => 'int','precision' => '4'),
-				'session_dla' => array('type' => 'int','precision' => '4'),
-				'session_action' => array('type' => 'varchar','precision' => '255'),
-				'session_flags' => array('type' => 'char','precision' => '2')
-			),
-			'pk' => array(),
-			'fk' => array(),
-			'ix' => array(array('session_flags','session_dla')),
-			'uc' => array('session_id')
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.022';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.022';
-	function phpgwapi_upgrade0_9_99_022()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_history_log',array(
-			'fd' => array(
-				'history_id' => array('type' => 'auto','precision' => '4','nullable' => False),
-				'history_record_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'history_appname' => array('type' => 'varchar','precision' => '64','nullable' => False),
-				'history_owner' => array('type' => 'int','precision' => '4','nullable' => False),
-				'history_status' => array('type' => 'char','precision' => '2','nullable' => False),
-				'history_new_value' => array('type' => 'text','nullable' => False),
-				'history_timestamp' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'),
-				'history_old_value' => array('type' => 'text','nullable' => False)
-			),
-			'pk' => array('history_id'),
-			'fk' => array(),
-			'ix' => array(array('history_appname','history_record_id','history_status','history_timestamp')),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.023';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.023';
-	function phpgwapi_upgrade0_9_99_023()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_vfs',array(
-			'fd' => array(
-				'file_id' => array('type' => 'auto','nullable' => False),
-				'owner_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'createdby_id' => array('type' => 'int','precision' => '4'),
-				'modifiedby_id' => array('type' => 'int','precision' => '4'),
-				'created' => array('type' => 'date','nullable' => False,'default' => '1970-01-01'),
-				'modified' => array('type' => 'date'),
-				'size' => array('type' => 'int','precision' => '4'),
-				'mime_type' => array('type' => 'varchar','precision' => '64'),
-				'deleteable' => array('type' => 'char','precision' => '1','default' => 'Y'),
-				'comment' => array('type' => 'varchar','precision' => '255'),
-				'app' => array('type' => 'varchar','precision' => '25'),
-				'directory' => array('type' => 'varchar','precision' => '255'),
-				'name' => array('type' => 'varchar','precision' => '128','nullable' => False),
-				'link_directory' => array('type' => 'varchar','precision' => '255'),
-				'link_name' => array('type' => 'varchar','precision' => '128'),
-				'version' => array('type' => 'varchar','precision' => '30','nullable' => False,'default' => '0.0.0.0'),
-				'content' => array('type' => 'text')
-			),
-			'pk' => array('file_id'),
-			'fk' => array(),
-			'ix' => array(array('directory','name','mime_type')),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.024';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.024';
-	function phpgwapi_upgrade0_9_99_024()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_addressbook_extra',array(
-			'fd' => array(
-				'contact_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'contact_owner' => array('type' => 'int','precision' => '8'),
-				'contact_name' => array('type' => 'varchar','precision' => '255','nullable' => False),
-				'contact_value' => array('type' => 'text')
-			),
-			'pk' => array('contact_id','contact_name'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.025';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '0.9.99.025';
-	function phpgwapi_upgrade0_9_99_025()
-	{
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_addressbook',array(
-			'fd' => array(
-				'id' => array('type' => 'auto','nullable' => False),
-				'lid' => array('type' => 'varchar','precision' => '32'),
-				'tid' => array('type' => 'char','precision' => '1'),
-				'owner' => array('type' => 'int','precision' => '8'),
-				'access' => array('type' => 'varchar','precision' => '7'),
-				'cat_id' => array('type' => 'varchar','precision' => '32'),
-				'fn' => array('type' => 'varchar','precision' => '64'),
-				'n_family' => array('type' => 'varchar','precision' => '64'),
-				'n_given' => array('type' => 'varchar','precision' => '64'),
-				'n_middle' => array('type' => 'varchar','precision' => '64'),
-				'n_prefix' => array('type' => 'varchar','precision' => '64'),
-				'n_suffix' => array('type' => 'varchar','precision' => '64'),
-				'sound' => array('type' => 'varchar','precision' => '64'),
-				'bday' => array('type' => 'varchar','precision' => '32'),
-				'note' => array('type' => 'text'),
-				'tz' => array('type' => 'varchar','precision' => '8'),
-				'geo' => array('type' => 'varchar','precision' => '32'),
-				'url' => array('type' => 'varchar','precision' => '128'),
-				'pubkey' => array('type' => 'text'),
-				'org_name' => array('type' => 'varchar','precision' => '64'),
-				'org_unit' => array('type' => 'varchar','precision' => '64'),
-				'title' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_street' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_locality' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_region' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_postalcode' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_countryname' => array('type' => 'varchar','precision' => '64'),
-				'adr_one_type' => array('type' => 'varchar','precision' => '32'),
-				'label' => array('type' => 'text'),
-				'adr_two_street' => array('type' => 'varchar','precision' => '64'),
-				'adr_two_locality' => array('type' => 'varchar','precision' => '64'),
-				'adr_two_region' => array('type' => 'varchar','precision' => '64'),
-				'adr_two_postalcode' => array('type' => 'varchar','precision' => '64'),
-				'adr_two_countryname' => array('type' => 'varchar','precision' => '64'),
-				'adr_two_type' => array('type' => 'varchar','precision' => '32'),
-				'tel_work' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_home' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_voice' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_fax' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_msg' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_cell' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_pager' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_bbs' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_modem' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_car' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_isdn' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_video' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'),
-				'tel_prefer' => array('type' => 'varchar','precision' => '32'),
-				'email' => array('type' => 'varchar','precision' => '64'),
-				'email_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'),
-				'email_home' => array('type' => 'varchar','precision' => '64'),
-				'email_home_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'),
-				'last_mod' => array('type' => 'int','precision' => '8','nullable' => False)
-			),
-			'pk' => array('id'),
-			'fk' => array(),
-			'ix' => array(array('tid','owner','access','n_family','n_given','email'),array('tid','cat_id','owner','access','n_family','n_given','email')),
-			'uc' => array()
-		));
-
-		// we dont need to do update 0.9.99.026, as UpdateSequenze is called now by RefreshTable
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-	
-	
-	$test[] = '0.9.99.026';
-	function phpgwapi_upgrade0_9_99_026()
-	{
-		// update the sequenzes for refreshed tables (postgres only)
-		$GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_categories','cat_id');
-		$GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_applications','app_id');
-		$GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_history_log','history_id');
-		$GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_vfs','file_id');
-		$GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_addressbook','id');
-		
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0';
-	function phpgwapi_upgrade1_0_0()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_email',array(
-			'type' => 'varchar',
-			'precision' => '100'
-		));
-		
-		$GLOBALS['phpgw_setup']->oProc->query("SELECT config_value FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='mail_suffix'",__LINE__,__FILE__);
-		$mail_domain = $GLOBALS['phpgw_setup']->oProc->next_record() ? $GLOBALS['phpgw_setup']->oProc->f(0) : '';
-
-		// copy the email-addresses from the preferences of the mail-app (if set) to the new field
-		$db2 = $GLOBALS['phpgw_setup']->oProc->m_odb;
-		$sql = "SELECT account_id,account_lid,preference_value FROM phpgw_accounts LEFT JOIN phpgw_preferences ON account_id=preference_owner AND preference_app='email' WHERE account_type = 'u'";
-		$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
-		while ($GLOBALS['phpgw_setup']->oProc->next_record())
-		{
-			$email_prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value'));
-			$account_lid = $GLOBALS['phpgw_setup']->oProc->f('account_lid');
-			$db2->update('phpgw_accounts',array(
-				'account_email' => $email_prefs['address'] ? $email_prefs['address'] : $account_lid.(strstr($account_lid,'@')===False?'@'.$mail_domain:''),
-			),array(
-				'account_id' => $GLOBALS['phpgw_setup']->oProc->f('account_id')
-			),__LINE__,__FILE__);
-		}
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.000';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.000';
-	function phpgwapi_upgrade1_0_0_000()
-	{
-		// removing the not longer needed 'availible' column, that information is in the file setup/lang/languages
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_languages',array(
-			'fd' => array(
-				'lang_id' => array('type' => 'varchar','precision' => '5','nullable' => False),
-				'lang_name' => array('type' => 'varchar','precision' => '50','nullable' => False)
-			),
-			'pk' => array('lang_id'),
-			'ix' => array(),
-			'fk' => array(),
-			'uc' => array()
-		),'available');
-
-		// correcting the id for Catalan
-		$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET lang_id='es-ca' WHERE lang_id='ca'");
-
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.001';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.001';
-	function phpgwapi_upgrade1_0_0_001()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.002';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.002';
-	function phpgwapi_upgrade1_0_0_002()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.003';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.003';
-	function phpgwapi_upgrade1_0_0_003()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.004';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.004';
-	function phpgwapi_upgrade1_0_0_004()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.005';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-
-	$test[] = '1.0.0.005';
-	function phpgwapi_upgrade1_0_0_005()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.006';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
-	$test[] = '1.0.0.006';
-	function phpgwapi_upgrade1_0_0_006()
-	{
-		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.007';
-		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
-
+	// Since Expresso 1.2 using API EgroupWare 1.0.0.007 
 	$test[] = '1.0.0.007';
 	function phpgwapi_upgrade1_0_0_007()
@@ -1678,9 +48,45 @@
 		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.002';
 		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-	}
+	}		
 	$test[] = '2.0.002';
 	function phpgwapi_upgrade2_0_002()
 	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.003';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}
+	$test[] = '2.0.003';
+	function phpgwapi_upgrade2_0_003()
+	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.004';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}
+	$test[] = '2.0.004';
+	function phpgwapi_upgrade2_0_004()
+	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.005';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}
+	$test[] = '2.0.005';
+	function phpgwapi_upgrade2_0_005()
+	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.006';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}			
+	$test[] = '2.0.006';
+	function phpgwapi_upgrade2_0_006()
+	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.007';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}	
+	$test[] = '2.0.007';
+	function phpgwapi_upgrade2_0_007()
+	{
 		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.1.000';
+		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+	}	
+	$test[] = '2.1.000';
+	function phpgwapi_upgrade2_1_000()
+	{
+		$GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.2.000';
 		return $GLOBALS['setup_info']['phpgwapi']['currentver'];
 	}
Index: branches/2.2/phpgwapi/setup/tables_update_0_9_10.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/tables_update_0_9_10.inc.php	(revision 2)
+++ 	(revision )
@@ -1,953 +1,0 @@
-<?php
-  /**************************************************************************\
-  * phpGroupWare - Setup                                                     *
-  * http://www.phpgroupware.org                                              *
-  * --------------------------------------------                             *
-  *  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.                                              *
-  \**************************************************************************/
-
-
-	$test[] = '0.9.9';
-	function phpgwapi_upgrade0_9_9()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db2 = $phpgw_setup->db;
-		//convert user settings
-		$phpgw_setup->oProc->query("select account_id, account_permissions from accounts",__LINE__,__FILE__);
-		if($phpgw_setup->oProc->num_rows())
-		{
-			while($phpgw_setup->oProc->next_record())
-			{
-				$apps_perms = explode(":",$phpgw_setup->oProc->f('account_permissions'));
-				for($i=1;$i<count($apps_perms)-1;$i++)
-				{
-					if ($apps_perms[$i] != "")
-					{
-						$sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)";
-						$sql .= " values('".$apps_perms[$i]."', 'run', ".$phpgw_setup->oProc->f("account_id").", 'u', 1)";
-						$db2->query($sql ,__LINE__,__FILE__);
-					}
-				}
-			}
-		}
-		$phpgw_setup->oProc->query("update accounts set account_permissions = ''",__LINE__,__FILE__);
-		//convert group settings
-		$phpgw_setup->oProc->query("select group_id, group_apps from groups",__LINE__,__FILE__);
-		if($phpgw_setup->oProc->num_rows())
-		{
-			while($phpgw_setup->oProc->next_record())
-			{
-				$apps_perms = explode(":",$phpgw_setup->oProc->f('group_apps'));
-				for($i=1;$i<count($apps_perms)-1;$i++)
-				{
-					if ($apps_perms[$i] != '')
-					{
-						$sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)";
-						$sql .= " values('".$apps_perms[$i]."', 'run', ".$phpgw_setup->oProc->f("group_id").", 'g', 1)";
-						$db2->query($sql ,__LINE__,__FILE__);
-					}
-				}
-			}
-		}
-		$phpgw_setup->oProc->query("update groups set group_apps = ''",__LINE__,__FILE__);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre1';
-	function phpgwapi_upgrade0_9_10pre1()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_categories','cat_access',array('type' => 'varchar', 'precision' => 25));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre2';
-	function phpgwapi_upgrade0_9_10pre2()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db2 = $phpgw_setup->oProc;
-
-		$phpgw_setup->oProc->query("SELECT account_groups,account_id FROM accounts",__LINE__,__FILE__);
-		if($phpgw_setup->oProc->num_rows())
-		{
-			while($phpgw_setup->oProc->next_record())
-			{
-				$gl = explode(',',$phpgw_setup->oProc->f('account_groups'));
-				for ($i=1; $i<(count($gl)-1); $i++)
-				{
-					$ga = explode(':',$gl[$i]);
-					$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)";
-					$sql .= " VALUES('phpgw_group', '".$ga[0]."', ".$phpgw_setup->oProc->f("account_id").", 'u', 1)";
-					$db2->query($sql ,__LINE__,__FILE__);
-				}
-			}
-		}
-		$phpgw_setup->oProc->query("UPDATE accounts SET account_groups= ''",__LINE__,__FILE__);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre3';
-	function phpgwapi_upgrade0_9_10pre3()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameTable('accounts','phpgw_accounts');
-
-		$newtbldef = array(
-			'fd' => array(
-				'account_id' => array('type' => 'auto', 'nullable' => false),
-				'account_lid' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
-				'account_pwd' => array('type' => 'varchar', 'precision' => 32, 'nullable' => false),
-				'account_firstname' => array('type' => 'varchar', 'precision' => 50),
-				'account_lastname' => array('type' => 'varchar', 'precision' => 50),
-				'account_groups' => array('type' => 'varchar', 'precision' => 30),
-				'account_lastlogin' => array('type' => 'int', 'precision' => 4),
-				'account_lastloginfrom' => array('type' => 'varchar', 'precision' => 255),
-				'account_lastpwd_change' => array('type' => 'int', 'precision' => 4),
-				'account_status' => array('type' => 'char', 'precision' => 1, 'nullable' => false, 'default' => 'A')
-			),
-			'pk' => array('account_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array('account_lid')
-		);
-		$phpgw_setup->oProc->DropColumn('phpgw_accounts',$newtbldef,'account_permissions');
-
-		$newtbldef = array(
-			'fd' => array(
-				'account_id' => array('type' => 'auto', 'nullable' => false),
-				'account_lid' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
-				'account_pwd' => array('type' => 'varchar', 'precision' => 32, 'nullable' => false),
-				'account_firstname' => array('type' => 'varchar', 'precision' => 50),
-				'account_lastname' => array('type' => 'varchar', 'precision' => 50),
-				'account_lastlogin' => array('type' => 'int', 'precision' => 4),
-				'account_lastloginfrom' => array('type' => 'varchar', 'precision' => 255),
-				'account_lastpwd_change' => array('type' => 'int', 'precision' => 4),
-				'account_status' => array('type' => 'char', 'precision' => 1, 'nullable' => false, 'default' => 'A')
-			),
-			'pk' => array('account_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array('account_lid')
-		);
-		$phpgw_setup->oProc->DropColumn('phpgw_accounts',$newtbldef,'account_groups');
-
-		$phpgw_setup->oProc->AddColumn('phpgw_accounts','account_type', array('type' => 'char', 'precision' => 1));
-		$phpgw_setup->oProc->query("update phpgw_accounts set account_type='u'",__LINE__,__FILE__);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre4';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	// TODO see next function
-/*
-		$tables = Array('addressbook','calendar_entry','f_forums','todo');
-		$fields["addressbook"] = Array('ab_access','ab_id');
-		$fields["calendar_entry"] = Array('cal_group','cal_id');
-		$fields["f_forums"] = Array('groups','id');
-		$fields["phpgw_categories"] = Array('cat_access','cat_id');
-		$fields["todo"] = Array('todo_access','todo_id');
-*/
-	function change_groups($table,$field,$old_id,$new_id,$db2,$db3)
-	{
-		$sql = $field[0];
-		for($i=1;$i<count($field);$i++)
-		{
-			$sql .= ", ".$field[$i];
-		}
-		$db2->query("SELECT $sql FROM $table WHERE $field[0] like '%,".$old_id.",%'",__LINE__,__FILE__);
-		if($db2->num_rows())
-		{
-			while($db2->next_record())
-			{
-				$access = $db2->f($field[0]);
-				$id = $db2->f($field[1]);
-				$access = str_replace(','.$old_id.',' , ','.$new_id.',' , $access);
-				$db3->query("UPDATE $table SET ".$field[0]."='".$access."' WHERE ".$field[1]."=".$id,__LINE__,__FILE__);
-			}
-		}
-	}
-
-	$test[] = '0.9.10pre4';
-	function phpgwapi_upgrade0_9_10pre4()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db2 = $phpgw_setup->oProc;
-		$db3 = $phpgw_setup->oProc;
-
-		$phpgw_setup->oProc->query("SELECT MAX(group_id) FROM groups",__LINE__,__FILE__);
-		$phpgw_setup->oProc->next_record();
-		$max_group_id = $phpgw_setup->oProc->f(0);
-
-		// This is for use by former CORE apps to use in this version number's upgrade locally
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_temp_groupmap', array(
-				'fd' => array(
-					'oldid'  => array('type' => 'int', 'precision' => 4, 'nullable' => False),
-					'oldlid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
-					'newid'  => array('type' => 'int', 'precision' => 4, 'nullable' => True),
-					'newlid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True)
-				),
-				'pk' => array('oldid'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$phpgw_setup->oProc->query("SELECT group_id, group_name FROM groups",__LINE__,__FILE__);
-		while($phpgw_setup->oProc->next_record())
-		{
-			$old_group_id = $phpgw_setup->oProc->f('group_id');
-			$old_group_name = $phpgw_setup->oProc->f('group_name');
-			$group_name = $phpgw_setup->oProc->f('group_name');
-			while(1)
-			{
-				$new_group_id = mt_rand ($max_group_id, 60000);
-				$db2->query("SELECT account_id FROM phpgw_accounts WHERE account_id=$new_group_id",__LINE__,__FILE__);
-				if(!$db2->num_rows()) { break; }
-			}
-			$db2->query("SELECT account_lid FROM phpgw_accounts WHERE account_lid='$group_name'",__LINE__,__FILE__);
-			if($db2->num_rows())
-			{
-				$group_name .= '_group';
-			}
-			$db2->query("INSERT INTO phpgw_accounts(account_id, account_lid, account_pwd, "
-				."account_firstname, account_lastname, account_lastlogin, "
-				."account_lastloginfrom, account_lastpwd_change, "
-				."account_status, account_type) "
-				."VALUES ($new_group_id,'$group_name','x','','',$old_group_id,NULL,NULL,'A','g')");
-
-			// insert oldid/newid into temp table (for use by other apps in this version upgrade
-			$db2->query("INSERT INTO phpgw_temp_groupmap (oldid,oldlid,newid,newlid) VALUES ($old_group_id,'$old_group_name',$new_group_id,'$group_name')",__LINE__,__FILE__);
-
-			$db2->query("UPDATE phpgw_acl SET acl_location='$new_group_id' "
-				."WHERE acl_appname='phpgw_group' AND acl_account_type='u' "
-				."AND acl_location='$old_group_id'");
-			$db2->query("UPDATE phpgw_acl SET acl_account=$new_group_id "
-				."WHERE acl_location='run' AND acl_account_type='g' "
-				."AND acl_account=$old_group_id");
-
-			$db2->query("SELECT cat_access,cat_id FROM phpgw_categories WHERE cat_access LIKE '%,".$old_group_id.",%'",__LINE__,__FILE__);
-			if($db2->num_rows())
-			{
-				while($db2->next_record())
-				{
-					$access = $db2->f('cat_access');
-					$id     = $db2->f('cat_id');
-					$access = str_replace(','.$old_group_id.',' , ','.$new_group_id.',' , $access);
-					$db3->query("UPDATE phpgw_categories SET cat_access='".$access."' WHERE cat_id=".$id,__LINE__,__FILE__);
-				}
-			}
-		}
-
-		$phpgw_setup->oProc->DropTable('groups');
-
-		/* Moved back from addressbook */
-		$phpgw_setup->oProc->query('SELECT oldid,newid FROM phpgw_temp_groupmap',__LINE__,__FILE__);
-		if($phpgw_setup->oProc->num_rows())
-		{
-			while($phpgw_setup->oProc->next_record())
-			{
-				$old_group_id = $phpgw_setup->oProc->f(0);
-				$new_group_id = $phpgw_setup->oProc->f(1);
-				$db2->query("SELECT ab_access,ab_id FROM addressbook WHERE ab_access LIKE '%,".$old_group_id.",%'",__LINE__,__FILE__);
-				if($db2->num_rows())
-				{
-					while($db2->next_record())
-					{
-						$access = $db2->f('cat_access');
-						$id     = $db2->f('cat_id');
-						$access = str_replace(','.$old_group_id.',' , ','.$new_group_id.',' , $access);
-						$db3->query("UPDATE phpgw_categories SET cat_access='".$access."' WHERE cat_id=".$id,__LINE__,__FILE__);
-					}
-				}
-			}
-		}
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre5';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
- 
-	$test[] = '0.9.10pre5';
-	function phpgwapi_upgrade0_9_10pre5()
-	{
-		global $setup_info, $phpgw_setup;
-
-		/* This is only temp data, so we can kill it. */
-		$phpgw_setup->oProc->DropTable('phpgw_app_sessions');
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_app_sessions', array(
-				'fd' => array(
-					'sessionid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => False),
-					'loginid' => array('type' => 'varchar', 'precision' => 20),
-					'location' => array('type' => 'varchar', 'precision' => 255),
-					'app' => array('type' => 'varchar', 'precision' => 20),
-					'content' => array('type' => 'text')
-				),
-				'pk' => array(),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre6';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre6';
-	function phpgwapi_upgrade0_9_10pre6()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameTable('config','phpgw_config');
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre7';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre7';
-	function phpgwapi_upgrade0_9_10pre7()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameTable('applications','phpgw_applications');
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre8';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre8';
-	function phpgwapi_upgrade0_9_10pre8()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameColumn('phpgw_sessions', 'session_info', 'session_action');
-		$phpgw_setup->oProc->AlterColumn('phpgw_sessions', 'session_action', array('type' => 'varchar', 'precision' => '255'));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre9';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre9';
-	function phpgwapi_upgrade0_9_10pre9()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameTable('preferences','phpgw_preferences');
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre10';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre10';
-	function phpgwapi_upgrade0_9_10pre10()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$newtbldef = array(
-			"fd" => array(
-				'acl_appname' => array('type' => 'varchar', 'precision' => 50),
-				'acl_location' => array('type' => 'varchar', 'precision' => 255),
-				'acl_account' => array('type' => 'int', 'precision' => 4),
-				'acl_rights' => array('type' => 'int', 'precision' => 4)
-			),
-			'pk' => array(),
-			'ix' => array(),
-			'fk' => array(),
-			'uc' => array()
-		);
-
-		$phpgw_setup->oProc->DropColumn('phpgw_acl',$newtbldef,'acl_account_type');
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre11';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre11';
-	function phpgwapi_upgrade0_9_10pre11()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre12';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre12';
-	function phpgwapi_upgrade0_9_10pre12()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db1 = $phpgw_setup->db;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_addressbook', array(
-				'fd' => array(
-					'id'           => array('type' => 'auto', 'nullable' => False),
-					'lid'          => array('type' => 'varchar', 'precision' => 32),
-					'tid'          => array('type' => 'char', 'precision' => 1),
-					'owner'        => array('type' => 'int', 'precision' => 4),
-					'fn'           => array('type' => 'varchar', 'precision' => 64),
-					'sound'        => array('type' => 'varchar', 'precision' => 64),
-					'org_name'     => array('type' => 'varchar', 'precision' => 64),
-					'org_unit'     => array('type' => 'varchar', 'precision' => 64),
-					'title'        => array('type' => 'varchar', 'precision' => 64),
-					'n_family'     => array('type' => 'varchar', 'precision' => 64),
-					'n_given'      => array('type' => 'varchar', 'precision' => 64),
-					'n_middle'     => array('type' => 'varchar', 'precision' => 64),
-					'n_prefix'     => array('type' => 'varchar', 'precision' => 64),
-					'n_suffix'     => array('type' => 'varchar', 'precision' => 64),
-					'label'        => array('type' => 'text'),
-					'adr_poaddr'   => array('type' => 'varchar', 'precision' => 64),
-					'adr_extaddr'  => array('type' => 'varchar', 'precision' => 64),
-					'adr_street'   => array('type' => 'varchar', 'precision' => 64),
-					'adr_locality' => array('type' => 'varchar', 'precision' => 32),
-					'adr_region'   => array('type' => 'varchar', 'precision' => 32),
-					'adr_postalcode'  => array('type' => 'varchar', 'precision' => 32),
-					'adr_countryname' => array('type' => 'varchar', 'precision' => 32),
-					'adr_work'     => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'adr_home'     => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'adr_parcel'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'adr_postal'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'tz'           => array('type' => 'varchar', 'precision' => 8),
-					'geo'          => array('type' => 'varchar', 'precision' => 32),
-					'a_tel'        => array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'a_tel_work'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'a_tel_home'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'a_tel_voice'  => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'a_tel_msg'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'a_tel_fax'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'a_tel_prefer' => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel'        => array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'b_tel_work'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel_home'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel_voice'  => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel_msg'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel_fax'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'b_tel_prefer' => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel'        => array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'c_tel_work'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel_home'   => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel_voice'  => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel_msg'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel_fax'    => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'c_tel_prefer' => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'd_emailtype'  => array('type' => 'varchar', 'precision' => 32),
-					'd_email'      => array('type' => 'varchar', 'precision' => 64),
-					'd_email_work' => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False),
-					'd_email_home' => array('type' => 'char', 'precision' => '1', 'default' => 'n', 'nullable' => False)
-				),
-				'pk' => array('id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('id')
-			)
-		);
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_addressbook_extra', array(
-				'fd' => array(
-					'contact_id'    => array('type' => 'int',     'precision' => 4),
-					'contact_owner' => array('type' => 'int',     'precision' => 4),
-					'contact_name'  => array('type' => 'varchar', 'precision' => 255),
-					'contact_value' => array('type' => 'varchar', 'precision' => 255)
-				),
-				'pk' => array(),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$phpgw_setup->oProc->query("SELECT * FROM addressbook");
-		/* echo '<br>numrows: ' . $phpgw_setup->oProc->num_rows; */
-
-		while ($phpgw_setup->oProc->next_record())
-		{
-			$fields = $extra = array();
-
-			$fields['id']         = $phpgw_setup->oProc->f('ab_id');
-			$fields['owner']      = addslashes($phpgw_setup->oProc->f('ab_owner'));
-			$fields['n_given']    = addslashes($phpgw_setup->oProc->f('ab_firstname'));
-			$fields['n_family']   = addslashes($phpgw_setup->oProc->f('ab_lastname'));
-			$fields['d_email']    = addslashes($phpgw_setup->oProc->f('ab_email'));
-			$fields['b_tel']      = addslashes($phpgw_setup->oProc->f('ab_hphone'));
-			$fields['a_tel']      = addslashes($phpgw_setup->oProc->f('ab_wphone'));
-			$fields['c_tel']      = addslashes($phpgw_setup->oProc->f('ab_fax'));
-			$fields['fn']         = addslashes($phpgw_setup->oProc->f('ab_firstname').' '.$phpgw_setup->oProc->f('ab_lastname'));
-			$fields['a_tel_work'] = 'y';
-			$fields['b_tel_home'] = 'y';
-			$fields['c_tel_fax']  = 'y';
-			$fields['org_name']   = addslashes($phpgw_setup->oProc->f('ab_company'));
-			$fields['title']      = addslashes($phpgw_setup->oProc->f('ab_title'));
-			$fields['adr_street'] = addslashes($phpgw_setup->oProc->f('ab_street'));
-			$fields['adr_locality']   = addslashes($phpgw_setup->oProc->f('ab_city'));
-			$fields['adr_region']     = addslashes($phpgw_setup->oProc->f('ab_state'));
-			$fields['adr_postalcode'] = addslashes($phpgw_setup->oProc->f('ab_zip'));
-
-			$extra['pager']       = $phpgw_setup->oProc->f('ab_pager');
-			$extra['mphone']      = $phpgw_setup->oProc->f('ab_mphone');
-			$extra['ophone']      = $phpgw_setup->oProc->f('ab_ophone');
-			$extra['bday']        = $phpgw_setup->oProc->f('ab_bday');
-			$extra['notes']       = $phpgw_setup->oProc->f('ab_notes');
-			$extra['address2']    = $phpgw_setup->oProc->f('ab_address2');
-			$extra['url']         = $phpgw_setup->oProc->f('ab_url');
-
-			$sql = "INSERT INTO phpgw_addressbook (org_name,n_given,n_family,fn,d_email,title,a_tel,a_tel_work,"
-				. "b_tel,b_tel_home,c_tel,c_tel_fax,adr_street,adr_locality,adr_region,adr_postalcode,owner)"
-				. " VALUES ('".$fields['org_name']."','".$fields['n_given']."','".$fields['n_family']."','"
-				. $fields['fn']."','".$fields['d_email']."','".$fields['title']."','".$fields['a_tel']."','"
-				. $fields['a_tel_work']."','".$fields['b_tel']."','".$fields['b_tel_home']."','"
-				. $fields['c_tel']."','".$fields['c_tel_fax']."','".$fields['adr_street']."','"
-				. $fields['adr_locality']."','".$fields['adr_region']."','".$fields['adr_postalcode']."','"
-				. $fields['owner'] ."')";
-
-			$db1->query($sql);
-
-			while (list($name,$value) = each($extra))
-			{
-				$sql = "INSERT INTO phpgw_addressbook_extra VALUES ('".$fields['id']."','" . $fields['owner'] . "','"
-					. addslashes($name) . "','" . addslashes($value) . "')";
-				$db1->query($sql);
-			}
-		}
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre13';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-		// Note we are still leaving the old addressbook table alone here... for third party apps if they need it
-	}
-
-	$test[] = '0.9.10pre13';
-	function phpgwapi_upgrade0_9_10pre13()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db1 = $phpgw_setup->db;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'url',  array('type' => 'varchar', 'precision' => 128));
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'bday', array('type' => 'varchar', 'precision' => 32));
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'note', array('type' => 'text'));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook_extra', 'contact_value', array('type' => 'text'));
-
-		$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='url'";
-		$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
-
-		while($phpgw_setup->oProc->next_record())
-		{
-			$cid   = $phpgw_setup->oProc->f('contact_id');
-			$cvalu = $phpgw_setup->oProc->f('contact_value');
-			if ($cid && $cvalu)
-			{
-				$update = "UPDATE phpgw_addressbook SET url='" . $cvalu . "' WHERE id=" . $cid;
-				$db1->query($update);
-				$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='url'";
-				$db1->query($delete);
-			}
-		}
-
-		$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='bday'";
-		$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
-
-		while($phpgw_setup->oProc->next_record())
-		{
-			$cid   = $phpgw_setup->oProc->f('contact_id');
-			$cvalu = $phpgw_setup->oProc->f('contact_value');
-			if ($cid && $cvalu)
-			{
-				$update = "UPDATE phpgw_addressbook set bday='" . $cvalu . "' WHERE id=" . $cid;
-				$db1->query($update);
-				$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='bday'";
-				$db1->query($delete);
-			}
-		}
-
-		$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='notes'";
-		$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
-
-		while($phpgw_setup->oProc->next_record())
-		{
-			$cid   = $phpgw_setup->oProc->f('contact_id');
-			$cvalu = $phpgw_setup->oProc->f('contact_value');
-			if ($cvalu)
-			{
-				$update = "UPDATE phpgw_addressbook set note='" . $cvalu . "' WHERE id=" . $cid;
-				$db1->query($update);
-				$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='notes'";
-				$db1->query($delete);
-			}
-		}
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre14';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre14';
-	function phpgwapi_upgrade0_9_10pre14()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_sessions','session_flags', array('type' => 'char', 'precision' => 2));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre15';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre15';
-	function phpgwapi_upgrade0_9_10pre15()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_work',      array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_home',      array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_parcel',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_postal',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_work',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_home',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_voice',   array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_msg',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_fax',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_prefer',  array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_work',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_home',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_voice',   array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_msg',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_fax',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_prefer',  array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_work',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_home',    array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_voice',   array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_msg',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_fax',     array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
- 		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_prefer',  array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'd_email_work',  array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-		$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'd_email_home',  array('type' => 'char', 'precision' => 1, 'default' => 'n', 'nullable' => False));
-
-		$setup_info['addressbook']['currentver'] = '0.9.10pre16';
-		return $setup_info['addressbook']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre16';
-	function phpgwapi_upgrade0_9_10pre16()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$db1 = $phpgw_setup->db;
-
-		$phpgw_setup->oProc->RenameTable('phpgw_addressbook', 'phpgw_addressbook_old');
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_addressbook', array(
-				'fd' => array(
-					'id' =>                  array('type' => 'auto', 'nullable' => False),
-					'lid' =>                 array('type' => 'varchar', 'precision' => 32),
-					'tid' =>                 array('type' => 'char', 'precision' => 1),
-					'owner' =>               array('type' => 'int', 'precision' => 4),
-					'fn' =>                  array('type' => 'varchar', 'precision' => 64),
-					'n_family' =>            array('type' => 'varchar', 'precision' => 64),
-					'n_given' =>             array('type' => 'varchar', 'precision' => 64),
-					'n_middle' =>            array('type' => 'varchar', 'precision' => 64),
-					'n_prefix' =>            array('type' => 'varchar', 'precision' => 64),
-					'n_suffix' =>            array('type' => 'varchar', 'precision' => 64),
-					'sound' =>               array('type' => 'varchar', 'precision' => 64),
-					'bday' =>                array('type' => 'varchar', 'precision' => 32),
-					'note' =>                array('type' => 'text'),
-					'tz' =>                  array('type' => 'varchar', 'precision' => 8),
-					'geo' =>                 array('type' => 'varchar', 'precision' => 32),
-					'url' =>                 array('type' => 'varchar', 'precision' => 128),
-					'org_name' =>            array('type' => 'varchar', 'precision' => 64),
-					'org_unit' =>            array('type' => 'varchar', 'precision' => 64),
-					'title' =>               array('type' => 'varchar', 'precision' => 64),
-					'adr_one_street' =>      array('type' => 'varchar', 'precision' => 64),
-					'adr_one_locality' =>    array('type' => 'varchar', 'precision' => 32),
-					'adr_one_region' =>      array('type' => 'varchar', 'precision' => 32),
-					'adr_one_postalcode' =>  array('type' => 'varchar', 'precision' => 32),
-					'adr_one_countryname' => array('type' => 'varchar', 'precision' => 32),
-					'adr_one_type' =>        array('type' => 'varchar', 'precision' => 64),
-					'label' =>               array('type' => 'text'),
-					'adr_two_street' =>      array('type' => 'varchar', 'precision' => 64),
-					'adr_two_locality' =>    array('type' => 'varchar', 'precision' => 32),
-					'adr_two_region' =>      array('type' => 'varchar', 'precision' => 32),
-					'adr_two_postalcode' =>  array('type' => 'varchar', 'precision' => 32),
-					'adr_two_type' =>        array('type' => 'varchar', 'precision' => 64),
-					'tel_work' =>            array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_home' =>            array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_voice' =>           array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_fax' =>             array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_msg' =>             array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_cell' =>            array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_pager' =>           array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_bbs' =>             array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_modem' =>           array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_car' =>             array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_isdn' =>            array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_video' =>           array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
-					'tel_prefer' =>          array('type' => 'varchar', 'precision' => 32),
-					'email' =>               array('type' => 'varchar', 'precision' => 64),
-					'email_type' =>          array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET'),
-					'email_home' =>          array('type' => 'varchar', 'precision' => 64),
-					'email_home_type' =>     array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET')
-				),
-				'pk' => array('id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$phpgw_setup->oProc->query("SELECT * FROM phpgw_addressbook_old");
-		while ($phpgw_setup->oProc->next_record())
-		{
-			$fields['id']                  = $phpgw_setup->oProc->f("id");
-			$fields['owner']               = $phpgw_setup->oProc->f("owner");
-			$fields['n_given']             = $phpgw_setup->oProc->f("firstname");
-			$fields['n_family']            = $phpgw_setup->oProc->f("lastname");
-			$fields['email']               = $phpgw_setup->oProc->f("d_email");
-			$fields['email_type']          = $phpgw_setup->oProc->f("d_emailtype");
-			$fields['tel_home']            = $phpgw_setup->oProc->f("b_tel");
-			$fields['tel_work']            = $phpgw_setup->oProc->f("a_tel");
-			$fields['tel_fax']             = $phpgw_setup->oProc->f("c_tel");
-			$fields['fn']                  = $phpgw_setup->oProc->f("fn");
-			$fields['org_name']            = $phpgw_setup->oProc->f("org_name");
-			$fields['title']               = $phpgw_setup->oProc->f("title");
-			$fields['adr_one_street']      = $phpgw_setup->oProc->f("adr_street");
-			$fields['adr_one_locality']    = $phpgw_setup->oProc->f("adr_locality");
-			$fields['adr_one_region']      = $phpgw_setup->oProc->f("adr_region");
-			$fields['adr_one_postalcode']  = $phpgw_setup->oProc->f("adr_postalcode");
-			$fields['adr_one_countryname'] = $phpgw_setup->oProc->f("adr_countryname");
-			$fields['bday']                = $phpgw_setup->oProc->f("bday");
-			$fields['note']                = $phpgw_setup->oProc->f("note");
-			$fields['url']                 = $phpgw_setup->oProc->f("url");
-
-			$sql="INSERT INTO phpgw_addressbook (org_name,n_given,n_family,fn,email,email_type,title,tel_work,"
-				. "tel_home,tel_fax,adr_one_street,adr_one_locality,adr_one_region,adr_one_postalcode,adr_one_countryname,"
-				. "owner,bday,url,note)"
-				. " VALUES ('".$fields["org_name"]."','".$fields["n_given"]."','".$fields["n_family"]."','"
-				. $fields["fn"]."','".$fields["email"]."','".$fields["email_type"]."','".$fields["title"]."','".$fields["tel_work"]."','"
-				. $fields["tel_home"]."','".$fields["tel_fax"] ."','".$fields["adr_one_street"]."','"
-				. $fields["adr_one_locality"]."','".$fields["adr_one_region"]."','".$fields["adr_one_postalcode"]."','"
-				. $fields["adr_one_countryname"]."','".$fields["owner"] ."','".$fields["bday"]."','".$fields["url"]."','".$fields["note"]."')";
-
-			$db1->query($sql,__LINE__,__FILE__);
-		}
- 
-		$phpgw_setup->oProc->query("DROP TABLE phpgw_addressbook_old");
- 
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_home=''   WHERE tel_home='n'   OR tel_home='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_work=''   WHERE tel_work='n'   OR tel_work='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_cell=''   WHERE tel_cell='n'   OR tel_cell='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_voice=''  WHERE tel_voice='n'  OR tel_voice='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_fax=''    WHERE tel_fax='n'    OR tel_fax='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_car=''    WHERE tel_car='n'    OR tel_car='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_pager=''  WHERE tel_pager='n'  OR tel_pager='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_msg=''    WHERE tel_msg='n'    OR tel_msg='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_bbs=''    WHERE tel_bbs='n'    OR tel_bbs='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_modem=''  WHERE tel_modem='n'  OR tel_modem='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_prefer='' WHERE tel_prefer='n' OR tel_prefer='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_video=''  WHERE tel_video='n'  OR tel_video='y'");
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tel_isdn=''   WHERE tel_isdn='n'   OR tel_isdn='y'");
-
-		$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='mphone'";
-		$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
-
-		while($phpgw_setup->oProc->next_record())
-		{
-			$cid   = $phpgw_setup->oProc->f('contact_id');
-			$cvalu = $phpgw_setup->oProc->f('contact_value');
-			if ($cvalu)
-			{
-				$update = "UPDATE phpgw_addressbook SET tel_cell='" . $cvalu . "' WHERE id=" . $cid;
-				$db1->query($update);
-				$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='mphone'";
-				$db1->query($delete);
-			}
-		}
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre17';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre17';
-	function phpgwapi_upgrade0_9_10pre17()
-	{
-		global $phpgw_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook','pubkey', array('type' => 'text'));
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook','adr_two_countryname', array('type' => 'varchar', 'precision' => 32));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre18';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre18';
-	function phpgwapi_upgrade0_9_10pre18()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_nextid', array(
-				'fd' => array(
-					'appname' => array('type' => 'varchar', 'precision' => 25),
-					'id' => array('type' => 'int', 'precision' => 4)
-				),
-				'pk' => array(),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('appname')
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre19';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre19';
-	function phpgwapi_upgrade0_9_10pre19()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->DropTable('phpgw_nextid');
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_nextid', array(
-				'fd' => array(
-					'appname' => array('type' => 'varchar', 'precision' => 25, 'nullable' => False),
-					'id' => array('type' => 'int', 'precision' => 4)
-				),
-				'pk' => array(),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array('appname')
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre20';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.10pre20';
-	function phpgwapi_upgrade0_9_10pre20()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'access', array('type' => 'char', 'precision' => 7));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre21';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre21';
-	function phpgwapi_upgrade0_9_10pre21()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'cat_id', array('type' => 'varchar', 'precision' => 32));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre22';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre22';
-	function phpgwapi_upgrade0_9_10pre22()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre23';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre23';
-	function phpgwapi_upgrade0_9_10pre23()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tid='n' WHERE tid is null");
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre24';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre24';
-	function phpgwapi_upgrade0_9_10pre24()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_categories','cat_access', array('type' => 'char', 'precision' => 7));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre25';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre25';
-	function phpgwapi_upgrade0_9_10pre25()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_app_sessions','session_dla', array('type' => 'int', 'precision' => 4));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre26';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre26';
-	function phpgwapi_upgrade0_9_10pre26()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre27';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre27';
-	function phpgwapi_upgrade0_9_10pre27()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('phpgw_app_sessions', 'content', array('type' => 'longtext'));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.10pre28';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.10pre28';
-	function phpgwapi_upgrade0_9_10pre28()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.10';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-?>
Index: branches/2.2/phpgwapi/setup/tables_update_0_9_12.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/tables_update_0_9_12.inc.php	(revision 2)
+++ 	(revision )
@@ -1,134 +1,0 @@
-<?php
-  /**************************************************************************\
-  * phpGroupWare - Setup                                                     *
-  * http://www.phpgroupware.org                                              *
-  * --------------------------------------------                             *
-  *  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.                                              *
-  \**************************************************************************/
-
-
-	$test[] = '0.9.10';
-	function phpgwapi_upgrade0_9_10()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.001';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.001';
-	function phpgwapi_upgrade0_9_11_001()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.002';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.002';
-	function phpgwapi_upgrade0_9_11_002()
-	{
-		global $phpgw_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_categories','cat_main',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False));
-		$phpgw_setup->oProc->AddColumn('phpgw_categories','cat_level',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.003';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-
-	$test[] = '0.9.11.003';
-	function phpgwapi_upgrade0_9_11_003()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.004';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.004';
-	function phpgwapi_upgrade0_9_11_004()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_config','config_app', array('type' => 'varchar', 'precision' => 50));
-		$phpgw_setup->oProc->query("UPDATE phpgw_config SET config_app='phpgwapi'",__LINE__,__FILE__);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.005';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.005';
-	function phpgwapi_upgrade0_9_11_005()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_accounts','account_expires', array('type' => 'int', 'precision' => 4));
-		$phpgw_setup->oProc->query("UPDATE phpgw_accounts SET account_expires='-1'",__LINE__,__FILE__);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.006';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.006';
-	function phpgwapi_upgrade0_9_11_006()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.007';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.007';
-	function phpgwapi_upgrade0_9_11_007()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.008';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.008';
-	function phpgwapi_upgrade0_9_11_008()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->DropTable('profiles');
-		
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.009';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.009';
-	function phpgwapi_upgrade0_9_11_009()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.11.010';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.010';
-	function phpgwapi_upgrade0_9_11_010()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.001';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.11.011';
-	function phpgwapi_upgrade0_9_11_011()
-	{
-		global $setup_info;
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.13.001';
-		return $setup_info['phpgwapi']['currentver'];
-	}
-?>
Index: branches/2.2/phpgwapi/setup/test_data.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/test_data.inc.php	(revision 2)
+++ 	(revision )
@@ -1,43 +1,0 @@
-<?php
-  /**************************************************************************\
-  * phpGroupWare - Setup                                                     *
-  * http://www.phpgroupware.org                                              *
-  * --------------------------------------------                             *
-  *  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.                                              *
-  \**************************************************************************/
-
-
-	$oProc->query("INSERT INTO addressbook (
-	ab_owner,ab_access,ab_firstname,ab_lastname,
-	ab_email,ab_hphone,ab_wphone,ab_fax,ab_pager,
-	ab_mphone,ab_ophone,ab_street,ab_city,ab_state,ab_zip,
-	ab_bday,ab_notes,ab_company)
-	VALUES(500,'private','John','Doe',
-	'jdoe@yahoo.com','212-555-5555','212-555-4444','212-555-4445','212-555-5556',
-	'212-555-5557','212-555-5558','1234 Elm','Anytown','New York','01010',
-	'12/25/1970','This is a test note\nfor verification','ClearRiver Tech.')");
-
-	$oProc->query("INSERT INTO addressbook (
-	ab_owner,ab_access,ab_firstname,ab_lastname,
-	ab_email,ab_hphone,ab_wphone,ab_fax,ab_pager,
-	ab_mphone,ab_ophone,ab_street,ab_city,ab_state,ab_zip,
-	ab_bday,ab_notes,ab_company)
-	VALUES(502,'public','Jane','Smith',
-	'jane.smith@motherearth.org','212-555-5555','212-555-4444','212-555-4445','212-555-5556',
-	'212-555-5557','212-555-5558','1313 Mockingbird Ln.','Hooterville','Kentucky','54874',
-	'01/01/1983','This is a test note\nfor verification','Jasper Automotive')");
-
-	$oProc->query("INSERT INTO addressbook (
-	ab_owner,ab_access,ab_firstname,ab_lastname,
-	ab_email,ab_hphone,ab_wphone,ab_fax,ab_pager,
-	ab_mphone,ab_ophone,ab_street,ab_city,ab_state,ab_zip,
-	ab_bday,ab_notes,ab_company)
-	VALUES(1,'private','Steven','Wright',
-	'jdoe@yahoo.com','212-555-5555','212-555-4444','212-555-4445','212-555-5556',
-	'212-555-5557','212-555-5558','321 Contact','Oiforgot','North Dakota','15421',
-	'10/05/1955','This is a test note\nfor verification','Baubles and Beads')");
-
-?>
Index: branches/2.2/phpgwapi/setup/tables_update_0_9_9.inc.php
===================================================================
--- branches/2.2/phpgwapi/setup/tables_update_0_9_9.inc.php	(revision 2)
+++ 	(revision )
@@ -1,804 +1,0 @@
-<?php
-  /**************************************************************************\
-  * phpGroupWare - Setup                                                     *
-  * http://www.phpgroupware.org                                              *
-  * --------------------------------------------                             *
-  *  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.                                              *
-  \**************************************************************************/
-
-
-	$test[] = '0.9.1';
-	function phpgwapi_upgrade0_9_1()
-	{
-		global $phpgw_info, $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('access_log', 'lo', array('type' => 'varchar', 'precision' => 255));
-
-		$phpgw_setup->oProc->query("update lang set lang='da' where lang='dk'");
-		$phpgw_setup->oProc->query("update lang set lang='ko' where lang='kr'");
-
-		$phpgw_setup->oProc->AddColumn('addressbook', 'ab_company_id', array('type' => 'int', 'precision' => 4));
-		$phpgw_setup->oProc->AddColumn('addressbook', 'ab_title', array('type' => 'varchar', 'precision' => 60));
-		$phpgw_setup->oProc->AddColumn('addressbook', 'ab_address2', array('type' => 'varchar', 'precision' => 60));
-
-		$phpgw_setup->oProc->query("update preferences set preference_name='da' where preference_name='dk'");
-		$phpgw_setup->oProc->query("update preferences set preference_name='ko' where preference_name='kr'");
-
-		//install weather support
-		$phpgw_setup->oProc->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('weather', 'Weather', 1, 12, NULL, '".$phpgw_info['server']['version']."')");
-		$phpgw_setup->oProc->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'weather','Weather','en','weather')");
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	function phpgwapi_v0_9_2to0_9_3update_owner($table, $field)
-	{
-		global $phpgw_setup;
-
-		$phpgw_setup->oProc->query("select distinct($field) from $table");
-		if ($phpgw_setup->oProc->num_rows()) {
-			while ($phpgw_setup->oProc->next_record())
-			{
-				$owner[count($owner)] = $phpgw_setup->oProc->f($field);
-			}
-			for($i=0;$i<count($owner);$i++)
-			{
-				$phpgw_setup->oProc->query("select account_id from accounts where account_lid='".$owner[$i]."'");
-				$phpgw_setup->oProc->next_record();
-				$phpgw_setup->oProc->query("update $table set $field=".$phpgw_setup->oProc->f("account_id")." where $field='".$owner[$i]."'");
-			}
-		}
-
-		$phpgw_setup->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0));
-	}
-
-	$test[] = '0.9.2';
-	function phpgwapi_upgrade0_9_2()
-	{
-		global $setup_info;
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.3pre1';
-	function phpgwapi_upgrade0_9_3pre1()
-	{
-		global $setup_info;
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre2';
-	function phpgwapi_upgrade0_9_3pre2()
-	{
-		global $setup_info;
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre3';
-	function phpgwapi_upgrade0_9_3pre3()
-	{
-		global $setup_info;
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre4';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre4';
-	function phpgwapi_upgrade0_9_3pre4()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn("config", "config_name", array("type" => "varchar", "precision" => 255, "nullable" => false));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre5';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre5';
-	function phpgwapi_upgrade0_9_3pre5()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'categories', array(
-				'fd' => array(
-					'cat_id' => array('type' => 'auto', 'nullable' => false),
-					'account_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0),
-					'app_name' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false),
-					'cat_name' => array('type' => 'varchar', 'precision' => 150, 'nullable' => false),
-					'cat_description' => array('type' => 'text', 'nullable' => false)
-				),
-				'pk' => array('cat_id'),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre6';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre6';
-	function phpgwapi_upgrade0_9_3pre6()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('transy', 'Translation Management', 0, 13, NULL, '".$setup_info['phpgwapi']['version']."')");
-
-		$phpgw_setup->oProc->AddColumn('addressbook', 'ab_url', array('type' => 'varchar', 'precision' => 255));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre7';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre7';
-	function phpgwapi_upgrade0_9_3pre7()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable('languages', array(
-				'fd' => array(
-					'lang_id' =>   array('type' => 'varchar', 'precision' => 2, 'nullable' => false),
-					'lang_name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => false),
-					'available' => array('type' => 'char', 'precision' => 3, 'nullable' => false, 'default' => 'No')
-				),
-				'pk' => array('lang_id'),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			)
-		);
-
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AA','Afar','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AB','Abkhazian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AF','Afrikaans','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AM','Amharic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AR','Arabic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AS','Assamese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AY','Aymara','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('AZ','Azerbaijani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BA','Bashkir','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BE','Byelorussian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BG','Bulgarian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BH','Bihari','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BI','Bislama','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BN','Bengali / Bangla','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BO','Tibetan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('BR','Breton','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('CA','Catalan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('CO','Corsican','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('CS','Czech','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('CY','Welsh','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('DA','Danish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('DE','German','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('DZ','Bhutani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('EL','Greek','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('EN','English / US','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('EO','Esperanto','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ES','Spanish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ET','Estonian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('EU','Basque','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FA','Persian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FI','Finnish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FJ','Fiji','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FO','Faeroese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FR','French','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('FY','Frisian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('GA','Irish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('GD','Gaelic / Scots Gaelic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('GL','Galician','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('GN','Guarani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('GU','Gujarati','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('HA','Hausa','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('HI','Hindi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('HR','Croatian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('HU','Hungarian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('HY','Armenian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IA','Interlingua','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IE','Interlingue','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IK','Inupiak','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IN','Indonesian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IS','Icelandic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IT','Italian','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('IW','Hebrew','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('JA','Japanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('JI','Yiddish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('JW','Javanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KA','Georgian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KK','Kazakh','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KL','Greenlandic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KM','Cambodian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KN','Kannada','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KO','Korean','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KS','Kashmiri','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KU','Kurdish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('KY','Kirghiz','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('LA','Latin','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('LN','Lingala','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('LO','Laothian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('LT','Lithuanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('LV','Latvian / Lettish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MG','Malagasy','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MI','Maori','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MK','Macedonian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ML','Malayalam','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MN','Mongolian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MO','Moldavian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MR','Marathi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MS','Malay','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MT','Maltese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('MY','Burmese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('NA','Nauru','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('NE','Nepali','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('NL','Dutch','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('NO','Norwegian','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('OC','Occitan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('OM','Oromo / Afan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('OR','Oriya','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('PA','Punjabi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('PL','Polish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('PS','Pashto / Pushto','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('PT','Portuguese','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('QU','Quechua','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('RM','Rhaeto-Romance','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('RN','Kirundi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('RO','Romanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('RU','Russian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('RW','Kinyarwanda','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SA','Sanskrit','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SD','Sindhi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SG','Sangro','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SH','Serbo-Croatian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SI','Singhalese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SK','Slovak','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SL','Slovenian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SM','Samoan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SN','Shona','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SO','Somali','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SQ','Albanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SR','Serbian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SS','Siswati','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ST','Sesotho','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SU','Sudanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SV','Swedish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('SW','Swahili','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TA','Tamil','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TE','Tegulu','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TG','Tajik','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TH','Thai','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TI','Tigrinya','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TK','Turkmen','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TL','Tagalog','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TN','Setswana','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TO','Tonga','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TR','Turkish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TS','Tsonga','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TT','Tatar','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('TW','Twi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('UK','Ukrainian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('UR','Urdu','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('UZ','Uzbek','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('VI','Vietnamese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('VO','Volapuk','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('WO','Wolof','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('XH','Xhosa','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('YO','Yoruba','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ZH','Chinese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ZU','Zulu','No')");
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre8';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.3pre8';
-	function phpgwapi_upgrade0_9_3pre8()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre9';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.3pre9';
-	function phpgwapi_upgrade0_9_3pre9()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.3pre10';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.3pre10';
-	function phpgwapi_upgrade0_9_3pre10()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.3';
-	function phpgwapi_upgrade0_9_3()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.4pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.4pre1';
-	function phpgwapi_upgrade0_9_4pre1()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.4pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.4pre2';
-	function phpgwapi_upgrade0_9_4pre2()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.4pre3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.4pre3';
-	function phpgwapi_upgrade0_9_4pre3()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.4pre4';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.4pre4';
-	function phpgwapi_upgrade0_9_4pre4()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AlterColumn('sessions', 'session_lid', array('type' => 'varchar', 'precision' => 255));
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.4pre5';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.4pre5';
-	function phpgwapi_upgrade0_9_4pre5()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.4';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.4';
-	function phpgwapi_upgrade0_9_4()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->query('delete from languages');
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('aa','Afar','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ab','Abkhazian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('af','Afrikaans','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('am','Amharic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ar','Arabic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('as','Assamese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ay','Aymara','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('az','Azerbaijani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ba','Bashkir','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('be','Byelorussian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('bg','Bulgarian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('bh','Bihari','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('bi','Bislama','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('bn','Bengali / Bangla','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('bo','Tibetan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('br','Breton','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ca','Catalan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('co','Corsican','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('cs','Czech','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('cy','Welsh','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('da','Danish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('de','German','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('dz','Bhutani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('el','Greek','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('en','English / US','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('eo','Esperanto','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('es','Spanish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('et','Estonian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('eu','Basque','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fa','Persian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fi','Finnish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fj','Fiji','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fo','Faeroese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fr','French','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('fy','Frisian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ga','Irish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('gd','Gaelic / Scots Gaelic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('gl','Galician','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('gn','Guarani','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('gu','Gujarati','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ha','Hausa','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('hi','Hindi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('hr','Croatian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('hu','Hungarian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('hy','Armenian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ia','Interlingua','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ie','Interlingue','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ik','Inupiak','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('in','Indonesian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('is','Icelandic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('it','Italian','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('iw','Hebrew','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ja','Japanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ji','Yiddish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('jw','Javanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ka','Georgian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('kk','Kazakh','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('kl','Greenlandic','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('km','Cambodian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('kn','Kannada','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ko','Korean','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ks','Kashmiri','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ku','Kurdish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ky','Kirghiz','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('la','Latin','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ln','Lingala','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('lo','Laothian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('lt','Lithuanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('lv','Latvian / Lettish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mg','Malagasy','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mi','Maori','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mk','Macedonian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ml','Malayalam','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mn','Mongolian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mo','Moldavian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mr','Marathi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ms','Malay','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('mt','Maltese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('my','Burmese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('na','Nauru','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ne','Nepali','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('nl','Dutch','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('no','Norwegian','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('oc','Occitan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('om','Oromo / Afan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('or','Oriya','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('pa','Punjabi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('pl','Polish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ps','Pashto / Pushto','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('pt','Portuguese','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('qu','Quechua','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('rm','Rhaeto-Romance','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('rn','Kirundi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ro','Romanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ru','Russian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('rw','Kinyarwanda','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sa','Sanskrit','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sd','Sindhi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sg','Sangro','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sh','Serbo-Croatian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('si','Singhalese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sk','Slovak','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sl','Slovenian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sm','Samoan','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sn','Shona','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('so','Somali','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sq','Albanian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sr','Serbian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ss','Siswati','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('st','Sesotho','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('su','Sudanese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sv','Swedish','Yes')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('sw','Swahili','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ta','Tamil','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('te','Tegulu','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tg','Tajik','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('th','Thai','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ti','Tigrinya','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tk','Turkmen','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tl','Tagalog','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tn','Setswana','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('to','Tonga','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tr','Turkish','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ts','Tsonga','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tt','Tatar','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('tw','Twi','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('uk','Ukrainian','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('ur','Urdu','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('uz','Uzbek','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('vi','Vietnamese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('vo','Volapuk','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('wo','Wolof','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('xh','Xhosa','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('yo','Yoruba','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('zh','Chinese','No')");
-		@$phpgw_setup->oProc->query("INSERT INTO languages (lang_id, lang_name, available) values ('zu','Zulu','No')");
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.5pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.5pre1';
-	function phpgwapi_upgrade0_9_5pre1()
-	{
-		global $phpgw_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->DropTable('sessions');
-		$phpgw_setup->oProc->CreateTable('phpgw_sessions', array(
-				'fd' => array(
-					'session_id' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
-					'session_lid' => array('type' => 'varchar', 'precision' => 255),
-					'session_pwd' => array('type' => 'varchar', 'precision' => 255),
-					'session_ip' => array('type' => 'varchar', 'precision' => 255),
-					'session_logintime' => array('type' => 'int', 'precision' => 4),
-					'session_dla' => array('type' => 'int', 'precision' => 4)
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array('session_id')
-			));
-
-		$phpgw_setup->oProc->CreateTable('phpgw_acl', array(
-				'fd' => array(
-					'acl_appname' => array('type' => 'varchar', 'precision' => 50),
-					'acl_location' => array('type' => 'varchar', 'precision' => 255),
-					'acl_account' => array('type' => 'int', 'precision' => 4),
-					'acl_account_type' => array('type' => 'char', 'precision' => 1),
-					'acl_rights' => array('type' => 'int', 'precision' => 4)
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			));
-
-		$phpgw_setup->oProc->DropTable('app_sessions');
-		$phpgw_setup->oProc->CreateTable('phpgw_app_sessions', array(
-				'fd' => array(
-					'sessionid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
-					'loginid' => array('type' => 'varchar', 'precision' => 20),
-					'app' => array('type' => 'varchar', 'precision' => 20),
-					'content' => array('type' => 'text')
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			));
-
-		$phpgw_setup->oProc->DropTable('access_log');
-		$phpgw_setup->oProc->CreateTable('phpgw_access_log', array(
-				'fd' => array(
-					'sessionid' => array('type' => 'varchar', 'precision' => 255),
-					'loginid' => array('type' => 'varchar', 'precision' => 30),
-					'ip' => array('type' => 'varchar', 'precision' => 30),
-					'li' => array('type' => 'int', 'precision' => 4),
-					'lo' => array('type' => 'varchar', 'precision' => 255)
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			));
-		
-		$setup_info['phpgwapi']['currentver'] = '0.9.5pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.5pre2';
-	function phpgwapi_upgrade0_9_5pre2()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.5';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.5';
-	function phpgwapi_upgrade0_9_5()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.6';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.6';
-	function phpgwapi_upgrade0_9_6()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.7pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.7pre1';
-	function phpgwapi_upgrade0_9_7pre1()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.7pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-	$test[] = '0.9.7pre2';
-	function phpgwapi_upgrade0_9_7pre2()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.7pre3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.7pre3';
-	function phpgwapi_upgrade0_9_7pre3()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.7';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.7';
-	function phpgwapi_upgrade0_9_7()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.8pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.8pre1';
-	function phpgwapi_upgrade0_9_8pre1()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->query("SELECT * FROM preferences ORDER BY preference_owner");
-		$t = array();
-		while ($phpgw_setup->oProc->next_record())
-		{
-			$t[$phpgw_setup->oProc->f('preference_owner')][$phpgw_setup->oProc->f('preference_appname')][$phpgw_setup->oProc->f('preference_var')] = $phpgw_setup->oProc->f('preference_value');
-		}
-
-		$phpgw_setup->oProc->DropTable('preferences');
-		$phpgw_setup->oProc->CreateTable('preferences', array(
-				'fd' => array(
-					'preference_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false),
-					'preference_value' => array('type' => 'text')
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			));
-
-		while ($tt = each($t))
-		{
-			$phpgw_setup->oProc->query("insert into preferences values ('$tt[0]','" . serialize($tt[1]) . "')");
-		}
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.8pre2';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.8pre2';
-	function phpgwapi_upgrade0_9_8pre2()
-	{
-		global $setup_info, $phpgw_setup;
-		$setup_info['phpgwapi']['currentver'] = '0.9.8pre3';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.8pre3';
-	function phpgwapi_upgrade0_9_8pre3()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->DropTable('phpgw_sessions');
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_sessions', array(
-				'fd' => array(
-					'session_id' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
-					'session_lid' => array('type' => 'varchar', 'precision' => 255),
-					'session_ip' => array('type' => 'varchar', 'precision' => 255),
-					'session_logintime' => array('type' => 'int', 'precision' => 4),
-					'session_dla' => array('type' => 'int', 'precision' => 4),
-					'session_info' => array('type' => 'text')
-				),
-				'pk' => array(),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array('session_id')
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.8pre4';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.8pre4';
-	function phpgwapi_upgrade0_9_8pre4()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_hooks', array(
-				'fd' => array(
-					'hook_id' =>       array('type' => 'auto', 'nullable' => false),
-					'hook_appname' =>  array('type' => 'varchar', 'precision' => 255),
-					'hook_location' => array('type' => 'varchar', 'precision' => 255),
-					'hook_filename' => array('type' => 'varchar', 'precision' => 255)
-				),
-				'pk' => array("hook_id"),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.8pre5';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.8pre5';
-	function phpgwapi_upgrade0_9_8pre5()
-	{
-		global $setup_info, $phpgw_setup;
-
-		// Since no applications are using it yet.  I am gonna drop it and create a new one.
-		// This is becuase I never finished the classes
-		$phpgw_setup->oProc->DropTable('categories');
-
-		$phpgw_setup->oProc->CreateTable(
-			'phpgw_categories', array(
-				'fd' => array(
-					'cat_id' =>      array('type' => 'auto', 'nullable' => false),
-					'cat_parent' =>  array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => false),
-					'cat_owner' =>   array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => false),
-					'cat_appname' => array('type' => 'varchar', 'precision'  => 50, 'nullable' => false),
-					'cat_name' =>    array('type' => 'varchar', 'precision'  => 150, 'nullable' => false),
-					'cat_description' => array('type' => 'varchar', 'precision'  => 255, 'nullable' => false),
-					'cat_data' =>    array('type' => 'text')
-				),
-				'pk' => array('cat_id'),
-				'ix' => array(),
-				'fk' => array(),
-				'uc' => array()
-			)
-		);
-
-		$setup_info['phpgwapi']['currentver'] = '0.9.9pre1';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-
-	$test[] = '0.9.9pre1';
-	function phpgwapi_upgrade0_9_9pre1()
-	{
-		global $setup_info;
-		$setup_info['phpgwapi']['currentver'] = '0.9.9';
-		return $setup_info['phpgwapi']['currentver'];
-		//return True;
-	}
-?>
Index: branches/2.2/expressoAdmin1_2/setup/tables_update.inc.php
===================================================================
--- branches/2.2/expressoAdmin1_2/setup/tables_update.inc.php	(revision 1836)
+++ branches/2.2/expressoAdmin1_2/setup/tables_update.inc.php	(revision 3031)
@@ -9,50 +9,5 @@
 	* option) any later version.                                               *
 	\**************************************************************************/	
-	$test[] = '1.2';
-	function expressoAdmin1_2_upgrade1_2()
-	{
-		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.21';
-		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
-	}
-	
-	$test[] = '1.21';
-	function expressoAdmin1_2_upgrade1_21()
-	{
-		$oProc = $GLOBALS['phpgw_setup']->oProc;
-
-		$oProc->CreateTable(
-			'phpgw_expressoadmin_samba', array(
-				'fd' => array(
-					'samba_domain_name' => array( 'type' => 'varchar', 'precision' => 50),
-					'samba_domain_sid' => array( 'type' => 'varchar', 'precision' => 100)
-				),
-				'pk' => array('samba_domain_name'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-		
-		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.240';
-		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
-	}
-
-	$test[] = '1.240';
-	function expressoAdmin1_2_upgrade1_240()
-	{
-		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.250';
-		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
-	}
-	
-	$test[] = '1.250';
-	function expressoAdmin1_2_upgrade1_250()
-	{
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','appinfo');
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','groupinfo');
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_expressoadmin_log','','msg');
-		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.261';
-		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
-	}
-	
+	// Since Expresso 1.2 using ExpressoAdmin 1.261
 	$test[] = '1.261';
 	function expressoAdmin1_2_upgrade1_261()
@@ -70,7 +25,30 @@
 	function expressoAdmin1_2_upgrade2_0_001()
 	{
+		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.0.002';
+		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
+	}	
+	$test[] = '2.0.002';
+	function expressoAdmin1_2_upgrade2_0_002()
+	{
+		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.0.003';
+		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
+	}	
+	$test[] = '2.0.003';
+	function expressoAdmin1_2_upgrade2_0_003()
+	{
+		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.0.004';
+		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
+	}		
+	$test[] = '2.0.004';
+	function expressoAdmin1_2_upgrade2_0_004()
+	{
 		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.1.000';
 		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
 	}
-
+	$test[] = '2.1.000';
+	function expressoAdmin1_2_upgrade2_1_000()
+	{
+		$GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.2.000';
+		return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'];
+	}
 ?>
Index: branches/2.2/expressoAdmin1_2/setup/setup.inc.php
===================================================================
--- branches/2.2/expressoAdmin1_2/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/expressoAdmin1_2/setup/setup.inc.php	(revision 3031)
@@ -13,5 +13,5 @@
 	$setup_info['expressoAdmin1_2']['title']     	= 'Expresso Admin';
 	/* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/
-	$setup_info['expressoAdmin1_2']['version']   	= '2.1.000';
+	$setup_info['expressoAdmin1_2']['version']   	= '2.2.000';
 	$setup_info['expressoAdmin1_2']['app_order']	= 1;
 	$setup_info['expressoAdmin1_2']['tables'][]		= 'phpgw_expressoadmin';
@@ -35,5 +35,5 @@
 	$setup_info['expressoAdmin1_2']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/news_admin/setup/setup.inc.php
===================================================================
--- branches/2.2/news_admin/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/news_admin/setup/setup.inc.php	(revision 3031)
@@ -14,5 +14,5 @@
 	$setup_info['news_admin']['name']      = 'news_admin';
 	//$setup_info['news_admin']['title']     = 'News Admin';
-	$setup_info['news_admin']['version']   = '2.1.000';
+	$setup_info['news_admin']['version']   = '2.2.000';
 	$setup_info['news_admin']['app_order'] = 16;
 	$setup_info['news_admin']['enable']    = 1;
@@ -31,5 +31,5 @@
 	$setup_info['news_admin']['depends'][] = array(
 		 'appname' => 'phpgwapi',
-		 'versions' => Array('2.1')
+		 'versions' => Array('2.2')
 	);
 
Index: branches/2.2/news_admin/setup/tables_update.inc.php
===================================================================
--- branches/2.2/news_admin/setup/tables_update.inc.php	(revision 1835)
+++ branches/2.2/news_admin/setup/tables_update.inc.php	(revision 3031)
@@ -12,141 +12,5 @@
 	* http://www.goldenglair.com                                               *
 	\**************************************************************************/
-
-
-	$test[] = '0.0.1';
-	function news_admin_upgrade0_0_1()
-	{
-		global $setup_info;
-
-		$setup_info['news_admin']['currentver'] = '0.8.1';
-		return $setup_info['news_admin']['currentver'];
-	}
-
-	$test[] = '0.8.1';
-	function news_admin_upgrade0_8_1()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->RenameTable('webpage_news','phpgw_news');
-
-		$setup_info['news_admin']['currentver'] = '0.8.1.001';
-		return $setup_info['news_admin']['currentver'];
-	}
-
-	$test[] = '0.8.1.001';
-	function news_admin_upgrade0_8_1_001()
-	{
-		global $setup_info, $phpgw_setup;
-
-		$phpgw_setup->oProc->AddColumn('phpgw_news','news_cat',array('type' => 'int','precision' => 4,'nullable' => True));
-		$phpgw_setup->oProc->query("update phpgw_news set news_cat='0'",__LINE__,__FILE__);
-
-		$setup_info['news_admin']['currentver'] = '0.8.1.002';
-		return $setup_info['news_admin']['currentver'];
-	}
-
-	$test[] = '0.8.1.002';
-	function news_admin_upgrade0_8_1_002()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_teaser',array(
-			'type' => 'varchar',
-			'precision' => '255',
-			'nullable' => True
-		));
-
-
-		$GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.500';
-		return $GLOBALS['setup_info']['news_admin']['currentver'];
-	}
-
-	$test[] = '0.9.14.500';
-	function news_admin_upgrade0_9_14_500()
-	{
-		$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_news_export',array(
-			'fd' => array(
-				'cat_id' => array('type' => 'int','precision' => '4','nullable' => False),
-				'export_type' => array('type' => 'int','precision' => '2','nullable' => True),
-				'export_itemsyntax' => array('type' => 'int','precision' => '2','nullable' => True),
-				'export_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'export_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'export_description' => array('type' => 'text', 'nullable' => True),
-				'export_img_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'export_img_url' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'export_img_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
-			),
-			'pk' => array('cat_id'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()
-		));
-
-		$GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.501';
-		return $GLOBALS['setup_info']['news_admin']['currentver'];
-	}
-
-	$test[] = '0.9.14.501';
-	function news_admin_upgrade0_9_14_501()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_begin',array(
-			'type' => 'int','precision' => '4','nullable' => True
-		));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_end',array(
-			'type' => 'int','precision' => '4','nullable' => True
-		));
-		$db2 = $GLOBALS['phpgw_setup']->db;
-		$GLOBALS['phpgw_setup']->oProc->query('SELECT news_id,news_status FROM phpgw_news');
-		while($GLOBALS['phpgw_setup']->oProc->next_record())
-		{
-			$unixtimestampmax = 2147483647;
-			$db2->query('UPDATE phpgw_news SET news_begin=news_date,news_end=' . 
-				(($GLOBALS['phpgw_setup']->oProc->f('news_status') == 'Active') ? $unixtimestampmax : 'news_date') .
-				' WHERE news_id=' . $GLOBALS['phpgw_setup']->oProc->f('news_id'));
-		}
-		$newtbldef = array(
-			'fd' => array(
-				'news_id' => array('type' => 'auto','nullable' => False),
-				'news_date' => array('type' => 'int','precision' => '4','nullable' => True),
-				'news_subject' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'news_submittedby' => array('type' => 'varchar','precision' => '255','nullable' => True),
-				'news_content' => array('type' => 'blob','nullable' => True),
-				'news_begin' => array('type' => 'int','precision' => '4','nullable' => True),
-				'news_end' => array('type' => 'int','precision' => '4','nullable' => True),
-				'news_cat' => array('type' => 'int','precision' => '4','nullable' => True),
-				'news_teaser' => array('type' => 'varchar','precision' => '255','nullable' => True)
-			),
-			'pk' => array('news_id'),
-			'fk' => array(),
-			'ix' => array('news_date','news_subject'),
-			'uc' => array()
-		);
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_news',$newtbldef,'news_status');
-
-		$GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.502';
-		return $GLOBALS['setup_info']['news_admin']['currentver'];
-	}
-
-
-	$test[] = '0.9.14.502';
-	function news_admin_upgrade0_9_14_502()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','is_html',array(
-			'type' => 'int',
-			'precision' => '2',
-			'nullable' => False,
-			'default' => '0'
-		));
-
-
-		$GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.503';
-		return $GLOBALS['setup_info']['news_admin']['currentver'];
-	}
-
-
-	$test[] = '0.9.14.503';
-	function news_admin_upgrade0_9_14_503()
-	{
-		$GLOBALS['setup_info']['news_admin']['currentver'] = '1.0.0';
-		return $GLOBALS['setup_info']['news_admin']['currentver'];
-	}
+	// Since Expresso 1.2 using news_admin 1.0.0 
 	$test[] = '1.0.0';
 	function news_admin_upgrade1_0_0()
@@ -167,3 +31,9 @@
 		return $GLOBALS['setup_info']['news_admin']['currentver'];
 	}
+	$test[] = '2.1.000';
+	function news_admin_upgrade2_1_000()
+	{
+		$GLOBALS['setup_info']['news_admin']['currentver'] = '2.2.000';
+		return $GLOBALS['setup_info']['news_admin']['currentver'];
+	}	
 ?>
Index: branches/2.2/admin/setup/setup.inc.php
===================================================================
--- branches/2.2/admin/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/admin/setup/setup.inc.php	(revision 3031)
@@ -12,5 +12,5 @@
 
 	$setup_info['admin']['name']      = 'admin';
-	$setup_info['admin']['version']   = '2.1.000';
+	$setup_info['admin']['version']   = '2.2.000';
 	$setup_info['admin']['app_order'] = 1;
 	$setup_info['admin']['tables']    = '';
@@ -47,5 +47,5 @@
 	$setup_info['admin']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/help/setup/setup.inc.php
===================================================================
--- branches/2.2/help/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/help/setup/setup.inc.php	(revision 3031)
@@ -13,5 +13,5 @@
 	$setup_info['help']['name']      = 'help';
 	$setup_info['help']['title']     = 'User Manual and Help Page';
-	$setup_info['help']['version']   = '2.1.000';
+	$setup_info['help']['version']   = '2.2.000';
 	$setup_info['help']['app_order'] = 5;
 	$setup_info['help']['enable']    = 2;	// Invisible on top (navigation bar)
@@ -26,5 +26,5 @@
 	$setup_info['help']['depends'][] = array(
 		 'appname' => 'phpgwapi',
-		 'versions' => Array('2.1')
+		 'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/jabberit_messenger/setup/setup.inc.php
===================================================================
--- branches/2.2/jabberit_messenger/setup/setup.inc.php	(revision 3030)
+++ branches/2.2/jabberit_messenger/setup/setup.inc.php	(revision 3031)
@@ -8,5 +8,5 @@
 	$setup_info['jabberit_messenger']['name']      	= 'jabberit_messenger';
 	$setup_info['jabberit_messenger']['title']     	= 'Jeti Applet';
-	$setup_info['jabberit_messenger']['version']   	= '2.1.000';
+	$setup_info['jabberit_messenger']['version']   	= '2.2.000';
 	$setup_info['jabberit_messenger']['app_order'] 	= 9;
 	$setup_info['jabberit_messenger']['enable']    	= 1;
Index: branches/2.2/contactcenter/setup/tables_update.inc.php
===================================================================
--- branches/2.2/contactcenter/setup/tables_update.inc.php	(revision 1728)
+++ branches/2.2/contactcenter/setup/tables_update.inc.php	(revision 3031)
@@ -9,111 +9,5 @@
 	* option) any later version.                                               *
 	\**************************************************************************/	
-	$test[] = '0.4.1';
-	function contactcenter_upgrade0_4_1() {
-		
-		$oProc = $GLOBALS['phpgw_setup']->oProc;
-		$oProc->DropTable('phpgw_cc_city');
-		$oProc->DropTable('phpgw_cc_state');
-		$oProc->CreateTable(
-			'phpgw_cc_state',array(
-				'fd' => array(
-					'id_state' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false),
-					'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2),
-					'state_name' => array( 'type' => 'varchar', 'precision' => 30),
-					'state_symbol' => array( 'type' => 'varchar', 'precision' => 10)
-				),
-				'pk' => array('id_state'),
-				'fk' => array('id_country' => array('phpgw_common_country_list' => 'id_country')),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-		$oProc->CreateTable(
-			'phpgw_cc_city', array(
-				'fd' => array(
-					'id_city' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false ),
-					'id_state' => array( 'type' => 'int', 'precision' => 8 ),
-					'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2),
-					'city_timezone' => array( 'type' => 'int', 'precision' => 2 ),
-					'city_geo_location' => array(  'type'  => 'varchar', 'precision' => 40 ),
-					'city_name' => array( 'type'  => 'varchar', 'precision' => 60, 'nullable' => 'false' ),				
-				),
-				'pk' => array('id_city'),
-				'fk' => array('id_state'   => array('phpgw_cc_state' => 'id_state')	),
-				'ix' => array(),
-				'uc' => array()
-			)		
-		);		
-		
-		include("states_pt-br.inc.php"); 
-		include("cities_pt-br.inc.php");
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.0';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.0.0';
-	function contactcenter_upgrade1_0_0() {
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.005';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.0.005';
-	function contactcenter_upgrade1_0_005() {
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.14';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.14';
-	function contactcenter_upgrade1_14() {				
-		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_connections ALTER COLUMN connection_value TYPE varchar(100)");
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.15';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.15';
-	function contactcenter_upgrade1_15() {		
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cc_contact','last_status', array('type' => 'char', 'precision' => 1, 'default' => 'N'));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cc_contact','category', array('type' => 'varchar', 'precision' => 20));				
-		// Verify if last_update column exists.....
-		$GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_cc_contact', &$sColumns);
- 		if(array_search("last_update",explode(",",$sColumns)) === FALSE) {
-			$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_update int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)");
- 		}
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.20';
-	function contactcenter_upgrade1_20() {
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20.001';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '1.20.001';
-	function contactcenter_upgrade1_20_001() {
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '1.21';
-		// Verify if plpgsql language is installed.
-		$res = $GLOBALS['phpgw_setup']->db->query("select lanname from pg_language where lanname = 'plpgsql'");
-		if(!strstr($res,'plpgsql')){
-			$GLOBALS['phpgw_setup']->db->query("create language 'plpgsql'");
-		}		
-		// Verify if trigger Insert() for Shared Contacts exists, else create it.....
-		$res = $GLOBALS['phpgw_setup']->db->query("select tgname from pg_trigger where tgname = 'trig_share_catalog_insert'");
-		if(!strstr($res,'trig_share_catalog_insert')){
-			$GLOBALS['phpgw_setup']->db->query("create function share_catalog_insert() returns trigger as ' begin if ".
-				"new.acl_appname = ''contactcenter'' and  new.acl_location <> ''run'' then ".
-				"insert into phpgw_cc_contact_rels (id_contact,id_related,id_typeof_contact_relation) ".
-				"values (new.acl_location::integer,new.acl_account,1); end if; return new; end;' language 'plpgsql';");		
-
-			$GLOBALS['phpgw_setup']->db->query("create trigger trig_share_catalog_insert after insert on phpgw_acl for " .
-				"each row execute procedure share_catalog_insert()"); 
-		}
-		// Verify if trigger Delete() for Shared Contacts exists, else create it.....
-		$res = $GLOBALS['phpgw_setup']->db->query("select tgname from pg_trigger where tgname = 'trig_share_catalog_delete'");		
-		if(!strstr($res,'trig_share_catalog_delete')){
-			$GLOBALS['phpgw_setup']->db->query("create function share_catalog_delete() returns trigger as '	begin if " .
-								"old.acl_appname = ''contactcenter'' then delete from phpgw_cc_contact_rels where " .
-								"id_contact=old.acl_location and id_related=old.acl_account and " .
-								"id_typeof_contact_relation=1; end if; return new; end;' language 'plpgsql'");
-	
-			$GLOBALS['phpgw_setup']->db->query("create trigger trig_share_catalog_delete after delete on phpgw_acl for " .
-				"each row execute procedure share_catalog_delete()");
-		}
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
+	// Since Expresso 1.2 using ContactCenter 1.21
 	$test[] = '1.21';
 	function contactcenter_upgrade1_21() {
@@ -129,14 +23,24 @@
 	function contactcenter_upgrade2_0_000() {
 		$GLOBALS['setup_info']['contactcenter']['currentver'] = '2.0.001';
+		return $GLOBALS['setup_info']['contactcenter']['currentver'];
+	}
+	$test[] = '2.0.001';
+	function contactcenter_upgrade2_0_001() {
+		$GLOBALS['setup_info']['contactcenter']['currentver'] = '2.0.002';
+		return $GLOBALS['setup_info']['contactcenter']['currentver'];
+	}		
+	$test[] = '2.0.002';
+	function contactcenter_upgrade2_0_002() {
+		$GLOBALS['setup_info']['contactcenter']['currentver'] = '2.1.000';
+		return $GLOBALS['setup_info']['contactcenter']['currentver'];
+	}	
+	$test[] = '2.1.000';
+	function contactcenter_upgrade2_1_000() {		
 		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN web_page character varying(100)");
  		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN corporate_name character varying(100)");
 		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN job_title character varying(40)");
 		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN department character varying(30)");
+		$GLOBALS['setup_info']['contactcenter']['currentver'] = '2.2.000';
 		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
-	$test[] = '2.0.001';
-	function contactcenter_upgrade2_0_001() {
-		$GLOBALS['setup_info']['contactcenter']['currentver'] = '2.1.000';
-		return $GLOBALS['setup_info']['contactcenter']['currentver'];
-	}
+	}	
 ?>
Index: branches/2.2/contactcenter/setup/setup.inc.php
===================================================================
--- branches/2.2/contactcenter/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/contactcenter/setup/setup.inc.php	(revision 3031)
@@ -17,5 +17,5 @@
 	$setup_info['contactcenter']['name']      = 'contactcenter';
 	$setup_info['contactcenter']['title']     = 'ContactCenter';
-	$setup_info['contactcenter']['version']   = '2.1.000';
+	$setup_info['contactcenter']['version']   = '2.2.000';
 	$setup_info['contactcenter']['app_order'] = 4;
 	$setup_info['contactcenter']['enable']    = 1;
@@ -76,5 +76,5 @@
 	$setup_info['contactcenter']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/emailadmin/setup/setup.inc.php
===================================================================
--- branches/2.2/emailadmin/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/emailadmin/setup/setup.inc.php	(revision 3031)
@@ -14,5 +14,5 @@
 	$setup_info['emailadmin']['name']      = 'emailadmin';
 	$setup_info['emailadmin']['title']     = 'EMailAdmin';
-	$setup_info['emailadmin']['version']   = '2.1.000';
+	$setup_info['emailadmin']['version']   = '2.2.000';
 	$setup_info['emailadmin']['app_order'] = 10;
 	$setup_info['emailadmin']['enable']    = 2;
@@ -40,5 +40,5 @@
 	$setup_info['emailadmin']['depends'][] = array(
 		'appname'  => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 
Index: branches/2.2/emailadmin/setup/tables_update.inc.php
===================================================================
--- branches/2.2/emailadmin/setup/tables_update.inc.php	(revision 1728)
+++ branches/2.2/emailadmin/setup/tables_update.inc.php	(revision 3031)
@@ -92,14 +92,14 @@
    $test[] = '2.0.000';
    function emailadmin_upgrade2_0_000()
-	{
-      $GLOBALS['setup_info']['emailadmin']['currentver'] = '2.0.001';
+	{      
       $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_emailadmin','imapcreatespamfolder', array('type' => 'varchar', 'precision' => 3));
       $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_emailadmin','imapcyrususerpostspam', array('type' => 'varchar', 'precision' => 30));
+	  $GLOBALS['setup_info']['emailadmin']['currentver'] = '2.1.000';      
       return $GLOBALS['setup_info']['emailadmin']['currentver'];
    }
-   $test[] = '2.0.001';
-   function emailadmin_upgrade2_0_001()
+   $test[] = '2.1.000';
+   function emailadmin_upgrade2_1_000()
 	{
-      $GLOBALS['setup_info']['emailadmin']['currentver'] = '2.1.000';
+      $GLOBALS['setup_info']['emailadmin']['currentver'] = '2.2.000';
       return $GLOBALS['setup_info']['emailadmin']['currentver'];
    }
Index: branches/2.2/preferences/setup/setup.inc.php
===================================================================
--- branches/2.2/preferences/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/preferences/setup/setup.inc.php	(revision 3031)
@@ -13,5 +13,5 @@
 	$setup_info['preferences']['name']      = 'preferences';
 	$setup_info['preferences']['title']     = 'Preferences';
-	$setup_info['preferences']['version']   = '2.1.000';
+	$setup_info['preferences']['version']   = '2.2.000';
 	$setup_info['preferences']['app_order'] = 1;
 	$setup_info['preferences']['tables']    = '';
@@ -28,5 +28,5 @@
 	$setup_info['preferences']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/mobile/setup/setup.inc.php
===================================================================
--- branches/2.2/mobile/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/mobile/setup/setup.inc.php	(revision 3031)
@@ -14,5 +14,5 @@
 	$setup_info['mobile']['name']      = 'mobile';
 	$setup_info['mobile']['title']     = 'ExpressoMini';
-	$setup_info['mobile']['version']   = '2.1.000';
+	$setup_info['mobile']['version']   = '2.2.000';
 	$setup_info['mobile']['app_order'] = 4;
 	$setup_info['mobile']['enable']    = 2;
@@ -39,5 +39,5 @@
 	$setup_info['mobile']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
Index: branches/2.2/calendar/setup/setup.inc.php
===================================================================
--- branches/2.2/calendar/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/calendar/setup/setup.inc.php	(revision 3031)
@@ -12,5 +12,5 @@
 
 	$setup_info['calendar']['name']    = 'calendar';
-	$setup_info['calendar']['version'] = '2.1.000';
+	$setup_info['calendar']['version'] = '2.2.000';
 	$setup_info['calendar']['app_order'] = 3;
 	$setup_info['calendar']['enable']  = 1;
@@ -52,4 +52,4 @@
 	$setup_info['calendar']['depends'][] = array(
 		 'appname' => 'phpgwapi',
-		 'versions' => Array('2.1')
+		 'versions' => Array('2.2')
 	);
Index: branches/2.2/calendar/setup/tables_update.inc.php
===================================================================
--- branches/2.2/calendar/setup/tables_update.inc.php	(revision 1835)
+++ branches/2.2/calendar/setup/tables_update.inc.php	(revision 3031)
@@ -19,42 +19,5 @@
 		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE ".$table." ADD COLUMN ".$column." ".$attrs);
 	}  
-	$test[] = '0.9.2';
-	function calendar_upgrade0_9_2()
-	{
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.17';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}
-	$test[] = '0.9.17';
-	function calendar_upgrade0_9_17()
-	{
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.21';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}
-	$test[] = '0.9.20';
-	function calendar_upgrade0_9_20()
-	{
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.21';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}	
-	$test[] = '0.9.21';
-	function calendar_upgrade0_9_21()
-	{
-		addSpecialColumn("phpgw_cal","last_status","char(1) DEFAULT 'N'::bpchar");
-		addSpecialColumn("phpgw_cal","last_update","int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)");
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.22';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}	
-	$test[] = '0.9.22';
-	function calendar_upgrade0_9_22()
-	{
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.23';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}
-	$test[] = '0.9.23';
-	function calendar_upgrade0_9_23()
-	{
-		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3';
-		return $GLOBALS['setup_info']['calendar']['currentver'];
-	}	
+/// Since Expresso 1.2 using Calendar 0.9.3 
 	$test[] = '0.9.3';
 	function calendar_upgrade0_9_3()
@@ -78,6 +41,30 @@
 	function calendar_upgrade2_0_002()
 	{
+		$GLOBALS['setup_info']['calendar']['currentver'] = '2.0.003';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}
+	$test[] = '2.0.003';
+	function calendar_upgrade2_0_003()
+	{
+		$GLOBALS['setup_info']['calendar']['currentver'] = '2.0.004';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}	
+	$test[] = '2.0.004';
+	function calendar_upgrade2_0_004()
+	{
+		$GLOBALS['setup_info']['calendar']['currentver'] = '2.0.005';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}	
+	$test[] = '2.0.005';
+	function calendar_upgrade2_0_005()
+	{
 		$GLOBALS['setup_info']['calendar']['currentver'] = '2.1.000';
 		return $GLOBALS['setup_info']['calendar']['currentver'];
 	}
+	$test[] = '2.1.000';
+	function calendar_upgrade2_1_000()
+	{
+		$GLOBALS['setup_info']['calendar']['currentver'] = '2.2.000';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}
 ?>
Index: branches/2.2/filemanager/setup/setup.inc.php
===================================================================
--- branches/2.2/filemanager/setup/setup.inc.php	(revision 3019)
+++ branches/2.2/filemanager/setup/setup.inc.php	(revision 3031)
@@ -47,5 +47,5 @@
 	(
 		 'appname' => 'phpgwapi',
-		 'versions' => array('2.0.004')
+		 'versions' => array('2.2')
 	);
 ?>
Index: branches/2.2/filemanager/setup/tables_update.inc.php
===================================================================
--- branches/2.2/filemanager/setup/tables_update.inc.php	(revision 3019)
+++ 	(revision )
@@ -1,18 +1,0 @@
-<?php
-/**************************************************************************\
- * eGroupWare - Setup                                                       *
- * http://www.egroupware.org                                                *
- * --------------------------------------------                             *
- *  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.                                              *
- \**************************************************************************/
-	$test[] = '2.1.00';
-	function filemanager_upgrade2_1_00()
-	{
-		$GLOBALS['setup_info']['filemanager']['currentver'] = '2.2.00';
-		return $GLOBALS['setup_info']['filemanager']['currentver'];
-	}
-
-?>
Index: branches/2.2/workflow/setup/setup.inc.php
===================================================================
--- branches/2.2/workflow/setup/setup.inc.php	(revision 1974)
+++ branches/2.2/workflow/setup/setup.inc.php	(revision 3031)
@@ -13,5 +13,5 @@
 	$setup_info['workflow']['name']			= 'workflow';
 	$setup_info['workflow']['title']		= 'Workflow management';
-	$setup_info['workflow']['version']		= '2.1.000';
+	$setup_info['workflow']['version']		= '2.2.000';
 	$setup_info['workflow']['app_order']	= 10;
 	$setup_info['workflow']['enable']		= 1;
@@ -59,9 +59,9 @@
 	$setup_info['workflow']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('1.0.0','1.0.1','1.2', '2.0', '2.1')
+		'versions' => Array('1.2', '2.0', '2.2')
 	);
 	$setup_info['workflow']['depends'][] = array(
 		'appname' => 'preferences',
-		'versions' => Array('1.0.0', '0.9.13.002', '2.0', '2.1')
+		'versions' => Array('0.9.13.002', '2.0', '2.2')
 	);
 ?>
Index: branches/2.2/workflow/setup/tables_update.inc.php
===================================================================
--- branches/2.2/workflow/setup/tables_update.inc.php	(revision 1981)
+++ branches/2.2/workflow/setup/tables_update.inc.php	(revision 3031)
@@ -39,1099 +39,5 @@
 		return $workflowHostInfo;
 	}
-
-	$test[] = '1.0.1';
-	function workflow_upgrade1_0_1()
-	{
-		# add an instance_supplements table
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_instance_supplements',
-			array(
-				'fd' => array(
-					'wf_supplement_id' 	=> array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-					'wf_supplement_type'	=> array('type' => 'varchar', 'precision' => '50', 'nullable' => True),
-					'wf_supplement_name'	=> array('type' => 'varchar', 'precision' => '100', 'nullable' => True),
-					'wf_supplement_value'	=> array('type' => 'text', 'nullable' => True),
-					'wf_workitem_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-					'wf_supplement_blob'	=> array('type' => 'blob', 'nullable' => True)
-				),
-				'pk' => array('wf_supplement_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		#Add in activities table is_reassign_box, is_report, default_user and default group
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_is_reassign_box',array('type' => 'char', 'precision' => 1, 'nullable' => True));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_is_report',array('type' => 'char', 'precision' => 1, 'nullable' => True));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_default_user', array('type' => 'varchar', 'precision' => '200', 'nullable' => True, 'default' => '*'));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_default_group', array('type' => 'varchar', 'precision' => '200', 'nullable' => True, 'default' => '*'));
-
-		#Add in instance_activities table the group field
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_instance_activities' ,'wf_group',array('type' => 'varchar', 'precision' => 200, 'nullable' => True, 'default' => '*'));
-
-		#Add in instance table the name, and the priority, we keep the properties for the moment
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_instances' ,'wf_priority',array('type' => 'int', 'precision' => 4, 'nullable' => True));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_instances' ,'wf_name',array('type' => 'varchar', 'precision' => 120, 'nullable' => True));
-
-		#Add in workitems table note and action
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_workitems' ,'wf_note',array('type' => 'text', 'precision' => 50, 'nullable' => True));
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_workitems' ,'wf_action',array('type' => 'text', 'precision' => 50, 'nullable' => True));
-
-		#Add in user_roles table the account type
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_user_roles' ,'wf_account_type',array('type' => 'char', 'precision' => 1, 'nullable' => True, 'default' => 'u'));
-			#modifying the sequence as well
-			#we need a RefreshTable
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_wf_user_roles' ,array(
-		 	'fd' => array(
-				'wf_role_id'            => array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-				'wf_p_id'               => array('type' => 'int', 'precision' => '4', 'nullable' => False),
-				'wf_user'               => array('type' => 'varchar', 'precision' => '200', 'nullable' => False),
-				'wf_account_type'       => array('type' => 'char', 'precision' => '1', 'nullable' => True, 'default' => 'u'),
-			 ),
-			 'pk' => array('wf_role_id', 'wf_user', 'wf_account_type'),
-			 'fk' => array(),
-			 'ix' => array(),
-			 'uc' => array()
-		));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.1.00.000';
-	function workflow_upgrade1_1_00_000()
-	{
-		# add a process_config table
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_process_config',
-			array(
-				'fd' => array(
-					'wf_p_id'               => array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_config_name' 	=> array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
-					'wf_config_value'	=> array('type' => 'text', 'nullable' => True),
-					'wf_config_value_int'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-				),
-				'pk' => array('wf_p_id','wf_config_name'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		//change de default value for priority
-
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.01.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.1.01.000';
-	function workflow_upgrade1_1_01_000()
-	{
-		#remove unused 'new' fields in activity and add a agent key
- 		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_activities', '', 'wf_is_reassign_box');
- 		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_activities', '', 'wf_is_report');
- 		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_activities', '', 'wf_default_group');
- 		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_agent', array('type' => 'int', 'precision' => '4', 'nullable' => True));
-
-		#add a readonly attribute to role/activty mapping
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activity_roles' ,'wf_readonly', array('type' => 'int', 'precision' => '1', 'nullable' => False, 'default'=> 0));
-
-		#add a instance category attribute
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_instances' ,'wf_category', array('type' => 'int', 'precision'=>'4', 'nullable' => True));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.02.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-
-	$test[] = '1.1.02.000';
-	function workflow_upgrade1_1_02_000()
-	{
- 		//drop the agent key in activity, we need something more complex in fact
- 		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_activities','','wf_agent');
-
-		//add the agent table, link between activities and agents
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_activity_agents',
-			array(
-				'fd' => array(
-					'wf_activity_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_agent_id' 		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_agent_type'		=> array('type' => 'varchar', 'precision' => '15', 'nullable' => False),
-				),
-				'pk' => array('wf_activity_id', 'wf_agent_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		// add the mail_smtp agent table
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_agent_mail_smtp',
-			array(
-				'fd' => array(
-					'wf_agent_id'		=> array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-					'wf_to' 		=> array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '%roles%'),
-					'wf_cc'			=> array('type' => 'varchar', 'precision' => '255', 'nullable' => True),
-					'wf_bcc'		=> array('type' => 'varchar', 'precision' => '255', 'nullable' => True),
-					'wf_from'		=> array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => '%user%'),
-					'wf_replyTo'		=> array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => '%user%'),
-					'wf_subject'		=> array('type' => 'varchar', 'precision' => '255', 'nullable' => True),
-					'wf_message'		=> array('type' => 'text', 'nullable' => True),
-					'wf_send_mode'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => 0),
-				),
-				'pk' => array('wf_agent_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.03.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.1.03.000';
-	function workflow_upgrade1_1_03_000()
-	{
-		//change type of wf_next_user to handle serialization -> multiple states if instance has multiple activities running
-		//we will loose current wf_next_activity but the update should'nt be made when instances are running and this is
-		//a field needed only at runtime, normally.
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_instances','','wf_next_activity');
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_instances' ,'wf_next_activity', array('type' => 'blob', 'nullable' => True));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.04.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.1.04.000';
-	function workflow_upgrade1_1_04_000()
-	{
-		//unused column. Notice I had to do this manually with MAIN versions of phpgwapi/class.schema_proc.inc.php
-		$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_wf_instance_activities','','wf_group');
-
-		//Adding some indexes on some tables:
-
-		//we need a RefreshTable for that
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_wf_instance_activities' ,array(
-			'fd' => array(
-				'wf_instance_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-				'wf_activity_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-				'wf_started'		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-				'wf_ended'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-				'wf_user'		=> array('type' => 'varchar', 'precision' => '200', 'nullable' => True),
-				'wf_status'		=> array('type' => 'varchar', 'precision' => '25', 'nullable' => True),
-			),
-			'pk' => array('wf_instance_id', 'wf_activity_id'),
-			'fk' => array(),
-			'ix' => array(array('wf_activity_id'),array('wf_instance_id'), array('wf_user')),
-			'uc' => array()
-		));
-		// we change some indexes
-		// we need a RefreshTable
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_wf_instances' ,array(
-			'fd' => array(
-				'wf_instance_id'	=> array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-				'wf_p_id'		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-				'wf_started'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-				'wf_owner'		=> array('type' => 'varchar', 'precision' => '200', 'nullable' => True),
-				'wf_next_activity'	=> array('type' => 'blob', 'nullable' => True),
-				'wf_next_user'		=> array('type' => 'varchar', 'precision' => '200', 'nullable' => True),
-				'wf_ended'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-				'wf_status'		=> array('type' => 'varchar', 'precision' => '25', 'nullable' => True),
-				'wf_priority'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default'=> 0),
-				'wf_properties'		=> array('type' => 'blob', 'nullable' => True),
-				'wf_name'		=> array('type' => 'varchar', 'precision'=>'120', 'nullable' => True),
-				'wf_category'		=> array('type' => 'int', 'precision'=>'4', 'nullable' => True),
-			),
-			'pk' => array('wf_instance_id'),
-			'fk' => array(),
-			'ix' => array(array('wf_owner'), array('wf_status')),
-			'uc' => array()
-		));
-		// we change some indexes
-		// we need a RefreshTable
-		$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_wf_processes' ,array(
-			'fd' => array(
-				'wf_p_id'		=> array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-				'wf_name'		=> array('type' => 'varchar', 'precision' => '80', 'nullable' => True),
-				'wf_is_valid'		=> array('type' => 'char', 'precision' => '1', 'nullable' => True),
-				'wf_is_active'		=> array('type' => 'char', 'precision' => '1', 'nullable' => True),
-				'wf_version'		=> array('type' => 'varchar', 'precision' => '12', 'nullable' => True),
-				'wf_description'	=> array('type' => 'text', 'nullable' => True),
-				'wf_last_modif'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-				'wf_normalized_name'	=> array('type' => 'varchar', 'precision' => '80', 'nullable' => True),
-			),
-			'pk' => array('wf_p_id'),
-			'fk' => array(),
-			'ix' => array(array('wf_p_id','wf_is_active')),
-			'uc' => array()
-		));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.1.05.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.1.05.000';
-	function workflow_upgrade1_1_05_000()
-	{
-		#serialized data is now stored with a Base64 encoding to ensure it work in all case (even with \' for example)
-		//We gonna make our updates manually here:
-		//they were an error (quotes) in the first version of this upgrade, if your database is MySQL you should
-		//set the version to 1.1.05.000 in egw_applications and rerun this upgrade for old properties
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC);
-			$result = $GLOBALS['phpgw']->ADOdb->query('select * from egw_wf_instances');
-			if (!(empty($result)))
-			{
-				while ($res = $result->fetchRow())
-				{
-					$new_props = base64_encode($res['wf_properties']);
-					$new_next = base64_encode($res['wf_next_activity']);
-					$ok =  $GLOBALS['phpgw']->ADOdb->query(
-						'update egw_wf_instances set wf_properties = ?, wf_next_activity=? where wf_instance_id = ?',
-						array($new_props,$new_next, (int)$res['wf_instance_id'])
-					);
-				}
-			}
-			$result = $GLOBALS['phpgw']->ADOdb->query('select * from egw_wf_workitems');
-			if (!(empty($result)))
-			{
-				while ($res = $result->fetchRow())
-				{
-					$new_props = base64_encode($res['wf_properties']);
-					$ok =  $GLOBALS['phpgw']->ADOdb->query(
-						'update egw_wf_workitems set wf_properties = ?  where wf_item_id = ?',
-						array($new_props, (int)$res['wf_item_id'])
-					);
-				}
-			}
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.2.00.000';
-	function workflow_upgrade1_2_00_000()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.00.001';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-	$test[] = '1.2.00.001';
-	function workflow_upgrade1_2_00_001()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.00.002';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-	$test[] = '1.2.00.002';
-	function workflow_upgrade1_2_00_002()
-	{
-		#groups Ids are now negative in egroupware, we need to negative all user id which is positive and of type 'g'
-		#code inspired by phpgwapi/setup/table_update.inc.php
-		// convert all positive group id's to negative ones
-		// this allows duplicate id for users and groups in ldap
-
-		/* Celepar: não realizar esta atualização
-		$where = false;
-		list($table,$col,$where) = $data;
-		$table = 'egw_wf_user_roles';
-		$col = 'wf_user';
-		$where = "wf_account_type='g' and (SUBSTR($col,1,1) <> '-')";
-		$set = $col.'='.$GLOBALS['egw_setup']->db->concat("'-'",$col);
-		$query = "UPDATE $table SET $set WHERE $where";
-		//echo "<p>debug query: $query</p>\n";
-		$GLOBALS['egw_setup']->db->query($query,__LINE__,__FILE__);
-
-		*/
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.2.01.000';
-        function workflow_upgrade1_2_01_000()
-        {
-                #updating the current version
-                $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.001';
-                return $GLOBALS['setup_info']['workflow']['currentver'];
-        }
-
-        $test[] = '1.2.01.001';
-        function workflow_upgrade1_2_01_001()
-        {
-                #updating the current version
-                $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.002';
-                return $GLOBALS['setup_info']['workflow']['currentver'];
-        }
-
-        $test[] = '1.2.01.002';
-        function workflow_upgrade1_2_01_002()
-        {
-                #updating the current version
-                $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.003';
-                return $GLOBALS['setup_info']['workflow']['currentver'];
-        }
-
-	$test[] = '1.2.01.003';
-	function workflow_upgrade1_2_01_003()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.004';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.2.01.004';
-	function workflow_upgrade1_2_01_004()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.005';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.2.01.005';
-	function workflow_upgrade1_2_01_005()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* create the workflow database */
-			$GLOBALS['phpgw']->ADOdb->query("CREATE DATABASE workflow WITH OWNER = postgres TEMPLATE = template0 ENCODING = 'LATIN1'");
-			$GLOBALS['phpgw']->ADOdb->query("CREATE USER admin_workflow WITH PASSWORD 'admin_workflow' NOCREATEDB NOCREATEUSER VALID UNTIL 'infinity'");
-			$GLOBALS['phpgw']->ADOdb->query("CREATE GROUP workflow");
-			$GLOBALS['phpgw']->ADOdb->query("ALTER GROUP workflow ADD USER admin_workflow");
-			$GLOBALS['phpgw']->ADOdb->query("GRANT workflow TO admin_workflow");
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* create a sample application (Music CD Loan) */
-				$workflowDB->query("CREATE USER admin_cds WITH PASSWORD 'admin_cds' NOCREATEDB NOCREATEUSER VALID UNTIL 'infinity'");
-				$workflowDB->query("ALTER GROUP workflow ADD USER admin_cds");
-				$workflowDB->query("CREATE SCHEMA cds AUTHORIZATION admin_cds");
-				$workflowDB->query("GRANT ALL ON SCHEMA cds TO admin_cds");
-				$workflowDB->query("GRANT ALL ON SCHEMA cds TO postgres");
-				$workflowDB->query("CREATE TABLE cds.cdcollection(cdid int4 NOT NULL, title varchar(200), status varchar(40), usuario varchar(200), CONSTRAINT cdcollection_pkey PRIMARY KEY (cdid))");
-				$workflowDB->query("ALTER TABLE cds.cdcollection OWNER TO admin_cds");
-				$workflowDB->query("GRANT ALL ON TABLE cds.cdcollection TO postgres WITH GRANT OPTION");
-				$workflowDB->query("GRANT ALL ON TABLE cds.cdcollection TO admin_cds");
-				$workflowDB->query("COMMENT ON TABLE cds.cdcollection IS 'Exemplo de Empréstimo de CDs'");
-				$workflowDB->query("INSERT INTO cdcollection VALUES (1, 'Iron Maiden - Powerslave', 'disponivel', '')");
-				$workflowDB->query("INSERT INTO cdcollection VALUES (2, 'Pink Floyd - The Wall', 'disponivel', '')");
-				$workflowDB->query("INSERT INTO cdcollection VALUES (3, 'Deep Purple - Fireball', 'disponivel', '')");
-
-				/* create the new tables */
-				$workflowDB->query('CREATE TABLE organizacao (organizacao_id serial NOT NULL, nome character varying(20) NOT NULL, descricao character varying(100) NOT NULL)');
-				$workflowDB->query('CREATE TABLE area_status (area_status_id serial NOT NULL, organizacao_id integer NOT NULL, descricao character varying(50) NOT NULL, nivel integer NOT NULL)');
-				$workflowDB->query('CREATE TABLE centro_custo (organizacao_id integer NOT NULL, centro_custo_id serial NOT NULL, nm_centro_custo integer NOT NULL, grupo character varying(30), descricao character varying(100) NOT NULL)');
-				$workflowDB->query('CREATE TABLE localidade (organizacao_id integer NOT NULL, localidade_id serial NOT NULL, centro_custo_id integer, descricao character varying(50) NOT NULL)');
-				$workflowDB->query('CREATE TABLE funcionario (funcionario_id character varying NOT NULL, area_id integer NOT NULL, localidade_id integer NOT NULL, centro_custo_id integer NOT NULL, organizacao_id integer NOT NULL, funcionario_status_id integer NOT NULL)');
-				$workflowDB->query('CREATE TABLE area (organizacao_id integer NOT NULL, area_id serial NOT NULL, area_status_id integer NOT NULL, areasup_organizacao_id integer, superior_area_id integer, centro_custo_id integer, titular_funcionario_id character varying, substituto_funcionario_id character varying, sigla character varying(20) NOT NULL, descricao character varying(100) NOT NULL, ativa character varying(1) NOT NULL)');
-				$workflowDB->query('CREATE TABLE funcionario_status (funcionario_status_id serial NOT NULL, descricao character varying(50) NOT NULL)');
-				$workflowDB->query('CREATE TABLE admin_access (admin_access_id integer NOT NULL, tipo character(3) NOT NULL, numvalue smallint NOT NULL, nivel integer DEFAULT 0)');
-				$workflowDB->query('CREATE TABLE aplicacao_externa (apl_in_id serial NOT NULL, apl_st_nome character varying(50) NOT NULL, apl_st_descricao text, apl_st_imagem character varying(100), apl_st_endereco character varying(120) NOT NULL, apl_bt_autentica bit(1), apl_st_post text, apl_in_responsavel integer NOT NULL, apl_in_area integer NOT NULL)');
-				$workflowDB->query('CREATE TABLE aplicacao_externa_acl (apl_in_id integer NOT NULL, apl_in_uid integer NOT NULL)');
-
-				/* add the constraints */
-				$workflowDB->query('ALTER TABLE ONLY organizacao ADD CONSTRAINT organizacao_pkey PRIMARY KEY (organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY area_status ADD CONSTRAINT areastatus_pkey PRIMARY KEY (area_status_id, organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY centro_custo ADD CONSTRAINT centrocusto_pkey PRIMARY KEY (organizacao_id, centro_custo_id)');
-				$workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT localidade_pkey PRIMARY KEY (organizacao_id, localidade_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT funcionario_pkey PRIMARY KEY (funcionario_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT area_pkey PRIMARY KEY (organizacao_id, area_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario_status ADD CONSTRAINT funcionario_status_pkey PRIMARY KEY (funcionario_status_id)');
-				$workflowDB->query('ALTER TABLE ONLY area_status ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY centro_custo ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT "$1" FOREIGN KEY (centro_custo_id, organizacao_id) REFERENCES centro_custo(centro_custo_id, organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT "$2" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id, centro_custo_id) REFERENCES centro_custo(organizacao_id, centro_custo_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$2" FOREIGN KEY (organizacao_id, localidade_id) REFERENCES localidade(organizacao_id, localidade_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$1" FOREIGN KEY (superior_area_id, areasup_organizacao_id) REFERENCES area(area_id, organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$2" FOREIGN KEY (centro_custo_id, organizacao_id) REFERENCES centro_custo(centro_custo_id, organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$5" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$6" FOREIGN KEY (area_status_id, organizacao_id) REFERENCES area_status(area_status_id, organizacao_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$3" FOREIGN KEY (organizacao_id, area_id) REFERENCES area(organizacao_id, area_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$4" FOREIGN KEY (funcionario_status_id) REFERENCES funcionario_status(funcionario_status_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$3" FOREIGN KEY (titular_funcionario_id) REFERENCES funcionario(funcionario_id)');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$4" FOREIGN KEY (substituto_funcionario_id) REFERENCES funcionario(funcionario_id)');
-				$workflowDB->query('ALTER TABLE ONLY admin_access ADD CONSTRAINT admin_access_pkey PRIMARY KEY (admin_access_id, tipo, numvalue)');
-				$workflowDB->query('ALTER TABLE ONLY aplicacao_externa ADD CONSTRAINT seq_aplicacao_externa PRIMARY KEY (apl_in_id)');
-				$workflowDB->query('ALTER TABLE ONLY aplicacao_externa_acl ADD CONSTRAINT pk_aplicacao_externa_acl PRIMARY KEY (apl_in_id, apl_in_uid)');
-				$workflowDB->query('ALTER TABLE ONLY aplicacao_externa_acl ADD CONSTRAINT fk01_aplicacao_externa_acl FOREIGN KEY (apl_in_id) REFERENCES aplicacao_externa(apl_in_id) ON UPDATE CASCADE ON DELETE CASCADE');
-
-				/* set the permissions to the database objects */
-				$dbObjects = array('organizacao', 'area_status', 'centro_custo', 'localidade', 'funcionario', 'area', 'funcionario_status', 'organizacao_organizacao_id_seq', 'area_status_area_status_id_seq', 'centro_custo_centro_custo_id_seq', 'localidade_localidade_id_seq', 'area_area_id_seq', 'funcionario_status_funcionario_status_id_seq', 'admin_access', 'aplicacao_externa', 'aplicacao_externa_apl_in_id_seq', 'aplicacao_externa_acl');
-				foreach ($dbObjects as $dbObject)
-				{
-					$workflowDB->query("GRANT ALL ON TABLE $dbObject TO admin_workflow");
-					$workflowDB->query("GRANT ALL ON TABLE $dbObject TO postgres");
-					$workflowDB->query("GRANT SELECT ON TABLE $dbObject TO public");
-				}
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.3.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.3.00.000';
-	function workflow_upgrade1_3_00_000()
-	{
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_interinstance_relations',
-			array(
-				'fd' => array(
-					'wf_parent_instance_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_parent_activity_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_child_instance_id' 	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_parent_lock' 		=> array('type' => 'int', 'precision' => '2', 'nullable' => True)
-				),
-				'pk' => array('wf_parent_instance_id', 'wf_parent_activity_id', 'wf_child_instance_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the workflow database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* change the type of the employee ID (funcionario_id field) */
-				$workflowDB->query('ALTER TABLE funcionario ALTER COLUMN centro_custo_id DROP NOT NULL');
-				$workflowDB->query('ALTER TABLE area DROP CONSTRAINT "$3"');
-				$workflowDB->query('ALTER TABLE area DROP CONSTRAINT "$4"');
-				$workflowDB->query('ALTER TABLE funcionario ADD COLUMN funcionario_id2 int4');
-				$workflowDB->query('UPDATE funcionario SET funcionario_id2 = int4(funcionario_id)');
-				$workflowDB->query('ALTER TABLE funcionario DROP COLUMN funcionario_id');
-				$workflowDB->query('ALTER TABLE funcionario RENAME COLUMN funcionario_id2 TO funcionario_id');
-				$workflowDB->query('ALTER TABLE funcionario ALTER funcionario_id SET NOT NULL');
-				$workflowDB->query('ALTER TABLE funcionario ADD CONSTRAINT funcionario_pkey PRIMARY KEY (funcionario_id)');
-				$workflowDB->query('ALTER TABLE area ADD titular_funcionario_id2 int4');
-				$workflowDB->query('ALTER TABLE area ADD substituto_funcionario_id2 int4');
-				$workflowDB->query('UPDATE area SET titular_funcionario_id2 = int4(titular_funcionario_id), substituto_funcionario_id2 = int4(substituto_funcionario_id)');
-				$workflowDB->query('ALTER TABLE area DROP COLUMN titular_funcionario_id');
-				$workflowDB->query('ALTER TABLE area DROP COLUMN substituto_funcionario_id');
-				$workflowDB->query('ALTER TABLE area RENAME COLUMN titular_funcionario_id2 TO titular_funcionario_id');
-				$workflowDB->query('ALTER TABLE area RENAME COLUMN substituto_funcionario_id2 TO substituto_funcionario_id');
-				$workflowDB->query('ALTER TABLE area ADD CONSTRAINT "$3" FOREIGN KEY (titular_funcionario_id) REFERENCES funcionario (funcionario_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION');
-				$workflowDB->query('ALTER TABLE AREA ADD CONSTRAINT "$4" FOREIGN KEY (substituto_funcionario_id) REFERENCES funcionario (funcionario_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.00.000';
-	function workflow_upgrade1_4_00_000()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.00.001';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.00.001';
-	function workflow_upgrade1_4_00_001()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_menu_path', array('type' => 'varchar', 'precision' => 200, 'nullable' => True));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.01.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.01.000';
-	function workflow_upgrade1_4_01_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* add a new column to the area table (orgchart) */
-				$workflowDB->query('ALTER TABLE area ADD COLUMN auxiliar_funcionario_id int4');
-				$workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$7" FOREIGN KEY (auxiliar_funcionario_id) REFERENCES funcionario(funcionario_id)');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.02.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.02.000';
-	function workflow_upgrade1_4_02_000()
-	{
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_admin_access',
-			array(
-				'fd' => array(
-					'admin_access_id'		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'tipo'	=> array('type' => 'char', 'precision' => '3', 'nullable' => False),
-					'numvalue'	=> array('type' => 'int', 'precision' => '2', 'nullable' => False),
-					'nivel'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => 0)
-				),
-				'pk' => array('admin_access_id', 'tipo', 'numvalue'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_external_application',
-			array(
-				'fd' => array(
-					'external_application_id' => array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-					'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
-					'description' => array('type' => 'text', 'nullable' => True),
-					'image' => array('type' => 'varchar', 'precision' => '100', 'nullable' => True),
-					'address' => array('type' => 'varchar', 'precision' => '120', 'nullable' => False),
-					'authentication' => array('type' => 'bit', 'precision' => '1', 'nullable' => True),
-					'post' => array('type' => 'text', 'nullable' => True)
-				),
-				'pk' => array('external_application_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$adminAccessData = array();
-			$externalApplicationData = array();
-			$externalApplicationSequence = 1;
-			$externalApplicationACLData = array();
-			$workflowHostInfo = extractDatabaseParameters();
-			$GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC);
-
-			/* connect to the Workflow database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				$result = $GLOBALS['phpgw']->ADOdb->query('SELECT admin_access_id, tipo, numvalue, nivel FROM admin_access');
-				if ($result)
-					while ($row = $result->fetchRow())
-						$adminAccessData[] = array($row['admin_access_id'], $row['tipo'], $row['numvalue'], $row['nivel']);
-
-				$result = $GLOBALS['phpgw']->ADOdb->query('SELECT apl_in_id, apl_st_nome, apl_st_descricao, apl_st_imagem, apl_st_endereco, apl_bt_autentica, apl_st_post FROM aplicacao_externa');
-				if ($result)
-					while ($row = $result->fetchRow())
-						$externalApplicationData[] = array($row['apl_in_id'], $row['apl_st_nome'], $row['apl_st_descricao'], $row['apl_st_imagem'], $row['apl_st_endereco'], $row['apl_bt_autentica'], $row['apl_st_post']);
-				$result = $GLOBALS['phpgw']->ADOdb->query('SELECT last_value FROM aplicacao_externa_apl_in_id_seq');
-				if ($result)
-					if ($row = $result->fetchRow())
-						$externalApplicationSequence = $row['last_value'];
-
-				$result = $GLOBALS['phpgw']->ADOdb->query('SELECT apl_in_uid, apl_in_id FROM aplicacao_externa_acl');
-				if ($result)
-					while ($row = $result->fetchRow())
-						$externalApplicationACLData[] = array($row['apl_in_uid'], $row['apl_in_id']);
-
-				/* remove the unused tables */
-				$GLOBALS['phpgw']->ADOdb->query('DROP TABLE admin_access');
-				$GLOBALS['phpgw']->ADOdb->query('DROP SEQUENCE aplicacao_externa_apl_in_id_seq');
-				$GLOBALS['phpgw']->ADOdb->query('DROP CONSTRAINT fk01_aplicacao_externa_acl');
-				$GLOBALS['phpgw']->ADOdb->query('DROP TABLE aplicacao_externa_acl');
-				$GLOBALS['phpgw']->ADOdb->query('DROP TABLE aplicacao_externa');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-			foreach ($adminAccessData as $newRow)
-				$result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_admin_access(admin_access_id, tipo, numvalue, nivel) VALUES (?, ?, ?, ?)", $newRow);
-
-			foreach ($externalApplicationData as $newRow)
-				$result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_external_application(external_application_id, name, description, image, address, authentication, post) VALUES(?, ?, ?, ?, ?, ?, ?)", $newRow);
-			$GLOBALS['phpgw']->ADOdb->query("SELECT pg_catalog.setval('seq_egw_wf_external_application', ?, true)", array($externalApplicationSequence));
-
-			foreach ($externalApplicationACLData as $newRow)
-				$result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_admin_access(admin_access_id, tipo, numvalue, nivel) VALUES (?, 'APX', ?, 0)", $newRow);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.03.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.03.000';
-	function workflow_upgrade1_4_03_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* add a new column to the funcionario_status table (orgchart) */
-				$workflowDB->query('ALTER TABLE funcionario_status ADD COLUMN exibir character varying(1)');
-				$workflowDB->query('UPDATE funcionario_status SET exibir = ?', array('S'));
-				$workflowDB->query('ALTER TABLE funcionario_status ALTER COLUMN exibir SET NOT NULL');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.04.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.04.000';
-	function workflow_upgrade1_4_04_000()
-	{
-		/* remove unused table */
-		$GLOBALS['phpgw_setup']->oProc->DropTable('egw_wf_instance_supplements');
-
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$GLOBALS['phpgw']->ADOdb->query('ALTER TABLE egw_wf_instances ALTER COLUMN wf_next_user TYPE text');
-			$GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC);
-			$result = $GLOBALS['phpgw']->ADOdb->query('SELECT i.wf_instance_id, ia.wf_activity_id, i.wf_next_user FROM egw_wf_instances i, egw_wf_instance_activities ia WHERE (i.wf_instance_id = ia.wf_instance_id) AND (i.wf_next_user IS NOT NULL)');
-			if (!empty($result))
-			{
-				while ($res = $result->fetchRow())
-				{
-					$newNextUser = base64_encode(serialize(array('*' . $res['wf_activity_id'] => $res['wf_next_user'])));
-					$ok = $GLOBALS['phpgw']->ADOdb->query(
-						'UPDATE egw_wf_instances SET wf_next_user = ? WHERE (wf_instance_id = ?)',
-						array($newNextUser, (int)$res['wf_instance_id'])
-					);
-				}
-			}
-
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* add a new column to the organizacao table (orgchart) */
-				$workflowDB->query('ALTER TABLE organizacao ADD COLUMN url_imagem character varying(200)');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.05.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.05.000';
-	function workflow_upgrade1_4_05_000()
-	{
-		$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_external_application' ,'intranet_only', array('type' => 'bit', 'precision' => '1', 'nullable' => True));
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.4.06.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.4.06.000';
-	function workflow_upgrade1_4_06_000()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.6.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.6.00.000';
-	function workflow_upgrade1_6_00_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* create the new tables and add the referencial constraints */
-				$workflowDB->query('CREATE TABLE cargo (cargo_id serial NOT NULL, descricao character varying(150), organizacao_id int4)');
-				$workflowDB->query('ALTER TABLE ONLY cargo ADD CONSTRAINT cargo_pkey PRIMARY KEY (cargo_id)');
-				$workflowDB->query('ALTER TABLE ONLY cargo ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao (organizacao_id)');
-				$workflowDB->query('CREATE TABLE funcionario_categoria (funcionario_categoria_id serial NOT NULL, descricao character varying(150), organizacao_id int4)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario_categoria ADD CONSTRAINT funcionario_categoria_pkey PRIMARY KEY (funcionario_categoria_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario_categoria ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao (organizacao_id)');
-
-				/* add a new column to the organizacao table (orgchart) */
-				$workflowDB->query('ALTER TABLE funcionario ADD COLUMN cargo_id int4');
-				$workflowDB->query('ALTER TABLE funcionario ADD COLUMN nivel int2');
-				$workflowDB->query('ALTER TABLE funcionario ADD COLUMN funcionario_categoria_id int4');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$5" FOREIGN KEY (cargo_id) REFERENCES cargo (cargo_id)');
-				$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$6" FOREIGN KEY (funcionario_categoria_id) REFERENCES funcionario_categoria (funcionario_categoria_id)');
-
-				/* set the permissions to the database objects */
-				$dbObjects = array('cargo', 'cargo_cargo_id_seq', 'funcionario_categoria', 'funcionario_categoria_funcionario_categoria_id_seq');
-				foreach ($dbObjects as $dbObject)
-				{
-					$workflowDB->query("GRANT ALL ON TABLE $dbObject TO admin_workflow");
-					$workflowDB->query("GRANT ALL ON TABLE $dbObject TO postgres");
-					$workflowDB->query("GRANT SELECT ON TABLE $dbObject TO public");
-				}
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.6.01.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.6.01.000';
-	function workflow_upgrade1_6_01_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			/* tries to load the 'files_dir' value (usually '/home/expressolivre') */
-			$GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC);
-			$result = $GLOBALS['phpgw']->ADOdb->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir'));
-			if (!(empty($result)))
-			{
-				$res = $result->fetchRow();
-
-				/* initialize some variables */
-				$resourcesBase = $res['config_value'];
-				$oldResourcesDir = PHPGW_SERVER_ROOT . '/workflow/resources';
-				$success = true;
-
-				/* if the resources dir exists, move it's subdirectories */
-				if (is_dir($oldResourcesDir))
-				{
-					$success = false;
-					$handle = opendir($oldResourcesDir);
-					if ($handle)
-					{
-						$success = true;
-						$OKToDeleteDir = true;
-
-						/* move all subdirectories (except the '.' and '..' for oubvious reasons) to their new place */
-						while (false !== ($processDir = readdir($handle)))
-						{
-							if (($processDir == '.') || ($processDir == '..'))
-								continue;
-
-							/* check if we are dealing with a directory */
-							if (!is_dir($oldResourcesDir . '/' . $processDir))
-							{
-								$OKToDeleteDir = false;
-								continue;
-							}
-
-							/* special treatment for the workflow directory */
-							if ($processDir == 'workflow')
-							{
-								$success = $success && @rename($oldResourcesDir . '/' . $processDir, $resourcesBase . '/workflow/workflow');
-								continue;
-							}
-
-							/* if the destination directory exists, move it */
-							$newProcessDir = $resourcesBase . '/workflow/' . $processDir;
-							if (is_dir($newProcessDir))
-								$success = $success && @rename($oldResourcesDir . '/' . $processDir, $newProcessDir . '/resources');
-							else
-								$OKToDeleteDir = false;
-						}
-
-						/* close the handler */
-						closedir($handle);
-
-						/* if the directory is empty, remove it */
-						if ($OKToDeleteDir && $success)
-							if (!@rmdir($oldResourcesDir))
-								echo '<font color="red">Não foi possível remover o diretório: ' . $oldResourcesDir . '<br/> Tente removê-lo manualmente.</font>';
-					}
-				}
-
-				/* in case of an unsuccessful attemp to move a directory, warn the system admin */
-				if (!$success)
-					echo '<font color="red">Pelo menos um diretório não pode ser movido. Você precisa mover, manualmente, os diretórios de resources dos processos. Exemplo: <br/><strong>' . $oldResourcesDir . '/PROCESSO_XX</strong> para <strong>' . $resourcesBase . '/workflow/PROCESSO_XX/resources</strong></font>';
-			}
-
-		}
-
-		/* updates the current version */
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.6.02.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.6.02.000';
-	function workflow_upgrade1_6_02_000()
-	{
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_user_cache',
-			array(
-				'fd' => array(
-					'uidnumber'			=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'uid'				=> array('type' => 'varchar', 'precision' => '30', 'nullable' => True),
-					'cn'				=> array('type' => 'varchar', 'precision' => '100', 'nullable' => True),
-					'givenname'			=> array('type' => 'varchar', 'precision' => '30', 'nullable' => True),
-					'sn'				=> array('type' => 'varchar', 'precision' => '70', 'nullable' => True),
-					'mail'				=> array('type' => 'varchar', 'precision' => '80', 'nullable' => True),
-					'accountstatus'		=> array('type' => 'varchar', 'precision' => '80', 'nullable' => True),
-					'dn'				=> array('type' => 'varchar', 'precision' => '150', 'nullable' => True),
-					'employeenumber'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-					'cpf'				=> array('type' => 'varchar', 'precision' => '15', 'nullable' => True),
-					'telephonenumber'	=> array('type' => 'varchar', 'precision' => '50', 'nullable' => True),
-					'last_update'		=> array('type' => 'timestamp without time zone default now()', 'nullable' => True)
-				),
-				'pk' => array('uidnumber'),
-				'fk' => array(),
-				'ix' => array('mail', 'employeenumber', 'cpf'),
-				'uc' => array()
-			)
-		);
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.6.03.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.6.03.000';
-	function workflow_upgrade1_6_03_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				$result = $workflowDB->query("SELECT 1 FROM pg_tables WHERE (schemaname = 'public') AND (tablename = 'funcionario_status')");
-				$row = array();
-				if (!empty($result))
-					$row = $result->fetchRow();
-
-				/* only some instalations are missing this table */
-				if ($row === false)
-				{
-					$workflowDB->query('CREATE TABLE funcionario_status (funcionario_status_id serial NOT NULL, descricao character varying(50) NOT NULL, exibir character varying(1) NOT NULL)');
-					$workflowDB->query('ALTER TABLE ONLY funcionario_status ADD CONSTRAINT funcionario_status_pkey PRIMARY KEY (funcionario_status_id)');
-					$workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$4" FOREIGN KEY (funcionario_status_id) REFERENCES funcionario_status(funcionario_status_id)');
-
-					$dbObjects = array('funcionario_status', 'funcionario_status_funcionario_status_id_seq');
-					foreach ($dbObjects as $dbObject)
-					{
-						$workflowDB->query("GRANT ALL ON TABLE $dbObject TO admin_workflow");
-						$workflowDB->query("GRANT ALL ON TABLE $dbObject TO postgres");
-						$workflowDB->query("GRANT SELECT ON TABLE $dbObject TO public");
-					}
-				}
-			}
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.6.03.001';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.6.03.001';
-	function workflow_upgrade1_6_03_001()
-	{
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_jobs',
-			array(
-				'fd' => array(
-					'job_id'			=> array('type' => 'auto', 'precision' => '4', 'nullable' => False),
-					'wf_process_id'		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'name'				=> array('type' => 'varchar', 'precision' => '100', 'nullable' => False),
-					'description'		=> array('type' => 'text', 'nullable' => True),
-					'time_start'		=> array('type' => 'timestamp without time zone', 'nullable' => False),
-					'interval_value'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-					'interval_unity'	=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-					'date_type'			=> array('type' => 'int', 'precision' => '4', 'nullable' => True),
-					'week_days'			=> array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => 0),
-					'month_offset'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => 0),
-					'active'			=> array('type' => 'bool', 'nullable' => True)
-				),
-				'pk' => array('job_id'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		$GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_job_logs',
-			array(
-				'fd' => array(
-					'job_id'		=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'date_time'		=> array('type' => 'timestamp without time zone', 'nullable' => False),
-					'result'		=> array('type' => 'blob', 'nullable' => True),
-					'status'		=> array('type' => 'int', 'precision' => '4', 'nullable' => True)
-				),
-				'pk' => array('job_id', 'date_time'),
-				'fk' => array(),
-				'ix' => array(),
-				'uc' => array()
-			)
-		);
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.7.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.7.00.000';
-	function workflow_upgrade1_7_00_000()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.8.00.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.8.00.000';
-	function workflow_upgrade1_8_00_000()
-	{
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.8.01.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.8.01.000';
-	function workflow_upgrade1_8_01_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$GLOBALS['phpgw']->ADOdb->query('CREATE INDEX egw_wf_instances_wf_name_idx ON egw_wf_instances(UPPER(wf_name))');
-			$GLOBALS['phpgw']->ADOdb->query('CREATE INDEX egw_wf_instances_wf_p_id_idx ON egw_wf_instances(wf_p_id)');
-			$GLOBALS['phpgw']->ADOdb->query('DELETE FROM phpgw_config where config_app = \'workflow\' and config_name in (\'database_user\', \'database_password\')');
-
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* add a new column to the area organization (orgchart) */
-				$workflowDB->query('ALTER TABLE organizacao ADD COLUMN ativa character varying(1)');
-				$workflowDB->query('UPDATE organizacao SET ativa = \'S\'');
-				$workflowDB->query('ALTER TABLE organizacao ALTER ativa SET NOT NULL');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.8.02.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.8.02.000';
-	function workflow_upgrade1_8_02_000()
-	{
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$workflowHostInfo = extractDatabaseParameters();
-
-			/* connect to the new database */
-			$workflowDB = $GLOBALS['phpgw']->ADOdb;
-			if ($workflowDB->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow'))
-			{
-				/* gather some information */
-				$workflowDB->setFetchMode(ADODB_FETCH_ASSOC);
-				$organizations = $workflowDB->GetAll('SELECT organizacao_id FROM organizacao');
-				$employeeStatus = $workflowDB->GetAll('SELECT funcionario_status_id, descricao, exibir FROM funcionario_status');
-
-				/* add the new column */
-				$workflowDB->query('ALTER TABLE funcionario_status ADD COLUMN organizacao_id INTEGER');
-				if (count($organizations) > 0)
-				{
-					/* run update for the first organization */
-					$workflowDB->query('UPDATE funcionario_status SET organizacao_id = ?', array($organizations[0]['organizacao_id']));
-
-					/* replicate the 'funcionario_status' table information for other organizations */
-					for ($i = 1; $i < count($organizations); $i++)
-					{
-						$organizationID = $organizations[$i]['organizacao_id'];
-						foreach ($employeeStatus as $es)
-						{
-							$values = array(
-								$es['descricao'],
-								$es['exibir'],
-								$organizationID
-							);
-
-							/* insert the new status */
-							$workflowDB->query('INSERT INTO funcionario_status (descricao, exibir, organizacao_id) VALUES (?, ?, ?)', $values);
-
-							$values = array(
-								$organizationID,
-								$es['funcionario_status_id']
-							);
-
-							/* update the existing employees */
-							$workflowDB->query('UPDATE funcionario SET funcionario_status_id = (SELECT MAX(funcionario_status_id) FROM funcionario_status) WHERE (organizacao_id = ?) AND (funcionario_status_id = ?)', $values);
-						}
-					}
-				}
-				/* add the new constraint */
-				$workflowDB->query('ALTER TABLE ONLY funcionario_status ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)');
-			}
-
-			/* reconnect to the previous database */
-			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'].":".$workflowHostInfo['port'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.8.03.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
-	$test[] = '1.8.03.000';
-	function workflow_upgrade1_8_03_000()
-	{
-		/* setting new default attributes for workflow Logger  */
-		if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly)
-		{
-			$GLOBALS['phpgw']->ADOdb->query('INSERT INTO phpgw_config (config_app, config_name, config_value) VALUES (\'workflow\', \'log_type_file\', \'True\')');
-			$GLOBALS['phpgw']->ADOdb->query('INSERT INTO phpgw_config (config_app, config_name, config_value) VALUES (\'workflow\', \'log_type_firebug\', \'True\')');
-			$GLOBALS['phpgw']->ADOdb->query('INSERT INTO phpgw_config (config_app, config_name, config_value) VALUES (\'workflow\', \'log_level\', \'7\')');
-		}
-
-		#updating the current version
-		$GLOBALS['setup_info']['workflow']['currentver'] = '1.8.04.000';
-		return $GLOBALS['setup_info']['workflow']['currentver'];
-	}
-
+	// Since Expresso 1.2 using Workflow 1.8.04.000
 	$test[] = '1.8.04.000';
 	function workflow_upgrade1_8_04_000()
@@ -1216,6 +122,26 @@
 	{
 		#updating the current version
+		$GLOBALS['setup_info']['workflow']['currentver'] = '2.0.003';
+		return $GLOBALS['setup_info']['workflow']['currentver'];
+	}
+	$test[] = '2.0.003';
+	function workflow_upgrade2_0_003()
+	{
+		#updating the current version
+		$GLOBALS['setup_info']['workflow']['currentver'] = '2.0.004';
+		return $GLOBALS['setup_info']['workflow']['currentver'];
+	}	
+	$test[] = '2.0.004';
+	function workflow_upgrade2_0_004()
+	{
+		#updating the current version
 		$GLOBALS['setup_info']['workflow']['currentver'] = '2.1.000';
 		return $GLOBALS['setup_info']['workflow']['currentver'];
 	}
+	$test[] = '2.1.000';
+	function workflow_upgrade2_1_000()
+	{
+		$GLOBALS['setup_info']['workflow']['currentver'] = '2.2.000';
+		return $GLOBALS['setup_info']['workflow']['currentver'];
+	}	
 ?>
Index: branches/2.2/expressoMail1_2/setup/tables_update.inc.php
===================================================================
--- branches/2.2/expressoMail1_2/setup/tables_update.inc.php	(revision 1835)
+++ branches/2.2/expressoMail1_2/setup/tables_update.inc.php	(revision 3031)
@@ -9,56 +9,5 @@
 	* option) any later version.                                               *
 	\**************************************************************************/
-	$test[] = '1.2031';
-	function expressoMail1_2_upgrade1_2031() {
-		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.2201';
-		return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
-	}
-	
-	$test[] = '1.2201';
-	function expressoMail1_2_upgrade1_2201() {
-		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.2211';
-		return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];		
-	}
-	
-	$test[] = '1.2211';
-	function expressoMail1_2_upgrade1_2211() {
-		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.222';
-		return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
-	}
-
-	$test[] = '1.222';
-	function expressoMail1_2_upgrade1_222() {
-		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.230';
-		return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
-	}
-	
-	$test[] = '1.230';
-	function expressoMail1_2_upgrade1_230() {
-		$oProc = $GLOBALS['phpgw_setup']->oProc;
-		$oProc->CreateTable('phpgw_expressomail_contacts',array(
-			'fd' => array(
-				'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false),
-				'data' => array( 'type' => 'text')
-			),
-			'pk' => array('id_owner'),
-			'fk' => array(),
-			'ix' => array(),
-			'uc' => array()	)
-		);
-		$setup_info['expressoMail1_2']['currentver'] = '1.231';
-		return $setup_info['expressoMail1_2']['currentver'];
-	}		
-	$test[] = '1.231';													
-	function expressoMail1_2_upgrade1_231() {
-		$setup_info['expressoMail1_2']['currentver'] = '1.232';
-		return $setup_info['expressoMail1_2']['currentver'];
-	}
-	
-	$test[] = '1.232';
-	function expressoMail1_2_upgrade1_232() {
-		$setup_info['expressoMail1_2']['currentver'] = '1.233';
-		return $setup_info['expressoMail1_2']['currentver'];
-	}
-	
+	//	Since Expresso 1.2 using ExpressoMail 1.233		
 	$test[] = '1.233';
 	function expressoMail1_2_upgrade1_233() {
@@ -66,5 +15,4 @@
 		return $setup_info['expressoMail1_2']['currentver'];
 	}
-	
 	$test[] = '1.234';
 	function expressoMail1_2_upgrade1_234() {
@@ -105,6 +53,36 @@
 	$test[] = '2.0.002';
 	function expressoMail1_2_upgrade2_0_002() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.0.003';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}
+	$test[] = '2.0.003';
+	function expressoMail1_2_upgrade2_0_003() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.0.004';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}
+	$test[] = '2.0.004';
+	function expressoMail1_2_upgrade2_0_004() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.0.005';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}	
+	$test[] = '2.0.005';
+	function expressoMail1_2_upgrade2_0_005() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.0.006';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}	
+	$test[] = '2.0.006';
+	function expressoMail1_2_upgrade2_0_006() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.0.007';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}		
+	$test[] = '2.0.007';
+	function expressoMail1_2_upgrade2_0_007() {
 		$setup_info['expressoMail1_2']['currentver'] = '2.1.000';
 		return $setup_info['expressoMail1_2']['currentver'];
 	}
+	$test[] = '2.1.000';
+	function expressoMail1_2_upgrade2_1_000() {
+		$setup_info['expressoMail1_2']['currentver'] = '2.2.000';
+		return $setup_info['expressoMail1_2']['currentver'];
+	}	
 ?>
Index: branches/2.2/expressoMail1_2/setup/setup.inc.php
===================================================================
--- branches/2.2/expressoMail1_2/setup/setup.inc.php	(revision 1728)
+++ branches/2.2/expressoMail1_2/setup/setup.inc.php	(revision 3031)
@@ -12,5 +12,5 @@
 	$setup_info['expressoMail1_2']['name']      	= 'expressoMail1_2';
 	$setup_info['expressoMail1_2']['title']     	= 'Expresso Mail';
-	$setup_info['expressoMail1_2']['version']   	= '2.1.000';
+	$setup_info['expressoMail1_2']['version']   	= '2.2.000';
 	$setup_info['expressoMail1_2']['app_order'] 	= 2;
 	$setup_info['expressoMail1_2']['tables'][]		= 'phpgw_expressomail_contacts';
@@ -37,5 +37,5 @@
 	$setup_info['expressoMail1_2']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.1')
+		'versions' => Array('2.2')
 	);
 ?>
