Skip to content

Commit

Permalink
Add check if current step doesn't exist and no session current step t…
Browse files Browse the repository at this point in the history
…hen get the current step
  • Loading branch information
Lolly101 committed Nov 28, 2019
1 parent a57bfe7 commit 2574126
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Forms/MultiForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ public function getCurrentStep()
$currentStep = null;
$StepID = $this->controller->getRequest()->getVar('StepID');
if (isset($StepID)) {
$currentStep = DataObject::get_one(
MultiFormStep::class,
[
'SessionID' => $this->session->ID,
'ID' => $StepID
]
);
} elseif ($this->session->CurrentStepID) {
$currentStep = MultiFormStep::get()->filter([
'SessionID' => $this->session->ID,
'ID' => $StepID
])->first();
}

// if current step doesn't exist and no session current step then get the current step
if (!$currentStep && $this->session->CurrentStepID) {
$currentStep = $this->session->CurrentStep();
}

Expand Down

0 comments on commit 2574126

Please sign in to comment.