BUGFIX: duplicate email recipients when duplicating a UDF

This commit is contained in:
Will Rossiter 2010-05-31 09:01:58 +00:00
parent 78fe9947b9
commit 59fabd005c
2 changed files with 19 additions and 5 deletions

View File

@ -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;
}

View File

@ -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