[Vtigercrm-developers] Custom UItype (upload file field) working well except on Calendar/Events

apcloic apcloic at gmail.com
Wed Jan 28 08:08:57 GMT 2015


Hi Uma,

Here's the model field :

	/**
	 * Function to get the Template name for the current UI Type object
	 * @return <String> - Template Name
	 */
	public function getTemplateName() {
		return 'uitypes/FileField.tpl';
	}

	/**
	 * Function to get the Display Value, for the current field type with given
DB Insert Value
	 * @param <String> $value
	 * @param <Integer> $recordId
	 * @param <Vtiger_Record_Model>
	 * @return <String>
	 */
	public function getDisplayValue($value, $recordId, $recordModel = false) {
		$moduleName = $this->get('field')->getModule()->getName();
		if(!$recordModel) {
			$recordModel = Vtiger_Record_Model::getInstanceById($recordId,
$moduleName);
		}

		if($recordModel) {
			if(!empty($value)) {
				$db = PearDatabase::getInstance();
				$fileIdRes = $db->pquery('SELECT vtiger_attachments.name FROM
vtiger_attachments
								WHERE vtiger_attachments.attachmentsid=?', array($value));
				//$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
				//if($fileId){
					$value = ' '.$db->query_result($fileIdRes, 0, 'name').'
<index.php?module='.$moduleName.'&action=DownloadFile&record='.$recordId.'&fileid='.$value.'> 
';
				//}
			}
		}
		return $value;

File.php <http://vtiger-crm.2324883.n4.nabble.com/file/n15057/File.php>  

Thanks ;)
Regards,



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Custom-UItype-upload-file-field-working-well-except-on-Calendar-Events-tp15047p15057.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list