mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
MINOR Fixed SQL quoting (requires 2.4)
MINOR Added ingo at ss dot org as a maintainer
This commit is contained in:
parent
f508442eb5
commit
89513c6da6
5
README
5
README
@ -12,9 +12,12 @@ Maintainer Contact
|
||||
Sean Harvey (Nickname: sharvey, halkyon)
|
||||
<sean (at) silverstripe (dot) com>
|
||||
|
||||
Ingo Schommer (Nickname: chillu)
|
||||
<ingo (at) silverstripe (dot) com>
|
||||
|
||||
Requirements
|
||||
-----------------------------------------------
|
||||
SilverStripe 2.2.2 or higher is required.
|
||||
SilverStripe 2.4 or higher is required.
|
||||
|
||||
Documentation
|
||||
-----------------------------------------------
|
||||
|
@ -265,7 +265,7 @@ abstract class MultiForm extends Form {
|
||||
function getSavedSteps() {
|
||||
return DataObject::get(
|
||||
'MultiFormStep',
|
||||
sprintf("SessionID = '%s'",
|
||||
sprintf("\"SessionID\" = '%s'",
|
||||
$this->session->ID
|
||||
)
|
||||
);
|
||||
@ -442,7 +442,7 @@ abstract class MultiForm extends Form {
|
||||
}
|
||||
|
||||
// Get the previous step of the class instance returned from $currentStep->getPreviousStep()
|
||||
$prevStep = DataObject::get_one($prevStepClass, "SessionID = {$this->session->ID}");
|
||||
$prevStep = DataObject::get_one($prevStepClass, "\"SessionID\" = {$this->session->ID}");
|
||||
|
||||
// Set the current step as the previous step
|
||||
$this->setCurrentStep($prevStep);
|
||||
@ -501,7 +501,7 @@ abstract class MultiForm extends Form {
|
||||
public function getAllStepsLinear() {
|
||||
$stepsFound = new DataObjectSet();
|
||||
|
||||
$firstStep = DataObject::get_one($this->stat('start_step'), "SessionID = {$this->session->ID}");
|
||||
$firstStep = DataObject::get_one($this->stat('start_step'), "\"SessionID\" = {$this->session->ID}");
|
||||
$templateData = array(
|
||||
'ID' => $firstStep->ID,
|
||||
'ClassName' => $firstStep->class,
|
||||
@ -571,7 +571,7 @@ abstract class MultiForm extends Form {
|
||||
* @return int
|
||||
*/
|
||||
public function getCompletedStepCount() {
|
||||
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID} && Data IS NOT NULL");
|
||||
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->session->ID} && \"Data\" IS NOT NULL");
|
||||
return $steps ? $steps->Count() : 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Decorate {@link DataObject}s which are required to be saved
|
||||
@ -35,7 +35,7 @@ class MultiFormObjectDecorator extends DataObjectDecorator {
|
||||
&& strpos($query->where[0], "ID = ") !== 0
|
||||
&& !$this->wantsTemporary($query)
|
||||
) {
|
||||
$query->where[] = "`{$query->from[0]}`.`MultiFormIsTemporary` = 0";
|
||||
$query->where[] = "\"{$query->from[0]}\".\"MultiFormIsTemporary\" = 0";
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,11 +49,11 @@ class MultiFormObjectDecorator extends DataObjectDecorator {
|
||||
*/
|
||||
protected function wantsTemporary($query) {
|
||||
foreach($query->where as $whereClause) {
|
||||
if($whereClause == "`{$query->from[0]}`.`MultiFormIsTemporary` = 1") return true;
|
||||
if($whereClause == "\"{$query->from[0]}\".\"MultiFormIsTemporary\" = 1") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Task to clean out all {@link MultiFormSession} objects from the database.
|
||||
@ -45,10 +45,10 @@ class MultiFormPurgeTask extends DailyTask {
|
||||
protected function getExpiredSessions() {
|
||||
return DataObject::get(
|
||||
'MultiFormSession',
|
||||
"DATEDIFF(NOW(), `MultiFormSession`.`Created`) > " . self::$session_expiry_days
|
||||
"DATEDIFF(NOW(), \"MultiFormSession\".\"Created\") > " . self::$session_expiry_days
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -233,9 +233,9 @@ class MultiFormStep extends DataObject {
|
||||
if($this->SessionID && is_numeric($this->SessionID)) {
|
||||
$nextSteps = $this->stat('next_steps');
|
||||
if(is_string($nextSteps)) {
|
||||
return DataObject::get_one($nextSteps, "SessionID = {$this->SessionID}");
|
||||
return DataObject::get_one($nextSteps, "\"SessionID\" = {$this->SessionID}");
|
||||
} elseif(is_array($nextSteps)) {
|
||||
return DataObject::get_one($nextSteps[0], "SessionID = {$this->SessionID}");
|
||||
return DataObject::get_one($nextSteps[0], "\"SessionID\" = {$this->SessionID}");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -260,7 +260,7 @@ class MultiFormStep extends DataObject {
|
||||
* @return String Classname of a {@link MultiFormStep} subclass
|
||||
*/
|
||||
public function getPreviousStep() {
|
||||
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->SessionID}", 'LastEdited DESC');
|
||||
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC');
|
||||
if($steps) {
|
||||
foreach($steps as $step) {
|
||||
if($step->getNextStep()) {
|
||||
@ -281,7 +281,7 @@ class MultiFormStep extends DataObject {
|
||||
*/
|
||||
public function getPreviousStepFromDatabase() {
|
||||
if($prevStepClass = $this->getPreviousStep()) {
|
||||
return DataObject::get_one($prevStepClass, "SessionID = {$this->SessionID}");
|
||||
return DataObject::get_one($prevStepClass, "\"SessionID\" = {$this->SessionID}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user