diff --git a/code/submissions/SubmittedFileField.php b/code/submissions/SubmittedFileField.php index bff8684..ca577f7 100755 --- a/code/submissions/SubmittedFileField.php +++ b/code/submissions/SubmittedFileField.php @@ -16,10 +16,10 @@ class SubmittedFileField extends SubmittedFormField { * * @return String */ - function getValue() { + function getFormattedValue() { return ''. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .''; } - + /** * Return the Link object for this field * diff --git a/code/submissions/SubmittedFormField.php b/code/submissions/SubmittedFormField.php index a567334..526fbcd 100755 --- a/code/submissions/SubmittedFormField.php +++ b/code/submissions/SubmittedFormField.php @@ -16,5 +16,15 @@ class SubmittedFormField extends DataObject { static $has_one = array( "Parent" => "SubmittedForm" ); - + + /** + * Generate a formatted value for the reports and email notifications. + * Converts new lines (which are stored in the database text field) as + * so they will output as newlines in the reports + * + * @return String + */ + function getFormattedValue() { + return nl2br($this->dbObject('Value')->RAW()); + } } diff --git a/templates/SubmittedFormReportField.ss b/templates/SubmittedFormReportField.ss index 34c16f4..6f5f269 100644 --- a/templates/SubmittedFormReportField.ss +++ b/templates/SubmittedFormReportField.ss @@ -15,7 +15,7 @@ <% control FieldValues %> $Title - $Value.RAW + $FormattedValue <% end_control %> diff --git a/templates/email/SubmittedFormEmail.ss b/templates/email/SubmittedFormEmail.ss index 242dc2d..31d496a 100755 --- a/templates/email/SubmittedFormEmail.ss +++ b/templates/email/SubmittedFormEmail.ss @@ -6,7 +6,7 @@ $Body
<% control Fields %>
<% if Title %>$Title<% else %>$Name<% end_if %>
-
$Value.RAW
+
$FormattedValue
<% end_control %>
<% end_if %>