[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.2
From: |
Alejandro Borges (lex) <address@hidden> |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.23, 1.17.2.2.2.24 class.sql_builder.inc.php, 1.1.2.13, 1.1.2.14 |
Date: |
Tue, 21 Oct 2003 01:08:17 +0000 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv18743/inc
Modified Files:
Tag: Version-0_9_16-branch
class.contacts_sql.inc.php class.sql_builder.inc.php
Log Message:
Fixes mysql stuff, opens IE stuff
Index: class.sql_builder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.sql_builder.inc.php,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -C2 -d -r1.1.2.13 -r1.1.2.14
*** class.sql_builder.inc.php 16 Oct 2003 06:31:29 -0000 1.1.2.13
--- class.sql_builder.inc.php 21 Oct 2003 01:08:15 -0000 1.1.2.14
***************
*** 181,193 ****
$entity_far_away = key($this->distance);
$this->ldebug('sort_by_distances', 'entering to
sort_by_distance', 'msg');
! $this->add_path($entity_far_away);
$this->ldebug('sort_by_distances',
array('Distances' => $this->distance,
! 'Path' => array_keys($this->path),
'Entity Distance' =>
$entity_distance,
'Entity far away' =>
$entity_far_away),
'dump');
$this->entity_to_center($entity_far_away,
! $entity_distance);
$this->ldebug('sort_by_distances', 'entering to while,
all the add_path must be reverse from here', 'msg');
while(!($this->last_distance()))
--- 181,194 ----
$entity_far_away = key($this->distance);
$this->ldebug('sort_by_distances', 'entering to
sort_by_distance', 'msg');
! $this->add_path($entity_far_away, TRUE);
$this->ldebug('sort_by_distances',
array('Distances' => $this->distance,
! 'Path' => $this->path,
'Entity Distance' =>
$entity_distance,
'Entity far away' =>
$entity_far_away),
'dump');
$this->entity_to_center($entity_far_away,
! $entity_distance, TRUE);
! $this->merge_paths();
$this->ldebug('sort_by_distances', 'entering to while,
all the add_path must be reverse from here', 'msg');
while(!($this->last_distance()))
***************
*** 249,253 ****
'entity
this iteration' => $entity,
'Actual
distance' => $dist));
! $tmp = array_keys($this->path);
if ($dist < $min_distance || ($min_distance ==
$entity_distance && !in_array($entity, $tmp)))
{
--- 250,254 ----
'entity
this iteration' => $entity,
'Actual
distance' => $dist));
! $tmp = array_keys($this->get_path());
if ($dist < $min_distance || ($min_distance ==
$entity_distance && !in_array($entity, $tmp)))
{
***************
*** 316,323 ****
function merge_paths()
{
! $this->path = $this->path +
array_reverse($this->false_path);
$this->false_path = array();
}
/**
* Return the SQL select correct for all the entity map.
--- 317,328 ----
function merge_paths()
{
! $this->path = $this->get_path() +
array_reverse($this->false_path);
$this->false_path = array();
}
+ function get_path()
+ {
+ return is_array($this->path) ? $this->path : array();
+ }
/**
* Return the SQL select correct for all the entity map.
***************
*** 473,481 ****
function get_join()
{
! $path = $this->path;
// from +
// table as alias (1)
$this->ldebug('get_join',
! array('Path' =>
array_keys($this->path)),
'dump');
$prev_entity = key($path);
--- 478,486 ----
function get_join()
{
! $path = $this->get_path();
// from +
// table as alias (1)
$this->ldebug('get_join',
! array('Path' => $this->path),
'dump');
$prev_entity = key($path);
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.23
retrieving revision 1.17.2.2.2.24
diff -C2 -d -r1.17.2.2.2.23 -r1.17.2.2.2.24
*** class.contacts_sql.inc.php 16 Oct 2003 06:31:29 -0000 1.17.2.2.2.23
--- class.contacts_sql.inc.php 21 Oct 2003 01:08:14 -0000 1.17.2.2.2.24
***************
*** 1764,1770 ****
$this->lock_table($this->contact->table);
! $this->contact->insert(array('owner' => $owner,
! 'access' =>
$principal['access'],
! 'cat_id' =>
$this->get_categories($categories),
'contact_type' => $type),
PHPGW_SQL_RUN_SQL);
$cid = $this->last_id('contact', 'contact_id');
--- 1764,1770 ----
$this->lock_table($this->contact->table);
! $this->contact->insert(array('owner' => $owner,
! 'access' =>
$principal['access'],
! 'cat_id' =>
$this->get_categories($categories),
'contact_type' => $type),
PHPGW_SQL_RUN_SQL);
$cid = $this->last_id('contact', 'contact_id');
***************
*** 2373,2377 ****
}
}
!
function get_addr_by_contact($contact_id)
{
--- 2373,2377 ----
}
}
!
function get_addr_by_contact($contact_id)
{
***************
*** 3274,3277 ****
--- 3274,3432 ----
//ldap_close($this->LDAPResource);
//die('debug');
+ }
+
+ function contact_import($fields, $type = '')
+ {
+ if((isset($fields['first_name']) &&
!isset($fields['org_name'])) || $type == $this->_contact_person)
+ {
+ $contact['contact_id'] =
$fields['contact_id'];
+ $contact['per_first_name'] =
$fields['first_name'];
+ $contact['per_last_name'] =
$fields['last_name'];
+ $contact['per_middle_name'] =
$fields['middle_name'];
+ $contact['per_suffix'] =
$fields['suffix'];
+ $contact['per_prefix'] =
$fields['prefix'];
+ $contact['per_birthday'] =
$fields['birthday'];
+ $contact['per_pubkey'] =
$fields['pubkey'];
+ $contact['per_title'] =
$fields['title'];
+ $contact['per_departament'] =
$fields['departamet'];
+ $contact['per_initials'] =
$fields['initials'];
+ $contact['per_sound'] =
$fields['sound'];
+ $contact['per_active'] =
$fields['active'];
+ $contact['preferred_org'] =
$fields['preferred_org'];
+ $contact['preferred_address'] =
$fields['preferred_address'];
+ $contact['relations'] =
$fields['organizations'];
+
+ unset( $fields['contact_id'],
+ $fields['first_name'],
+ $fields['last_name'],
+ $fields['middle_name'],
+ $fields['suffix'],
+ $fields['prefix'],
+ $fields['bicthday'],
+ $fields['pubkey'],
+ $fields['title'],
+ $fields['departament'],
+ $fields['initials'],
+ $fields['sound'],
+ $fields['active'],
+ $fields['preferred_org'],
+ $fields['preferred_address'],
+ $fields['organizations']);
+ }
+ else
+ {
+ $contact['org_name'] =
$fields['org_name'];
+ $contact['org_active'] =
$fields['active'];
+ $contact['org_parent'] =
$fields['parent'];
+ $contact['relations'] =
$fields['people'];
+
+ unset( $fields['org_name'],
+ $fields['active'],
+ $fields['parent'],
+ $fields['people']);
+ }
+ $contact['categories'] = $fields['categories'];
+ unset($fields['categories']);
+
+ // Locations info
+ if(is_array($fields['locations']))
+ {
+ foreach($fields['locations'] as $location_input)
+ {
+ // Go for a _good_ address type
+ $addr_type =
$this->search_location_type($Location_input['type']);
+ if(!empty($addr_type))
+ {
+ $location['addr_type'] =
$addr_type;
+ }
+ else
+ {
+ $addr_type =
$this->search_location_type('work');
+ if(!empty($addr_type))
+ {
+ $location['addr_type']
= $addr_type;
+ }
+ else
+ {
+ //return
PHPGW_CONTACTS_ERROR_LOCATION_TYPE_MISSING;
+ return -1;
+ }
+ }
+ $location['addr_add1'] =
$location_input['add1'];
+ $location['addr_add2'] =
$location_input['add2'];
+ $location['addr_add3'] =
$location_input['add3'];
+ $location['addr_city'] =
$location_input['city'];
+ $location['addr_state'] =
$location_input['state'];
+ $location['addr_postal_code'] =
$location_input['postal_code'];
+ $location['addr_country'] =
$location_input['country'];
+ $location['addr_preferred'] =
$location_input['preferred'];
+ $locations[] =
$location;
+ }
+ }
+ unset($fields['locations']);
+
+ // Notes
+ if(is_array($fields['notes']))
+ {
+ foreach($fields['notes'] as $note_input)
+ {
+ $note_type =
$this->search_note_type($note_input['type']);
+ if(!empty($note_type))
+ {
+ $note['note_type'] = $note_type;
+ }
+ else
+ {
+ // FIXME: what is the default
value for note_type?
+ $note_type =
$this->search_location_type('default');
+ if(!empty($note_type))
+ {
+ $note['note_type'] =
$note_type;
+ }
+ else
+ {
+ //return
PHPGW_CONTACTS_ERROR_NOTE_TYPE_MISSING;
+ return -1;
+ }
+ }
+ }
+ $note['note_text'] = $note_input['note'];
+ $notes[] = $note;
+ }
+ unset($fields['notes']);
+
+ // Communcation media fields
+ if(is_array($fields['comm_media']))
+ {
+ foreach($fields['comm_media'] as
$description_input => $comm_input)
+ {
+ $description_id =
$this->search_comm_descr($description_input);
+ if(!empty($comm_description))
+ {
+ $comm['comm_descr'] =
$description_id;
+ $comm['comm_data'] =
$comm_input;
+ $comm_media[] = $comm;
+ }
+ else
+ {
+ // Promote to others
+ $fields[$description_input] =
$comm_input;
+ }
+ }
+ }
+ unset($fields['comm_media']);
+
+ // Other fields
+ if(count($fields) > 0)
+ {
+ foreach($fields as $field_name => $field_value)
+ {
+ $others['other_name'] = $field_name;
+ $others['other_value'] = $field_value;
+ }
+ }
+ // FIXME: Jarg needs to check this
+ $this->add_contact($type, $contact, $comm_media,
$locations, $categories, $others, $contact['relations']);
+ return $contact;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.23, 1.17.2.2.2.24 class.sql_builder.inc.php, 1.1.2.13, 1.1.2.14,
Alejandro Borges (lex) <address@hidden> <=