[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.contact_central.inc.php, 1.1.2.6,
From: |
Alejandro Borges (lex) <address@hidden> |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.contact_central.inc.php, 1.1.2.6, 1.1.2.7 class.contacts_sql.inc.php, 1.17.2.2.2.27, 1.17.2.2.2.28 class.vcard.inc.php, 1.4, 1.4.4.1 |
Date: |
Tue, 28 Oct 2003 01:23:35 +0000 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv32618/phpgwapi/inc
Modified Files:
Tag: Version-0_9_16-branch
class.contact_central.inc.php class.contacts_sql.inc.php
class.vcard.inc.php
Log Message:
Vcard import and changes to the length of certain tables in contacts.
This table field changes will be exclusively for the new instalations, your
5x series will not be upgraded.
Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.27
retrieving revision 1.17.2.2.2.28
diff -C2 -d -r1.17.2.2.2.27 -r1.17.2.2.2.28
*** class.contacts_sql.inc.php 26 Oct 2003 04:46:28 -0000 1.17.2.2.2.27
--- class.contacts_sql.inc.php 28 Oct 2003 01:23:31 -0000 1.17.2.2.2.28
***************
*** 265,268 ****
--- 265,269 ----
'contact_type' =>
array('phpgwapi.contact_central', '0'),
'count_contacts' =>
array('phpgwapi.contact_central', '0'),
+ 'max_contacts' =>
array('phpgwapi.contact_central', '0'),
'sel_cat_id' =>
array('phpgwapi.contact_central', '0'),
'organizations_contact'=>
array('phpgwapi.contact_central', '0'),
***************
*** 558,562 ****
{
$this->db = &$GLOBALS['phpgw']->db;
! $this->session = CreateObject('phpgwapi.sessions');
$this->stock_contact_fields=&$this->contact_fields['showable'];
$this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
--- 559,567 ----
{
$this->db = &$GLOBALS['phpgw']->db;
! if(!is_object($GLOBALS['phpgw']->session))
! {
! $GLOBALS['phpgw']->session =
CreateObject('phpgwapi.sessions');
! }
!
$this->stock_contact_fields=&$this->contact_fields['showable'];
$this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
***************
*** 577,581 ****
function read_sessiondata()
{
! $data =
$this->session->appsession('session_data','phpgwapi');
if ($data['comm_descr'])
--- 582,586 ----
function read_sessiondata()
{
! $data =
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi');
if ($data['comm_descr'])
***************
*** 636,645 ****
'contact_type' => $this->contact_type
);
!
$this->session->appsession('session_data','phpgwapi',$data);
}
function delete_sessiondata($var='')
{
! $data =
$this->session->appsession('session_data','phpgwapi');
if($var!='')
{
--- 641,650 ----
'contact_type' => $this->contact_type
);
!
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi',$data);
}
function delete_sessiondata($var='')
{
! $data =
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi');
if($var!='')
{
***************
*** 650,654 ****
$data = '';
}
!
$this->session->appsession('session_data','phpgwapi',$data);
}
--- 655,659 ----
$data = '';
}
!
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi',$data);
}
***************
*** 677,680 ****
--- 682,686 ----
\*************************************************************/
+ /* @deprecated */
/* send this the id and whatever fields you want to see */
function read_single_entry($id,$fields='',
$action=PHPGW_SQL_RUN_SQL)
***************
*** 695,726 ****
}
! /* This function get all the Communication media from one
contact.
! *
! * Or the first if there is no one marked as preferred.
! * @param integer $contact_id id to locate the contact
! * return array Form: (description => value, description =>
value, ...)
! */
! function get_all_comms($contact_id)
! {
! if (intval($contact_id) != 0)
! {
! // get all comm_descriptions from api function
! $this->request(array('comm_data',
'comm_descr'));
! $this->criteria(array('comm_contact_id' =>
$contact_id));
! // get all comms from db
! $records = $this->get_query(PHPGW_SQL_RUN_SQL,
__LINE__, __FILE__);
! if(count($records) == 0)
! {
! return;
! }
! foreach ($records as $comm)
! {
! $descr =
$this->search_comm_descr_id($comm['comm_descr']);
! $comms[$descr] = $comm['comm_data'];
! }
! }
! return $comms;
! }
!
function read_last_entry($fields='')
{
--- 701,705 ----
}
! /* @deprecated */
function read_last_entry($fields='')
{
***************
*** 731,734 ****
--- 710,714 ----
}
+ /* @deprecated */
/* send this the range, query, sort, order and whatever fields
you want to see */
function
read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='',
$lastmod=-1)
***************
*** 771,865 ****
}
! /**
! * Get all the data for any contact or contacts that are part of
$optional_criteria.
! *
! * This function try to be a comprensive way to get data from
contacts<br /> convert the contacts database output on a multidimensional
array<br />
! * @param int|array $contact_id
! * @param mixed $optional_criteria criteria built with
sql_criteria
! * @param integer $line where this function is called, usefull
for debug
! * @param integer $file where this function is called, usefull
for debug
! * @return mixed array with all the data of contact (contacts).
! */
! function person_complete_data($contact_id, $optional_criteria =
'', $line=__LINE__, $file=__FILE__)
! {
! $this->request($this->import_export_fields);
! if (empty($optional_criteria))
! {
! if (intval($contact_id) == 0)
! {
! // this is an error
! return ;
! }
!
$this->criteria_token(sql_criteria::_equal('contact_id', $contact_id));
! }
! else
! {
! $this->criteria_token($optional_criteria);
! }
!
! $sql = $this->get_sql();
!
! $this->execute_query($sql, $line, $file);
!
! while ($this->db->next_record())
! {
! $record = $this->db->Record;
! $contact['contact_id'] =
$record['contact_id'];
! $contact['per_full_name'] =
$record['per_full_name'];
! $contact['per_first_name'] =
$record['per_first_name'];
! $contact['per_last_name'] =
$record['per_full_name'];
! $contact['per_middle_name'] =
$record['per_middle_name'];
! $contact['per_suffix'] =
$record['per_suffix'];
! $contact['per_prefix'] =
$record['per_prefix'];
! $contact['per_birthday'] =
$record['per_birthday'];
! $contact['per_pubkey'] =
$record['per_pubkey'];
! $contact['per_title'] =
$record['per_title'];
! $contact['per_departament'] =
$record['per_departamet'];
! $contact['per_initials'] =
$record['per_initials'];
! $contact['per_sound'] =
$record['per_sound'];
! $contact['per_active'] =
$record['per_active'];
! $contact['per_createon'] =
$record['per_createon'];
! $contact['per_createby'] =
$record['per_createby'];
! $contact['per_modby'] =
$record['per_modby'];
! $contact['per_modon'] =
$record['per_modon'];
! $contact['account_id'] =
$record['account_id'];
! // Locations info
! $loc_id
= $record['key_addr_id'];
! if($loc_id)
! {
! $contact['locations'][$loc_id]['type']
= $record['addr_description'];
! $contact['locations'][$loc_id]['add1']
= $record['addr_add1'];
! $contact['locations'][$loc_id]['add2']
= $record['addr_add2'];
! $contact['locations'][$loc_id]['add3']
= $record['addr_add3'];
!
$contact['locations'][$loc_id]['address'] = $record['addr_address'];
! $contact['locations'][$loc_id]['city']
= $record['addr_city'];
! $contact['locations'][$loc_id]['state']
= $record['addr_state'];
!
$contact['locations'][$loc_id]['postal_code'] = $record['addr_postal_code'];
!
$contact['locations'][$loc_id]['country'] = $record['addr_country'];
!
$contact['locations'][$loc_id]['preferred'] = $record['addr_preferred'];
! }
! // Notes
! $note_id
= $record['key_note_id'];
! if($note_id)
! {
! $contact['notes'][$note_id]['text']
= $record['note_text'];
! $contact['notes'][$note_id]['type']
= $record['note_description'];
! }
! // Communcation media fields
! if($record['comm_data'])
! {
! $comm_descr
= $record['comm_description'];
! $contact[$comm_descr]
= $record['comm_data'];
! $contact['comm_type'][$comm_descr]
= $record['comm_type_description'];
! }
! // Other fields
! if($record['other_value'])
! {
! $contact[$record['other_name']]
= $record['other_value'];
! }
! }
! return $contact;
! }
!
function add($owner,$fields,$access='',$cat_id='',$tid='n')
{
--- 751,755 ----
}
! /* @deprecated */
function add($owner,$fields,$access='',$cat_id='',$tid='n')
{
***************
*** 872,875 ****
--- 762,766 ----
}
+ /* @deprecated */
function field_exists($id,$field_name)
{
***************
*** 883,886 ****
--- 774,778 ----
}
+ /* @deprecated */
function
add_single_extra_field($id,$owner,$field_name,$field_value)
{
***************
*** 893,896 ****
--- 785,789 ----
}
+ /* @deprecated */
function delete_single_extra_field($id,$field_name)
{
***************
*** 902,905 ****
--- 795,799 ----
}
+ /* @deprecated */
function
update($id,$owner,$fields,$access='',$cat_id='',$tid='n')
{
***************
*** 933,947 ****
}
! /* Used by admin to change ownership on account delete */
! function change_owner($old_owner='',$new_owner='')
! {
! if (!($new_owner && $old_owner))
! {
! return False;
! }
! $contact = CreateObject('phpgwapi.contact_central');
! return $contact->update(array('owner' => $new_owner),
sql_criteria::_equal('owner',sql::integer($old_owner)), PHPGW_SQL_RUN_SQL);
! }
!
function read_extra_fields($id)
{
--- 827,831 ----
}
! /* @deprecated */
function read_extra_fields($id)
{
***************
*** 1221,1224 ****
--- 1105,1136 ----
}
+ /* This function get all the Communication media from one
contact.
+ *
+ * Or the first if there is no one marked as preferred.
+ * @param integer $contact_id id to locate the contact
+ * return array Form: (description => value, description =>
value, ...)
+ */
+ function get_all_comms($contact_id)
+ {
+ if (intval($contact_id) != 0)
+ {
+ // get all comm_descriptions from api function
+ $this->request(array('comm_data',
'comm_descr'));
+ $this->criteria(array('comm_contact_id' =>
$contact_id));
+ // get all comms from db
+ $records = $this->get_query(PHPGW_SQL_RUN_SQL,
__LINE__, __FILE__);
+ if(count($records) == 0)
+ {
+ return;
+ }
+ foreach ($records as $comm)
+ {
+ $descr =
$this->search_comm_descr_id($comm['comm_descr']);
+ $comms[$descr] = $comm['comm_data'];
+ }
+ }
+ return $comms;
+ }
+
/**
* Retrieve locations data for contact id.
***************
*** 1404,1409 ****
$this->criteria($criteria);
}
! $count = $this->get_query(__LINE__, __FILE__);
! return $count[0]['count_orgs'];
}
--- 1316,1339 ----
$this->criteria($criteria);
}
! $count = $this->get_query($action, __LINE__, __FILE__);
! return $count[0]['count_contacts'];
! }
!
! /**
! * Get the max contact_id
! *
! * @param string $criteria The criterias
! * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
! * @return integer The record count number
! */
! function get_max_contact($criteria='',
$action=PHPGW_SQL_RUN_SQL)
! {
! $this->request('max_contacts');
! if($criteria!='')
! {
! $this->criteria($criteria);
! }
! $max = $this->get_query($action, __LINE__, __FILE__);
! return $max[0]['max_contacts'];
}
***************
*** 1545,1548 ****
--- 1475,1569 ----
}
+ /**
+ * Get all the data for any contact or contacts that are part of
$optional_criteria.
+ *
+ * This function try to be a comprensive way to get data from
contacts<br /> convert the contacts database output on a multidimensional
array<br />
+ * @param int|array $contact_id
+ * @param mixed $optional_criteria criteria built with
sql_criteria
+ * @param integer $line where this function is called, usefull
for debug
+ * @param integer $file where this function is called, usefull
for debug
+ * @return mixed array with all the data of contact (contacts).
+ */
+ function person_complete_data($contact_id, $optional_criteria =
'', $line=__LINE__, $file=__FILE__)
+ {
+ $this->request($this->import_export_fields);
+ if (empty($optional_criteria))
+ {
+ if (intval($contact_id) == 0)
+ {
+ // this is an error
+ return ;
+ }
+
$this->criteria_token(sql_criteria::_equal('contact_id', $contact_id));
+ }
+ else
+ {
+ $this->criteria_token($optional_criteria);
+ }
+
+ $sql = $this->get_sql();
+
+ $this->execute_query($sql, $line, $file);
+
+ while ($this->db->next_record())
+ {
+ $record = $this->db->Record;
+ $contact['contact_id'] =
$record['contact_id'];
+ $contact['per_full_name'] =
$record['per_full_name'];
+ $contact['per_first_name'] =
$record['per_first_name'];
+ $contact['per_last_name'] =
$record['per_full_name'];
+ $contact['per_middle_name'] =
$record['per_middle_name'];
+ $contact['per_suffix'] =
$record['per_suffix'];
+ $contact['per_prefix'] =
$record['per_prefix'];
+ $contact['per_birthday'] =
$record['per_birthday'];
+ $contact['per_pubkey'] =
$record['per_pubkey'];
+ $contact['per_title'] =
$record['per_title'];
+ $contact['per_departament'] =
$record['per_departamet'];
+ $contact['per_initials'] =
$record['per_initials'];
+ $contact['per_sound'] =
$record['per_sound'];
+ $contact['per_active'] =
$record['per_active'];
+ $contact['per_createon'] =
$record['per_createon'];
+ $contact['per_createby'] =
$record['per_createby'];
+ $contact['per_modby'] =
$record['per_modby'];
+ $contact['per_modon'] =
$record['per_modon'];
+ $contact['account_id'] =
$record['account_id'];
+ // Locations info
+ $loc_id
= $record['key_addr_id'];
+ if($loc_id)
+ {
+ $contact['locations'][$loc_id]['type']
= $record['addr_description'];
+ $contact['locations'][$loc_id]['add1']
= $record['addr_add1'];
+ $contact['locations'][$loc_id]['add2']
= $record['addr_add2'];
+ $contact['locations'][$loc_id]['add3']
= $record['addr_add3'];
+
$contact['locations'][$loc_id]['address'] = $record['addr_address'];
+ $contact['locations'][$loc_id]['city']
= $record['addr_city'];
+ $contact['locations'][$loc_id]['state']
= $record['addr_state'];
+
$contact['locations'][$loc_id]['postal_code'] = $record['addr_postal_code'];
+
$contact['locations'][$loc_id]['country'] = $record['addr_country'];
+
$contact['locations'][$loc_id]['preferred'] = $record['addr_preferred'];
+ }
+ // Notes
+ $note_id
= $record['key_note_id'];
+ if($note_id)
+ {
+ $contact['notes'][$note_id]['text']
= $record['note_text'];
+ $contact['notes'][$note_id]['type']
= $record['note_description'];
+ }
+ // Communcation media fields
+ if($record['comm_data'])
+ {
+ $comm_descr
= $record['comm_description'];
+ $contact[$comm_descr]
= $record['comm_data'];
+ $contact['comm_type'][$comm_descr]
= $record['comm_type_description'];
+ }
+ // Other fields
+ if($record['other_value'])
+ {
+ $contact[$record['other_name']]
= $record['other_value'];
+ }
+ }
+ return $contact;
+ }
+
/*************************************************************\
* Search in catalogs functions section *
***************
*** 1768,1772 ****
return $relation->update($data, $criteria, $action);
}
!
/*************************************************************\
* Add contact section *
--- 1789,1810 ----
return $relation->update($data, $criteria, $action);
}
!
! /**
! * Allow to change the current owner for the new
! * @param integer $old_owner Current owner
! * @param integer $new_owner New owner, wath you want to have
now.
! */
! function change_owner($old_owner='',$new_owner='')
! {
! if (!($new_owner && $old_owner))
! {
! return False;
! }
! $contact = CreateObject('phpgwapi.contact_central');
! return $contact->update(array('owner' => $new_owner),
!
sql_criteria::_equal('owner',sql::integer($old_owner)),
! PHPGW_SQL_RUN_SQL);
! }
!
/*************************************************************\
* Add contact section *
***************
*** 1907,1910 ****
--- 1945,1949 ----
foreach($people as $person)
{
+ $orgs = $this->has_preferred_org($person);
$this->relations =
CreateObject('phpgwapi.contact_org_person');
if ($action == PHPGW_SQL_RUN_SQL)
***************
*** 1915,1919 ****
$data['my_creaton'] = $this->get_mkdate();
$data['my_creatby'] = $this->get_user_id();
- $orgs = $this->has_preferred_org($person);
if(count($orgs[0]) == 0)
{
--- 1954,1957 ----
***************
*** 1980,1983 ****
--- 2018,2022 ----
function add_location($location, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
+ $addr = $this->has_preferred_location($cid);
$this->location = CreateObject('phpgwapi.contact_addr');
if ($action == PHPGW_SQL_RUN_SQL)
***************
*** 1985,1989 ****
$this->lock_table($this->location->table);
}
- $addr = $this->has_preferred_location($cid);
if(count($addr[0]) == 0)
{
--- 2024,2027 ----
Index: class.contact_central.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/phpgwapi/inc/Attic/class.contact_central.inc.php,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** class.contact_central.inc.php 16 Oct 2003 06:31:29 -0000 1.1.2.6
--- class.contact_central.inc.php 28 Oct 2003 01:23:31 -0000 1.1.2.7
***************
*** 59,62 ****
--- 59,69 ----
'sort' => '',
'field' => ''),
+ 'max_contacts' => array('select' => '',
+ 'criteria' => '',
+ 'insert' => '',
+ 'update' => '',
+ 'delete' => '',
+ 'sort' => '',
+ 'field' => ''),
'people_contact'=> array('select' =>
'unlink_org'),
'organizations_contact' => array('select' =>
'unlink_org'));
***************
*** 121,124 ****
--- 128,136 ----
{
$this->add_field('count_contacts', 'count(contact_id)');
+ }
+
+ function select_max_contacts()
+ {
+ $this->add_field('max_contacts', 'max(contact_id)');
}
Index: class.vcard.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.vcard.inc.php,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** class.vcard.inc.php 2 Oct 2001 04:32:21 -0000 1.4
--- class.vcard.inc.php 28 Oct 2003 01:23:32 -0000 1.4.4.1
***************
*** 98,104 ****
var $names = array(
! 'family' => 'family',
! 'given' => 'given',
! 'middle' => 'middle',
'prefix' => 'prefix',
'suffix' => 'suffix'
--- 98,104 ----
var $names = array(
! 'first_name' => 'first_name',
! 'last_name' => 'last_name',
! 'middle_name' => 'middle_name',
'prefix' => 'prefix',
'suffix' => 'suffix'
***************
*** 149,152 ****
--- 149,154 ----
$entry = $this->in($buffer);
+ //var_dump($entry);
+
/* _debug_array($entry);exit; */
***************
*** 162,182 ****
{
$buffer = $this->_parse_in($buffer);
! $contacts = CreateObject('phpgwapi.contacts');
/* RB 2001/05/08 Lotus Organizer uses/needs extrafields from edit.php */
! $all_fields = $contacts->stock_contact_fields + array(
! 'ophone' => 'ophone',
! 'address2' => 'address2',
! 'address3' => 'address3'
! );
!
! while (list($fname,$fvalue) = each($all_fields))
! {
! if($buffer[$fname])
! {
! $entry[$fname] = $buffer[$fname];
! /* echo '<br>'.$fname.' =
"'.$entry[$fname].'"'."\n"; */
! }
! }
! return $entry;
}
--- 164,189 ----
{
$buffer = $this->_parse_in($buffer);
+ return $buffer;
+
+ //var_dump($buffer);
+
+ // $contacts = CreateObject('phpgwapi.contacts');
/* RB 2001/05/08 Lotus Organizer uses/needs extrafields from edit.php */
+ // $all_fields = $contacts->stock_contact_fields + array(
+ // 'ophone' => 'ophone',
+ // 'address2' => 'address2',
+ // 'address3' => 'address3'
+ // );
! // while (list($fname,$fvalue) = each($all_fields))
! // {
! // if($buffer[$fname])
! // {
! // $entry[$fname] = $buffer[$fname];
! // /* echo '<br>'.$fname.' =
"'.$entry[$fname].'"'."\n"; */
! // }
! // }
! //var_dump($entry);
!
! //return $entry;
}
***************
*** 197,584 ****
$field[0] = ereg_replace("D\.",'',$field[0]);
$values = split(';',$value);
! if ($field[1])
{
! //echo $field[0];
! switch ($field[0])
{
! case 'LABEL':
! $entry['label'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! break;
! case 'NOTE':
! $entry['note'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! break;
! case 'ADR':
! switch ($field[1])
! {
! case 'INTL':
! switch
($field[2])
! {
!
case 'WORK':
!
if ( !stristr($buffer['adr_one_type'],$field[1]))
!
{
!
$entry['adr_one_type'] .= 'intl;';
!
}
!
if (!$buffer['adr_one_street'])
!
{
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
!
}
!
break;
!
case 'HOME':
!
if ( !stristr($buffer['adr_two_type'],$field[1]) )
!
{
!
$entry['adr_two_type'] .= 'intl;';
!
}
!
if (!$buffer['adr_two_street'])
!
{
!
$entry['adr_two_street'] = $values[2];
!
$entry['adr_two_locality'] = $values[3];
!
$entry['adr_two_region'] = $values[4];
!
$entry['adr_two_postalcode'] = $values[5];
!
$entry['adr_two_countryname'] = $values[6];
!
}
!
break;
!
default:
!
break;
! }
! break;
! case 'DOM':
! switch
($field[2])
! {
!
case 'WORK':
!
if ( !stristr($buffer['adr_one_type'],$field[1]))
!
{
!
$entry['adr_one_type'] .= 'dom;';
!
}
!
if (!$buffer['adr_one_street'])
!
{
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
!
}
!
break;
!
case 'HOME':
!
if ( !stristr($buffer['adr_two_type'],$field[1]) )
!
{
!
$entry['adr_two_type'] .= 'dom;';
!
}
!
if (!$buffer['adr_two_street'])
!
{
!
$entry['adr_two_street'] = $values[2];
!
$entry['adr_two_locality'] = $values[3];
!
$entry['adr_two_region'] = $values[4];
!
$entry['adr_two_postalcode'] = $values[5];
!
$entry['adr_two_countryname'] = $values[6];
!
}
!
break;
!
default:
!
break;
! }
! break;
! case 'PARCEL':
! switch
($field[2])
! {
!
case 'WORK':
!
if ( !stristr($buffer['adr_one_type'],$field[1]))
!
{
!
$entry['adr_one_type'] .= 'parcel;';
!
}
!
if (!$buffer['adr_one_street'])
!
{
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
!
}
!
break;
!
case 'HOME':
!
if ( !stristr($buffer['adr_two_type'],$field[1]) )
!
{
!
$entry['adr_two_type'] .= 'parcel;';
!
}
!
if (!$buffer['adr_two_street'])
!
{
!
$entry['adr_two_street'] = $values[2];
!
$entry['adr_two_locality'] = $values[3];
!
$entry['adr_two_region'] = $values[4];
!
$entry['adr_two_postalcode'] = $values[5];
!
$entry['adr_two_countryname'] = $values[6];
!
}
!
break;
!
default:
!
break;
! }
! break;
! case 'POSTAL':
! switch
($field[2])
! {
!
case 'WORK':
!
if ( !stristr($buffer['adr_one_type'],$field[1]))
!
{
!
$entry['adr_one_type'] .= 'postal;';
!
}
!
if (!$buffer['adr_one_street'])
!
{
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
!
}
!
break;
!
case 'HOME':
!
if ( !stristr($buffer['adr_two_type'],$field[1]) )
!
{
!
$entry['adr_two_type'] .= 'postal;';
!
}
!
if (!$buffer['adr_two_street'])
!
{
!
$entry['adr_two_street'] = $values[2];
!
$entry['adr_two_locality'] = $values[3];
!
$entry['adr_two_region'] = $values[4];
!
$entry['adr_two_postalcode'] = $values[5];
!
$entry['adr_two_countryname'] = $values[6];
!
}
!
break;
!
default:
!
break;
! }
! break;
! case 'WORK':
! if
(!$buffer['adr_one_street'])
! {
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
! }
! break;
! case 'HOME':
!
$entry['adr_two_street'] = $values[2];
!
$entry['adr_two_locality'] = $values[3];
!
$entry['adr_two_region'] = $values[4];
!
$entry['adr_two_postalcode'] = $values[5];
!
$entry['adr_two_countryname'] = $values[6];
! break;
! default:
! if
(!$buffer['adr_one_street'])
! {
!
$entry['address2'] = $values[1];
!
$entry['adr_one_street'] = $values[2];
!
$entry['adr_one_locality'] = $values[3];
!
$entry['adr_one_region'] = $values[4];
!
$entry['adr_one_postalcode'] = $values[5];
!
$entry['adr_one_countryname'] = $values[6];
! }
! break;
! }
! break;
! case 'TEL': // RB
2001/05/07 added for Lotus Organizer ueses TEL;{WORK|HOME};{VOICE|FAX}[;PREF]
! if ($field[2] == 'FAX'
&& ($field[1] == 'WORK' || $field[i] == 'HOME'))
! {
! /* TODO This is
PHP4 only */
!
array_shift($field); // --> ignore the WORK or HOME if FAX follows, HOME;FAX
and HOME;TEL are maped later
! }
! switch ($field[1])
! {
! case 'PREF':
! //echo
$field[2].' is preferred';
! if
($field[2])
! {
!
$buffer['tel_prefer'] .= strtolower($field[2]) . ';';
! }
! break;
! case 'WORK':
// RB don't overwrite TEL;WORK;VOICE (main nr.) with TEL;WORK, TEL;WORK -->
tel_isdn
!
$entry[$buffer['tel_work'] ? 'tel_isdn' : 'tel_work'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'HOME':
// RB don't overwrite TEL;HOME;VOICE (main nr.) with TEL;HOME, TEL;HOME -->
ophone
!
$entry[$buffer['tel_home'] ? 'ophone' : 'tel_home' ] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'VOICE':
!
$entry['tel_voice'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'FAX':
! if
($entry['tel_fax'])
! {
!
// RB don't overwrite TEL;WORK;FAX with TEL;HOME;FAX, TEL;HOME;FAX --> ophone
!
$entry['ophone'] = $values[0] . ' Fax';
!
break;
! }
!
$entry['tel_fax'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'MSG':
!
$entry['tel_msg'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'CELL':
!
$entry['tel_cell'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'PAGER':
!
$entry['tel_pager'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'BBS':
!
$entry['tel_bbs'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'MODEM':
!
$entry['tel_modem'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'CAR':
!
$entry['tel_car'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'ISDN':
!
$entry['tel_isdn'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! case 'VIDEO':
!
$entry['tel_video'] = $values[0];
! if
($field[2] == 'PREF')
! {
!
$entry['tel_prefer'] .= strtolower($field[1]) . ';';
! }
! break;
! default:
! break;
! }
! break;
! case 'EMAIL':
! switch ($field[1])
! {
! case 'WORK':
!
$entry['email'] = $values[0];
!
$entry['email_type'] = $field[2];
! break;
! case 'HOME':
!
$entry['email_home'] = $values[0];
!
$entry['email_home_type'] = $field[2];
! break;
! default:
!
if($buffer['email'])
! {
!
$entry['email_type'] = $field[2];
! }
! elseif
(!$buffer['email'])
! {
!
$entry['email'] = $values[0];
!
$entry['email_type'] = $field[1];
! }
! break;
! }
break;
! case 'URL': // RB
2001/05/08 Lotus Organizer uses URL;WORK and URL;HOME (URL;HOME droped if both)
! $entry['url'] =
$values[0];
break;
default:
break;
! }
! }
! else
! {
! switch ($field[0])
! {
! case 'N':
! reset($this->names);
! $j=0;
!
while(list($myname,$myval) = each($this->names) )
! {
! $namel = 'n_' .
$myname;
! $entry[$namel]
= $values[$j];
! $j++;
! }
break;
! case 'FN':
! $entry['fn'] =
$values[0];
break;
! case 'TITLE':
! $entry['title'] =
$values[0];
break;
! case 'TZ':
! $entry['tz'] =
$values[0];
break;
! case 'GEO':
! $entry['geo'] =
$values[0];
break;
! case 'URL':
! $entry['url'] =
$values[0];
break;
! case 'NOTE':
! $entry['note'] =
ereg_replace('=0D=0A',"\n",$values[0]);
break;
! case 'KEY':
! $entry['key'] =
ereg_replace('=0D=0A',"\n",$values[0]);
break;
! case 'LABEL':
! $entry['label'] =
ereg_replace('=0D=0A',"\n",$values[0]);
break;
! case 'BDAY': #1969-12-31
! $tmp =
split('-',$values[0]);
! if ($tmp[0])
{
! $entry['bday']
= $tmp[1] . '/' . $tmp[2] . '/' . $tmp[0];
}
break;
! case 'ORG': // RB
2001/05/07 added for Lotus Organizer: ORG:Company;Department
! $entry['org_name'] =
$values[0];
! $entry['org_unit'] =
$values[1];
break;
}
}
}
- $entry['tel_prefer'] =
substr($buffer['tel_prefer'],0,-1);
- $entry['adr_one_type'] =
substr($buffer['adr_one_type'],0,-1);
- $entry['adr_two_type'] =
substr($buffer['adr_two_type'],0,-1);
if (count($street =
split("\r*\n",$buffer['adr_one_street'],3)) > 1)
--- 204,446 ----
$field[0] = ereg_replace("D\.",'',$field[0]);
$values = split(';',$value);
! switch (strtoupper($field[0]))
{
! case 'N':
! reset($this->names);
! $j=0;
! while(list($myname,$myval) =
each($this->names) )
{
! //$namel = 'per_' . $myname;
! $namel = $myname;
! $entry[$namel] = $values[$j];
! $j++;
! }
! break;
! case 'FN':
! $fn = split(" ", $values[0]);
! $entry['first_name'] = $fn[0];
! $entry['last_name'] = $fn[1];
! break;
! case 'TITLE':
! $entry['title'] = $values[0];
! break;
! case 'TZ':
! //$entry['tz'] = $values[0];
! break;
! case 'GEO':
! //$entry['geo'] = $values[0];
! break;
! case 'URL':
! //$entry['url'] = $values[0];
! $entry['comm_media']['website'] =
$values[0];
! break;
! case 'NOTE':
! //$entry['note'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! $entry['notes']['type'] = 'vcard';
! $entry['notes']['note'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! break;
! case 'KEY':
! $entry['key'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! break;
! case 'LABEL':
! $entry['label'] =
ereg_replace('=0D=0A',"\n",$values[0]);
! break;
! case 'BDAY': #1969-12-31
! $tmp =
split('-',$values[0]);
! if ($tmp[0])
! {
! $entry['birthday'] = $tmp[1] .
'/' . $tmp[2] . '/' . $tmp[0];
! }
! break;
! case 'ORG': // RB 2001/05/07 added for
Lotus Organizer: ORG:Company;Department
! $entry['preferred_org'] = $values[0];
! $entry['department'] = $values[1];
! break;
! case 'ADR':
! switch ($field[1])
! {
! case 'INTL':
! $location_level = 'int';
! switch ($field[2])
! {
! case 'WORK':
! $location_type = 'work';
break;
! case 'HOME':
! $location_type = 'home';
break;
default:
break;
! }
! break;
! case 'DOM':
! $location_level = 'dom';
! switch ($field[2])
! {
! case 'WORK':
! $location_type = 'work';
break;
! case 'HOME':
! $location_type = 'home';
break;
! default:
break;
! }
! break;
! case 'PARCEL':
! $location_level = 'parcel';
! switch ($field[2])
! {
! case 'WORK':
! $location_type = 'work';
break;
! case 'HOME':
! $location_type = 'home';
break;
! default:
break;
! }
! break;
! case 'POSTAL':
! $location_level = 'postal';
! switch ($field[2])
! {
! case 'WORK':
! $location_type = 'work';
break;
! case 'HOME':
! $location_type = 'home';
break;
! default:
break;
! }
! break;
! case 'WORK':
! $location_type = 'work';
! break;
! case 'HOME':
! $location_type = 'home';
! break;
! default:
! $location_type = 'work';
! break;
! }
! $loc =
$location_level?$location_level.'_'.$location_type:$location_type;
! $entry['locations'][$loc]['type'] =
$location_type;
! $entry['locations'][$loc]['add1'] =
$values[1];
! $entry['locations'][$loc]['add2'] =
$values[2];
! $entry['locations'][$loc]['city'] =
$values[3];
! $entry['locations'][$loc]['state'] =
$values[4];
!
$entry['locations'][$loc]['postal_code'] = $values[5];
! $entry['locations'][$loc]['country'] =
$values[6];
! break;
! case 'TEL':
! // RB 2001/05/07 added for Lotus
Organizer ueses TEL;{WORK|HOME};{VOICE|FAX}[;PREF]
! if ($field[2] == 'FAX' && ($field[1] ==
'WORK' || $field[1] == 'HOME'))
! {
! /* TODO This is PHP4 only */
! array_shift($field); // -->
ignore the WORK or HOME if FAX follows, HOME;FAX and HOME;TEL are maped later
! }
! switch ($field[1])
! {
! case 'WORK':
! // RB don't overwrite
TEL;WORK;VOICE (main nr.) with TEL;WORK, TEL;WORK --> tel_isdn
! //$entry[$buffer['tel_work'] ?
'tel_isdn' : 'tel_work'] = $values[0];
! $entry['comm_media']['work
phone'] = $values[0];
! break;
! case 'HOME':
! // RB don't overwrite
TEL;HOME;VOICE (main nr.) with TEL;HOME, TEL;HOME --> ophone
! //$entry[$buffer['tel_home'] ?
'ophone' : 'tel_home' ] = $values[0];
! $entry['comm_media']['home
phone'] = $values[0];
! break;
! case 'VOICE':
! $entry['comm_media']['voice
phone'] = $values[0];
! break;
! case 'FAX':
! switch ($fields[2])
! {
! case 'WORK':
!
if(!$entry['comm_media']['work fax'])
{
!
$entry['comm_media']['work fax'] = $values[0];
! }
! else
! {
!
$entry['comm_media']['other work fax'] = $values[0];
}
break;
! case 'HOME':
!
$entry['comm_media']['home fax'] = $values[0];
break;
+ default:
+
$entry['comm_media']['work fax'] = $values[0];
+ }
+ break;
+ case 'MSG':
+ $entry['comm_media']['msg
phone'] = $values[0];
+ break;
+ case 'CELL':
+ $entry['comm_media']['mobile
(cell) phone'] = $values[0];
+ break;
+ case 'PAGER':
+ $entry['comm_media']['pager'] =
$values[0];
+ break;
+ case 'BBS':
+ $entry['comm_media']['bbs'] =
$values[0];
+ break;
+ case 'MODEM':
+ $entry['comm_media']['modem'] =
$values[0];
+ break;
+ case 'CAR':
+ $entry['comm_media']['car
phone'] = $values[0];
+ break;
+ case 'ISDN':
+ $entry['comm_media']['isdn'] =
$values[0];
+ break;
+ case 'VIDEO':
+ $entry['comm_media']['video'] =
$values[0];
+ break;
+ case 'PREF':
+ //echo $field[2].' is
preferred';
+ if ($field[2])
+ {
+ //$buffer['tel_prefer']
.= strtolower($field[2]) . ';';
+
$entry['comm_media_preferred'] .= strtolower($field[2]) . ';';
+ }
+ break;
+ default:
+ break;
+ }
+ if ($field[2] == 'PREF')
+ {
+ $entry['comm_media_preferred']
.= strtolower($field[1]) . ';';
}
+ break;
+ case 'EMAIL':
+ switch ($field[1])
+ {
+ case 'WORK':
+ $entry['comm_media']['work
email'] = $values[0];
+ break;
+ case 'HOME':
+ $entry['comm_media']['home
email'] = $values[0];
+ break;
+ default:
+ if($buffer['email'])
+ {
+
$entry['comm_media']['work email'] = $values[2];
+ //$entry['email_type']
= $field[2];
+ }
+ elseif (!$buffer['email'])
+ {
+
$entry['comm_media']['work email'] = $values[0];
+ }
+ break;
+ }
+ break;
+ default:
+ break;
}
}
if (count($street =
split("\r*\n",$buffer['adr_one_street'],3)) > 1)
***************
*** 588,592 ****
$entry['address3'] = $street[2];
}
-
return $entry;
}
--- 450,453 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.contact_central.inc.php, 1.1.2.6, 1.1.2.7 class.contacts_sql.inc.php, 1.17.2.2.2.27, 1.17.2.2.2.28 class.vcard.inc.php, 1.4, 1.4.4.1,
Alejandro Borges (lex) <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] phpgwapi/setup tables_current.inc.php, 1.32.2.6.2.11, 1.32.2.6.2.12 tables_update.inc.php, 1.53.2.9.2.25, 1.53.2.9.2.26
- Next by Date:
[Phpgroupware-cvs] setup/templates/default applications.tpl, 1.4.2.2, 1.4.2.3 lang_main.tpl, 1.4, 1.4.2.1 setup_db_blocks.tpl, 1.5.2.1, 1.5.2.2 setup_demo.tpl, 1.4.4.1, 1.4.4.2
- Previous by thread:
[Phpgroupware-cvs] phpgwapi/setup tables_current.inc.php, 1.32.2.6.2.11, 1.32.2.6.2.12 tables_update.inc.php, 1.53.2.9.2.25, 1.53.2.9.2.26
- Next by thread:
[Phpgroupware-cvs] setup/templates/default applications.tpl, 1.4.2.2, 1.4.2.3 lang_main.tpl, 1.4, 1.4.2.1 setup_db_blocks.tpl, 1.5.2.1, 1.5.2.2 setup_demo.tpl, 1.4.4.1, 1.4.4.2
- Index(es):