mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX Fixing plain email blank file field value (#940)
* Fixing plain email blank file field value
This commit is contained in:
parent
8c2d9a9438
commit
6ca8ce2596
@ -25,6 +25,7 @@ use SilverStripe\UserForms\Form\UserForm;
|
|||||||
use SilverStripe\UserForms\Model\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
|
||||||
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
|
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
|
||||||
|
use SilverStripe\UserForms\Model\Submission\SubmittedFileField;
|
||||||
use SilverStripe\UserForms\Model\UserDefinedForm;
|
use SilverStripe\UserForms\Model\UserDefinedForm;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
@ -416,9 +417,13 @@ JS
|
|||||||
$body = strip_tags($recipient->getEmailBodyContent()) . "\n";
|
$body = strip_tags($recipient->getEmailBodyContent()) . "\n";
|
||||||
if (isset($emailData['Fields']) && !$emailData['HideFormData']) {
|
if (isset($emailData['Fields']) && !$emailData['HideFormData']) {
|
||||||
foreach ($emailData['Fields'] as $field) {
|
foreach ($emailData['Fields'] as $field) {
|
||||||
|
if ($field instanceof SubmittedFileField) {
|
||||||
|
$body .= $field->Title . ': ' . $field->ExportValue ." \n";
|
||||||
|
} else {
|
||||||
$body .= $field->Title . ': ' . $field->Value . " \n";
|
$body .= $field->Title . ': ' . $field->Value . " \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$email->setBody($body);
|
$email->setBody($body);
|
||||||
$email->sendPlain();
|
$email->sendPlain();
|
||||||
|
@ -61,7 +61,8 @@ class SubmittedFileField extends SubmittedFormField
|
|||||||
*/
|
*/
|
||||||
public function getLink()
|
public function getLink()
|
||||||
{
|
{
|
||||||
if ($file = $this->UploadedFile()) {
|
$file = $this->UploadedFile();
|
||||||
|
if ($file && $file->exists()) {
|
||||||
if (trim($file->getFilename(), '/') != trim(ASSETS_DIR, '/')) {
|
if (trim($file->getFilename(), '/') != trim(ASSETS_DIR, '/')) {
|
||||||
return $this->UploadedFile()->AbsoluteLink();
|
return $this->UploadedFile()->AbsoluteLink();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user