mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #269 from mediabeastnz
This commit is contained in:
commit
a3d425d443
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
class UserDefinedForm extends Page {
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -101,6 +101,12 @@ class UserDefinedForm extends Page {
|
||||
*/
|
||||
private static $enable_are_you_sure = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @config
|
||||
*/
|
||||
private static $recipients_warning_enabled = false;
|
||||
|
||||
/**
|
||||
* Temporary storage of field ids when the form is duplicated.
|
||||
* Example layout: array('EditableCheckbox3' => 'EditableCheckbox14')
|
||||
@ -229,6 +235,13 @@ SQL;
|
||||
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
if($this->EmailRecipients()->Count() == 0 && static::config()->recipients_warning_enabled) {
|
||||
$fields->addFieldToTab("Root.Main", new LiteralField("EmailRecipientsWarning",
|
||||
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
|
||||
"Warning: You have not configured any recipients. Form submissions may be missed.")
|
||||
. "</p>"), "Title");
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@ -687,7 +700,7 @@ JS
|
||||
foreach($recipients as $recipient) {
|
||||
$email = new UserFormRecipientEmail($submittedFields);
|
||||
$mergeFields = $this->getMergeFieldsMap($emailData['Fields']);
|
||||
|
||||
|
||||
if($attachments) {
|
||||
foreach($attachments as $file) {
|
||||
if($file->ID != 0) {
|
||||
@ -699,7 +712,7 @@ JS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$parsedBody = SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields);
|
||||
|
||||
if (!$recipient->SendPlain && $recipient->emailTemplateExists()) {
|
||||
|
@ -27,6 +27,7 @@ en_GB:
|
||||
SINGULARNAME: 'User Defined Form'
|
||||
SUBMITBUTTON: Submit
|
||||
TEXTONSUBMIT: 'Text on submit button:'
|
||||
NORECIPIENTS: 'Warning: You have not configured any recipients. Form submissions may be missed.'
|
||||
UserDefinedForm_EmailRecipient:
|
||||
PLURALNAME: 'User Defined Form Email Recipients'
|
||||
SINGULARNAME: 'User Defined Form Email Recipient'
|
||||
|
@ -29,6 +29,7 @@ en_US:
|
||||
SINGULARNAME: 'User Defined Form'
|
||||
SUBMITBUTTON: Submit
|
||||
TEXTONSUBMIT: 'Text on submit button:'
|
||||
NORECIPIENTS: 'Warning: You have not configured any recipients. Form submissions may be missed.'
|
||||
UserDefinedForm_EmailRecipient:
|
||||
PLURALNAME: 'User Defined Form Email Recipients'
|
||||
SINGULARNAME: 'User Defined Form Email Recipient'
|
||||
|
Loading…
Reference in New Issue
Block a user