ENHANCEMENT Display and export the submitter email

This commit is contained in:
Cam Findlay 2017-06-17 12:34:15 +12:00
parent 7e63094bb1
commit 5ad7767ead
2 changed files with 18 additions and 1 deletions

View File

@ -232,6 +232,7 @@ SQL;
// attach every column to the print view form
$columns['Created'] = 'Created';
$columns['SubmittedBy.Email'] = 'Submitter';
$filter->setColumns($columns);
// print configuration

View File

@ -57,7 +57,23 @@ class SubmittedForm extends DataObject
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
$fields->removeByName('Values');
$fields->dataFieldByName('SubmittedByID')->setDisabled(true);
//check to ensure there is a Member to extract an Email from else null value
if($self->SubmittedBy() && $self->SubmittedBy()->exists()){
$submitter = $self->SubmittedBy()->Email;
} else {
$submitter = null;
}
//replace scaffolded field with readonly submitter
$fields->replaceField(
'SubmittedByID',
ReadonlyField::create(
'Submitter',
'Submitter',
$submitter
)
);
$values = new GridField(
'Values',