return TRUE;
}
- /**
- * Create last viewed link to recently updated contact.
- *
- * @param array $crudLinkSpec
- * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
- * - entity_table: string, eg "civicrm_contact"
- * - entity_id: int
- *
- * @return array|NULL
- * NULL if unavailable, or
- * [path: string, query: string, title: string]
- * @see CRM_Utils_System::createDefaultCrudLink
- */
- public function createDefaultCrudLink($crudLinkSpec) {
- switch ($crudLinkSpec['action']) {
- case CRM_Core_Action::VIEW:
- $result = [
- 'title' => $this->display_name,
- 'path' => 'civicrm/contact/view',
- 'query' => [
- 'reset' => 1,
- 'cid' => $this->id,
- ],
- ];
- return $result;
-
- case CRM_Core_Action::UPDATE:
- $result = [
- 'title' => $this->display_name,
- 'path' => 'civicrm/contact/add',
- 'query' => [
- 'reset' => 1,
- 'action' => 'update',
- 'cid' => $this->id,
- ],
- ];
- return $result;
- }
- return NULL;
- }
-
/**
* Get the values for pseudoconstants for name->value and reverse.
*
else {
//we should get contact type only if contact
if ($ufGroupId) {
- $data['contact_type'] = CRM_Core_BAO_UFField::getProfileType($ufGroupId);
+ $data['contact_type'] = CRM_Core_BAO_UFField::getProfileType($ufGroupId, TRUE, FALSE, TRUE);
//special case to handle profile with only contact fields
if ($data['contact_type'] == 'Contact') {
if ($contact->birth_date) {
$birthDate = CRM_Utils_Date::customFormat($contact->birth_date, '%Y%m%d');
if ($birthDate < date('Ymd')) {
- $age = CRM_Utils_Date::calculateAge($birthDate);
+ $deceasedDate = NULL;
+ if (!empty($contact->is_deceased) && !empty($contact->deceased_date)) {
+ $deceasedDate = $contact->deceased_date;
+ }
+ $age = CRM_Utils_Date::calculateAge($birthDate, $deceasedDate);
$values['age']['y'] = $age['years'] ?? NULL;
$values['age']['m'] = $age['months'] ?? NULL;
}
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
case 'membership':
- return CRM_Member_BAO_Membership::getContactMembershipCount($contactId, TRUE);
+ return CRM_Member_BAO_Membership::getContactMembershipCount((int) $contactId, TRUE);
case 'participant':
return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
}
// finally get menu item for -more- action widget.
+ while (!empty($contextMenu['moreActions'][$values['weight']])) {
+ // Quick & dirty way of handling 2 items with the same weight
+ // without clobbering one.
+ $values['weight']++;
+ }
$contextMenu['moreActions'][$values['weight']] = [
'title' => $values['title'],
'ref' => $values['ref'],
}
// finally get menu item for -more- action widget.
+ while (!empty($contextMenu['otherActions'][$value['weight']])) {
+ // Quick & dirty way of handling 2 items with the same weight
+ // without clobbering one.
+ $value['weight']++;
+ }
$contextMenu['otherActions'][$value['weight']] = [
'title' => $value['title'],
'ref' => $value['ref'],
$obj = new $daoName();
$obj->id = $id;
$obj->find();
- $hookParams = [];
+
if ($obj->fetch()) {
- CRM_Utils_Hook::pre('delete', $type, $id, $hookParams);
+ CRM_Utils_Hook::pre('delete', $type, $id);
$contactId = $obj->contact_id;
$obj->delete();
}