diff --git a/code/UserDefinedForm.php b/code/UserDefinedForm.php index 3522a1d..ac572a6 100755 --- a/code/UserDefinedForm.php +++ b/code/UserDefinedForm.php @@ -87,7 +87,7 @@ class UserDefinedForm extends Page { 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From') ), 'getCMSFields_forPopup', - "FormID = '$this->ID'" + "\"FormID\" = '$this->ID'" ); $emailRecipients->setAddTitle(_t('UserDefinedForm.AEMAILRECIPIENT', 'A Email Recipient')); @@ -326,7 +326,7 @@ class UserDefinedForm_Controller extends Page_Controller { if(is_array($dependency) && isset($dependency['ConditionField']) && $dependency['ConditionField'] != "") { // get the field which is effected $formName = Convert::raw2sql($dependency['ConditionField']); - $formFieldWatch = DataObject::get_one("EditableFormField", "Name = '$formName'"); + $formFieldWatch = DataObject::get_one("EditableFormField", "\"Name\" = '$formName'"); if(!$formFieldWatch) break; @@ -660,8 +660,8 @@ class UserDefinedForm_EmailRecipient extends DataObject { ); if($this->Form()) { - $validEmailFields = DataObject::get("EditableEmailField", "ParentID = '$this->FormID'"); - $multiOptionFields = DataObject::get("EditableMultipleOptionField", "ParentID = '$this->FormID'"); + $validEmailFields = DataObject::get("EditableEmailField", "\"ParentID\" = '$this->FormID'"); + $multiOptionFields = DataObject::get("EditableMultipleOptionField", "\"ParentID\" = '$this->FormID'"); // if they have email fields then we could send from it if($validEmailFields) { diff --git a/code/migration/UserFormsMigrationTask.php b/code/migration/UserFormsMigrationTask.php index ef1e9c9..1316cb6 100644 --- a/code/migration/UserFormsMigrationTask.php +++ b/code/migration/UserFormsMigrationTask.php @@ -90,7 +90,7 @@ class UserFormsMigrationTask extends MigrationTask { else if($field->ClassName == "EditableCheckboxGroupField") { $optionClass = "EditableCheckboxOption"; } - $query = DB::query("SELECT * FROM $optionClass WHERE ParentID = '$field->ID'"); + $query = DB::query("SELECT * FROM \"$optionClass\" WHERE \"ParentID\" = '$field->ID'"); $result = $query->first(); if($result) { do { @@ -104,7 +104,7 @@ class UserFormsMigrationTask extends MigrationTask { $database = $this->findDatabaseTableName('EditableTextField'); // get the data from the table - $result = DB::query("SELECT * FROM $database WHERE ID = $field->ID")->first(); + $result = DB::query("SELECT * FROM \"$database\" WHERE \"ID\" = $field->ID")->first(); if($result) { $field->setFieldSettings(array( @@ -123,7 +123,7 @@ class UserFormsMigrationTask extends MigrationTask { $database = $this->findDatabaseTableName('EditableLiteralField'); // get the data from the table - $result = DB::query("SELECT * FROM $database WHERE ID = $field->ID")->first(); + $result = DB::query("SELECT * FROM \"$database\" WHERE \"ID\" = $field->ID")->first(); if($result) { $field->setFieldSettings(array( @@ -139,7 +139,7 @@ class UserFormsMigrationTask extends MigrationTask { $database = $this->findDatabaseTableName('EditableMemberListField'); // get the data from the table - $result = DB::query("SELECT * FROM $database WHERE ID = $field->ID")->first(); + $result = DB::query("SELECT * FROM \"$database\" WHERE \"ID\" = $field->ID")->first(); if($result) { $field->setFieldSettings(array( @@ -155,7 +155,7 @@ class UserFormsMigrationTask extends MigrationTask { $database = $this->findDatabaseTableName('EditableCheckbox'); // get the data from the table - $result = DB::query("SELECT * FROM $database WHERE ID = $field->ID")->first(); + $result = DB::query("SELECT * FROM \"$database\" WHERE \"ID\" = $field->ID")->first(); if($result) { $field->setFieldSettings(array( @@ -167,7 +167,7 @@ class UserFormsMigrationTask extends MigrationTask { case 'EditableEmailField': $database = $this->findDatabaseTableName('EditableEmailField'); - $result = DB::query("SELECT * FROM $database WHERE ID = $field->ID")->first(); + $result = DB::query("SELECT * FROM \"$database\" WHERE \"ID\" = $field->ID")->first(); if($result && isset($result['SendCopy']) && $result['SendCopy'] == true) { // we do not store send copy on email field anymore. This has been wrapped into // the email recipients diff --git a/code/submissions/SubmittedFormReportField.php b/code/submissions/SubmittedFormReportField.php index e201b4c..b8e0316 100755 --- a/code/submissions/SubmittedFormReportField.php +++ b/code/submissions/SubmittedFormReportField.php @@ -22,10 +22,10 @@ class SubmittedFormReportField extends FormField { $pageStart = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0; $pageLength = 10; - $items = $this->form->getRecord()->getComponents('Submissions', null, "Created DESC", null, "$pageStart,$pageLength"); + $items = $this->form->getRecord()->getComponents('Submissions', null, "\"Created\" DESC", null, "$pageStart,$pageLength"); $formId = $this->form->getRecord()->ID; - foreach(DB::query("SELECT COUNT(*) AS CountRows FROM SubmittedForm WHERE ParentID = $formId") as $r) $totalCount = $r['CountRows']; + foreach(DB::query("SELECT COUNT(*) AS \"CountRows\" FROM \"SubmittedForm\" WHERE \"ParentID\" = $formId") as $r) $totalCount = $r['CountRows']; $items->setPageLimits($pageStart, $pageLength, $totalCount); $items->NextStart = $pageStart + $pageLength;