| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
}
/**
- * Ajax callback for custom fields of type ContactReference
+ * Ajax callback for custom fields of type ContactReference.
*
* Todo: Migrate contact reference fields to use EntityRef
*/
}
/**
- * Fetch the custom field help
+ * Fetch the custom field help.
*/
public static function customField() {
$fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
}
/**
- * Delete custom value
+ * Delete custom value.
*/
public static function deleteCustomValue() {
$customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
}
/**
- * Perform enable / disable actions on record.
- */
- public static function enableDisable() {
- $op = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
- $recordID = CRM_Utils_Type::escape($_REQUEST['recordID'], 'Positive');
- $recordBAO = CRM_Utils_Type::escape($_REQUEST['recordBAO'], 'String');
-
- $isActive = NULL;
- if ($op == 'disable-enable') {
- $isActive = TRUE;
- }
- elseif ($op == 'enable-disable') {
- $isActive = FALSE;
- }
- $status = array('status' => 'record-updated-fail');
- if (isset($isActive)) {
- // first munge and clean the recordBAO and get rid of any non alpha numeric characters
- $recordBAO = CRM_Utils_String::munge($recordBAO);
- $recordClass = explode('_', $recordBAO);
-
- // make sure recordClass is namespaced (we cant check CRM since extensions can also use this)
- // but it should be at least 3 levels deep
- if (count($recordClass) >= 3) {
- require_once str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . ".php";
- $method = 'setIsActive';
-
- if (method_exists($recordBAO, $method)) {
- $updated = call_user_func_array(array($recordBAO, $method),
- array($recordID, $isActive)
- );
- if ($updated) {
- $status = array('status' => 'record-updated-success');
- }
-
- // call hook enableDisable
- CRM_Utils_Hook::enableDisable($recordBAO, $recordID, $isActive);
- }
- }
- CRM_Utils_JSON::output($status);
- }
- }
-
- /**
- * check the CMS username
+ * check the CMS username.
*/
static public function checkUserName() {
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts'));
}
/**
- * Function to get email address of a contact
+ * Function to get email address of a contact.
*/
public static function getContactEmail() {
if (!empty($_REQUEST['contact_id'])) {
}
/**
- * Function used for CiviCRM dashboard operations
+ * Function used for CiviCRM dashboard operations.
*/
public static function dashboard() {
$operation = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
}
/**
- * Retrieve signature based on email id
+ * Retrieve signature based on email id.
*/
public static function getSignature() {
$emailID = CRM_Utils_Type::escape($_REQUEST['emailID'], 'Positive');
$mergeParams .= "&gid={$gid}";
}
- $searchRows[$mainId]['actions'] = CRM_Utils_System::href(ts('merge'), 'civicrm/contact/merge', $mergeParams);
- $searchRows[$mainId]['actions'] .= " | <a id='notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
+ $searchRows[$mainId]['actions'] = '<a class="action-item crm-hover-button" href="' . CRM_Utils_System::url('civicrm/contact/merge', $mergeParams) . '">' . ts('merge') . '</a>';
+ $searchRows[$mainId]['actions'] .= "<a class='action-item crm-hover-button crm-notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
}
else {
$searchRows[$mainId]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
}
/**
- * Retrieve a PDF Page Format for the PDF Letter form
+ * Retrieve a PDF Page Format for the PDF Letter form.
*/
public function pdfFormat() {
$formatId = CRM_Utils_Type::escape($_REQUEST['formatId'], 'Integer');
}
/**
- * Retrieve Paper Size dimensions
+ * Retrieve Paper Size dimensions.
*/
public static function paperSize() {
$paperSizeName = CRM_Utils_Type::escape($_REQUEST['paperSizeName'], 'String');
CRM_Utils_JSON::output($paperSize);
}
+ /**
+ * Used to store selected contacts across multiple pages in advanced search.
+ */
public static function selectUnselectContacts() {
$name = CRM_Utils_Array::value('name', $_REQUEST);
$cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
}
/**
- * Retrieve contact relationships
+ * Retrieve contact relationships.
*/
public static function getContactRelationships() {
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$context = CRM_Utils_Type::escape($_GET['context'], 'String');
+ $relationship_type_id = CRM_Utils_Type::escape($_GET['relationship_type_id'], 'Integer', FALSE);
+
+ if (!CRM_Contact_BAO_Contact_Permission::allow($contactID)) {
+ return CRM_Utils_System::permissionDenied();
+ }
$sortMapper = array(
0 => 'relation',
$params['contact_id'] = $contactID;
$params['context'] = $context;
+ if ($relationship_type_id) {
+ $params['relationship_type_id'] = $relationship_type_id;
+ }
// get the contact relationships
$relationships = CRM_Contact_BAO_Relationship::getContactRelationshipSelector($params);
echo CRM_Utils_JSON::encodeDataTableSelector($relationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
+
}