Skip to content

Commit

Permalink
Merge pull request #22397 from eileenmcnaughton/silly
Browse files Browse the repository at this point in the history
Remove unnecessary pass-by-ref
  • Loading branch information
eileenmcnaughton authored Jan 7, 2022
2 parents cfcffe7 + 22b28b5 commit 8b4476e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions CRM/Contact/BAO/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ public static function checkValidRelationship($params, $ids, $contactId) {
* This function checks for duplicate relationship.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* An assoc array of name/value pairs.
* @param int $id
* This the id of the contact whom we are adding relationship.
* @param int $contactId
Expand All @@ -920,7 +920,7 @@ public static function checkValidRelationship($params, $ids, $contactId) {
* @return bool
* true if record exists else false
*/
public static function checkDuplicateRelationship(&$params, $id, $contactId = 0, $relationshipId = 0) {
public static function checkDuplicateRelationship($params, $id, $contactId = 0, $relationshipId = 0) {
$relationshipTypeId = $params['relationship_type_id'] ?? NULL;
list($type) = explode('_', $relationshipTypeId);

Expand Down Expand Up @@ -964,18 +964,18 @@ public static function checkDuplicateRelationship(&$params, $id, $contactId = 0,
}

$queryString .=
" AND ( ( contact_id_a = " . CRM_Utils_Type::escape($id, 'Integer') .
" AND contact_id_b = " . CRM_Utils_Type::escape($contactId, 'Integer') .
" ) OR ( contact_id_a = " . CRM_Utils_Type::escape($contactId, 'Integer') .
" AND contact_id_b = " . CRM_Utils_Type::escape($id, 'Integer') . " ) ) ";
' AND ( ( contact_id_a = ' . CRM_Utils_Type::escape($id, 'Integer') .
' AND contact_id_b = ' . CRM_Utils_Type::escape($contactId, 'Integer') .
' ) OR ( contact_id_a = ' . CRM_Utils_Type::escape($contactId, 'Integer') .
' AND contact_id_b = ' . CRM_Utils_Type::escape($id, 'Integer') . " ) ) ";

//if caseId is provided, include it duplicate checking.
if ($caseId = CRM_Utils_Array::value('case_id', $params)) {
$queryString .= " AND case_id = " . CRM_Utils_Type::escape($caseId, 'Integer');
$queryString .= ' AND case_id = ' . CRM_Utils_Type::escape($caseId, 'Integer');
}

if ($relationshipId) {
$queryString .= " AND id !=" . CRM_Utils_Type::escape($relationshipId, 'Integer');
$queryString .= ' AND id !=' . CRM_Utils_Type::escape($relationshipId, 'Integer');
}

$relationship = CRM_Core_DAO::executeQuery($queryString);
Expand Down

0 comments on commit 8b4476e

Please sign in to comment.