[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.4, 1.17.2.2.2.5 |
Date: |
Fri, 12 Sep 2003 19:33:16 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv2441
Modified Files:
Tag: Version-0_9_16-branch
class.contacts_sql.inc.php
Log Message:
jarg told me to commit this ... apparently it fixes a lot
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.4
retrieving revision 1.17.2.2.2.5
diff -C2 -r1.17.2.2.2.4 -r1.17.2.2.2.5
*** class.contacts_sql.inc.php 10 Sep 2003 23:58:01 -0000 1.17.2.2.2.4
--- class.contacts_sql.inc.php 12 Sep 2003 23:33:14 -0000 1.17.2.2.2.5
***************
*** 797,808 ****
* @return Array (Asociat ive with id and all data that you
requested)
*/
! function get_organizations_by_person($person_id, $data,
$action=PHPGW_SQL_RUN_SQL)
{
! $this->request('contact_id');
$this->request($data);
$this->criteria(array('my_person_id' => $person_id));
return $this->get_query($action, __LINE__, __FILE__);
}
-
/**
* Retrieve all organizations data which you specify, this can
use
--- 797,811 ----
* @return Array (Asociat ive with id and all data that you
requested)
*/
! function get_organizations_by_person($person_id, $criteria ='',
$action=PHPGW_SQL_RUN_SQL)
{
! $data = array('my_org_id',
! 'my_addr_id',
! 'my_preferred');
!
$this->request($data);
$this->criteria(array('my_person_id' => $person_id));
+ $this->criteria($criteria);
return $this->get_query($action, __LINE__, __FILE__);
}
/**
* Retrieve all organizations data which you specify, this can
use
***************
*** 831,835 ****
}
! $sql = $this->get_sql();
if ($limit)
--- 834,838 ----
}
! $sql = $this->get_sql();
if ($limit)
***************
*** 876,884 ****
* @return Array (Asociative with id and all data that we
requested)
*/
! function get_people_by_organizations($organizations_id, $data,
$action=PHPGW_SQL_RUN_SQL)
{
! $this->request('contact_id');
$this->request($data);
$this->criteria(array('my_org_id' =>
$organizations_id));
return $this->get_query($action, __LINE__, __FILE__);
}
--- 879,890 ----
* @return Array (Asociative with id and all data that we
requested)
*/
! function get_people_by_organizations($organizations_id,
$criteria='', $action=PHPGW_SQL_RUN_SQL)
{
! $data = array('my_person_id',
! 'my_addr_id',
! 'my_preferred');
$this->request($data);
$this->criteria(array('my_org_id' =>
$organizations_id));
+ $this->criteria($criteria);
return $this->get_query($action, __LINE__, __FILE__);
}
***************
*** 966,970 ****
* @return Array (Asociative with id and all data that you
requested)
*/
! function get_others_contact_data($contact_id)
{
$others = array();
--- 972,976 ----
* @return Array (Asociative with id and all data that you
requested)
*/
! function get_others_contact_data($contact_id, $criteria='')
{
$others = array();
***************
*** 976,979 ****
--- 982,989 ----
$this->request($data);
$this->criteria(array('other_contact_id' =>
$contact_id));
+ if($criteria!='')
+ {
+ $this->criteria($criteria);
+ }
$entry = $this->get_records(__LINE__, __FILE__);
if($entry)
***************
*** 1542,1554 ****
function add_people_for_organzation($people, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
! foreach($people as $person)
{
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
! $this->lock_table($this->relations->table);
! $data['my_person_id'] = $person;
! $data['my_creaton'] = 1;
! $data['my_creatby'] = 1;
! $sql[] = $this->_add($data,'relations',
'my_org_id', $cid, $action);
! $this->unlock_table();
}
return $sql;
--- 1552,1567 ----
function add_people_for_organzation($people, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
! if(is_array($people))
{
! foreach($people as $person)
! {
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
!
$this->lock_table($this->relations->table);
! $data['my_person_id'] = $person;
! $data['my_creaton'] = 1;
! $data['my_creatby'] = 1;
! $sql[] = $this->_add($data,'relations',
'my_org_id', $cid, $action);
! $this->unlock_table();
! }
}
return $sql;
***************
*** 1566,1587 ****
function add_orgs_for_person($organizations, $preferred_org,
$addr_id, $cid, $action=PHPGW_SQL_RETURN_SQL)
{
! foreach($organizations as $org)
{
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
! $this->lock_table($this->relations->table);
! $data['my_org_id'] = $org;
! $data['my_addr_id'] = $addr_id;
! if ($preferred_org == $org)
{
! $data['my_preferred'] = 'Y';
}
- else
- {
- $data['my_preferred'] = 'N';
- }
- $data['my_creaton'] = 1;
- $data['my_creatby'] = 1;
- $sql[] = $this->_add($data,'relations',
'my_person_id', $cid, $action);
- $this->unlock_table();
}
return $sql;
--- 1579,1603 ----
function add_orgs_for_person($organizations, $preferred_org,
$addr_id, $cid, $action=PHPGW_SQL_RETURN_SQL)
{
! if(is_array($organizations))
{
! foreach($organizations as $org)
{
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
!
$this->lock_table($this->relations->table);
! $data['my_org_id'] = $org;
! $data['my_addr_id'] = $addr_id;
! if ($preferred_org == $org)
! {
! $data['my_preferred'] = 'Y';
! }
! else
! {
! $data['my_preferred'] = 'N';
! }
! $data['my_creaton'] = 1;
! $data['my_creatby'] = 1;
! $sql[] = $this->_add($data,'relations',
'my_person_id', $cid, $action);
! $this->unlock_table();
}
}
return $sql;
***************
*** 2036,2039 ****
--- 2052,2061 ----
}
+ /**
+ * Decide if contact exist
+ *
+ * @param integer $contact_id Contact id which want to check.
+ * @return Boolean TRUE if contact exist.
+ */
function exist_contact($contact_id)
{
***************
*** 2130,2133 ****
--- 2152,2164 ----
}
+ /**
+ * Search a value into an array
+ *
+ * @param string $field_to_search Field into what you want to
find
+ * @param string $value_to_search Value what you want
+ * @param string $field Field what you want return
+ * @param string $catalog Catalog name into you want to find
+ * @return string The value which you requiere in $field
+ */
function search_catalog($field_to_search, $value_to_search,
$field, $catalog)
{
***************
*** 2141,2148 ****
}
function copy_contact($contact_id, $type='')
{
$type = ($type)? $type :
$this->get_type_contact($contact_id);
! $get_data_type= 'get_principal_' .
$this->search_contact_type_id($type) . '_data';
$principal = $this->$get_data_type($contact_id);
--- 2172,2188 ----
}
+ /**
+ * Copy all contact data to new contact
+ *
+ * @param integer $contact_id Id of the contact what you want to
copy
+ * @param integer $type Type Id of the contact what you want to
copy
+ * @return integer Id of the new contact
+ */
function copy_contact($contact_id, $type='')
{
$type = ($type)? $type :
$this->get_type_contact($contact_id);
! $copy_type = $this->search_contact_type_id($type);
!
! $get_data_type= 'get_principal_' . $copy_type . '_data';
$principal = $this->$get_data_type($contact_id);
***************
*** 2151,2157 ****
$locations = $this->get_addr_contact_data($contact_id);
$others = $this->get_others_contact_data($contact_id);
! $contact_id = $this->add_contact($type, $principal[0],
$comms, $locations, $categories, $others);
! return $contact_id;
}
--- 2191,2254 ----
$locations = $this->get_addr_contact_data($contact_id);
$others = $this->get_others_contact_data($contact_id);
+
+ $new_contact_id = $this->add_contact($type,
$principal[0], $comms, $locations, $categories, $others);
! switch($copy_type)
! {
! case $this->tab_main_persons:
!
$this->copy_organizations_by_person($contact_id, $new_contact_id);
! break;
! case $this->tab_main_organizations:
!
$this->copy_people_by_organizations($contact_id, $new_contact_id);
! break;
! }
!
! return $new_contact_id;
! }
!
! /**
! * Copy all organizatons from person_id to new person_id
! *
! * @param integer $person_id Id of the person what you want to
copy
! * @param integer $new_person_id Id of the new person
! */
! function copy_organizations_by_person($person_id,
$new_person_id)
! {
! $records =
$this->get_organizations_by_person($person_id);
! if(is_array($records))
! {
! foreach($records as $data)
! {
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
!
$this->lock_table($this->relations->table);
! $data['my_creaton'] = 1;
! $data['my_creatby'] = 1;
! $sql[] = $this->_add($data,
'relations', 'my_person_id', $new_person_id, PHPGW_SQL_RUN_SQL);
! $this->unlock_table();
! }
! }
! }
!
! /**
! * Copy all persons from org_id to new org_id
! *
! * @param integer $organization_id Id of the organization what
you want to copy
! * @param integer $new_organization_id Id of the new organization
! */
! function copy_people_by_organizations($organization_id,
$new_organization_id)
! {
! $records =
$this->get_people_by_organizations($organization_id);
! if(is_array($records))
! {
! foreach($records as $data)
! {
! $this->relations =
CreateObject('phpgwapi.contact_org_person');
!
$this->lock_table($this->relations->table);
! $data['my_creaton'] = 1;
! $data['my_creatby'] = 1;
! $sql[] = $this->_add($data,'relations',
'my_org_id', $new_organization_id, PHPGW_SQL_RUN_SQL);
! $this->unlock_table();
! }
! }
}
***************
*** 2173,2176 ****
--- 2270,2278 ----
}
+ /**
+ * Display the correct translation for the field
+ *
+ * @param string $field The field what you want
+ */
function display_name($field)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.4, 1.17.2.2.2.5,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: addressbook/inc class.uiaddressbook.inc.php, 1.36.2.15.2.14, 1.36.2.15.2.15 class.soaddressbook.inc.php, 1.14.2.3.2.3, 1.14.2.3.2.4 class.boaddressbook.inc.php, 1.21.2.2.2.5, 1.21.2.2.2.6
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_sql.inc.php, 1.80.2.8.2.12, 1.80.2.8.2.13
- Previous by thread:
[Phpgroupware-cvs] CVS: addressbook/inc class.uiaddressbook.inc.php, 1.36.2.15.2.14, 1.36.2.15.2.15 class.soaddressbook.inc.php, 1.14.2.3.2.3, 1.14.2.3.2.4 class.boaddressbook.inc.php, 1.21.2.2.2.5, 1.21.2.2.2.6
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_sql.inc.php, 1.80.2.8.2.12, 1.80.2.8.2.13
- Index(es):