$relationship->free();
- CRM_Utils_Hook::post($hook, 'Relationship', $relationshipId, $relationship);
+ CRM_Utils_Hook::post($hook, 'Relationship', $relationship->id, $relationship);
return $relationship;
}
) &&
(!$contactSubType ||
(in_array($value['contact_sub_type_a'], $contactSubType) ||
+ in_array($value['contact_sub_type_b'], $contactSubType) ||
((!$value['contact_sub_type_b'] &&
!$value['contact_sub_type_a']
) &&
) &&
(!$contactSubType ||
(in_array($value['contact_sub_type_b'], $contactSubType) ||
+ in_array($value['contact_sub_type_a'], $contactSubType) ||
((!$value['contact_sub_type_a'] &&
!$value['contact_sub_type_b']
) &&
return $relationshipType;
}
+ /**
+ * @param $id
+ * @param $action
+ *
+ * @return CRM_Contact_DAO_Relationship
+ */
static function clearCurrentEmployer($id, $action) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;
$relationship->delete();
CRM_Core_Session::setStatus(ts('Selected relationship has been deleted successfully.'), ts('Record Deleted'), 'success');
- CRM_Utils_Hook::post('delete', 'Relationship', $relationship->id, $relationship);
+ CRM_Utils_Hook::post('delete', 'Relationship', $id, $relationship);
// delete the recently created Relationship
$relationshipRecent = array(
*
* @param int $id relationship id
*
+ * @param $action
+ *
* @return null
* @access public
-
* @static
*/
static function disableEnableRelationship($id, $action) {
/**
* this function does the validtion for valid relationship
*
- * @param array $params this array contains the values there are subitted by the form
- * @param array $ids the array that holds all the db ids
- * @param integer $contactId this is contact id for adding relationship
+ * @param array $params this array contains the values there are subitted by the form
+ * @param array $ids the array that holds all the db ids
+ * @param integer $contactId this is contact id for adding relationship
*
- * @return
- * @access public
+ * @return string
+ @access public
* @static
*/
static function checkValidRelationship(&$params, &$ids, $contactId) {
* Given the list of params in the params array, fetch the object
* and store the values in the values array
*
- * @param array $params input parameters to find object
- * @param array $values output values of the object
- * @param array $ids the array that holds all the db ids
+ * @param array $params input parameters to find object
+ * @param array $values output values of the object
+ * @internal param array $ids the array that holds all the db ids
*
* @return array (reference) the values that could be potentially assigned to smarty
* @access public
civicrm_state_province.abbreviation as state,
civicrm_country.name as country,
civicrm_email.email as email,
+ civicrm_contact.contact_type as contact_type,
civicrm_phone.phone as phone,
civicrm_contact.id as civicrm_contact_id,
- civicrm_contact.contact_type as contact_type,
civicrm_relationship.contact_id_b as contact_id_b,
civicrm_relationship.contact_id_a as contact_id_a,
civicrm_relationship_type.id as civicrm_relationship_type_id,
$values[$rid]['cid'] = $cid;
$values[$rid]['contact_id_a'] = $relationship->contact_id_a;
$values[$rid]['contact_id_b'] = $relationship->contact_id_b;
+ $values[$rid]['contact_type'] = $relationship->contact_type;
$values[$rid]['relationship_type_id'] = $relationship->civicrm_relationship_type_id;
$values[$rid]['relation'] = $relationship->relation;
$values[$rid]['name'] = $relationship->sort_name;
// format params
foreach ($relationships as $relationshipId => $values) {
- $contactRelationships[$relationshipId]['name'] = CRM_Utils_System::href(
+ //Add image icon for related contacts: CRM-14919
+ $icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type'],
+ FALSE,
+ $values['cid']
+ );
+ $contactRelationships[$relationshipId]['name'] = $icon.' '.CRM_Utils_System::href(
$values['name'],
'civicrm/contact/view',
- "reset=1&cid={$values['contact_id_b']}");
+ "reset=1&cid={$values['cid']}");
$contactRelationships[$relationshipId]['relation'] = CRM_Utils_System::href(
$values['relation'],
'civicrm/contact/view/rel',
- "action=view&reset=1&cid={$values['contact_id_a']}&id={$values['id']}&rtype={$values['rtype']}");
+ "action=view&reset=1&cid={$values['cid']}&id={$values['id']}&rtype={$values['rtype']}");
if ($params['context'] == 'current') {
if (($params['contact_id'] == $values['contact_id_a'] AND $values['is_permission_a_b'] == 1) OR