mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUGFIX: duplicate email recipients when duplicating a UDF
This commit is contained in:
parent
78fe9947b9
commit
59fabd005c
@ -190,11 +190,25 @@ class UserDefinedForm extends Page {
|
||||
*/
|
||||
public function duplicate() {
|
||||
$page = parent::duplicate();
|
||||
foreach($this->Fields() as $field) {
|
||||
$newField = $field->duplicate();
|
||||
$newField->ParentID = $page->ID;
|
||||
$newField->write();
|
||||
|
||||
// the form fields
|
||||
if($this->Fields()) {
|
||||
foreach($this->Fields() as $field) {
|
||||
$newField = $field->duplicate();
|
||||
$newField->ParentID = $page->ID;
|
||||
$newField->write();
|
||||
}
|
||||
}
|
||||
|
||||
// the emails
|
||||
if($this->EmailRecipients()) {
|
||||
foreach($this->EmailRecipients() as $email) {
|
||||
$newEmail = $email->duplicate();
|
||||
$newEmail->FormID = $page->ID;
|
||||
$newEmail->write();
|
||||
}
|
||||
}
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class EditableDateField extends EditableFormField {
|
||||
Requirements::customScript(<<<JS
|
||||
(function(jQuery) {
|
||||
$(document).ready(function() {
|
||||
$('input[name^=EditableDateField]').datepicker();
|
||||
$('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker();
|
||||
});
|
||||
})(jQuery);
|
||||
JS
|
||||
|
Loading…
Reference in New Issue
Block a user