| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
'context' => 'context',
'rel' => 'rel',
'contact_sub_type' => 'contact_sub_type',
- 'contact_type' => 'contact_type'
+ 'contact_type' => 'contact_type',
);
foreach ($whitelist as $key => $param) {
if (!empty($_GET[$key])) {
}
/**
- * Ajax callback for custom fields of type ContactReference
+ * Ajax callback for custom fields of type ContactReference.
*
* Todo: Migrate contact reference fields to use EntityRef
*/
}
$list = array_keys(CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'contact_reference_options'
- ), '1');
+ 'contact_reference_options'
+ ), '1');
$return = array_unique(array_merge(array('sort_name'), $list));
}
if (!empty($action)) {
- $excludeGet = array('reset', 'key', 'className', 'fnName', 'json', 'reset', 'context', 'timestamp', 'limit', 'id', 's', 'q', 'action');
+ $excludeGet = array(
+ 'reset',
+ 'key',
+ 'className',
+ 'fnName',
+ 'json',
+ 'reset',
+ 'context',
+ 'timestamp',
+ 'limit',
+ 'id',
+ 's',
+ 'q',
+ 'action',
+ );
foreach ($_GET as $param => $val) {
if (empty($val) ||
in_array($param, $excludeGet) ||
* Fetch PCP ID by PCP Supporter sort_name, also displays PCP title and associated Contribution Page title
*/
public static function getPCPList() {
- $name = CRM_Utils_Array::value('s', $_GET);
- $name = CRM_Utils_Type::escape($name, 'String');
+ $name = CRM_Utils_Array::value('term', $_GET);
+ $name = CRM_Utils_Type::escape($name, 'String');
$limit = '10';
$where = ' AND pcp.page_id = cp.id AND pcp.contact_id = cc.id';
$ret = array('is_error' => 0);
- foreach($clientList as $sourceContactID) {
+ foreach ($clientList as $sourceContactID) {
$relationParams = array(
'relationship_type_id' => $relType . '_a_b',
'contact_check' => array($relContactID => 1),
$caseRelationships->contact_id_a = $sourceContactID;
$caseRelationships->find();
- while($caseRelationships->fetch()) {
+ while ($caseRelationships->fetch()) {
$relationIds['relationship'] = $caseRelationships->id;
$relationIds['contactTarget'] = $relContactID;
}
}
// create new or update existing relationship
- $return = CRM_Contact_BAO_Relationship::create($relationParams, $relationIds);
+ $return = CRM_Contact_BAO_Relationship::createMultiple($relationParams, $relationIds);
if (!empty($return[4][0])) {
$relationshipID = $return[4][0];
$ret = array(
'is_error' => 1,
'error_message' => ts('The relationship type definition for the case role is not valid for the client and / or staff contact types. You can review and edit relationship types at <a href="%1">Administer >> Option Lists >> Relationship Types</a>.',
- array(1 => CRM_Utils_System::url('civicrm/admin/reltype', 'reset=1')))
+ array(1 => CRM_Utils_System::url('civicrm/admin/reltype', 'reset=1'))),
);
}
}
}
/**
- * Fetch the custom field help
+ * Fetch the custom field help.
*/
public static function customField() {
- $fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
- $params = array('id' => $fieldId);
+ $fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
+ $params = array('id' => $fieldId);
$returnProperties = array('help_pre', 'help_post');
- $values = array();
+ $values = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $values, $returnProperties);
CRM_Utils_JSON::output($values);
$relType = NULL;
if (isset($_GET['rel'])) {
$relation = explode('_', $_GET['rel']);
- $relType = CRM_Utils_Type::escape($relation[0], 'Integer');
- $rel = CRM_Utils_Type::escape($relation[2], 'String');
+ $relType = CRM_Utils_Type::escape($relation[0], 'Integer');
+ $rel = CRM_Utils_Type::escape($relation[2], 'String');
}
//shared household info
$splitName = explode(' :: ', $name);
if ($splitName) {
$contactName = trim(CRM_Utils_Array::value('0', $splitName));
- $street = trim(CRM_Utils_Array::value('1', $splitName));
- $city = trim(CRM_Utils_Array::value('2', $splitName));
+ $street = trim(CRM_Utils_Array::value('1', $splitName));
+ $city = trim(CRM_Utils_Array::value('2', $splitName));
}
else {
$contactName = $name;
else {
while ($dao->fetch()) {
if ($json) {
- $elements[] = array('name' => addslashes($dao->sort_name),
+ $elements[] = array(
+ 'name' => addslashes($dao->sort_name),
'id' => $dao->id,
);
}
}
/**
- * 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');
+ $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;
// 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");
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . ".php";
$method = 'setIsActive';
if (method_exists($recordBAO, $method)) {
}
/**
- * check the CMS username
- *
- */
+ * check the CMS username.
+ */
static public function checkUserName() {
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts'));
if (
}
/**
- * 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'])) {
}
list($displayName,
$userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
if ($userEmail) {
echo $userEmail;
}
CRM_Utils_Array::value('cid', $_GET)
);
-
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
- //working here
+ //working here
$result[] = array(
'text' => '"' . $dao->name . '" <' . $dao->email . '>',
'id' => (CRM_Utils_Array::value('id', $_GET)) ? "{$dao->id}::{$dao->email}" : '"' . $dao->name . '" <' . $dao->email . '>',
}
/**
- * 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');
- $query = "SELECT signature_text, signature_html FROM civicrm_email WHERE id = {$emailID}";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $query = "SELECT signature_text, signature_html FROM civicrm_email WHERE id = {$emailID}";
+ $dao = CRM_Core_DAO::executeQuery($query);
$signatures = array();
while ($dao->fetch()) {
/**
* Process dupes.
- *
*/
public static function processDupes() {
$oper = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
- $cid = CRM_Utils_Type::escape($_REQUEST['cid'], 'Positive');
- $oid = CRM_Utils_Type::escape($_REQUEST['oid'], 'Positive');
+ $cid = CRM_Utils_Type::escape($_REQUEST['cid'], 'Positive');
+ $oid = CRM_Utils_Type::escape($_REQUEST['oid'], 'Positive');
if (!$oper || !$cid || !$oid) {
return;
public static function getDedupes() {
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = 'sort_name';
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = 'sort_name';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
- $gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
- $rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
+ $gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
+ $rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
$contactType = '';
if ($rgid) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
}
- $cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
- $searchRows = array();
+ $cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
+ $searchRows = array();
$selectorElements = array('src', 'dst', 'weight', 'actions');
-
$join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
pn.entity_id2 = de.contact_id2 )";
$where = "de.id IS NULL";
$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);
- $state = CRM_Utils_Array::value('state', $_REQUEST, 'checked');
+ $name = CRM_Utils_Array::value('name', $_REQUEST);
+ $cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
+ $state = CRM_Utils_Array::value('state', $_REQUEST, 'checked');
$variableType = CRM_Utils_Array::value('variableType', $_REQUEST, 'single');
$actionToPerform = CRM_Utils_Array::value('action', $_REQUEST, 'select');
$addressVal["error_message"] = "no contact id found";
}
else {
- $entityBlock =
- array(
- 'contact_id' => $contactId,
- 'entity_id' => $contactId,
- );
+ $entityBlock = array(
+ 'contact_id' => $contactId,
+ 'entity_id' => $contactId,
+ );
$addressVal = CRM_Core_BAO_Address::getValues($entityBlock);
}
}
/**
- * 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');
+ if (!CRM_Contact_BAO_Contact_Permission::allow($contactID)) {
+ return CRM_Utils_System::permissionDenied();
+ }
+
$sortMapper = array(
0 => 'relation',
1 => 'sort_name',
10 => '',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
echo CRM_Utils_JSON::encodeDataTableSelector($relationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
+
}