From b42d84aab4ead7b177efd319ec00cdf547374f90 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 27 Oct 2014 18:08:12 +0530 Subject: [PATCH] CRM-15501 Wrong File ID on Public Multi-Record Detail View Fix --- CRM/Core/BAO/CustomField.php | 9 +++++++-- CRM/Core/BAO/UFGroup.php | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 9f1e60b255..da6671bb40 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1447,7 +1447,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @return array */ - static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE) { + static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE, $multiRecordWhereClause = NULL) { if ($contactID) { if (!$fileID) { $params = array('id' => $cfID); @@ -1462,7 +1462,12 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { ); //query to fetch id from civicrm_file - $query = "SELECT {$columnName} FROM {$tableName} where entity_id = {$contactID}"; + if ($multiRecordWhereClause) { + $query = "SELECT {$columnName} FROM {$tableName} where entity_id = {$contactID} AND {$multiRecordWhereClause}"; + } + else { + $query = "SELECT {$columnName} FROM {$tableName} where entity_id = {$contactID}"; + } $fileID = CRM_Core_DAO::singleValueQuery($query); } diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 184f520dd7..1280d4a03b 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1097,7 +1097,8 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $fileURL = CRM_Core_BAO_CustomField::getFileURL($entityId, $cfID, NULL, - $absolute + $absolute, + $additionalWhereClause ); $params[$index] = $values[$index] = $fileURL['file_url']; } -- 2.25.1