[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.6
From: |
nomail |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc/class.contacts_sql.inc.php, 1.17.2.2.2.63 |
Date: |
Mon, 21 Jun 2004 09:49:45 +0200 |
Update of /phpgwapi/inc
Modified Files:
Branch: Version-0_9_16-branch
class.contacts_sql.inc.php
date: 2004/06/21 07:49:45; author: powerstat; state: Exp; lines: +476 -330
Log Message:
partly phpdoc update for contacts backend - still not finished.
=====================================================================
Index: phpgwapi/inc/class.contacts_sql.inc.php
diff -u phpgwapi/inc/class.contacts_sql.inc.php:1.17.2.2.2.62
phpgwapi/inc/class.contacts_sql.inc.php:1.17.2.2.2.63
--- phpgwapi/inc/class.contacts_sql.inc.php:1.17.2.2.2.62 Thu Jun 17
09:11:15 2004
+++ phpgwapi/inc/class.contacts_sql.inc.php Mon Jun 21 07:49:45 2004
@@ -32,7 +32,7 @@
* Contact Management System
*
* This class provides a contact database scheme.
- * It attempts to be based on the vcard 2.1 standard,
+ * It attempts to be based on the vcard 2.1 standard,
* with mods as needed to make for more reasonable sql storage.
* Note that changes here must also work in the LDAP version.
* @package phpgwapi
@@ -57,7 +57,6 @@
var $stock_contact_fields;
/**
- *
* This is an array of three elements that are arrays themselves.
*
* The purpose of the whole thing is to give us all the fields
we can manage.
@@ -67,9 +66,9 @@
* from the preferences page...etc.
* 2. contact_fields['retreivable'] the rest of the fields that
we generaly dont show in
* the addressbook ui.
- * 3. contact_fields['catalogs'] fields that belong to catalogs
and, as such, we never
+ * 3. contact_fields['catalogs'] fields that belong to catalogs
and, as such, we never
* show in raw form as they correspond to the database but we
need to query for them.
- * .
+ *
* All of the array data points to the english translation of
the field that should then
* be langed to get a label for the field
* @access private
@@ -79,16 +78,16 @@
array(
'per_full_name'
=> 'full name',
'per_first_name'
=> 'first name',
- 'per_last_name'
=> 'last name',
- 'per_middle_name'
=> 'middle name',
+ 'per_last_name'
=> 'last name',
+ 'per_middle_name'
=> 'middle name',
'per_initials'
=> 'initials',
'per_prefix'
=> 'prefix',
'per_suffix'
=> 'suffix',
'per_birthday'
=> 'birthday',
- 'per_pubkey'
=> 'public key',
- 'per_title'
=> 'title',
- 'per_department'
=> 'department',
- 'per_sound'
=> 'sound',
+ 'per_pubkey'
=> 'public key',
+ 'per_title'
=> 'title',
+ 'per_department'
=> 'department',
+ 'per_sound'
=> 'sound',
// 'per_name'
=> 'full name',
// 'sel_cat_id'
=> 'categories',
'org_name'
=> 'company name',
@@ -119,7 +118,7 @@
'adr_two_countryname'
=> 'home country',
'adr_two_type'
=> 'home address type',
'tz'
=> 'time zone',
- 'geo'
=> 'geo',
+ 'geo'
=> 'geo',
'fn'
=> 'full name',
'sound'
=> 'Sound',
'org_name'
=> 'company name',
@@ -155,18 +154,18 @@
'url'
=> 'url',
'pubkey'
=> 'public key',
'tel_work'
=> 'business phone',
-
+
//deprecated end
'addr_preferred'
=> 'preffered address',
'owner'
=> 'owner',
'access'
=> 'access',
'addr_pref_val'
=> 'preferred address value',
- 'other_name'
=> 'custom name',
+ 'other_name'
=> 'custom name',
'other_value'
=> 'custom value',
'other_owner'
=> 'custom owner',
'other_count_row'
=> 'custom number',
- 'org_creaton'
=> 'created on',
+ 'org_creaton'
=> 'created on',
'org_creatby'
=> 'created by',
'org_modon'
=> 'modified on',
'org_modby'
=> 'modified by',
@@ -176,10 +175,10 @@
- 'contact_id'
=> 'contact id',
+ 'contact_id'
=> 'contact id',
'cat_id'
=> 'category id',
'count_contacts'
=> 'number of contacts',
- 'org_id'
=> 'organization id',
+ 'org_id'
=> 'organization id',
'person_id'
=> 'person id',
'my_org_id'
=> 'private organization id',
'my_person_id'
=> 'private person id',
@@ -199,8 +198,8 @@
// 'account_id'
=> 'account id',
// 'account_person_id'
=> 'account person id',
'person_only'
=> 'only persons',
- 'per_active'
=> 'active person',
- 'per_creaton'
=> 'created on',
+ 'per_active'
=> 'active person',
+ 'per_creaton'
=> 'created on',
'per_creatby'
=> 'created by',
'per_modon'
=> 'modified on',
'per_modby'
=> 'modified by',
@@ -208,7 +207,7 @@
'key_cat_id'
=> 'category id'
-
+
),
'catalogs' =>
@@ -216,19 +215,19 @@
'comm_descr'
=> 'communication type description',
'comm_preferred'
=> 'communication type preferred',
'comm_data'
=> 'communication type data',
-
-
+
+
'contact_type_descr'
=> 'contact type description',
'contact_type_table'
=> 'contact type table',
-
+
'comm_description'
=> 'communication media description',
'comm_type'
=> 'communication media type',
'comm_find_descr'
=> 'find communication media description',
-
+
'comm_type_description'=> 'communication media type description',
'comm_active'
=> 'active communication media type',
'comm_class'
=> 'communication media class',
-
+
'addr_description'
=> 'address type description',
'comm_creaton'
=> 'created on',
'comm_creatby'
=> 'created by',
@@ -244,7 +243,7 @@
'note_type_id'
=> 'note type id',
'note_type'
=> 'note type',
'note_text'
=> 'note text',
-
+
'note_description'
=> 'note type description',
'key_note_id'
=> 'note id',
'note_contact_id'
=> 'note contact id',
@@ -259,6 +258,7 @@
)
);
/**
+ *
* @access private
*/
var $map = array('contact_id' =>
array('phpgwapi.contact_central', '0'),
@@ -388,7 +388,7 @@
'other_value' =>
array('phpgwapi.contact_others', '5'),
'other_owner' =>
array('phpgwapi.contact_others', '5'),
'other_count_row' =>
array('phpgwapi.contact_others', '5'),
- //deprecated start
+ //deprecated start
'label' =>
array('phpgwapi.contact_others', '5'),
'email_type' =>
array('phpgwapi.contact_others', '5'),
'email_home_type' =>
array('phpgwapi.contact_others', '5'),
@@ -452,16 +452,17 @@
'key_cat_id' =>
array('phpgwapi.contact_categories', '13'));
/**
+ *
* @access private
*/
- var $import_export_fields = array('contact_id',
+ var $import_export_fields = array('contact_id',
'access',
'owner',
'per_full_name',
'per_first_name',
'per_middle_name',
'org_name',
- 'people',
+ 'people',
'per_last_name',
'per_suffix',
'per_prefix',
@@ -497,6 +498,7 @@
'other_name');
/**
+ *
* @access private
*/
var $import_fields = array('contact_id' => 'contact id',
@@ -522,17 +524,15 @@
'postal_code'
=> 'Postal code',
'country'
=> 'Country',
'preferred' =>
'Preferred'));
-
+
//'parent_id' => array('categories_parent', '14'));
- /address@hidden
- * @access private
- */
/**
* Adresses fields array for mantain backward compatibility.
- *
+ *
* As soon as csv and vcard import/export, had been fixed, this
could be removed.
+ * @access private
* @deprecated Just for old add function.
*/
var $adr_old = array(array('adr_one_street',
@@ -547,8 +547,9 @@
'adr_two_countryname'));
/**
* Phone/Emails fields array for mantain backward compatibility.
- *
+ *
* As soon as csv and vcard import/export, had been fixed, this
could be removed.
+ * @access private
* @deprecated Just for old add function.
*/
var $comm_old = array('tel_work'=> array('Bussiness Phone',
'phone'),
@@ -567,6 +568,7 @@
'email_home' => array('Home', 'email'));
/**
* Describe the type of contact, this var know the type of
contact.
+ * @access private
*/
var $_contact_person;
var $_contact_org;
@@ -586,7 +588,7 @@
$this->read_sessiondata();
$this->save_sessiondata();
}
-
+
if
($GLOBALS['phpgw_info']['server']['contact_repository'] == 'ldap')
{
$this->LDAPSyncEnabled = true;
@@ -594,8 +596,10 @@
ldap_bind($this->LDAPResource,$GLOBALS['phpgw_info']['server']['ldap_contact_dn'],
$GLOBALS['phpgw_info']['server']['ldap_contact_pw']);
}
}
- /address@hidden/
- /address@hidden
+
+ /**
+ *
+ *
* @access private
*/
function read_sessiondata()
@@ -634,7 +638,7 @@
$this->addr_type =
$this->get_contact_addr_type();
$this->addr_type_flag = 'cache';
}
-
+
if ($data['note_type_flag']=='cache')
{
$this->note_type = $data['note_type'];
@@ -656,27 +660,31 @@
$this->contact_type =
$this->get_contact_types();
$this->contact_type_flag = 'cache';
}
- $this->_contact_person = 'Persons';
- $this->_contact_org = 'Organizations';
+ $this->_contact_person = 'Persons';
+ $this->_contact_org = 'Organizations';
}
+ /**
+ *
+ *
+ * @access private
+ */
function save_sessiondata()
{
$data = array(
- 'comm_descr'=> $this->comm_descr,
- 'comm_type' => $this->comm_type,
- 'addr_type' => $this->addr_type,
+ 'comm_descr'=> $this->comm_descr,
+ 'comm_type' => $this->comm_type,
+ 'addr_type' => $this->addr_type,
'note_type' => $this->note_type,
'contact_type' => $this->contact_type,
- 'comm_descr_flag'=> $this->comm_descr_flag,
- 'comm_type_flag' => $this->comm_type_flag,
- 'addr_type_flag' => $this->addr_type_flag,
+ 'comm_descr_flag'=> $this->comm_descr_flag,
+ 'comm_type_flag' => $this->comm_type_flag,
+ 'addr_type_flag' => $this->addr_type_flag,
'note_type_flag' => $this->note_type_flag,
'contact_type_flag' => $this->contact_type_flag
);
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi',$data);
}
- /address@hidden/
function delete_sessiondata($var='')
{
@@ -711,14 +719,16 @@
{
return $this->_contact_org;
}
-
+
/*************************************************************\
* Deprecated functions section *
\*************************************************************/
-
+
/* send this the id and whatever fields you want to see */
- /address@hidden
- * @deprecated
+ /**
+ *
+ *
+ * @deprecated
* @access private
*/
function read_single_entry($id,$fields='')
@@ -787,6 +797,10 @@
return $entry_data;
}
+ /**
+ * @deprecated
+ * @access private
+ */
function read_last_entry($fields='')
{
$last_contact = $this->get_max_contact();
@@ -794,7 +808,11 @@
return $person_data;
}
- /* send this the range, query, sort, order and whatever fields
you want to see */
+ /**
+ * Send this the range, query, sort, order and whatever fields
you want to see
+ * @deprecated
+ * @access private
+ */
function
read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='',
$lastmod=-1)
{
foreach($fields as $field)
@@ -834,7 +852,12 @@
return $return_fields;
}
- // Deprecated, this method is for old import only, I ask help
to code a new one
+ /**
+ *
+ *
+ * @deprecated This method is for old import only, I ask help to
code a new one
+ * @access private
+ */
function add($owner,$fields,$access='',$cat_id='',$tid='n')
{
foreach($fields as $field => $value)
@@ -874,6 +897,12 @@
$this->contact_import($fields);
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function field_exists($id,$field_name)
{
$this->request('other_count_row');
@@ -885,29 +914,47 @@
return $this->db->f(0);
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function
add_single_extra_field($id,$owner,$field_name,$field_value)
{
$this->other_fields =
CreateObject('phpgwapi.contact_others');
$this->other_fields->insert(array('other_contact_id' =>
$id, 'other_name' => $field_name, 'other_value' => $field_value));
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function delete_single_extra_field($id,$field_name)
{
$this->delete_others($cid);
return array();
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function
update($id,$owner,$fields,$access='',$cat_id='',$tid='n')
{
$this->update($fields);
$this->criteria('contact_id', $id);
$sql_update = $this->run_update();
-
+
foreach($sql_update as $update)
{
$this->db->query($update, __LINE__, __FILE__);
}
-
+
foreach($extra_fields as $name => $value)
{
if ($this->field_exists($id,$x_name))
@@ -919,7 +966,7 @@
else
{
$this->update_single_extra_field($id,$name);
- }
+ }
}
else
{
@@ -928,26 +975,33 @@
}
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function read_extra_fields($id)
{
echo "don't use this";
}
+ /**
+ *
+ *
+ * @deprecated
+ * @access private
+ */
function update_single_extra_field($id, $name, $value)
{
$other = CreateObject('phpgwapi.contact_others');
$criteria =
sql_criteria::token_and(sql_criteria::_equal('other_name', $name),
sql_criteria::_equal('contact_id', $id));
$other->update($id, array('other_value' => $value),
$criteria);
}
- /address@hidden/
- /*************************************************************\
- * Retrieve functions section *
- \*************************************************************/
/**
- * Retrieve all persons data which you specify, this can use
- * limit and order.
+ * Retrieve all persons data which you specify, this can use
limit and order.
*
* @param array $fields The fields that you can see from person
* @param integer $limit Limit of records that you want
@@ -958,7 +1012,7 @@
* @param mixed $criteria_token same like $criteria but
builded<br>with sql_criteria class, more powerfull
* @return array with records
*/
- function get_persons($fields, $limit='', $ofset='',
$orderby='', $sort='', $criteria='', $criteria_token='')
+ function get_persons($fields, $limit='', $ofset='',
$orderby='', $sort='', $criteria='', $criteria_token='')
{
$this->request($fields);
if(in_array('org_name', $fields))
@@ -1009,9 +1063,9 @@
/**
* Get all the `principal' information related for organization
*
- * @param integer|Array $contact_id id of the contact or array
of the same
+ * @param integer|array $contact_id id of the contact or array
of the same
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_principal_persons_data($contact_id,
$action=PHPGW_SQL_RUN_SQL, $get_org=True)
{
@@ -1021,8 +1075,8 @@
'cat_id',
'per_full_name',
'per_first_name',
- 'per_last_name',
- 'per_middle_name',
+ 'per_last_name',
+ 'per_middle_name',
'per_prefix',
'per_suffix',
'per_birthday',
@@ -1032,7 +1086,7 @@
'per_initials',
'per_sound');
$this->request($data);
- $this->criteria(array('contact_id' => $contact_id));
+ $this->criteria(array('contact_id' => $contact_id));
if($get_org==True)
{
$this->request(array('org_name', 'people'));
@@ -1045,8 +1099,9 @@
* Retrieve Data for Id, taking care that are person.
*
* @param mixed $person_id Organizations Id which want
information.
+ * @param string $criteria
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociat ive with id and all data that you
requested)
+ * @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)
{
@@ -1055,7 +1110,7 @@
'my_preferred',
'org_name',
'people');
-
+
$this->request($data);
$this->criteria(array('my_person_id' => $person_id));
if (!empty($criteria))
@@ -1064,9 +1119,9 @@
}
return $this->get_query($action, __LINE__, __FILE__);
}
+
/**
- * Retrieve all organizations data which you specify, this can
use
- * limit and order.
+ * Retrieve all organizations data which you specify, this can
use limit and order.
*
* @param array $fields The fields that you can see from person
* @param integer $limit Limit of records that you want
@@ -1103,14 +1158,14 @@
$this->criteria_token($criteria_token);
}
}
-
+
if($orderby)
{
$this->order(array($orderby), $sort);
}
-
+
$sql = $this->get_sql();
-
+
if ($limit)
{
$this->db->limit_query($sql, $ofset, __LINE__,
__FILE__, $limit);
@@ -1132,9 +1187,9 @@
/**
* Get all the `principal' information related for contacts
(when is/are person)
*
- * @param integer|Array $contact_id id of the contact or array
of the same
+ * @param integer|array $contact_id id of the contact or array
of the same
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_principal_organizations_data($contact_id,
$action=PHPGW_SQL_RUN_SQL)
{
@@ -1152,8 +1207,9 @@
* Retrieve Data for Id, taking care that are organizations.
*
* @param mixed $organizations_id Organizations Id which want
information.
+ * @param string $criteria
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and all data that we
requested)
+ * @return array (Asociative with id and all data that we
requested)
*/
function get_people_by_organizations($organizations_id,
$criteria='', $action=PHPGW_SQL_RUN_SQL)
{
@@ -1175,7 +1231,7 @@
* This parameter is an array and you can use it when you want
get
* information of especific comm_description (based in
descriptions
* from comm_description catalog).
- * @return Array (Asociative with id and all data that you
requested)
+ * @return array Asociative with id and all data that you
requested
*/
function get_comm_contact_data($contact_id,
$fields_to_search='')
{
@@ -1204,14 +1260,14 @@
return $comms;
}
-
+
/**
* Retrieve locations data for contact id.
*
* @param integer $contact_id Id which want information.
* @param array $criteria Others criterias what you want.
- * @return Array (Asociative with id and all data that you
requested)
+ * @return array Asociative with id and all data that you
requested
*/
function get_addr_contact_data($contact_id, $criteria='')
{
@@ -1247,7 +1303,8 @@
* Retrieve others data for contact id.
*
* @param integer $contact_id Id which want information.
- * @return Array (Asociative with id and all data that you
requested)
+ * @param string $criteria
+ * @return array Asociative with id and all data that you
requested
*/
function get_others_contact_data($contact_id, $criteria='')
{
@@ -1278,7 +1335,7 @@
* Get the records from contact type catalog
*
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_contact_types($action=PHPGW_SQL_RUN_SQL)
{
@@ -1291,7 +1348,7 @@
* Get the records from addr type catalog
*
* @param integer $action PHPGW_SQL_RETURN_SQL | RUN_SQL
depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_contact_addr_type($action=PHPGW_SQL_RUN_SQL)
{
@@ -1304,11 +1361,11 @@
* Get the records from comm type catalog
*
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_contact_comm_type($action=PHPGW_SQL_RUN_SQL)
{
- $fields = array('comm_type_id',
'comm_type_description', 'comm_active', 'comm_class');
+ $fields = array('comm_type_id',
'comm_type_description', 'comm_active', 'comm_class');
$this->request($fields);
return $this->get_query($action, __LINE__, __FILE__);
}
@@ -1317,7 +1374,7 @@
* Get the records from comm descr catalog
*
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
*/
function get_contact_comm_descr($action=PHPGW_SQL_RUN_SQL)
{
@@ -1330,7 +1387,7 @@
* Get the records from note descr catalog
*
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return mixed sql string or records with note_type_id and
not_description
+ * @return mixed SQL string or records with note_type_id and
not_description
*/
function get_contact_note_type($action=PHPGW_SQL_RUN_SQL)
{
@@ -1342,7 +1399,7 @@
/**
* Count the persons and return the number
*
- * @param string $criteria The criterias
+ * @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
*/
@@ -1356,11 +1413,11 @@
$count = $this->get_query($action, __LINE__, __FILE__);
return $count[0]['count_persons'];
}
-
+
/**
* Count the organizations and return the number
*
- * @param string $criteria The criterias
+ * @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
*/
@@ -1374,11 +1431,11 @@
$count = $this->get_query($action, __LINE__, __FILE__);
return $count[0]['count_orgs'];
}
-
+
/**
* Count the contacts and return the number
*
- * @param string $criteria The criterias
+ * @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
*/
@@ -1396,7 +1453,7 @@
/**
* Get the max contact_id
*
- * @param string $criteria The criterias
+ * @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
*/
@@ -1414,10 +1471,10 @@
/**
* Retrieve all the people that is owned by $owner (but I have
read access).
*
- * @param Integer $owner The account_id of the owner.
- * @param Array $data This is the information that want to
retrieve.
+ * @param integer $owner The account_id of the owner.
+ * @param array $data This is the information that want to
retrieve.
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and all data that we
requested)
+ * @return array Asociative with id and all data that we
requested
*/
function get_people_by_owner($owner, $data,
$action=PHPGW_SQL_RUN_SQL)
{
@@ -1431,7 +1488,8 @@
* Retrieve all the people that is part from specified category.
*
* @param integer $cat_id The cat_id of the owner.
- * @return array (Asociative with id and all data that we
requested)
+ * @param boolean $sub_cat
+ * @return array Asociative with id and all data that we
requested
*/
function get_persons_by_cat($cat_id, $sub_cat=True)
{
@@ -1439,7 +1497,7 @@
{
$cat_id = array_merge(array($cat_id),
$this->get_sub_cats($cat_id));
}
-
+
$this->request('person_id');
if(is_array($cat_id))
{
@@ -1449,9 +1507,9 @@
{
$this->criteria(array('cat_id' => $cat_id));
}
-
+
$sql = $this->get_sql();
-
+
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
{
@@ -1463,9 +1521,9 @@
/**
* Get all the contacts id, and data if it is dessired, from the
contacts that are users of phpGroupWare
*
- * @param Array $person_id Data that we want for each contact
that we retrieve.
+ * @param array $data Data that we want for each contact that we
retrieve.
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array Contacts that are users and his data.
+ * @return array Contacts that are users and his data.
*/
function get_system_contacts($data, $action=PHPGW_SQL_RUN_SQL)
{
@@ -1495,7 +1553,7 @@
*
* @param mixed $data List of fields what we want retrieve
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and all data that we
requested)
+ * @return array Asociative with id and all data that we
requested
*/
function get_private_contacts($data, $action=PHPGW_SQL_RUN_SQL)
{
@@ -1511,7 +1569,7 @@
*
* @param integer $contacts_id The contact id that will be used
for search his email.
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and email)
+ * @return array Asociative with id and email
*/
function get_email($contacts_id, $action=PHPGW_SQL_RUN_SQL)
{
@@ -1526,7 +1584,7 @@
*
* @param integer $contacts_id The contact id that will be used
for search his phone.
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and phone)
+ * @return array Asociative with id and phone
*/
function get_phone($contacts_id, $action=PHPGW_SQL_RUN_SQL)
{
@@ -1539,8 +1597,8 @@
/**
* Get all sub categories from cat_id
*
- * @param integer $cat_id The categori id to find
- * @return array with all sub categories
+ * @param integer $cat_id The category id to find
+ * @return array With all sub categories
* @access private
*/
function get_sub_cats($cat_id)
@@ -1548,24 +1606,25 @@
$sql = 'SELECT cat2.cat_id FROM phpgw_categories as cat
'
.'INNER JOIN phpgw_categories as cat2 ON
cat.cat_id=cat2.cat_parent '
.'WHERE '.sql::in('cat.cat_id', $cat_id);
-
+
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
{
$cats[] = $this->db->f('cat_id');
}
-
+
if(is_array($cats))
{
return array_merge($cats,
$this->get_sub_cats($cats));
}
}
- /* This function get all the Communication media from one
contact.
+ /**
+ * 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, ...)
+ * @return array Form: description => value, ...
*/
function get_all_comms($contact_id)
{
@@ -1583,20 +1642,21 @@
foreach ($records as $comm)
{
$descr =
$this->search_comm_descr_id($comm['comm_descr']);
- $comms[$descr] = $comm['comm_data'];
+ $comms[$descr] = $comm['comm_data'];
}
}
return $comms;
}
-
- /* This function get the contact name.
+
+ /**
+ * This function get the contact name.
*
* @param integer $contact_id id The contact what you want
- * return string The name of the contact
+ * @return string The name of the contact
*/
function get_contact_name($contact_id)
{
- $type =
$this->search_contact_type_id($this->get_type_contact($contact_id));
+ $type =
$this->search_contact_type_id($this->get_type_contact($contact_id));
if($type == $this->_contact_person)
{
$field_name = 'per_full_name';
@@ -1605,7 +1665,7 @@
{
$field_name = 'org_name';
}
-
+
$this->request(array($field_name));
$this->criteria(array('contact_id' => $contact_id));
$contact_name =
$this->get_records_by_field($field_name, __LINE__, __FILE__);
@@ -1621,15 +1681,19 @@
}
/**
+ *
+ *
+ * @param string $comm_type
+ * @param string $comm_description
* @access private
- */
+ */
function comms_fixed($comm_type, $comm_description)
{
// In this array add all the label that you have on an
import method, an make the
// association with the corresponding description on
database
if(!$this->hash_comms_import)
{
- $this->hash_comms_import =
+ $this->hash_comms_import =
array('email' => array('home'
=> 'home email',
'work' => 'work email',
'other' => 'other email'),
@@ -1652,10 +1716,10 @@
}
/**
- * explode a field name by `_' so parts of the field name have a
meaning, not only the whole name
- *
+ * Explode a field name by `_' so parts of the field name have a
meaning, not only the whole name
+ *
* @param string $field meta-field name, with form:
{kind}_{key_{real_field_name}
- * @param value $value to assing to field
+ * @param mixed $value to assing to field
* @param mixed &$field_list reference to the list that contain
$field
* @access private
*/
@@ -1705,12 +1769,13 @@
/**
* 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
+ * This function try to be a comprensive way to get data from
contacts
+ * convert the contacts database output on a multidimensional
array
+ * @param integer|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).
+ * @return array All the data of contact (contacts).
*/
function person_complete_data($contact_id, $optional_criteria =
'', $line=__LINE__, $file=__FILE__)
{
@@ -1795,10 +1860,7 @@
}
return $contact;
}
-
- /*************************************************************\
- * Search in catalogs functions section *
- \*************************************************************/
+
/**
* Search location id in location catalog
@@ -1810,7 +1872,7 @@
{
return $this->search_catalog('addr_type_id', $id,
'addr_description', 'addr_type');
}
-
+
/**
* Search location type in location catalog
*
@@ -1832,7 +1894,7 @@
{
return $this->search_catalog('note_type_id', $id,
'note_description', 'note_type');
}
-
+
/**
* Search location type in location catalog
*
@@ -1854,7 +1916,7 @@
{
return $this->search_catalog('comm_type_id', $id,
'comm_type_description', 'comm_type');
}
-
+
/**
* Search communication type in location catalog
*
@@ -1911,22 +1973,21 @@
return $this->search_catalog('contact_type_descr',
$description, 'contact_type_id', 'contact_type');
}
- /*************************************************************\
- * Edit contact section *
- \*************************************************************/
/**
* Allow edit information of an existent contact
- *
- * Allow edit many communications media, locations, categories
and others fields, that already exist for a given contact.
+ *
+ * Allow edit many communications media, locations, categories
and others fields,
+ * that already exist for a given contact.
* @param integer $cid Contact Id that want to be edited.
* @param array $principal Principal information for contact,
its depends on $type, but is according which each definition
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * @return
+ */
function edit_contact($cid, $principal,
$action=PHPGW_SQL_RETURN_SQL)
{
$contact = CreateObject('phpgwapi.contact_central');
- if (isset($principal['cat_id']))
+ if (isset($principal['cat_id']))
{
$principal['cat_id'] =
$this->get_categories($principal['cat_id']);
}
@@ -1939,10 +2000,11 @@
/**
* Allow edit information of an person
- *
+ *
* @param integer $id Person Id that want to be edited.
* @param array $data Principal information for person
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_person($id, $data, $action=PHPGW_SQL_RUN_SQL)
{
@@ -1960,10 +2022,11 @@
/**
* Allow edit information of an org
- *
+ *
* @param integer $id Org Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_org($id, $data, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -1986,6 +2049,7 @@
* @param integer $id Contact location Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_location($id, $data, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2007,6 +2071,7 @@
* @param integer $id Contact comm Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_comms($id, $data, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2028,6 +2093,7 @@
* @param integer $id Contact other Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_other($id, $data, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2037,9 +2103,11 @@
/**
* Allow edit communication information of an contact
+ *
* @param integer $id Contact Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_comms_by_contact($id, $data,
$action=PHPGW_SQL_RETURN_SQL)
{
@@ -2049,10 +2117,12 @@
/**
* Allow edit org-person relation of an contact
+ *
* @param integer $org_id Organization Id that want to be edited.
* @param integer $person_id Person Id that want to be edited.
* @param array $data Information for contact
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_org_person_relation($org_id='', $person_id='',
$data=array(), $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2076,8 +2146,10 @@
/**
* 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.
+ * @return
*/
function change_owner($old_owner='',$new_owner='')
{
@@ -2086,15 +2158,17 @@
return False;
}
$contact = CreateObject('phpgwapi.contact_central');
- return $contact->update(array('owner' => $new_owner),
-
sql_criteria::_equal('owner',sql::integer($old_owner)),
+ return $contact->update(array('owner' => $new_owner),
+
sql_criteria::_equal('owner',sql::integer($old_owner)),
PHPGW_SQL_RUN_SQL);
}
/**
* 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.
+ * @return
*/
function change_owner_others($old_owner='',$new_owner='')
{
@@ -2103,19 +2177,20 @@
return False;
}
$contact = CreateObject('phpgwapi.contact_others');
- return $contact->update(array('other_owner' =>
$new_owner),
-
sql_criteria::_equal('other_owner',sql::integer($old_owner)),
+ return $contact->update(array('other_owner' =>
$new_owner),
+
sql_criteria::_equal('other_owner',sql::integer($old_owner)),
PHPGW_SQL_RUN_SQL);
}
/**
- * Allow to edit the current other data for the owner,
- * you can modify other_name or other_value fields
+ * Allow to edit the current other data for the owner, you can
modify other_name or other_value fields
+ *
* @param integer $id the owner id
* @param string $new_data The new value which you want to
update.
* @param string $old_data The current value which you want to
update.
* @param string $field_data The field is can be other_name or
other_value
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
*/
function edit_other_by_owner($id, $new_data, $old_data,
$field_data, $action=PHPGW_SQL_RUN_SQL)
{
@@ -2127,8 +2202,10 @@
/**
* Allow to change the current cat_id by the new
+ *
* @param integer $cid The contact_id what you want to edit
* @param array $categories The new categories
+ * @return
*/
function edit_category($cid, $categories=array(),
$action=PHPGW_SQL_RETURN_SQL)
{
@@ -2137,9 +2214,6 @@
return $contact->update($principal,
sql_criteria::_equal('contact_id',sql::integer($cid)), $action);
}
- /*************************************************************\
- * Add contact section *
- \*************************************************************/
/**
* Add a contact and it's data
@@ -2152,8 +2226,8 @@
* @param array $categeries Catagories in which contact must be
added.
* @param array $others Others fields to be added.
* @param array $contact_relations the org_id or the person_id
for this person or organzation
- * @param array $notes Notes to be added.
- * @return Array With person_id, account_person_id and all data
of contacts that we wanted.
+ * @param array $notes Notes to be added.
+ * @return array With person_id, account_person_id and all data
of contacts that we wanted.
*/
function add_contact($type, $principal=array(), $comms=array(),
$locations=array(), $categories=array(), $others=array(),
$contact_relations=array(), $notes=array())
{
@@ -2196,7 +2270,7 @@
$this->unlock_table();
}
}
-
+
if(is_array($others))
{
foreach($others as $other)
@@ -2222,12 +2296,13 @@
}
/**
- * Add a org and it's data
- *
- * @param array $principal Principal information for org
- * @param integer $cid org id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a org and it's data
+ *
+ * @param array $principal Principal information for org
+ * @param integer $cid org id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_org($principal, $cid, $action=PHPGW_SQL_RETURN_SQL)
{
$this->org = CreateObject('phpgwapi.contact_org');
@@ -2247,12 +2322,13 @@
}
/**
- * Add a person and it's data
- *
- * @param array $principal Principal information for person
- * @param integer $cid person id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a person and it's data
+ *
+ * @param array $principal Principal information for person
+ * @param integer $cid person id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_person($principal, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
$this->person = CreateObject('phpgwapi.contact_person');
@@ -2273,12 +2349,13 @@
}
/**
- * Add a people for a organizations
- *
- * @param array $people People id which you want to insert
- * @param integer $cid Organization id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a people for a organizations
+ *
+ * @param array $people People id which you want to insert
+ * @param integer $cid Organization id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_people_for_organzation($people, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
if(!is_array($people))
@@ -2304,7 +2381,7 @@
{
$data['my_preferred'] = 'N';
}
-
+
if ($action == PHPGW_SQL_RUN_SQL)
{
$this->lock_table($this->relations->table);
@@ -2314,16 +2391,17 @@
}
return $sql;
}
-
+
/**
- * Add a organizations for a person
- *
- * @param array $oragnizations Organizations id which you want
to insert
- * @param integer $preferred_org Organization id from preferred
organization
- * @param integer $addr_id Address id from preferred
organization
- * @param integer $cid Person id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a organizations for a person
+ *
+ * @param array $oragnizations Organizations id which you want
to insert
+ * @param integer $preferred_org Organization id from preferred
organization
+ * @param integer $addr_id Address id from preferred organization
+ * @param integer $cid Person id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_orgs_for_person($organizations, $preferred_org,
$addr_id, $cid, $action=PHPGW_SQL_RETURN_SQL)
{
if(is_array($organizations))
@@ -2355,12 +2433,13 @@
}
/**
- * Add a locations for a contact
- *
- * @param array $location Locations information for contact
- * @param integer $cid contact id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a locations for a contact
+ *
+ * @param array $location Locations information for contact
+ * @param integer $cid contact id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_location($location, $cid,
$action=PHPGW_SQL_RETURN_SQL)
{
$addr = $this->has_preferred_location($cid);
@@ -2379,8 +2458,8 @@
}
$location['addr_creatby'] = $this->get_user_id();
$location['addr_modby'] = $this->get_user_id();
- $location['addr_creaton'] = $this->get_mkdate();
- $location['addr_modon'] = $this->get_mkdate();
+ $location['addr_creaton'] = $this->get_mkdate();
+ $location['addr_modon'] = $this->get_mkdate();
unset($location['key_addr_id']);
@@ -2388,14 +2467,15 @@
}
/**
- * Add a communications for a contact
- *
- * @param array $comm Communications information for contact
- * @param integer $cid contact id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a communications for a contact
+ *
+ * @param array $comm Communications information for contact
+ * @param integer $cid contact id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_communication_media($comm, $cid = '',
$action=PHPGW_SQL_RETURN_SQL)
- {
+ {
$this->comm = CreateObject('phpgwapi.contact_comm');
if ($action == PHPGW_SQL_RUN_SQL)
{
@@ -2404,8 +2484,8 @@
$comm['comm_creatby'] = $this->get_user_id();
$comm['comm_modby'] = $this->get_user_id();
- $comm['comm_creaton'] = $this->get_mkdate();
- $comm['comm_modon'] = $this->get_mkdate();
+ $comm['comm_creaton'] = $this->get_mkdate();
+ $comm['comm_modon'] = $this->get_mkdate();
unset($comm['key_comm_id']);
@@ -2413,12 +2493,13 @@
}
/**
- * Add a note for a contact
- *
- * @param array $note Note information for contact
- * @param integer $cid contact id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a note for a contact
+ *
+ * @param array $note Note information for contact
+ * @param integer $cid contact id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_note($note, $cid = '',
$action=PHPGW_SQL_RETURN_SQL)
{
$this->note = CreateObject('phpgwapi.contact_note');
@@ -2429,8 +2510,8 @@
$note['note_creatby'] = $this->get_user_id();
$note['note_modby'] = $this->get_user_id();
- $note['note_creaton'] = $this->get_mkdate();
- $note['note_modon'] = $this->get_mkdate();
+ $note['note_creaton'] = $this->get_mkdate();
+ $note['note_modon'] = $this->get_mkdate();
unset($comm['key_note_id']);
@@ -2438,12 +2519,13 @@
}
/**
- * Add a others for a contact
- *
- * @param array $others Others information for contact
- * @param integer $cid contact id
- * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- */
+ * Add a others for a contact
+ *
+ * @param array $others Others information for contact
+ * @param integer $cid contact id
+ * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
+ * @return
+ */
function add_others($others, $cid='',
$action=PHPGW_SQL_RETURN_SQL)
{
$this->others = CreateObject('phpgwapi.contact_others');
@@ -2457,15 +2539,14 @@
return
$this->_add($others,'others','other_contact_id',$cid, $action);
}
- /*************************************************************\
- * Delete contact section *
- \*************************************************************/
/**
* Delete all data of this contact_id
*
* @param mixed $cid The contact_id or any list of contacts_id
- * @param string $type Contact type
+ * @param string $contact_type Contact type
+ * @param boolean $transaction
+ * @return
*/
function delete($cid, $contact_type='', $transaction=True)
{
@@ -2474,7 +2555,7 @@
'location' =>
'delete_addressbook',
'contact_id' =>
$cid )
);
-
+
$negative_apps=false;
foreach($hook_response as $application => $response)
{
@@ -2534,8 +2615,9 @@
* Delete principal data of this contact_id
*
* @param mixed $cid The contact_id or any list of contacts_id
- * @param mixed $type Contact type
+ * @param mixed $contact_type Contact type
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_contact($cid, $contact_type='',
$action=PHPGW_SQL_RUN_SQL)
{
@@ -2583,6 +2665,7 @@
*
* @param mixed $cid The contact_id or any list of contacts_id
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_orgs_by_person($cid, $action=PHPGW_SQL_RUN_SQL)
{
@@ -2594,6 +2677,7 @@
*
* @param mixed $cid The contact_id or any list of contacts_id
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_people_by_org($cid, $action=PHPGW_SQL_RUN_SQL)
{
@@ -2603,8 +2687,10 @@
/**
* Delete relations between an org and their related person
*
- * @param mixed $cid The contact_id or any list of contacts_id
+ * @param mixed $org_id
+ * @param mixed $person_id
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_org_person_relation($org_id, $person_id,
$action=PHPGW_SQL_RUN_SQL)
{
@@ -2619,9 +2705,10 @@
/**
* Delete the address information of contact.
- *
+ *
* @param integer|array $cid contact_id or list of contact_ids
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_locations($cid, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2630,9 +2717,10 @@
/**
* Delete the communication media for this contact.
- *
+ *
* @param integer|array $cid contact_id or list of contact_ids
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_comms($cid, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2641,9 +2729,10 @@
/**
* Delete the others fields for this contact.
- *
+ *
* @param integer|array $cid contact_id or list of contact_ids
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_others($cid, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2652,9 +2741,10 @@
/**
* Delete the notes for this contact.
- *
- * @param integer|array $cid contact_id or list of contact_ids
+ *
+ * @param integer|array $cid Contact_id or list of contact_ids
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_notes($cid, $action=PHPGW_SQL_RETURN_SQL)
{
@@ -2663,9 +2753,10 @@
/**
* Delete the specified communication media.
- *
+ *
* @param integer|array $id Key of the comm media what you want
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_specified_comm($id,
$action=PHPGW_SQL_RETURN_SQL)
{
@@ -2674,19 +2765,22 @@
/**
* Delete the specified address.
- *
+ *
* @param integer|array $id Key of the address what you want
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_specified_location($id,
$action=PHPGW_SQL_RETURN_SQL)
{
return
$this->_delete(sql_criteria::_equal('key_addr_id',$id), $action);
}
+
/**
* Delete the specified others field.
- *
+ *
* @param integer|array $id Key of the other field what you want
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_specified_other($id,
$action=PHPGW_SQL_RETURN_SQL)
{
@@ -2695,16 +2789,22 @@
/**
* Delete the specified note.
- *
+ *
* @param integer|array $id Key of the note what you want
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL
+ * @return
*/
function delete_specified_note($id,
$action=PHPGW_SQL_RETURN_SQL)
{
return
$this->_delete(sql_criteria::_equal('key_note_id',$id), $action);
}
- /* This is for the admin script deleteaccount.php */
+ /**
+ *
+ *
+ * @param integer $owner
+ * @internal This is for the admin script deleteaccount.php
+ */
function delete_all($owner=0)
{
$owner = intval($owner);
@@ -2719,23 +2819,17 @@
}
}
}
- return;
}
- /*************************************************************\
- * Misc functions section *
- \*************************************************************/
- /address@hidden
- * @access private
- */
/**
* This function is the wrapper for getting queries or the sql
string
*
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
* @param integer $line where this function is called, usefull
for debug
* @param integer $file where this function is called, usefull
for debug
- * @return Array|string Array with records or string with sql
query
+ * @return array|string Array with records or string with sql
query
+ * @access private
*/
function get_query($action=PHPGW_SQL_RUN_SQL, $line=__LINE__,
$file=__FILE__)
{
@@ -2746,7 +2840,7 @@
return $this->get_records($line, $file);
break;
case PHPGW_SQL_RETURN_SQL:
- return $this->get_sql();
+ return $this->get_sql();
}
}
@@ -2755,9 +2849,9 @@
*
* @param integer $line where this function is called, usefull
for debug
* @param integer $file where this function is called, usefull
for debug
- * @return Recordset with all records in the database.
+ * @return array Recordset with all records in the database.
+ * @access private
*/
-
function get_records($line, $file)
{
$this->execute_query($this->get_sql(),$line,$file);
@@ -2767,7 +2861,12 @@
}
return $record;
}
-
+
+ /**
+ *
+ *
+ * @access private
+ */
function get_records_by_field($field, $line=__LINE__,
$file=__FILE__)
{
$this->execute_query($this->get_sql(),$line,$file);
@@ -2778,6 +2877,11 @@
return $record;
}
+ /**
+ *
+ *
+ * @access private
+ */
function execute_query($query, $line=__LINE__, $file=__FILE__)
{
if (is_null($this->db))
@@ -2787,6 +2891,11 @@
$this->db->query($query, $line, $file);
}
+ /**
+ *
+ *
+ * @access private
+ */
function execute_queries($queries=array())
{
if(is_array($queries))
@@ -2797,15 +2906,15 @@
}
}
}
- /address@hidden/
+
/**
* Retrieve all the locations of $contacts_id
*
* @param integer|array $contact_id The contact id that will be
used for search his data.
- * @param Array $data This is the information that want to
retrieve, according whith phpGroupware Address Specification.
+ * @param array $data This is the information that want to
retrieve, according whith phpGroupware Address Specification.
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and all data that we
requested)
+ * @return array Asociative with id and all data that we
requested
*/
function get_locations($contact_id, $data,
$action=PHPGW_SQL_RUN_SQL)
{
@@ -2828,9 +2937,9 @@
}
return $orgs;
}
-
+
function get_cats_by_person($person_id)
- {
+ {
$this->request('cat_id');
$this->criteria(array('contact_id' => $person_id));
$cats = $this->get_records_by_field('cat_id', __LINE__,
__FILE__);
@@ -2843,10 +2952,10 @@
{
$cats_array=array();
}
-
+
return $cats_array;
}
-
+
function get_cats_by_org($org_id)
{
$this->request('cat_id');
@@ -2893,22 +3002,25 @@
$this->criteria(array('addr_contact_id' =>
$contact_id));
return $this->get_query(PHPGW_SQL_RUN_SQL, __LINE__,
__FILE__);
}
-
- // Deprecated
+
+
/**
- * @deprecated
+ *
+ *
+ * @param $contacts_id
+ * @deprecated
*/
function get_phone_by_contact($contacts_id)
{
$this->get_phone($contacts_id);
}
- /*************************************************************\
- * Filters section *
- \*************************************************************/
/**
* Create a criteria with or and like operators for all the
fields
+ *
+ * @param array $fields
+ * @return
*/
function search_by_any($fields)
{
@@ -2936,9 +3048,12 @@
}
return sql_criteria::_append_or($elements);
}
-
+
/**
* Create a criteria with `and' and the corresponding operator
of each field.
+ *
+ * @param array $fields
+ * @return
*/
function search_by_all($fields)
{
@@ -2980,7 +3095,7 @@
*
* @param integer $owner The owner what you can find
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return mixed sql string or records with note_type_id and
not_description
+ * @return mixed SQL string or records with note_type_id and
not_description
*/
function get_contacts_by_owner($owner,$action=PHPGW_SQL_RUN_SQL)
{
@@ -2992,9 +3107,11 @@
/**
* Retrieve Data for categories given, taking care that are
person.
*
- * @param mixed $person_id Organizations Id which want
information.
+ * @param mixed $categories_id
+ * @param mixed $data
+ * @param mixed $contact_type
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array (Asociative with id and all data that we
requested)
+ * @return array Asociative with id and all data that we
requested
*/
function get_contact_by_categories($categories_id, $data,
$contact_type, $action=PHPGW_SQL_RUN_SQL)
{
@@ -3017,7 +3134,7 @@
* @param mixed $person_id Contacts Id which want his categories.
* @param mixed $data list of fields that we want retrieve
* @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
- * @return Array ?with what? FIXME
+ * @return array
* @access private
*/
function _get_categories($person_id, $data,
$action=PHPGW_SQL_RUN_SQL)
@@ -3032,12 +3149,12 @@
* Decide if contact is a user or not
*
* @param integer $contact_id Contact id which want to check.
- * @return Boolean TRUE if contact is a user.
+ * @return boolean|integer Account id or false
*/
function is_user($contact_id)
{
$account_id =
$GLOBALS['phpgw']->accounts->search_person($contact_id);
-
+
if($account_id == 0)
{
return FALSE;
@@ -3062,14 +3179,13 @@
return $account_id;
}
-
+
/**
* Decide if the person has preferred organization
*
* @param integer $person_id Person id which want to check.
- * @return Array|Boolean False if has't preferred org or
- * array with all id which has preferred org.
+ * @return array|boolean False if has't preferred org or array
with all id which has preferred org.
*/
function has_preferred_org($person_id)
{
@@ -3085,8 +3201,7 @@
* Decide if the contact has preferred location
*
* @param integer $contact_id Contact id which want to check.
- * @return Array|Boolean False if has't preferred org or
- * array with all id which has preferred org.
+ * @return Array|Boolean False if has't preferred org or array
with all id which has preferred org.
*/
function has_preferred_location($contact_id)
{
@@ -3097,12 +3212,12 @@
$locations = $this->get_records(__LINE__, __FILE__);
return $locations;
}
-
+
/**
* Decide if contact exist
*
* @param integer $contact_id Contact id which want to check.
- * @return Boolean TRUE if contact exist.
+ * @return boolean TRUE if contact exist false otherwise
*/
function exist_contact($contact_id)
{
@@ -3142,9 +3257,9 @@
* Decide if contacts are user or not, and retrieve its data.
*
* If account_person_id will be null for each person that is not
a user.
- * @param mixed $preson_id Person id which want to check.
- * @param Array $data the info that you want of this contact
- * @return Array With person_id, account_person_id and all data
of contacts that we wanted.
+ * @param mixed $person_id Person id which want to check.
+ * @param array $data the info that you want of this contact
+ * @return array With person_id, account_person_id and all data
of contacts that we wanted.
*/
function are_users($person_id, $data='')
{
@@ -3169,6 +3284,7 @@
* Get the orgs from one person
*
* @param integer $person_id Id of the contact type person
+ * @return
*/
function get_orgs_by_person($person_id)
{
@@ -3178,7 +3294,7 @@
/**
* Get the all contacts which are users of phpGroupWare
*
- * @return mixed sql string or records with note_type_id and
not_description
+ * @return mixed SQL string or records with note_type_id and
not_description
*/
function get_contacts_which_are_users()
{
@@ -3194,13 +3310,13 @@
function get_organization_properties()
{
$org = CreateObject('phpgwapi.contact_org');
- return $org->get_false_fields();
+ return $org->get_false_fields();
}
/**
* Get all persons of specified organization
*
- * @param integer $org_id id of the organization what you want
+ * @param integer $org_id ID of the organization what you want
* @return array Array with records
*/
function get_persons_by_org($org_id)
@@ -3236,26 +3352,29 @@
/**
* Retrieve the criteria for index addressbook implementation.
*
- * Could be used in others parts but thinks that it was
created<br />
- * with that propouse.
- * This looks for the categories and for the acl perms.
+ * Could be used in others parts but thinks that it was created
+ * with that propouse. This looks for the categories and for the
acl perms.
*
- * @param integer $owner this is the actual user of phpgroupware
+ * @param integer $owner This is the actual user of phpgroupware
*
- * @param mixed $access This is limit the search for private
only<br />
- * (with PHPGW_CONTACTS_PRIVATE), all my
contacts(PHPGW_CONTACTS_MINE)<br />
+ * @param mixed $access This is limit the search for private only
+ * (with PHPGW_CONTACTS_PRIVATE), all my
contacts(PHPGW_CONTACTS_MINE)
* or all the records I have access (PHPGW_CONTACTS_ALL).
*
- * @param integer $categories if have any value then limit the
result<br />
- * to contacts that belongs to this categories (and childs) <br
/>PHPGW_CONTACTS_CATEGORIES_ALL if want not use categories criterias.
+ * @param integer $categories if have any value then limit the
result
+ * to contacts that belongs to this categories (and childs)
+ * PHPGW_CONTACTS_CATEGORIES_ALL if want not use categories
criterias.
*
- * @param array $search_fields this is used in search, is the<br
/>
+ * @param array $search_fields This is used in search, is the<br
/>
* list of fields to search. Also this list is used to know if
we<br />
* need to set the criteria for search the prefered addresses
for contacts.
*
- * @param string $pattern Is the string that will be used to
search in<br />
- * all fields of $search_fields, set value to this param
without<br />
+ * @param string $pattern Is the string that will be used to
search in
+ * all fields of $search_fields, set value to this param without
* setting $search_field is useless.
+ *
+ * @param array $show_fields
+ * @return
*/
function criteria_for_index($owner, $access=PHPGW_CONTACTS_ALL,
$categories=PHPGW_CONTACTS_CATEGORIES_ALL, $search_fields=array(), $pattern='',
$show_fields=array())
{
@@ -3353,7 +3472,7 @@
{
if(count($search_fields) > 0 && $pattern)
{
- $index = array_search('per_full_name',
$search_fields);
+ $index = array_search('per_full_name',
$search_fields);
if($index!==False && $index!==Null)
{
unset($search_fields[$index]);
@@ -3381,14 +3500,14 @@
}
return $info;
}
-
+
function get_contacts_shared($owner_id,
$acl_type=PHPGW_ACL_READ)
{
$this->grants =
$GLOBALS['phpgw']->acl->get_grants('addressbook');
if($GLOBALS['phpgw']->acl->check('addressmaster', 7,
'addressbook'))
{
$required_grants[] =
$GLOBALS['phpgw_info']['server']['addressmaster'];
- }
+ }
foreach($this->grants as $owner => $perm)
{
if($this->check_perms($perm, $acl_type))
@@ -3406,10 +3525,11 @@
/**
* Check if the contact has a specified permission or if is
addressmaster
- *
+ *
* @param integer $contact_id The contact_id which you want to
find
* @param integer $needed The permission what you need
* @param integer $owner_id The owner_id of the contact
+ * @return boolean
*/
function check_acl($contact_id, $needed, $owner_id='')
{
@@ -3427,45 +3547,49 @@
return False;
}
}
-
+
/**
* Check if the contact has add permissions.
- *
+ *
* @param integer $contact_id The contact_id which you want to
check
* @param integer $owner_id The owner_id of the contact which
you want to check
+ * @return
*/
function check_add($contact_id, $owner_id='')
{
return $this->check_acl($contact_id, PHPGW_ACL_ADD,
$owner_id);
}
-
+
/**
* Check if the contact has edit permissions.
- *
+ *
* @param integer $contact_id The contact_id which you want to
check
* @param integer $owner_id The owner_id of the contact which
you want to check
+ * @return
*/
function check_edit($contact_id, $owner_id='')
{
return $this->check_acl($contact_id, PHPGW_ACL_EDIT,
$owner_id);
}
-
+
/**
* Check if the contact has read permissions.
- *
+ *
* @param integer $contact_id The contact_id which you want to
check
* @param integer $owner_id The owner_id of the contact which
you want to check
+ * @return
*/
function check_read($contact_id, $owner_id='')
{
return $this->check_acl($contact_id, PHPGW_ACL_READ,
$owner_id);
}
-
+
/**
* Check if the contact has delete permissions.
- *
+ *
* @param integer $contact_id The contact_id which you want to
check
* @param integer $owner_id The owner_id of the contact which
you want to check
+ * @return
*/
function check_delete($contact_id, $owner_id='')
{
@@ -3474,8 +3598,9 @@
/**
* Get the owner of the contact.
- *
+ *
* @param integer $contact_id The contact_id which you want to
find
+ * @return
*/
function get_contact_owner($contact_id)
{
@@ -3484,7 +3609,7 @@
$owner = $this->get_records(__LINE__, __FILE__);
return $owner[0]['owner'];
}
-
+
/**
* Copy all contact data to new contact
*
@@ -3498,11 +3623,11 @@
$copy_type = ($this->search_contact_type_id($type) ==
$this->_contact_person) ? 'persons' : 'organizations';
$get_data_type= 'get_principal_' . $copy_type . '_data';
-
+
$principal = $this->$get_data_type($contact_id);
unset($principal[0]['owner']);
unset($principal[0]['per_full_name']);
-
+
$cats = explode(",", $principal[0]['cat_id']);
foreach($cats as $cat)
{
@@ -3511,13 +3636,13 @@
$categories[] = $cat;
}
}
-
+
$comms = $this->get_comm_contact_data($contact_id);
$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);
-
+ $new_contact_id = $this->add_contact($type,
$principal[0], $comms, $locations, $categories, $others);
+
switch($copy_type)
{
case $this->tab_main_persons:
@@ -3553,7 +3678,7 @@
}
}
}
-
+
/**
* Copy all persons from org_id to new org_id
*
@@ -3582,6 +3707,14 @@
}
/**
+ *
+ *
+ * @param $data
+ * @param $object
+ * @param $key_field
+ * @param $cid
+ * @param $action
+ * @return
* @access private
*/
function _add($data, $object, $key_field, $cid = '',
$action=PHPGW_SQL_RETURN_SQL)
@@ -3605,6 +3738,7 @@
* Display the correct translation for the field
*
* @param string $field The field what you want
+ * @return
*/
function display_name($field)
{
@@ -3624,7 +3758,7 @@
/**
* Begin a Transaction to database.
- *
+ *
* Create de database if necesary
* @access private
*/
@@ -3643,6 +3777,7 @@
/**
* End actual Transaction
+ *
* @access private
*/
function transaction_end()
@@ -3660,15 +3795,17 @@
}
function lock_table($table, $action=PHPGW_SQL_RUN_SQL)
- {
+ {
if (!($this->locked[$table]) && $action ==
PHPGW_SQL_RUN_SQL)
- {
+ {
$this->db->lock($table);
$this->locked[$table] = TRUE;
}
}
/**
+ *
+ *
* @access private
*/
function unlock_table()
@@ -3683,6 +3820,11 @@
}
/**
+ *
+ *
+ * @param $fields
+ * @param $data_type
+ * @return array
* @access private
*/
function slice_old_fields($fields, $data_type)
@@ -3768,24 +3910,24 @@
'addr_pref_val'=>'Y'));
$addr_id = $this->get_query($action, __LINE__,
__FILE__);
return $addr_id[0]['key_addr_id'];
- }
+ }
function get_mkdate()
{
$date = mktime();
return $date;
}
-
+
function get_user_id()
{
return $GLOBALS['phpgw_info']['user']['account_id'];
}
-
+
function finalize_add($id)
{
$this->finalize_edit($id);
}
-
+
function finalize_edit($id)
{
if ($this->LDAPSyncEnabled)
@@ -3793,7 +3935,7 @@
$this->LDAPSync($id);
}
}
-
+
function finalize_delete($id)
{
if ($this->LDAPSyncEnabled)
@@ -3801,7 +3943,7 @@
$this->LDAPSyncDelete($id);
}
}
-
+
function LDAPSyncDelete($id)
{
$result = ldap_search($this->LDAPResource,
$GLOBALS['phpgw_info']['server']['ldap_contact_context'],
'employeeNumber='.$id, array('dn'));
@@ -3809,15 +3951,15 @@
if ((int)$count['count'] > 0)
{
ldap_delete($this->LDAPResource,$count[0]['dn']);
- }
+ }
}
-
+
function LDAPSync($id)
{
$this->LDAPSyncDelete($id);
$person = $this->get_principal_persons_data($id);
-
+
$time = gettimeofday();
//$uid =
time().$time['usec'].':'.$person[0]['per_full_name'];
$uid =
$person[0]['contact_id'].':'.$person[0]['per_full_name'];
@@ -3865,14 +4007,14 @@
if($address_pref[0]['addr_add1'] ||
$address_pref[0]['addr_add2'] || $address_pref[0]['addr_add3'])
{
- $attributes['street'][]
= utf8_encode($address_pref[0]['addr_add1'] .
-
$address_pref[0]['addr_add2'] .
+ $attributes['street'][]
= utf8_encode($address_pref[0]['addr_add1'] .
+
$address_pref[0]['addr_add2'] .
$address_pref[0]['addr_add3']);
- $attributes['postalAddress'][]
= utf8_encode($address_pref[0]['addr_add1'] .
-
$address_pref[0]['addr_add2'] .
+ $attributes['postalAddress'][]
= utf8_encode($address_pref[0]['addr_add1'] .
+
$address_pref[0]['addr_add2'] .
$address_pref[0]['addr_add3']);
}
-
+
if($address_pref[0]['addr_state'])
{
$attributes['st'][]
= utf8_encode($address_pref[0]['addr_state']);
@@ -3915,7 +4057,7 @@
$write =
$validator->is_email($comms[$i]['comm_data']);
break;
}
-
+
if($write)
{
if
($comms[$i]['comm_preferred'] == 'Y' && count($attributes[$key]) > 0)
@@ -3926,21 +4068,25 @@
{
$attributes[$key][] =
utf8_encode($comms[$i]['comm_data']);
}
- }
+ }
}
}
-
+
ldap_add($this->LDAPResource, $dn, $attributes);
//echo ldap_error($this->LDAPResource);
-
+
//ldap_close($this->LDAPResource);
//die('debug');
}
/**
* Method that could be used to import field, from an array with
the specified form.
- *
+ *
* This is the only one method that provide the fullfill fields
for contact.
- *
+ *
+ * @param $fields
+ * @param $type
+ * @param $update
+ * @return
*/
function contact_import($fields, $type = '', $update=false)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc/class.contacts_sql.inc.php, 1.17.2.2.2.63,
nomail <=