[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.1
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.19, 1.17.2.2.2.20 |
Date: |
Sat, 11 Oct 2003 08:22:57 +0000 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv8153
Modified Files:
Tag: Version-0_9_16-branch
class.contacts_sql.inc.php
Log Message:
bug fix #5835 from jarg
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.19
retrieving revision 1.17.2.2.2.20
diff -C2 -d -r1.17.2.2.2.19 -r1.17.2.2.2.20
*** class.contacts_sql.inc.php 9 Oct 2003 00:25:20 -0000 1.17.2.2.2.19
--- class.contacts_sql.inc.php 11 Oct 2003 08:22:54 -0000 1.17.2.2.2.20
***************
*** 899,909 ****
* @return Array|string Array with records or string with sql
query
*/
! function get_principal_persons_data($contact_id,
$action=PHPGW_SQL_RUN_SQL)
{
! $data = array('contact_id',
! 'owner',
! 'access',
! 'cat_id',
! 'per_first_name',
'per_last_name',
'per_middle_name',
--- 899,909 ----
* @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)
{
! $data = array('contact_id',
! 'owner',
! 'access',
! 'cat_id',
! 'per_first_name',
'per_last_name',
'per_middle_name',
***************
*** 915,923 ****
'per_department',
'per_initials',
! 'per_sound',
! 'org_name',
! 'people');
$this->request($data);
! $this->criteria(array('contact_id' => $contact_id,
'my_preferred' => 'Y'));
return $this->get_query($action, __LINE__, __FILE__);
}
--- 915,927 ----
'per_department',
'per_initials',
! 'per_sound');
$this->request($data);
! $this->criteria(array('contact_id' => $contact_id));
!
! if($get_org==True)
! {
! $this->request(array('org_name', 'people'));
! $this->criteria(array('my_preferred' => 'Y'));
! }
return $this->get_query($action, __LINE__, __FILE__);
}
***************
*** 958,962 ****
$this->request($fields);
$person_fields = array('per_full_name',
'per_first_name', 'per_last_name');
! if(array_intersect($person_fields, $fields) > 0)
{
$this->request(array('organizations'));
--- 962,966 ----
$this->request($fields);
$person_fields = array('per_full_name',
'per_first_name', 'per_last_name');
! if(count(array_intersect($person_fields, $fields)) > 0)
{
$this->request(array('organizations'));
***************
*** 1601,1604 ****
--- 1605,1635 ----
return $comm->update($data,
sql_criteria::_equal('contact_id',sql::integer($id)), $action);
}
+
+ /**
+ * 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
+ */
+ function edit_org_person_relation($org_id='', $person_id='',
$data=array(), $action=PHPGW_SQL_RETURN_SQL)
+ {
+ $relation = CreateObject('phpgwapi.contact_org_person');
+ if($org_id && $person_id)
+ {
+ $criteria =
sql_criteria::and_(sql_criteria::equal('org_id',sql::integer($org_id)),
+
sql_criteria::equal('person_id',sql::integer($person_id)));
+ }
+ elseif($org_id)
+ {
+ $criteria =
sql_criteria::equal('org_id',sql::integer($org_id));
+ }
+ elseif($person_id)
+ {
+ $criteria =
sql_criteria::equal('person_id',sql::integer($person_id));
+ }
+
+ return $relation->update($data, $criteria, $action);
+ }
/*************************************************************\
***************
*** 1746,1749 ****
--- 1777,1791 ----
$data['my_creaton'] = $this->get_mkdate();
$data['my_creatby'] = $this->get_user_id();
+ $orgs = $this->has_preferred_org($person);
+ if(count($orgs[0]) == 0)
+ {
+ $data['my_preferred'] = 'Y';
+ }
+ else
+ {
+ $data['my_preferred'] = 'N';
+ }
+
+
$sql[] = $this->_add($data,'relations',
'my_org_id', $cid, $action);
$this->unlock_table();
***************
*** 1751,1755 ****
return $sql;
}
!
/**
* Add a organizations for a person
--- 1793,1797 ----
return $sql;
}
!
/**
* Add a organizations for a person
***************
*** 2388,2391 ****
--- 2430,2450 ----
/**
+ * 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.
+ */
+ function has_preferred_org($person_id)
+ {
+ $this->request('my_person_id');
+ $this->request('my_org_id');
+ $this->criteria(array('my_person_id' => $person_id,
+ 'my_preferred' => 'Y'));
+ $persons = $this->get_records(__LINE__, __FILE__);
+ return $persons;
+ }
+
+ /**
* Decide if contact exist
*
***************
*** 2897,2901 ****
*
* @param integer $org_id The organization id which want to
check.
! * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
* @return integer The addr_id.
*/
--- 2956,2960 ----
*
* @param integer $org_id The organization id which want to
check.
! * @param integer $action PHPGW_SQL_RETURN_SQL |
PHPGW_SQL_RUN_SQL depending what we want
* @return integer The addr_id.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.19, 1.17.2.2.2.20,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] property/inc class.boadmin_entity.inc.php, NONE, 1.1 class.soadmin_entity.inc.php, NONE, 1.1 class.uiadmin_entity.inc.php, NONE, 1.1 class.uiworkorder.inc.php, 1.45, 1.46 class.uiproject.inc.php, 1.51, 1.52 class.bocommon.inc.php, 1.83, 1.84 hook_settings.inc.php, 1.14, 1.15 class.uilocation.inc.php, 1.31, 1.32 class.bostandard_entity.inc.php, 1.12, 1.13 class.soreport.inc.php, 1.12, 1.13 class.soproject.inc.php, 1.40, 1.41 class.soworkorder.inc.php, 1.29, 1.30 class.boworkorder.inc.php, 1.17, 1.18 class.boproject.inc.php, 1.17, 1.18 class.uitts.inc.php, 1.38, 1.39 class.botts.inc.php, 1.20, 1.21 class.sotts.inc.php, 1.27, 1.28 hook_admin.inc.php, 1.42, 1.43 class.boadmin_location.inc.php, 1.5, 1.6 class.soadmin_location.inc.php, 1.18, 1.19 class.bowo_hour.inc.php, 1.10, 1.11
- Next by Date:
[Phpgroupware-cvs] addressbook/inc class.uiaddressbook.inc.php, 1.36.2.15.2.23, 1.36.2.15.2.24 class.soaddressbook.inc.php, 1.14.2.3.2.13, 1.14.2.3.2.14 class.boaddressbook.inc.php, 1.21.2.2.2.14, 1.21.2.2.2.15
- Previous by thread:
[Phpgroupware-cvs] property/inc class.boadmin_entity.inc.php, NONE, 1.1 class.soadmin_entity.inc.php, NONE, 1.1 class.uiadmin_entity.inc.php, NONE, 1.1 class.uiworkorder.inc.php, 1.45, 1.46 class.uiproject.inc.php, 1.51, 1.52 class.bocommon.inc.php, 1.83, 1.84 hook_settings.inc.php, 1.14, 1.15 class.uilocation.inc.php, 1.31, 1.32 class.bostandard_entity.inc.php, 1.12, 1.13 class.soreport.inc.php, 1.12, 1.13 class.soproject.inc.php, 1.40, 1.41 class.soworkorder.inc.php, 1.29, 1.30 class.boworkorder.inc.php, 1.17, 1.18 class.boproject.inc.php, 1.17, 1.18 class.uitts.inc.php, 1.38, 1.39 class.botts.inc.php, 1.20, 1.21 class.sotts.inc.php, 1.27, 1.28 hook_admin.inc.php, 1.42, 1.43 class.boadmin_location.inc.php, 1.5, 1.6 class.soadmin_location.inc.php, 1.18, 1.19 class.bowo_hour.inc.php, 1.10, 1.11
- Next by thread:
[Phpgroupware-cvs] addressbook/inc class.uiaddressbook.inc.php, 1.36.2.15.2.23, 1.36.2.15.2.24 class.soaddressbook.inc.php, 1.14.2.3.2.13, 1.14.2.3.2.14 class.boaddressbook.inc.php, 1.21.2.2.2.14, 1.21.2.2.2.15
- Index(es):