mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUGFIX: table and column names quoted properly
This commit is contained in:
parent
91743ce3f5
commit
8166f686d0
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user