[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] addressbook/inc class.boaddressbook.inc.php, 1.21.2.2
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] addressbook/inc class.boaddressbook.inc.php, 1.21.2.2.2.10, 1.21.2.2.2.11 class.soaddressbook.inc.php, 1.14.2.3.2.7, 1.14.2.3.2.8 class.uiaddressbook.inc.php, 1.36.2.15.2.18, 1.36.2.15.2.19 |
Date: |
Fri, 26 Sep 2003 05:32:05 +0000 |
Update of /cvsroot/phpgroupware/addressbook/inc
In directory subversions:/tmp/cvs-serv730/inc
Modified Files:
Tag: Version-0_9_16-branch
class.boaddressbook.inc.php class.soaddressbook.inc.php
class.uiaddressbook.inc.php
Log Message:
Fixes for bugs 5188, 5237 - from jarg
Index: class.boaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.boaddressbook.inc.php,v
retrieving revision 1.21.2.2.2.10
retrieving revision 1.21.2.2.2.11
diff -C2 -d -r1.21.2.2.2.10 -r1.21.2.2.2.11
*** class.boaddressbook.inc.php 26 Sep 2003 05:22:29 -0000 1.21.2.2.2.10
--- class.boaddressbook.inc.php 26 Sep 2003 05:32:03 -0000 1.21.2.2.2.11
***************
*** 426,430 ****
}
! //used
function add_person($fields)
{
--- 426,436 ----
}
! /**
! * what you want
! *
! * @param integer $person_id The person id what you want to find
! * @return array The array with all data from person, this also
! * separate the cats and extra tab
! */
function add_person($fields)
{
***************
*** 437,468 ****
return $this->so->add_org($fields);
}
-
- function get_principal_organizations_data($id)
- {
- $entry =
$this->so->get_principal_organizations_data($id);
- $entry[0]['load']='load';
- $entry[0]['my_cats'] = explode(",",
$entry[0]['cat_id']);
- return $entry[0];
- }
! function get_principal_persons_data($id)
{
! $entry = $this->so->get_principal_persons_data($id);
! $email = $this->so->get_email($id);
! $phone = $this->so->get_phone($id);
!
! $entry[0]['email'] = $email[0]['email'];
! $entry[0]['wphone'] = $phone[0]['comm_data'];
! $entry[0]['load']='load';
! $entry[0]['my_cats'] = explode(",",
$entry[0]['cat_id']);
return $entry[0];
}
! function get_orgs_person_data($id)
{
! //get orgs for this person
! $entry = $this->so->get_organizations_by_person($id);
if($entry)
{
--- 443,483 ----
return $this->so->add_org($fields);
}
! /**
! * Get the principal person data for the psrson_id what you want
! *
! * @param integer $person_id The person id what you want to find
! * @return array The array with all data from person, this also
! * separate the cats and extra tab
! */
! function get_principal_persons_data($person_id)
{
! $entry =
$this->so->get_principal_persons_data($person_id);
! $entry[0]['tab_cats']['my_cats'] = explode(",",
$entry[0]['cat_id']);
! $entry[0]['tab_extra']['per_suffix'] =
$entry[0]['per_suffix'];
! $entry[0]['tab_extra']['per_sound'] =
$entry[0]['per_sound'];
! $entry[0]['tab_extra']['per_initials'] =
$entry[0]['per_initials'];
! $entry[0]['tab_extra']['per_pubkey'] =
$entry[0]['per_pubkey'];
! unset($entry[0]['cat_id']);
! unset($entry[0]['per_suffix']);
! unset($entry[0]['per_sound']);
! unset($entry[0]['per_initials']);
! unset($entry[0]['per_pubkey']);
!
return $entry[0];
}
! /**
! * Get the organizations for the person what you want
! *
! * @param integer $person_i The person id what you want to find
! * @return array The array with all organizations for this
person,
! * this also return in this array the preferred organization
! */
! function get_orgs_person_data($person_id)
{
! $entry =
$this->so->get_organizations_by_person($person_id);
if($entry)
{
***************
*** 471,581 ****
if ($v['my_preferred'] == 'Y')
{
!
$entry['entry']['preferred_org'] = $v['my_org_id'];
}
! $entry['entry']['my_orgs'][$k] =
$v['my_org_id'];
}
}
! $entry['entry']['my_orgs']['load']='load';
! return $entry['entry'];
}
! function get_person_orgs_data($id)
{
! //get orgs for this person
! $entry = $this->so->get_people_by_organizations($id);
if($entry)
{
foreach($entry as $k => $v)
{
! $entry['entry']['my_person'][$k] =
$v['my_person_id'];
}
}
! $entry['entry']['my_person']['load']='load';
! return $entry['entry'];
! }
!
! function get_others_contact_data($id)
! {
! $entry['entry']['others'] =
$this->so->get_others_contact_data($id);
! $entry['entry']['others']['load']='load';
! return $entry['entry'];
! }
!
! function get_comm_contact_data($contacts, $fields_comms='')
! {
! $entry['entry']['comm'] =
$this->so->get_comm_contact_data($contacts, $fields_comms);
! $entry['entry']['comm']['load']='load';
! return $entry['entry'];
! }
!
! function get_addr_contact_data($id, $criteria='')
! {
! $entry['entry']['addr'] =
$this->so->get_addr_contact_data($id);
! $entry['entry']['addr']['load']='load';
! return $entry['entry'];
! }
!
! function get_others_person_data($id, $criteria='')
! {
! $entry['entry']['others'] =
$this->so->get_others_contact_data($id, $criteria);
! $entry['entry']['others']['load']='load';
! return $entry['entry'];
! }
!
! function get_comm_person_data($id, $criteria='')
! {
! $entry['entry']['comm'] =
$this->so->get_comm_contact_data($id, $criteria);
! $entry['entry']['comm']['load']='load';
! return $entry['entry'];
! }
!
! function get_addr_person_data($id)
! {
! $entry['entry']['addr'] =
$this->so->get_addr_contact_data($id);
! $entry['entry']['addr']['load']='load';
! return $entry['entry'];
}
! function get_others_org_data($id)
{
! $entry['entry']['others'] =
$this->so->get_others_contact_data($id);
! $entry['entry']['others']['load']='load';
! return $entry['entry'];
}
! function get_comm_org_data($id)
{
! $entry['entry']['comm'] =
$this->so->get_comm_contact_data($id);
! $entry['entry']['comm']['load']='load';
! return $entry['entry'];
}
! function get_addr_org_data($id)
{
! $entry['entry']['addr'] =
$this->so->get_addr_contact_data($id);
! $entry['entry']['addr']['load']='load';
! return $entry['entry'];
}
! function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='')
{
! $entries = $this->so->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria);
$this->total = $this->so->contacts->total_records;
return $entries;
}
! function get_orgs($fields, $start='', $limit='', $orderby='',
$sort='', $criteria='')
{
! $entries = $this->so->get_orgs($fields, $start,
$limit, $orderby, $sort, $criteria);
$this->total = $this->so->contacts->total_records;
return $entries;
}
! function get_insert_other($contact_id, $fields)
{
return $this->so->add_others($fields, $contact_id);
}
! function get_update_other($contact_id, $fields)
{
unset($fields['key_other_id']);
--- 486,584 ----
if ($v['my_preferred'] == 'Y')
{
! $entry['preferred_org'] =
$v['my_org_id'];
}
! $entry['my_orgs'][$k] = $v['my_org_id'];
}
}
! return $entry;
}
! /**
! * Get the principal organization data for the org_id what you
want
! *
! * @param integer $org_id The organization id what you want to
find
! * @return array The array with all data from person, this also
! * separate the cats and extra tab
! */
! function get_principal_organizations_data($org_id)
{
! $entry =
$this->so->get_principal_organizations_data($org_id);
! $entry[0]['tab_cats']['my_cats'] = explode(",",
$entry[0]['cat_id']);
! unset($entry[0]['cat_id']);
! return $entry[0];
! }
!
! /**
! * Get the persons for the organization what you want
! *
! * @param integer $org_id The org id what you want to find
! * @return array The array with all persons for this organization
! */
! function get_person_orgs_data($org_id)
! {
! $entry =
$this->so->get_people_by_organizations($org_id);
if($entry)
{
foreach($entry as $k => $v)
{
! $entry['my_person'][$k] =
$v['my_person_id'];
}
}
! return $entry;
}
! /**
! * Get the others fields data for this contact
! *
! * @param integer $contact_id The contact id what you want to
find
! * @return array The array with all others data for this contact
! */
! function get_others_contact_data($contact_id)
{
! return $this->so->get_others_contact_data($contact_id);
}
! /**
! * Get the addresses data for this contact
! *
! * @param integer $contact_id The contact id what you want to
find
! * @return array The array with all addresses data for this
contact
! */
! function get_addr_contact_data($contact_id)
{
! return $this->so->get_addr_contact_data($contact_id);
}
! /**
! * Get the communications media data for this contact
! *
! * @param integer $contact_id The contact id what you want to
find
! * @return array The array with all communications media for
this contact
! */
! function get_comm_contact_data($contacts, $fields_comms='')
{
! return $this->so->get_comm_contact_data($contacts,
$fields_comms);
}
! function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='', $token_criteria='')
{
! $entries = $this->so->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
$this->total = $this->so->contacts->total_records;
return $entries;
}
! function get_orgs($fields, $start='', $limit='', $orderby='',
$sort='', $criteria='', $token_criteria='')
{
! $entries = $this->so->get_orgs($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
$this->total = $this->so->contacts->total_records;
return $entries;
}
! function get_insert_others($contact_id, $fields)
{
return $this->so->add_others($fields, $contact_id);
}
! function get_update_others($contact_id, $fields)
{
unset($fields['key_other_id']);
***************
*** 604,607 ****
--- 607,611 ----
return $this->so->edit_location($contact_id, $fields);
}
+
function get_columns_to_display($contact_type)
{
***************
*** 659,667 ****
{
$old_person= $fields['old_my_person']['my_person'];
! $new_person = $fields['my_person'];
! unset($old_person['load']);
! unset($new_person['load']);
!
! $fields['edit_person'] =
$this->diff_arrays($old_person, $new_person);
return $this->so->edit_org($org_id, $fields);
}
--- 663,677 ----
{
$old_person= $fields['old_my_person']['my_person'];
! $new_person = $fields['tab_persons']['my_person'];
! $fields['edit_persons'] =
$this->diff_arrays($old_person, $new_person);
!
! $old_comm = $fields['old_comm'];
! $new_comm = $fields['tab_comms']['comm_data'];
! $fields['edit_comms'] = $this->diff_arrays($old_comm,
$new_comm, 'keys');
!
! $old_others = $fields['old_others'];
! $new_others = $fields['others_data'];
! $fields['edit_others'] =
$this->diff_arrays($old_others, $new_others, 'keys');
!
return $this->so->edit_org($org_id, $fields);
}
***************
*** 669,683 ****
function edit_person($person_id, $fields)
{
! $old_orgs= $fields['old_my_orgs']['my_orgs'];
! $new_orgs = $fields['my_orgs'];
! unset($old_orgs['load']);
! unset($new_orgs['load']);
!
! $fields['edit_orgs'] = $this->diff_arrays($old_orgs,
$new_orgs);
!
! return $this->so->edit_person($person_id, $fields);
}
! function diff_arrays($old_array=array(), $new_array=array())
{
if(!is_array($old_array))
--- 679,697 ----
function edit_person($person_id, $fields)
{
! $old_orgs= $fields['old_my_orgs']['my_orgs'];
! $new_orgs = $fields['tab_orgs']['my_orgs'];
! $fields['edit_orgs'] = $this->diff_arrays($old_orgs,
$new_orgs);
!
! $old_comm = $fields['old_comm'];
! $new_comm = $fields['tab_comms']['comm_data'];
! $fields['edit_comms'] = $this->diff_arrays($old_comm,
$new_comm, 'keys');
!
! $old_others = $fields['old_others'];
! $new_others = $fields['others_data'];
! $fields['edit_others'] =
$this->diff_arrays($old_others, $new_others, 'keys');
! return $this->so->edit_person($person_id, $fields);
}
! function diff_arrays($old_array=array(), $new_array=array(),
$type='values')
{
if(!is_array($old_array))
***************
*** 691,696 ****
}
! $result['delete'] = array_diff($old_array, $new_array);
! $result['insert'] = array_diff($new_array, $old_array);
return $result;
}
--- 705,737 ----
}
! if($type=='values')
! {
! $result['delete'] = array_diff($old_array,
$new_array);
! $result['insert'] = array_diff($new_array,
$old_array);
! $result['edit'] = array_intersect($old_array,
$new_array);
! }
! elseif($type=='keys')
! {
! $bc_old_array = $old_array;
! $bc_new_array = $new_array;
!
! $delete = array_diff(array_keys($old_array),
array_keys($new_array));
! $insert = array_diff(array_keys($new_array),
array_keys($old_array));
! $edit = array_intersect(array_keys($old_array),
array_keys($new_array));
!
! foreach($delete as $key)
! {
! $result['delete'][$key] =
$bc_old_array[$key];
! }
! foreach($insert as $key)
! {
! $result['insert'][$key] =
$bc_new_array[$key];
! }
! foreach($edit as $key)
! {
! $result['edit'][$key] =
$bc_new_array[$key];
! }
! }
!
return $result;
}
***************
*** 700,703 ****
--- 741,755 ----
return $this->so->search_contact_type_id($id);
}
+ /**
+ * Search location id in location catalog
+ *
+ * @param integer $id The location id to find
+ * @return string The description of id
+ */
+ function search_location_type_id($id)
+ {
+ return $this->so->search_location_type_id($id);
+ }
+
function get_type_contact($contact_id)
Index: class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.36.2.15.2.18
retrieving revision 1.36.2.15.2.19
diff -C2 -d -r1.36.2.15.2.18 -r1.36.2.15.2.19
*** class.uiaddressbook.inc.php 26 Sep 2003 05:22:29 -0000 1.36.2.15.2.18
--- class.uiaddressbook.inc.php 26 Sep 2003 05:32:03 -0000 1.36.2.15.2.19
***************
*** 15,18 ****
--- 15,19 ----
/* $Id$ */
+
class uiaddressbook
{
***************
*** 46,50 ****
//@discussion Will hold the data to navigate between the tabs
var $fields_data = array();
[...3517 lines suppressed...]
- $comm_type .= '<option value="'
. $value['comm_type_id'] . '" selected>'
- .
$value['comm_type_description'] . '</option>';
- $comm_type_description =
$value['comm_type_description'];
- }
- else
- {
- $comm_type .= '<option value="'
. $value['comm_type_id'] . '">'
- .
$value['comm_type_description'] . '</option>';
- }
- }
- if ($type=='text')
- {
- return $comm_type_description;
- }
- else
- {
- return $comm_type;
}
}
--- 2947,2950 ----
Index: class.soaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.soaddressbook.inc.php,v
retrieving revision 1.14.2.3.2.7
retrieving revision 1.14.2.3.2.8
diff -C2 -d -r1.14.2.3.2.7 -r1.14.2.3.2.8
*** class.soaddressbook.inc.php 26 Sep 2003 05:22:29 -0000 1.14.2.3.2.7
--- class.soaddressbook.inc.php 26 Sep 2003 05:32:03 -0000 1.14.2.3.2.8
***************
*** 28,32 ****
if($useacl)
{
! $this->grants =
$GLOBALS['phpgw']->acl->get_grants('addressbook');
}
--- 28,32 ----
if($useacl)
{
! $this->grants =
$GLOBALS['phpgw']->acl->get_grants('addressbook');
}
***************
*** 195,206 ****
}
! function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='')
{
! return $this->contacts->get_persons($fields, $start,
$limit, $orderby, $sort, '', $criteria);
}
! function get_orgs($fields, $start='', $limit='', $orderby='',
$sort='', $criteria='')
{
! return $this->contacts->get_orgs($fields, $start,
$limit, $orderby, $sort, '', $criteria);
}
--- 195,206 ----
}
! function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='', $token_criteria='')
{
! return $this->contacts->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
}
! function get_orgs($fields, $start='', $limit='', $orderby='',
$sort='', $criteria='', $token_criteria='')
{
! return $this->contacts->get_orgs($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
}
***************
*** 218,251 ****
function add_person($fields)
{
! if (is_array($fields['my_orgs']))
{
! $my_orgs = $fields['my_orgs'];
! foreach($my_orgs as $key => $value)
{
! $fields['orgs'][] = $value;
}
}
!
! $comms = $fields['comm'];
! $addr = $fields['addr'];
! $others = $fields['others'];
! $orgs = $fields['orgs'];
! $cats = $fields['my_cats'];
!
! $fields['preferred_address']=1;
!
! unset($fields['tmp_data']);
! unset($fields['all_orgs']);
! unset($fields['all_cats']);
! unset($fields['my_cats']);
! unset($fields['my_orgs']);
! unset($fields['comm']);
! unset($fields['addr']);
! unset($fields['others']);
! unset($fields['orgs']);
! unset($fields['email']);
! unset($fields['wphone']);
! unset($fields['ispublic']);
! unset($fields['old_tab']);
$type =
$this->contacts->search_contact_type($this->contacts->get_person_name());
--- 218,246 ----
function add_person($fields)
{
! $principal = array_merge($fields['tab_person_data'],
$fields['tab_extra']);
!
! foreach($fields['tab_comms']['comm_data'] as
$type_descr => $data)
{
! if($data)
{
! $comms[] = array('comm_descr'
=> $this->contacts->search_comm_descr($type_descr),
! 'comm_data'
=> $data,
! 'comm_preferred'
=> ($type_descr==$fields['tab_comms']['preferred']?'Y':'N'));
}
}
!
! if(is_array($fields['addr_data']))
! {
!
$fields['addr_data'][$fields['tab_address']['addr_preferred']]['addr_preferred']='Y';
! $addr = $fields['addr_data'];
! }
!
! $others = $fields['others_data'];
!
! $orgs = $fields['tab_orgs']['my_orgs'];
! $principal['preferred_org'] =
$fields['tab_orgs']['preferred_org'];
! $principal['preferred_address'] = '1';
!
! $cats = $fields['tab_cats']['my_cats'];
$type =
$this->contacts->search_contact_type($this->contacts->get_person_name());
***************
*** 258,286 ****
function add_org($fields)
{
! if (is_array($fields['my_person']))
{
! $my_persons = $fields['my_person'];
! foreach($my_persons as $key => $value)
{
! $fields['persons'][] = $value;
}
}
-
- $comms = $fields['comm'];
- $addr = $fields['addr'];
- $others = $fields['others'];
- $persons = $fields['persons'];
- $cats = $fields['my_cats'];
! unset($fields['tmp_data']);
! unset($fields['all_person']);
! unset($fields['all_cats']);
! unset($fields['my_cats']);
! unset($fields['my_person']);
! unset($fields['comm']);
! unset($fields['addr']);
! unset($fields['others']);
! unset($fields['ispublic']);
! unset($fields['old_tab']);
$type =
$this->contacts->search_contact_type($this->contacts->get_org_name());
--- 253,279 ----
function add_org($fields)
{
! $principal = $fields['tab_org_data'];
!
! foreach($fields['tab_comms']['comm_data'] as
$type_descr => $data)
{
! if($data)
{
! $comms[] = array('comm_descr'
=> $this->contacts->search_comm_descr($type_descr),
! 'comm_data'
=> $data,
! 'comm_preferred'
=> ($type_descr==$fields['tab_comms']['preferred']?'Y':'N'));
}
}
! if(is_array($fields['addr_data']))
! {
!
$fields['addr_data'][$fields['tab_address']['addr_preferred']]['addr_preferred']='Y';
! $addr = $fields['addr_data'];
! }
!
! $others = $fields['others_data'];
!
! $persons = $fields['tab_persons']['my_person'];
!
! $cats = $fields['tab_cats']['my_cats'];
$type =
$this->contacts->search_contact_type($this->contacts->get_org_name());
***************
*** 292,356 ****
{
$principal['owner'] = $fields['owner'];
! $principal['access'] = $fields['access'];
! $principal['cat_id'] = $fields['my_cats'];
! $this->contacts->edit_contact($person_id, $principal,
PHPGW_SQL_RUN_SQL);
! unset($fields['contact_id']);
! unset($fields['owner']);
! unset($fields['access']);
! unset($fields['cat_id']);
! unset($fields['email']);
! unset($fields['wphone']);
! unset($fields['load']);
! unset($fields['my_cats']);
! unset($fields['ispublic']);
! unset($fields['old_tab']);
! unset($fields['bday_day']);
! unset($fields['bday_month']);
! unset($fields['bday_year']);
! $this->contacts->edit_person($person_id, $fields,
PHPGW_SQL_RUN_SQL);
! foreach($fields['edit_orgs']['delete'] as $org_id)
{
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RUN_SQL);
}
-
$fields['preferred_address']=1;
!
$this->contacts->add_orgs_for_person($fields['edit_orgs']['insert'],
!
$fields['preferred_org'],
$fields['preferred_address'],
$person_id,
PHPGW_SQL_RUN_SQL);
- }
function edit_org($org_id, $fields)
{
$principal['owner'] = $fields['owner'];
! $principal['access'] = $fields['access'];
! $principal['cat_id'] = $fields['my_cats'];
! $this->contacts->edit_contact($org_id, $principal,
PHPGW_SQL_RUN_SQL);
! unset($fields['contact_id']);
! unset($fields['owner']);
! unset($fields['access']);
! unset($fields['cat_id']);
! unset($fields['email']);
! unset($fields['wphone']);
! unset($fields['load']);
! unset($fields['my_cats']);
! unset($fields['ispublic']);
! unset($fields['old_tab']);
! unset($fields['bday_day']);
! unset($fields['bday_month']);
! unset($fields['bday_year']);
! $this->contacts->edit_org($org_id, $fields,
PHPGW_SQL_RUN_SQL);
! foreach($fields['edit_person']['delete'] as $person_id)
{
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RUN_SQL);
}
!
$this->contacts->add_people_for_organzation($fields['edit_person']['insert'],
$org_id, PHPGW_SQL_RUN_SQL);
}
--- 285,449 ----
{
$principal['owner'] = $fields['owner'];
! $principal['access'] =
$fields['tab_person_data']['ispublic'];
! foreach($fields['tab_cats']['my_cats'] as $cat)
! {
! if($cat)
! {
! $cats[] = $cat;
! }
! }
! $principal['cat_id'] = $cats;
! $person = array_merge($fields['tab_person_data'],
$fields['tab_extra']);
! $orgs = $fields['edit_orgs'];
! $orgs['preferred_org'] =
$fields['tab_orgs']['preferred_org'];
! $queries = $fields['transactions'];
! unset($fields['tab_person_data']);
! unset($fields['tab_extra']);
! unset($fields['tab_orgs']);
! unset($fields['edit_orgs']);
! unset($fields['tab_cats']);
! unset($fields['old_my_orgs']);
! unset($fields['tab_address']);
! unset($fields['addr_data']);
! unset($fields['transactions']);
! unset($fields['tab_comms']);
! unset($fields['old_comm']);
!
! $this->contacts->edit_contact($person_id, $principal,
PHPGW_SQL_RUN_SQL);
! $this->contacts->edit_person($person_id, $person,
PHPGW_SQL_RUN_SQL);
! foreach($orgs['delete'] as $org_id)
{
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RUN_SQL);
}
$fields['preferred_address']=1;
! $this->contacts->add_orgs_for_person($orgs['insert'],
!
$orgs['preferred_org'],
$fields['preferred_address'],
$person_id,
PHPGW_SQL_RUN_SQL);
+ $this->upgrade_comms($fields['edit_comms']['insert'],
+ $fields['edit_comms']['delete'],
+ $fields['edit_comms']['edit'],
+ $fields['comm_data'], $person_id);
+
+ $this->upgrade_others($fields['edit_others']['insert'],
+ $fields['edit_others']['delete'],
+ $fields['edit_others']['edit'],
+
$fields['tab_others']['other_value'], $person_id);
+
+ $this->execute_queries($queries);
+ }
+
function edit_org($org_id, $fields)
{
+
$principal['owner'] = $fields['owner'];
! $principal['access'] =
$fields['tab_person_data']['ispublic'];
! foreach($fields['tab_cats']['my_cats'] as $cat)
! {
! if($cat)
! {
! $cats[] = $cat;
! }
! }
! $principal['cat_id'] = $cats;
! $org = $fields['tab_org_data'];
! $persons = $fields['edit_persons'];
! $queries = $fields['transactions'];
! $this->contacts->edit_contact($org_id, $principal,
PHPGW_SQL_RUN_SQL);
! $this->contacts->edit_org($org_id, $org,
PHPGW_SQL_RUN_SQL);
! foreach($persons['delete'] as $person_id)
{
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RUN_SQL);
}
!
$this->contacts->add_people_for_organzation($persons['insert'], $org_id,
PHPGW_SQL_RUN_SQL);
! $this->upgrade_comms($fields['edit_comms']['insert'],
! $fields['edit_comms']['delete'],
! $fields['edit_comms']['edit'],
! $fields['comm_data'], $org_id);
!
! $this->upgrade_others($fields['edit_others']['insert'],
! $fields['edit_others']['delete'],
! $fields['edit_others']['edit'],
!
$fields['tab_others']['other_value'], $org_id);
!
! $this->execute_queries($queries);
! }
!
! function upgrade_comms($add_comms=array(), $del_comms=array(),
$edit_comms=array(), $data=array(), $contact_id)
! {
! if(!is_array($add_comms))
! {
! $add_comms = array();
! }
! if(!is_array($del_comms))
! {
! $del_comms = array();
! }
! if(!is_array($edit_comms))
! {
! $edit_comms = array();
! }
!
! if(!is_array($data))
! {
! $data = array();
! }
!
! foreach($data as $key => $value)
! {
! if(array_key_exists($value['comm_description'],
$del_comms))
! {
!
$this->delete_specified_comm($value['key_comm_id'], PHPGW_SQL_RUN_SQL);
! }
!
! // if(array_key_exists($value['comm_description'],
$add_comms))
! // {
! // print
$this->add_communication_media($value, $value['contact_id'], PHPGW_SQL_RUN_SQL);
! // }
!
! if(array_key_exists($value['comm_description'],
$edit_comms))
! {
!
$this->edit_comms($value['key_comm_id'], $value, PHPGW_SQL_RUN_SQL);
! }
! }
!
! foreach($add_comms as $key => $value)
! {
! $fields = array('comm_descr' =>
$this->search_comm_descr($key),
! 'comm_data' => $value);
!
! $this->add_communication_media($fields,
$contact_id, PHPGW_SQL_RUN_SQL);
! }
! }
!
! function upgrade_others($add_others=array(),
$del_others=array(), $edit_others=array(), $data=array(), $contact_id)
! {
! if(!is_array($data))
! {
! $data = array();
! }
! if(!is_array($edit_others))
! {
! $edit_others = array();
! }
!
! foreach($data as $key => $value)
! {
! if(array_key_exists($key, $edit_others))
! {
! $this->edit_other($key,
! array('other_value'
=> $value),
! PHPGW_SQL_RUN_SQL);
! }
! }
!
}
***************
*** 405,408 ****
--- 498,522 ----
}
+ /**
+ * Search communication description in communucations
description catalog
+ *
+ * @param string $description The communication type to find
+ * @return integer The id of description
+ */
+ function search_comm_descr($description)
+ {
+ return $this->contacts->search_comm_descr($description);
+ }
+
+ /**
+ * Search location id in location catalog
+ *
+ * @param integer $id The location id to find
+ * @return string The description of id
+ */
+ function search_location_type_id($id)
+ {
+ return $this->contacts->search_location_type_id($id);
+ }
/**
***************
*** 461,482 ****
}
! function add_others($fields, $contact_id)
{
! return $this->contacts->add_others($fields,
$contact_id);
}
! function edit_other($contact_id, $fields)
{
! return $this->contacts->edit_other($contact_id,
$fields);
}
! function add_communication_media($fields, $contact_id)
{
! return
$this->contacts->add_communication_media($fields, $contact_id);
}
! function edit_comms($contact_id, $fields)
{
! return $this->contacts->edit_comms($contact_id,
$fields);
}
--- 575,596 ----
}
! function add_others($fields, $contact_id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->add_others($fields,
$contact_id, $action);
}
! function edit_other($contact_id, $fields,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->edit_other($contact_id,
$fields, $action);
}
! function add_communication_media($fields, $contact_id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return
$this->contacts->add_communication_media($fields, $contact_id, $action);
}
! function edit_comms($comm_id, $fields,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->edit_comms($comm_id, $fields,
$action);
}
***************
*** 496,502 ****
* @param integer|array $id Key of the comm media what you want
*/
! function delete_specified_comm($id)
{
! return $this->contacts->delete_specified_comm($id);
}
--- 610,616 ----
* @param integer|array $id Key of the comm media what you want
*/
! function delete_specified_comm($id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->delete_specified_comm($id,
$action);
}
***************
*** 506,512 ****
* @param integer|array $id Key of the address what you want
*/
! function delete_specified_location($id)
{
! return $this->contacts->delete_specified_location($id);
}
/**
--- 620,626 ----
* @param integer|array $id Key of the address what you want
*/
! function delete_specified_location($id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->delete_specified_location($id,
$action);
}
/**
***************
*** 515,521 ****
* @param integer|array $id Key of the other field what you want
*/
! function delete_specified_other($id)
{
! return $this->contacts->delete_specified_other($id);
}
--- 629,635 ----
* @param integer|array $id Key of the other field what you want
*/
! function delete_specified_other($id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->delete_specified_other($id,
$action);
}
***************
*** 525,531 ****
* @param integer|array $id Key of the note what you want
*/
! function delete_specified_note($id)
{
! return $this->contacts->delete_specified_note($id);
}
--- 639,645 ----
* @param integer|array $id Key of the note what you want
*/
! function delete_specified_note($id,
$action=PHPGW_SQL_RETURN_SQL)
{
! return $this->contacts->delete_specified_note($id,
$action);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] addressbook/inc class.boaddressbook.inc.php, 1.21.2.2.2.10, 1.21.2.2.2.11 class.soaddressbook.inc.php, 1.14.2.3.2.7, 1.14.2.3.2.8 class.uiaddressbook.inc.php, 1.36.2.15.2.18, 1.36.2.15.2.19,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] addressbook index.php,1.117.4.1,1.117.4.2
- Next by Date:
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.8, 1.17.2.2.2.9 class.sql_builder.inc.php, 1.1.2.4, 1.1.2.5
- Previous by thread:
[Phpgroupware-cvs] addressbook index.php,1.117.4.1,1.117.4.2
- Next by thread:
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.8, 1.17.2.2.2.9 class.sql_builder.inc.php, 1.1.2.4, 1.1.2.5
- Index(es):