mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #241 from nhorstmeier/Bugfix_196
BUGFIX set email recipient on initial write()
This commit is contained in:
commit
729318fc0a
@ -1173,14 +1173,14 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
||||
new TextareaField('EmailBody', _t('UserDefinedForm.EMAILBODY','Body'))
|
||||
);
|
||||
|
||||
if($this->Form()) {
|
||||
$formID = ($this->FormID != 0) ? $this->FormID : Session::get('CMSMain.currentPage');
|
||||
$dropdowns = array();
|
||||
// if they have email fields then we could send from it
|
||||
$validEmailFields = EditableEmailField::get()->filter('ParentID', (int)$this->FormID);
|
||||
$validEmailFields = EditableEmailField::get()->filter('ParentID', (int)$formID);
|
||||
// for the subject, only one-line entry boxes make sense
|
||||
$validSubjectFields = EditableTextField::get()->filter('ParentID', (int)$this->FormID)->filterByCallback(function($item, $list) { return (int)$item->getSetting('Rows') === 1; });
|
||||
$validSubjectFields = EditableTextField::get()->filter('ParentID', (int)$formID)->filterByCallback(function($item, $list) { return (int)$item->getSetting('Rows') === 1; });
|
||||
// predefined choices are also candidates
|
||||
$multiOptionFields = EditableMultipleOptionField::get()->filter('ParentID', (int)$this->FormID);
|
||||
$multiOptionFields = EditableMultipleOptionField::get()->filter('ParentID', (int)$formID);
|
||||
|
||||
$fields->insertAfter($dropdowns[] = new DropdownField(
|
||||
'SendEmailFromFieldID',
|
||||
@ -1207,7 +1207,6 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
||||
$dropdown->setHasEmptyDefault(true);
|
||||
$dropdown->setEmptyString(" ");
|
||||
}
|
||||
}
|
||||
|
||||
$this->extend('updateCMSFields', $fields);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user