$contact->fetch();
$values[$note->id]['createdBy'] = $contact->display_name;
$values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
+
+ // paper icon view for attachments part
+ $paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
+ $values[$note->id]['attachment'] = $paperIconAttachmentInfo;
}
}
cg.id as groupID,
cg.is_multiple,
cf.column_name,
- cf.id as fieldID
+ cf.id as fieldID,
+ cf.data_type as fieldDataType
FROM civicrm_custom_group cg,
civicrm_custom_field cf
WHERE cf.custom_group_id = cg.id
$fields[$dao->table_name][] = $dao->fieldID;
$select[$dao->table_name][] = "{$dao->column_name} AS custom_{$dao->fieldID}";
$isMultiple[$dao->table_name] = $dao->is_multiple ? TRUE : FALSE;
+ $file[$dao->table_name][$dao->fieldID] = $dao->fieldDataType;
}
$result = array();
$fieldName = "custom_{$fieldID}";
if ($isMultiple[$tableName]) {
if ($formatMultiRecordField) {
- $result["{$dao->id}"]["{$fieldID}"] = $dao->$fieldName;
+ 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;
+ }
} else {
$result["{$fieldID}_{$dao->id}"] = $dao->$fieldName;
}
}
else {
- $result[$fieldID] = $dao->$fieldName;
+ 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;
+ }
}
}
}
CRM_Core_BAO_File::deleteEntityFile($params['entityTable'], $params['entityID'], NULL, $params['fileID']);
}
-}
+ /**
+ * function to display paper icon for a file attachment -- CRM-13624
+ *
+ * @static
+ * @access public
+ */
+ static function paperIconAttachment( $entityTable, $entityID ) {
+ if (empty($entityTable) || !$entityID) {
+ $results = NULL;
+ return $results;
+ }
+ $currentAttachmentInfo = self::getEntityFile( $entityTable, $entityID );
+ foreach($currentAttachmentInfo as $fileKey => $fileValue) {
+ $fileID = $fileValue['fileID'];
+ $fileType = $fileValue['mime_type'];
+ $eid = $entityID;
+ if($fileID) {
+ if ($fileType == 'image/jpeg' ||
+ $fileType == 'image/pjpeg' ||
+ $fileType == 'image/gif' ||
+ $fileType == 'image/x-png' ||
+ $fileType == 'image/png'
+ ) {
+ $url = $fileValue['url'];
+ $alt = $fileValue['cleanName'];
+ $file_url[$fileID] = "
+ <a href=\"$url\" class='crm-image-popup'>
+ <div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div>
+ </a>";
+ // for non image files
+ }
+ else {
+ $url = $fileValue['url'];
+ $alt = $fileValue['cleanName'];
+ $file_url[$fileID] = "<a href=\"$url\"><div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div></a>";
+ }
+ }
+ }
+ if(empty($file_url)) {
+ $results = NULL;
+ }
+ else {
+ $results = $file_url;
+ }
+ return $results;
+ }
+
+}
\ No newline at end of file
color: #fff;
}
+.crm-container .paper-icon {
+ background-position: -101px -222px;background-image: url("../i/icons/jquery-ui-3E3E3E.gif");
+}
\ No newline at end of file
<th>{ts}Subject{/ts}</th>
<th>{ts}Date{/ts}</th>
<th>{ts}Created By{/ts}</th>
+ <th>{ts}Attachment(s){/ts}</th>
<th></th>
</tr>
</thead>
<td class="crm-note-createdBy">
<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$note.contact_id`"}">{$note.createdBy}</a>
</td>
+ <td class="crm-note-attachment">
+ {foreach from=$note.attachment item=fileinfo}
+ {$fileinfo}
+ {/foreach}
+ </td>
<td class="nowrap">{$note.action|replace:'xx':$note.id}</td>
</tr>
{/foreach}