mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
MINOR: fixed notices and tidied up code
This commit is contained in:
parent
ecdb0e009a
commit
f19924d92f
@ -347,7 +347,6 @@ JS
|
||||
* @return Redirection
|
||||
*/
|
||||
function process($data, $form) {
|
||||
|
||||
// submitted form object
|
||||
$submittedForm = new SubmittedForm();
|
||||
$submittedForm->SubmittedBy = Member::currentUser();
|
||||
@ -380,9 +379,11 @@ JS
|
||||
$submittedFields->push($submittedField);
|
||||
|
||||
if(!empty($data[$field->Name])){
|
||||
|
||||
switch($field->ClassName){
|
||||
case "EditableFileField" :
|
||||
/**
|
||||
* @todo this should be on the EditableFile class. Just need to sort out
|
||||
* attachments array
|
||||
*/
|
||||
if($field->ClassName == "EditableFileField"){
|
||||
if(isset($_FILES[$field->Name])) {
|
||||
|
||||
// create the file from post data
|
||||
@ -404,17 +405,13 @@ JS
|
||||
} else {
|
||||
$submittedField->Value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make sure we save
|
||||
$submittedField->write();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif($field->hasMethod('getValueFromData')) {
|
||||
$values[$field->Title] = Convert::linkIfMatch($field->getValueFromData($data));
|
||||
} else {
|
||||
if(isset($data[$field->Name])) $values[$field->Title] = Convert::linkIfMatch($data[$field->Name]);
|
||||
}
|
||||
}
|
||||
$emailData = array(
|
||||
"Sender" => Member::currentUser(),
|
||||
"Fields" => $submittedFields,
|
||||
|
@ -23,12 +23,12 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
|
||||
|
||||
function getValueFromData($data) {
|
||||
$result = '';
|
||||
$entries = $data[$this->Name];
|
||||
$entries = (isset($data[$this->Name])) ? $data[$this->Name] : false;
|
||||
|
||||
if($entries) {
|
||||
if(!is_array($data[$this->Name])) {
|
||||
$entries = array($data[$this->Name]);
|
||||
}
|
||||
if($entries) {
|
||||
foreach($entries as $selected => $value) {
|
||||
if(!$result) {
|
||||
$result = $value;
|
||||
|
@ -30,5 +30,6 @@ class EditableFileField extends EditableFormField {
|
||||
public function getFormField() {
|
||||
return new FileField($this->Name, $this->Title);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user