mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUG: open ticket 7314 fixing some bugs that have been found
This commit is contained in:
parent
4335d8d910
commit
eba5edd60b
code/model
@ -70,11 +70,11 @@ class UserDefinedForm extends Page {
|
||||
$fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions',_t('UserDefinedForm.SAVESUBMISSIONS',"Disable Saving Submissions to Server")));
|
||||
$fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField( "Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this ) );
|
||||
|
||||
UserDefinedForm_EmailRecipient::$summary_fields=array(
|
||||
'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
|
||||
'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
|
||||
'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')
|
||||
);
|
||||
UserDefinedForm_EmailRecipient::$summary_fields=array(
|
||||
'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
|
||||
'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
|
||||
'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')
|
||||
);
|
||||
|
||||
// who do we email on submission
|
||||
$emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
|
||||
@ -85,7 +85,7 @@ class UserDefinedForm extends Page {
|
||||
$onCompleteFieldSet = new FieldList(
|
||||
$editor=new HtmlEditorField( "OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage))
|
||||
);
|
||||
$editor->setRows(3);
|
||||
$editor->setRows(3);
|
||||
|
||||
$fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet);
|
||||
$fields->addFieldsToTab("Root.Options", $this->getFormOptions());
|
||||
@ -672,7 +672,7 @@ JS
|
||||
if(!$this->DisableSaveSubmissions) $submittedForm->write();
|
||||
|
||||
$values = array();
|
||||
$attachments = array();
|
||||
$attachments = array();
|
||||
|
||||
$submittedFields = new ArrayList();
|
||||
|
||||
@ -756,7 +756,7 @@ JS
|
||||
// check to see if they are a dynamic sender. eg based on a email field a user selected
|
||||
if($recipient->SendEmailFromField()) {
|
||||
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailFromField()->Name);
|
||||
if($submittedFormField) {
|
||||
if($submittedFormField && is_string($submittedFormField->Value)) {
|
||||
$email->setFrom($submittedFormField->Value);
|
||||
}
|
||||
}
|
||||
@ -764,12 +764,12 @@ JS
|
||||
if($recipient->SendEmailToField()) {
|
||||
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailToField()->Name);
|
||||
|
||||
if($submittedFormField) {
|
||||
if($submittedFormField && is_string($submittedFormField->Value)) {
|
||||
$email->setTo($submittedFormField->Value);
|
||||
}
|
||||
}
|
||||
|
||||
$this->extend('updateEmail', $email, $recipient, $emailData);
|
||||
$this->extend('updateEmail', $email, $recipient, $emailData);
|
||||
|
||||
if($recipient->SendPlain) {
|
||||
$body = strip_tags($recipient->EmailBody) . "\n ";
|
||||
@ -859,7 +859,8 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
||||
|
||||
// if they have email fields then we could send from it
|
||||
if($validEmailFields) {
|
||||
$fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'), $validEmailFields->map('ID', 'Title'), '', null,""), 'EmailFrom');
|
||||
$fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'),
|
||||
$validEmailFields->map('ID', 'Title'), '', null,""), 'EmailFrom');
|
||||
}
|
||||
|
||||
// if they have multiple options
|
||||
@ -875,7 +876,8 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
||||
}
|
||||
|
||||
$multiOptionFields = $multiOptionFields->map('ID', 'Title');
|
||||
$fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'), $multiOptionFields, '', null, ""), 'EmailAddress');
|
||||
$fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'),
|
||||
$multiOptionFields, '', null, ""), 'EmailAddress');
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,7 +906,7 @@ class UserDefinedForm_SubmittedFormEmail extends Email {
|
||||
protected $ss_template = "SubmittedFormEmail";
|
||||
protected $data;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($submittedFields = null) {
|
||||
parent::__construct($submittedFields = null);
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,12 @@ class EditableLiteralField extends EditableFormField {
|
||||
static $plural_name = 'HTML Blocks';
|
||||
|
||||
public function getFieldConfiguration() {
|
||||
|
||||
$customSettings = unserialize($this->CustomSettings);
|
||||
$content = (isset($customSettings['Content'])) ? $customSettings['Content'] : '';
|
||||
$textAreaField = new TextareaField(
|
||||
$this->getSettingName('Content'),
|
||||
"HTML"
|
||||
"HTML",
|
||||
$content
|
||||
);
|
||||
$textAreaField->setRows(4);
|
||||
$textAreaField->setColumns(20);
|
||||
@ -44,4 +46,4 @@ class EditableLiteralField extends EditableFormField {
|
||||
public function showInReports() {
|
||||
return (!$this->getSetting('HideFromReports'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user