CRM-13624 - Fix api regression - format link in display layer instead of data layer
authorColeman Watts <coleman@civicrm.org>
Mon, 2 Feb 2015 20:35:35 +0000 (15:35 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 2 Feb 2015 20:35:35 +0000 (15:35 -0500)
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomValueTable.php

index da6671bb40205f80197c65f6a9ded5f1abc03f63..5ea64fb31c694b7509484656e0e4360b3e4d41fb 100644 (file)
@@ -1286,11 +1286,9 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         break;
 
       case 'File':
-        if ($contactID) {
-          $url = self::getFileURL($contactID, $fieldID, $value);
-          if ($url) {
-            $display = $url['file_url'];
-          }
+        if ($value) {
+          $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value);
+          $display = $icons[$value];
         }
         break;
 
index 2cb38118fdb0efc4b423d88af632a6a70b562586..365495d54e833f6c4383023e4c7e8cfedaf229b2 100644 (file)
@@ -453,29 +453,13 @@ AND    $cond
           $fieldName = "custom_{$fieldID}";
           if ($isMultiple[$tableName]) {
             if ($formatMultiRecordField) {
-              if($file[$tableName][$fieldID] == 'File') {
-                if($fileid = $dao->$fieldName) {
-                  $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
-                  $result["{$dao->id}"]["{$fieldID}"] = $fileurl[$dao->$fieldName];
-                }
-              }
-              else {
-                $result["{$dao->id}"]["{$fieldID}"] = $dao->$fieldName;
-              }
+              $result["{$dao->id}"]["{$fieldID}"] = $dao->$fieldName;
             } else {
               $result["{$fieldID}_{$dao->id}"] = $dao->$fieldName;
             }
           }
           else {
-            if($file[$tableName][$fieldID] == 'File') {
-              if($fileid = $dao->$fieldName) {
-                $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
-                $result[$fieldID] = $fileurl[$dao->$fieldName];
-              }
-            }
-            else {
-              $result[$fieldID] = $dao->$fieldName;
-            }
+            $result[$fieldID] = $dao->$fieldName;
           }
         }
       }