$cacheKeyString .= $export ? '_1' : '_0';
$cacheKeyString .= $status ? '_1' : '_0';
$cacheKeyString .= $search ? '_1' : '_0';
+ //CRM-14501 it turns out that the impact of permissioning here is sometimes inconsistent. The field that
+ //calculates custom fields takes into account the logged in user & caches that for all users
+ //as an interim fix we will cache the fields by contact
+ $cacheKeyString .= '_' . CRM_Core_Session::getLoggedInContactID();
if (!self::$_exportableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_exportableFields)) {
if (!self::$_exportableFields) {
self::$_managedNames = NULL;
}
+ /**
+ * Retrieve contact id of the logged in user
+ * @return integer | NULL contact ID of logged in user
+ */
+ static function getLoggedInContactID() {
+ $session = CRM_Core_Session::singleton();
+ if (!is_numeric($session->get('userID'))) {
+ return NULL;
+ }
+ return $session->get('userID');
+ }
+
function isEmpty() {
// check if session is empty, if so we dont cache
// stuff that we can get away with
function _civicrm_api3_resolve_contactID($contactIdExpr) {
//if value = 'user_contact_id' replace value with logged in user id
if ($contactIdExpr == "user_contact_id") {
- $session = &CRM_Core_Session::singleton();
- if (!is_numeric($session->get('userID'))) {
- return NULL;
- }
- return $session->get('userID');
- } elseif (preg_match('/^@user:(.*)$/', $contactIdExpr, $matches)) {
+ return CRM_Core_Session::getLoggedInContactID();
+ }
+ elseif (preg_match('/^@user:(.*)$/', $contactIdExpr, $matches)) {
$config = CRM_Core_Config::singleton();
$ufID = $config->userSystem->getUfId($matches[1]);