projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-04-00-48-43
[civicrm-core.git]
/
api
/
v3
/
Relationship.php
diff --git
a/api/v3/Relationship.php
b/api/v3/Relationship.php
index 0e754690da2b052f46df95cec2c02624c9f4355e..e3ae1509ae5e7756a0768b41361e387a74803fa0 100644
(file)
--- a/
api/v3/Relationship.php
+++ b/
api/v3/Relationship.php
@@
-2,9
+2,9
@@
/*
+--------------------------------------------------------------------+
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.
3
|
+ | CiviCRM version 4.
5
|
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
3
|
+ | Copyright CiviCRM LLC (c) 2004-201
4
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-32,7
+32,7
@@
* @package CiviCRM_APIv3
* @subpackage API_Relationship
*
* @package CiviCRM_APIv3
* @subpackage API_Relationship
*
- * @copyright CiviCRM LLC (c) 2004-201
3
+ * @copyright CiviCRM LLC (c) 2004-201
4
* @version $Id: Relationship.php 30486 2010-11-02 16:12:09Z shot $
*
*/
* @version $Id: Relationship.php 30486 2010-11-02 16:12:09Z shot $
*
*/
@@
-56,7
+56,7
@@
function civicrm_api3_relationship_create($params) {
_civicrm_api3_relationship_format_params($params, $values);
$ids = array();
_civicrm_api3_relationship_format_params($params, $values);
$ids = array();
- if (
CRM_Utils_Array::value('id', $params
)) {
+ if (
!empty($params['id']
)) {
$ids['contactTarget'] = $values['contact_id_b'];
}
$ids['contactTarget'] = $values['contact_id_b'];
}
@@
-137,7
+137,11
@@
function civicrm_api3_relationship_delete($params) {
*/
function civicrm_api3_relationship_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
*/
function civicrm_api3_relationship_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
- if (!CRM_Utils_Array::value('contact_id', $params)) {
+
+ if (empty($params['contact_id'])) {
+ if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
+ CRM_Contact_BAO_Relationship::membershipTypeToRelationshipTypes($params);
+ }
$relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
}
else {
$relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
}
else {
@@
-182,7
+186,7
@@
function _civicrm_api3_relationship_format_params($params, &$values) {
_civicrm_api3_store_values($fields, $params, $values);
$relationTypes = CRM_Core_PseudoConstant::relationshipType('name');
_civicrm_api3_store_values($fields, $params, $values);
$relationTypes = CRM_Core_PseudoConstant::relationshipType('name');
- if (
CRM_Utils_Array::value('id', $params
)) {
+ if (
!empty($params['id']
)) {
$relation = new CRM_Contact_BAO_Relationship();
$relation->id = $params['id'];
if (!$relation->find(TRUE)) {
$relation = new CRM_Contact_BAO_Relationship();
$relation->id = $params['id'];
if (!$relation->find(TRUE)) {
@@
-240,7
+244,7
@@
function _civicrm_api3_relationship_format_params($params, &$values) {
}
if ($relationshipTypeId) {
}
if ($relationshipTypeId) {
- if (
CRM_Utils_Array::value('relationship_type_id', $values
) &&
+ if (
!empty($values['relationship_type_id']
) &&
$relationshipTypeId != $values['relationship_type_id']
) {
throw new Exception('Mismatched Relationship Type and Relationship Type Id');
$relationshipTypeId != $values['relationship_type_id']
) {
throw new Exception('Mismatched Relationship Type and Relationship Type Id');