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
|
* @return Redirection
|
||||||
*/
|
*/
|
||||||
function process($data, $form) {
|
function process($data, $form) {
|
||||||
|
|
||||||
// submitted form object
|
// submitted form object
|
||||||
$submittedForm = new SubmittedForm();
|
$submittedForm = new SubmittedForm();
|
||||||
$submittedForm->SubmittedBy = Member::currentUser();
|
$submittedForm->SubmittedBy = Member::currentUser();
|
||||||
@ -380,9 +379,11 @@ JS
|
|||||||
$submittedFields->push($submittedField);
|
$submittedFields->push($submittedField);
|
||||||
|
|
||||||
if(!empty($data[$field->Name])){
|
if(!empty($data[$field->Name])){
|
||||||
|
/**
|
||||||
switch($field->ClassName){
|
* @todo this should be on the EditableFile class. Just need to sort out
|
||||||
case "EditableFileField" :
|
* attachments array
|
||||||
|
*/
|
||||||
|
if($field->ClassName == "EditableFileField"){
|
||||||
if(isset($_FILES[$field->Name])) {
|
if(isset($_FILES[$field->Name])) {
|
||||||
|
|
||||||
// create the file from post data
|
// create the file from post data
|
||||||
@ -404,17 +405,13 @@ JS
|
|||||||
} else {
|
} else {
|
||||||
$submittedField->Value = "";
|
$submittedField->Value = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure we save
|
||||||
$submittedField->write();
|
$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(
|
$emailData = array(
|
||||||
"Sender" => Member::currentUser(),
|
"Sender" => Member::currentUser(),
|
||||||
"Fields" => $submittedFields,
|
"Fields" => $submittedFields,
|
||||||
|
@ -23,12 +23,12 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
|
|||||||
|
|
||||||
function getValueFromData($data) {
|
function getValueFromData($data) {
|
||||||
$result = '';
|
$result = '';
|
||||||
$entries = $data[$this->Name];
|
$entries = (isset($data[$this->Name])) ? $data[$this->Name] : false;
|
||||||
|
|
||||||
|
if($entries) {
|
||||||
if(!is_array($data[$this->Name])) {
|
if(!is_array($data[$this->Name])) {
|
||||||
$entries = array($data[$this->Name]);
|
$entries = array($data[$this->Name]);
|
||||||
}
|
}
|
||||||
if($entries) {
|
|
||||||
foreach($entries as $selected => $value) {
|
foreach($entries as $selected => $value) {
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
$result = $value;
|
$result = $value;
|
||||||
|
@ -30,5 +30,6 @@ class EditableFileField extends EditableFormField {
|
|||||||
public function getFormField() {
|
public function getFormField() {
|
||||||
return new FileField($this->Name, $this->Title);
|
return new FileField($this->Name, $this->Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user