diff --git a/modules/Vtiger/models/Record.php b/modules/Vtiger/models/Record.php index 8e52a78eabb7269bdd6933a305ff8e191be61cc9..389812c1163a04d96018c23739b7763d07375b35 100644 --- a/modules/Vtiger/models/Record.php +++ b/modules/Vtiger/models/Record.php @@ -742,10 +742,10 @@ class Vtiger_Record_Model extends Vtiger_Base_Model { return array_merge($relatedModuleRecordIds, $directrelatedModuleRecordIds, $indirectrelatedModuleRecordIds); } - function getDownloadFileURL() { - $fileDetails = $this->getFileDetails(); + function getDownloadFileURL($attachmentId = false) { + $fileDetails = $this->getFileDetails($attachmentId); if (!empty($fileDetails)) { - return 'index.php?module='. $this->getModuleName() .'&action=DownloadFile&record='. $this->getId() .'&fileid='. $fileDetails['attachmentsid'].'&name='. $fileDetails['name']; + return 'index.php?module='. $this->getModuleName() .'&action=DownloadFile&record='. $this->getId() .'&fileid='. $fileDetails[0]['attachmentsid'].'&name='. $fileDetails[0]['name']; } else { return $this->get('filename'); } diff --git a/packages/vtiger/optional/ModComments.zip b/packages/vtiger/optional/ModComments.zip index 3838ff0e222876097ab0b39b93c00410814d9f93..d8bf00828de3834f7b04a685510cc41be2f81b99 100644 Binary files a/packages/vtiger/optional/ModComments.zip and b/packages/vtiger/optional/ModComments.zip differ diff --git a/pkg/vtiger/modules/ModComments/modules/ModComments/views/FilePreview.php b/pkg/vtiger/modules/ModComments/modules/ModComments/views/FilePreview.php index 1c8d08c18bd7c1965467c3b0b936af968b42f44e..1d058387c138e5f752e123c45546253136f5ac7d 100644 --- a/pkg/vtiger/modules/ModComments/modules/ModComments/views/FilePreview.php +++ b/pkg/vtiger/modules/ModComments/modules/ModComments/views/FilePreview.php @@ -57,7 +57,7 @@ class ModComments_FilePreview_View extends Vtiger_IndexAjax_View { $fileDetails = $recordModel->getFileNameAndDownloadURL($recordId, $attachmentId); } if ($recordModel->get('filename')) { - $downloadUrl = $recordModel->getDownloadFileURL(); + $downloadUrl = $recordModel->getDownloadFileURL($attachmentId); $trimmedFileName = $fileDetails[0]['trimmedFileName']; }