*
* @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);
);
//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);
}
* @param int $entityId entity id (contribution, membership...)
* @param boolean $inline consider inline custom groups only
* @param boolean $checkPermission if false, do not include permissioning clause
+ * @param boolean $includeViewOnly if true, fields marked 'View Only' are included. Required for APIv3.
*
* @return array $customFormatted formatted custom field array
* @static
$customFieldExtend, $customValueId = NULL,
$entityId = NULL,
$inline = FALSE,
- $checkPermission = TRUE
+ $checkPermission = TRUE,
+ $includeViewOnly = false
) {
//get the custom fields for the entity
//subtype and basic type
}
// return if field is a 'code' field
- if (!empty($customFields[$customFieldId]['is_view'])) {
+ if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) {
return;
}