From 2574126d1fae388e7a149e9e68c2168a3eb6efc8 Mon Sep 17 00:00:00 2001 From: Lauren Hodgson Date: Fri, 29 Nov 2019 12:14:46 +1300 Subject: [PATCH] Add check if current step doesn't exist and no session current step then get the current step --- src/Forms/MultiForm.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Forms/MultiForm.php b/src/Forms/MultiForm.php index 70ec2c3..8bb0aee 100644 --- a/src/Forms/MultiForm.php +++ b/src/Forms/MultiForm.php @@ -229,14 +229,14 @@ abstract class MultiForm extends Form $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(); }