2001-02-04 13:27:05 +01:00
|
|
|
<?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 *
|
2001-02-13 11:53:18 +01:00
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
2001-02-04 13:27:05 +01:00
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
$test[] = '0.9.1';
|
|
|
|
function addressbook_upgrade0_9_1()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AlterColumn('addressbook', 'ab_id', array('type' => 'auto', 'nullable' => false));
|
|
|
|
$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));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.2';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function addressbook_v0_9_2to0_9_3update_owner($table, $field)
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $phpgw_setup, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query("select distinct($field) from $table");
|
|
|
|
if ($phpgw_setup->oProc->num_rows())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
while ($phpgw_setup->oProc->next_record())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$owner[count($owner)] = $phpgw_setup->oProc->f($field);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
2001-06-05 03:36:58 +02:00
|
|
|
if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre4'))
|
2001-06-04 04:53:04 +02:00
|
|
|
{
|
|
|
|
$acctstbl = 'accounts';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$acctstbl = 'phpgw_accounts';
|
|
|
|
}
|
2001-05-18 05:34:17 +02:00
|
|
|
for($i=0;$i<count($owner);$i++)
|
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query("SELECT account_id FROM $acctstbl 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]."'");
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0));
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 17:06:43 +02:00
|
|
|
$test[] = '0.9.2';
|
|
|
|
function addressbook_upgrade0_9_2()
|
|
|
|
{
|
|
|
|
global $setup_info;
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.3pre1';
|
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
}
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.3pre1';
|
|
|
|
function addressbook_upgrade0_9_3pre1()
|
|
|
|
{
|
2001-06-04 04:53:04 +02:00
|
|
|
global $setup_info;
|
|
|
|
|
2001-06-10 17:06:43 +02:00
|
|
|
addressbook_v0_9_2to0_9_3update_owner('addressbook','ab_owner');
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.3pre2';
|
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.3pre2';
|
|
|
|
function addressbook_upgrade0_9_3pre2()
|
|
|
|
{
|
|
|
|
global $setup_info;
|
|
|
|
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.3pre6';
|
|
|
|
return $setup_info['addressbook']['currentver'];
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.3pre6';
|
|
|
|
function addressbook_upgrade0_9_3pre6()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AddColumn('addressbook', 'ab_url', array('type' => 'varchar', 'precision' => 255));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.3pre7';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 17:06:43 +02:00
|
|
|
$test[] = '0.9.3pre7';
|
|
|
|
function addressbook_upgrade0_9_3pre7()
|
|
|
|
{
|
|
|
|
global $setup_info;
|
|
|
|
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.8pre5';
|
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
}
|
|
|
|
|
2001-06-05 22:11:40 +02:00
|
|
|
$test[] = "0.9.8pre5";
|
|
|
|
function addressbook_upgrade0_9_8pre5()
|
|
|
|
{
|
|
|
|
global $setup_info;
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre4';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 22:11:40 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 09:42:08 +02:00
|
|
|
$test[] = "0.9.10pre4";
|
|
|
|
function addressbook_upgrade0_9_10pre4()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$db2 = $phpgw_setup->oProc;
|
|
|
|
$db3 = $phpgw_setup->oProc;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query('SELECT oldid,newid FROM phpgw_temp_groupmap',__LINE__,__FILE__);
|
|
|
|
if($phpgw_setup->oProc->num_rows())
|
2001-06-05 09:42:08 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
while($phpgw_setup->oProc->next_record())
|
2001-06-05 09:42:08 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$old_group_id = $phpgw_setup->oProc->f(0);
|
|
|
|
$new_group_id = $phpgw_setup->oProc->f(1);
|
2001-06-05 09:42:08 +02:00
|
|
|
$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["addressbook"]["currentver"] = "0.9.10pre5";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre5";
|
|
|
|
function addressbook_upgrade0_9_10pre5()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre6";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre6";
|
|
|
|
function addressbook_upgrade0_9_10pre6()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre7";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre7";
|
|
|
|
function addressbook_upgrade0_9_10pre7()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre8";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre8";
|
|
|
|
function addressbook_upgrade0_9_10pre8()
|
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre9";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre9";
|
|
|
|
function addressbook_upgrade0_9_10pre9()
|
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre10";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre10";
|
|
|
|
function addressbook_upgrade0_9_10pre10()
|
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre11";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = "0.9.10pre11";
|
|
|
|
function addressbook_upgrade0_9_10pre11()
|
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
|
|
|
|
$setup_info["addressbook"]["currentver"] = "0.9.10pre12";
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.10pre12';
|
|
|
|
function addressbook_upgrade0_9_10pre12()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$db1 = $phpgw_setup->oProc;
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->CreateTable(
|
2001-06-05 03:36:58 +02:00
|
|
|
'phpgw_addressbook', array(
|
|
|
|
'fd' => array(
|
|
|
|
'id' => array('type' => 'auto', 'default' => '0', '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(),
|
2001-06-05 22:11:40 +02:00
|
|
|
'uc' => array('id')
|
2001-06-05 03:36:58 +02:00
|
|
|
)
|
2001-06-04 04:53:04 +02:00
|
|
|
);
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->CreateTable(
|
2001-06-05 03:36:58 +02:00
|
|
|
'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()
|
|
|
|
)
|
2001-06-04 04:53:04 +02:00
|
|
|
);
|
|
|
|
|
2001-05-19 03:51:48 +02:00
|
|
|
$db1->query("SELECT * FROM addressbook");
|
2001-05-18 05:34:17 +02:00
|
|
|
|
|
|
|
while ($db1->next_record())
|
|
|
|
{
|
2001-06-10 17:06:43 +02:00
|
|
|
$fields = $extra = array();
|
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$fields['id'] = $db1->f('ab_id');
|
2001-05-19 03:51:48 +02:00
|
|
|
$fields['owner'] = addslashes($db1->f('ab_owner'));
|
|
|
|
$fields['n_given'] = addslashes($db1->f('ab_firstname'));
|
|
|
|
$fields['n_family'] = addslashes($db1->f('ab_lastname'));
|
|
|
|
$fields['d_email'] = addslashes($db1->f('ab_email'));
|
|
|
|
$fields['b_tel'] = addslashes($db1->f('ab_hphone'));
|
|
|
|
$fields['a_tel'] = addslashes($db1->f('ab_wphone'));
|
|
|
|
$fields['c_tel'] = addslashes($db1->f('ab_fax'));
|
|
|
|
$fields['fn'] = addslashes($db1->f('ab_firstname').' '.$db1->f('ab_lastname'));
|
|
|
|
$fields['a_tel_work'] = 'y';
|
|
|
|
$fields['b_tel_home'] = 'y';
|
|
|
|
$fields['c_tel_fax'] = 'y';
|
|
|
|
$fields['org_name'] = addslashes($db1->f('ab_company'));
|
|
|
|
$fields['title'] = addslashes($db1->f('ab_title'));
|
|
|
|
$fields['adr_street'] = addslashes($db1->f('ab_street'));
|
2001-06-04 04:53:04 +02:00
|
|
|
$fields['adr_locality'] = addslashes($db1->f('ab_city'));
|
|
|
|
$fields['adr_region'] = addslashes($db1->f('ab_state'));
|
|
|
|
$fields['adr_postalcode'] = addslashes($db1->f('ab_zip'));
|
2001-05-19 03:51:48 +02:00
|
|
|
|
|
|
|
$extra['pager'] = $db1->f('ab_pager');
|
|
|
|
$extra['mphone'] = $db1->f('ab_mphone');
|
|
|
|
$extra['ophone'] = $db1->f('ab_ophone');
|
|
|
|
$extra['bday'] = $db1->f('ab_bday');
|
|
|
|
$extra['notes'] = $db1->f('ab_notes');
|
|
|
|
$extra['address2'] = $db1->f('ab_address2');
|
|
|
|
$extra['url'] = $db1->f('ab_url');
|
|
|
|
|
|
|
|
$sql = "INSERT INTO phpgw_addressbook (org_name,n_given,n_family,fn,d_email,title,a_tel,a_tel_work,"
|
2001-05-18 05:34:17 +02:00
|
|
|
. "b_tel,b_tel_home,c_tel,c_tel_fax,adr_street,adr_locality,adr_region,adr_postalcode,owner)"
|
2001-05-19 03:51:48 +02:00
|
|
|
. " 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'] ."')";
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql);
|
2001-05-18 05:34:17 +02:00
|
|
|
|
|
|
|
while (list($name,$value) = each($extra))
|
|
|
|
{
|
2001-06-04 04:53:04 +02:00
|
|
|
$sql = "INSERT INTO phpgw_addressbook_extra VALUES ('".$fields['id']."','" . $fields['owner'] . "','"
|
2001-05-18 05:34:17 +02:00
|
|
|
. addslashes($name) . "','" . addslashes($value) . "')";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre13';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-04 04:53:04 +02:00
|
|
|
// Note we are still leaving the old addressbook table alone here... for third party apps if they need it
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.10pre13';
|
|
|
|
function addressbook_upgrade0_9_10pre13()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$db1 = $phpgw_setup->oProc;
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$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'));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
|
|
|
$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='url'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
while($phpgw_setup->oProc->next_record())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$cid = $phpgw_setup->oProc->f('contact_id');
|
|
|
|
$cvalu = $phpgw_setup->oProc->f('contact_value');
|
2001-06-10 17:06:43 +02:00
|
|
|
if ($cid && $cvalu)
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-05-19 03:51:48 +02:00
|
|
|
$update = "UPDATE phpgw_addressbook set url='" . $cvalu . "' WHERE id=" . $cid;
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($update);
|
2001-05-18 05:34:17 +02:00
|
|
|
$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='url'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($delete);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='bday'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
while($phpgw_setup->oProc->next_record())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$cid = $phpgw_setup->oProc->f('contact_id');
|
|
|
|
$cvalu = $phpgw_setup->oProc->f('contact_value');
|
2001-06-10 17:06:43 +02:00
|
|
|
if ($cid && $cvalu)
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-05-19 03:51:48 +02:00
|
|
|
$update = "UPDATE phpgw_addressbook set bday='" . $cvalu . "' WHERE id=" . $cid;
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($update);
|
2001-05-18 05:34:17 +02:00
|
|
|
$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='bday'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($delete);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='notes'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
while($phpgw_setup->oProc->next_record())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$cid = $phpgw_setup->oProc->f('contact_id');
|
|
|
|
$cvalu = $phpgw_setup->oProc->f('contact_value');
|
2001-05-18 05:34:17 +02:00
|
|
|
if ($cvalu)
|
|
|
|
{
|
2001-05-19 03:51:48 +02:00
|
|
|
$update = "UPDATE phpgw_addressbook set note='" . $cvalu . "' WHERE id=" . $cid;
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($update);
|
2001-05-18 05:34:17 +02:00
|
|
|
$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='notes'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($delete);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre14';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 22:11:40 +02:00
|
|
|
$test[] = '0.9.10pre14';
|
|
|
|
function addressbook_upgrade0_9_10pre14()
|
|
|
|
{
|
|
|
|
global $setup_info;
|
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre15';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 22:11:40 +02:00
|
|
|
}
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.10pre15';
|
|
|
|
function addressbook_upgrade0_9_10pre15()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_parcel', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'adr_postal', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_voice', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_msg', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_fax', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'a_tel_prefer', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_voice', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_msg', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_fax', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'b_tel_prefer', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_voice', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_msg', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_fax', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'c_tel_prefer', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'd_email_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
|
|
|
$phpgw_setup->oProc->AlterColumn('phpgw_addressbook', 'd_email_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre16';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
2001-06-05 22:11:40 +02:00
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.10pre16';
|
|
|
|
function addressbook_upgrade0_9_10pre16()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
2001-06-04 06:08:29 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$db = $db1 = $phpgw_setup->oProc;
|
2001-06-04 06:08:29 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->RenameTable('phpgw_addressbook', 'phpgw_addressbook_old');
|
|
|
|
$phpgw_setup->oProc->CreateTable(
|
2001-06-05 22:11:40 +02:00
|
|
|
'phpgw_addressbook', array(
|
2001-06-05 03:36:58 +02:00
|
|
|
'fd' => array(
|
|
|
|
'id' => array('type' => 'auto'),
|
|
|
|
'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),
|
2001-06-05 22:11:40 +02:00
|
|
|
'email_type' => array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET'),
|
2001-06-05 03:36:58 +02:00
|
|
|
'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()
|
|
|
|
)
|
2001-06-04 06:08:29 +02:00
|
|
|
);
|
2001-05-19 03:51:48 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query("SELECT * FROM phpgw_addressbook_old");
|
|
|
|
while ($phpgw_setup->oProc->next_record())
|
2001-06-04 06:08:29 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$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("hphone");
|
|
|
|
$fields['tel_work'] = $phpgw_setup->oProc->f("wphone");
|
|
|
|
$fields['tel_fax'] = $phpgw_setup->oProc->f("fax");
|
|
|
|
$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");
|
2001-06-04 06:08:29 +02:00
|
|
|
|
|
|
|
$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__);
|
|
|
|
}
|
|
|
|
|
|
|
|
$db->query("DROP TABLE phpgw_addressbook_old");
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$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'");
|
2001-05-18 05:34:17 +02:00
|
|
|
|
|
|
|
$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='mphone'";
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
while($phpgw_setup->oProc->next_record())
|
2001-05-18 05:34:17 +02:00
|
|
|
{
|
2001-06-11 18:30:34 +02:00
|
|
|
$cid = $phpgw_setup->oProc->f('contact_id');
|
|
|
|
$cvalu = $phpgw_setup->oProc->f('contact_value');
|
2001-05-18 05:34:17 +02:00
|
|
|
if ($cvalu)
|
|
|
|
{
|
|
|
|
$update = "UPDATE phpgw_addressbook set tel_cell='" . $cvalu . "' WHERE id=" . $cid;
|
2001-06-04 06:08:29 +02:00
|
|
|
$db1->query($update);
|
2001-05-18 05:34:17 +02:00
|
|
|
$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='mphone'";
|
2001-06-04 06:08:29 +02:00
|
|
|
$db1->query($delete);
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre17';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.10pre17';
|
|
|
|
function addressbook_upgrade0_9_10pre17()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $phpgw_info, $phpgw_setup;
|
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre18';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 09:42:08 +02:00
|
|
|
$test[] = '0.9.10pre18';
|
|
|
|
function addressbook_upgrade0_9_10pre18()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre19';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.10pre19';
|
|
|
|
function addressbook_upgrade0_9_10pre19()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre20';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.10pre20';
|
|
|
|
function addressbook_upgrade0_9_10pre20()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'access', array('type' => 'char', 'precision' => 7));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre21';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$test[] = '0.9.10pre21';
|
|
|
|
function addressbook_upgrade0_9_10pre21()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->AddColumn('phpgw_addressbook', 'cat_id', array('type' => 'varchar', 'precision' => 32));
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre22';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 09:42:08 +02:00
|
|
|
$test[] = '0.9.10pre22';
|
|
|
|
function addressbook_upgrade0_9_10pre22()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info;
|
2001-06-05 09:42:08 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre23';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-06-05 09:42:08 +02:00
|
|
|
}
|
|
|
|
|
2001-05-18 05:34:17 +02:00
|
|
|
$test[] = '0.9.10pre23';
|
|
|
|
function addressbook_upgrade0_9_10pre23()
|
|
|
|
{
|
2001-06-05 22:11:40 +02:00
|
|
|
global $setup_info, $phpgw_setup;
|
|
|
|
|
2001-06-11 18:30:34 +02:00
|
|
|
$phpgw_setup->oProc->query("UPDATE phpgw_addressbook SET tid='n' WHERE tid is null");
|
2001-05-18 05:34:17 +02:00
|
|
|
|
2001-06-04 04:53:04 +02:00
|
|
|
$setup_info['addressbook']['currentver'] = '0.9.10pre24';
|
2001-06-06 09:27:42 +02:00
|
|
|
return $setup_info['addressbook']['currentver'];
|
|
|
|
//return True;
|
2001-05-18 05:34:17 +02:00
|
|
|
}
|
|
|
|
?>
|