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