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 Harvey (Nickname: sharvey, halkyon)
|
||||||
<sean (at) silverstripe (dot) com>
|
<sean (at) silverstripe (dot) com>
|
||||||
|
|
||||||
|
Ingo Schommer (Nickname: chillu)
|
||||||
|
<ingo (at) silverstripe (dot) com>
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
SilverStripe 2.2.2 or higher is required.
|
SilverStripe 2.4 or higher is required.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
@ -265,7 +265,7 @@ abstract class MultiForm extends Form {
|
|||||||
function getSavedSteps() {
|
function getSavedSteps() {
|
||||||
return DataObject::get(
|
return DataObject::get(
|
||||||
'MultiFormStep',
|
'MultiFormStep',
|
||||||
sprintf("SessionID = '%s'",
|
sprintf("\"SessionID\" = '%s'",
|
||||||
$this->session->ID
|
$this->session->ID
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -442,7 +442,7 @@ abstract class MultiForm extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the previous step of the class instance returned from $currentStep->getPreviousStep()
|
// 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
|
// Set the current step as the previous step
|
||||||
$this->setCurrentStep($prevStep);
|
$this->setCurrentStep($prevStep);
|
||||||
@ -501,7 +501,7 @@ abstract class MultiForm extends Form {
|
|||||||
public function getAllStepsLinear() {
|
public function getAllStepsLinear() {
|
||||||
$stepsFound = new DataObjectSet();
|
$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(
|
$templateData = array(
|
||||||
'ID' => $firstStep->ID,
|
'ID' => $firstStep->ID,
|
||||||
'ClassName' => $firstStep->class,
|
'ClassName' => $firstStep->class,
|
||||||
@ -571,7 +571,7 @@ abstract class MultiForm extends Form {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getCompletedStepCount() {
|
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;
|
return $steps ? $steps->Count() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class MultiFormObjectDecorator extends DataObjectDecorator {
|
|||||||
&& strpos($query->where[0], "ID = ") !== 0
|
&& strpos($query->where[0], "ID = ") !== 0
|
||||||
&& !$this->wantsTemporary($query)
|
&& !$this->wantsTemporary($query)
|
||||||
) {
|
) {
|
||||||
$query->where[] = "`{$query->from[0]}`.`MultiFormIsTemporary` = 0";
|
$query->where[] = "\"{$query->from[0]}\".\"MultiFormIsTemporary\" = 0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class MultiFormObjectDecorator extends DataObjectDecorator {
|
|||||||
*/
|
*/
|
||||||
protected function wantsTemporary($query) {
|
protected function wantsTemporary($query) {
|
||||||
foreach($query->where as $whereClause) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class MultiFormPurgeTask extends DailyTask {
|
|||||||
protected function getExpiredSessions() {
|
protected function getExpiredSessions() {
|
||||||
return DataObject::get(
|
return DataObject::get(
|
||||||
'MultiFormSession',
|
'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)) {
|
if($this->SessionID && is_numeric($this->SessionID)) {
|
||||||
$nextSteps = $this->stat('next_steps');
|
$nextSteps = $this->stat('next_steps');
|
||||||
if(is_string($nextSteps)) {
|
if(is_string($nextSteps)) {
|
||||||
return DataObject::get_one($nextSteps, "SessionID = {$this->SessionID}");
|
return DataObject::get_one($nextSteps, "\"SessionID\" = {$this->SessionID}");
|
||||||
} elseif(is_array($nextSteps)) {
|
} elseif(is_array($nextSteps)) {
|
||||||
return DataObject::get_one($nextSteps[0], "SessionID = {$this->SessionID}");
|
return DataObject::get_one($nextSteps[0], "\"SessionID\" = {$this->SessionID}");
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ class MultiFormStep extends DataObject {
|
|||||||
* @return String Classname of a {@link MultiFormStep} subclass
|
* @return String Classname of a {@link MultiFormStep} subclass
|
||||||
*/
|
*/
|
||||||
public function getPreviousStep() {
|
public function getPreviousStep() {
|
||||||
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->SessionID}", 'LastEdited DESC');
|
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC');
|
||||||
if($steps) {
|
if($steps) {
|
||||||
foreach($steps as $step) {
|
foreach($steps as $step) {
|
||||||
if($step->getNextStep()) {
|
if($step->getNextStep()) {
|
||||||
@ -281,7 +281,7 @@ class MultiFormStep extends DataObject {
|
|||||||
*/
|
*/
|
||||||
public function getPreviousStepFromDatabase() {
|
public function getPreviousStepFromDatabase() {
|
||||||
if($prevStepClass = $this->getPreviousStep()) {
|
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