CRM-15501 Wrong File ID on Public Multi-Record Detail View Fix
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 27 Oct 2014 12:38:12 +0000 (18:08 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 27 Oct 2014 12:38:12 +0000 (18:08 +0530)
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/UFGroup.php

index 9f1e60b2556b0f696d0232de99b078a87cac3a59..da6671bb40205f80197c65f6a9ded5f1abc03f63 100644 (file)
@@ -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);
       }
 
index 184f520dd7baf893096732038ee5ba56e3103171..1280d4a03ba7dd242faf08cacf68da756ba8dc2b 100644 (file)
@@ -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'];
               }