diff --git a/README.md b/README.md index 8650154..da507a2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # MultiForm Module -[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-multiform.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-multiform) +[![Build Status](https://api.travis-ci.org/silverstripe/silverstripe-multiform.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-multiform) +[![Latest Stable Version](https://poser.pugx.org/silverstripe/multiform/version.svg)](https://github.com/silverstripe/silverstripe-multiform/releases) +[![Latest Unstable Version](https://poser.pugx.org/silverstripe/multiform/v/unstable.svg)](https://packagist.org/packages/silverstripe/multiform) +[![Total Downloads](https://poser.pugx.org/silverstripe/multiform/downloads.svg)](https://packagist.org/packages/silverstripe/multiform) +[![License](https://poser.pugx.org/silverstripe/multiform/license.svg)](https://github.com/silverstripe/silverstripe-multiform/blob/master/license.md) ## Introduction diff --git a/code/model/MultiForm.php b/code/model/MultiForm.php index 7bd0d00..8a3978a 100644 --- a/code/model/MultiForm.php +++ b/code/model/MultiForm.php @@ -54,6 +54,7 @@ abstract class MultiForm extends Form { * @var string */ private static $get_var = 'MultiFormSessionID'; + /** * These fields are ignored when saving the raw form data into session. * This ensures only field data is saved, and nothing else that's useless @@ -205,9 +206,15 @@ abstract class MultiForm extends Form { // Determine whether we use the current step, or create one if it doesn't exist $currentStep = null; - if(isset($_GET['StepID'])) { - $stepID = (int)$_GET['StepID']; - $currentStep = DataObject::get_one('MultiFormStep', "\"SessionID\" = {$this->session->ID} AND \"ID\" = {$stepID}"); + $StepID = $this->controller->request->getVar('StepID'); + if(isset($StepID)) { + $currentStep = DataObject::get_one( + 'MultiFormStep', + array( + 'SessionID' => $this->session->ID, + 'ID' => $StepID + ) + ); } elseif($this->session->CurrentStepID) { $currentStep = $this->session->CurrentStep(); } @@ -594,12 +601,15 @@ abstract class MultiForm extends Form { $firstStep = DataObject::get_one(static::$start_step, "\"SessionID\" = {$this->session->ID}"); $firstStep->LinkingMode = ($firstStep->ID == $this->getCurrentStep()->ID) ? 'current' : 'link'; - $firstStep->addExtraClass('completed'); $firstStep->setForm($this); $stepsFound->push($firstStep); // mark the further steps as non-completed if the first step is the current - if ($firstStep->ID == $this->getCurrentStep()->ID) $this->currentStepHasBeenFound = true; + if ($firstStep->ID == $this->getCurrentStep()->ID) { + $this->currentStepHasBeenFound = true; + } else { + $firstStep->addExtraClass('completed'); + } $this->getAllStepsRecursive($firstStep, $stepsFound); diff --git a/license.md b/license.md index f22af3f..9445c8e 100644 --- a/license.md +++ b/license.md @@ -1,4 +1,4 @@ -Copyright (c) 2015, SilverStripe Limited +Copyright (c) 2016, SilverStripe Limited All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: