From 1590172d0cb3b6cf5ae174a6484fc4b8fe59a31f Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Mon, 14 May 2012 14:16:46 +1200 Subject: [PATCH] BUGFIX: A Submitted file couldn't not be shown / downloaded in the submission report --- code/model/submissions/SubmittedFileField.php | 16 ++++++++++++++-- templates/SubmittedFormReportField.ss | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/code/model/submissions/SubmittedFileField.php b/code/model/submissions/SubmittedFileField.php index d2f4a75..6cbfd3c 100755 --- a/code/model/submissions/SubmittedFileField.php +++ b/code/model/submissions/SubmittedFileField.php @@ -19,11 +19,12 @@ class SubmittedFileField extends SubmittedFormField { * @return string */ public function getFormattedValue() { + $name = $this->getName(); $link = $this->getLink(); $title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File'); if($link) { - return sprintf('%s', $link, $title); + return sprintf('%s - %s', $name, $link, $title); } return false; @@ -49,5 +50,16 @@ class SubmittedFileField extends SubmittedFormField { return $this->UploadedFile()->URL; } } - } + } + + /** + * Return the name of the file, if present + * + * @return string + */ + public function getName() { + if($this->UploadedFile()) { + return $this->UploadedFile()->Name; + } + } } \ No newline at end of file diff --git a/templates/SubmittedFormReportField.ss b/templates/SubmittedFormReportField.ss index 6e5e2a0..28d8857 100644 --- a/templates/SubmittedFormReportField.ss +++ b/templates/SubmittedFormReportField.ss @@ -13,7 +13,7 @@
- $Value + $FormattedValue