From c77830bd2f9c147067865c8517017b557ce0a59d Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 12 Jul 2014 09:43:52 +1200 Subject: [PATCH] Pass submission to finished action. --- code/model/UserDefinedForm.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 251a32a..21a2db6 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -1032,7 +1032,7 @@ JS } $submittedForm->extend('updateAfterProcess'); - + Session::clear("FormInfo.{$form->FormName()}.errors"); Session::clear("FormInfo.{$form->FormName()}.data"); @@ -1052,6 +1052,10 @@ JS Session::set('FormProcessedNum',$randNum); } } + + if(!$this->DisableSaveSubmissions) { + Session::set('userformssubmission'. $this->ID, $submittedForm->ID); + } return $this->redirect($this->Link('finished') . $referrer); } @@ -1063,6 +1067,12 @@ JS * @return ViewableData */ public function finished() { + $submission = Session::get('userformssubmission'. $this->ID); + + if($submission) { + $submission = SubmittedForm::get()->byId($submission); + } + $referrer = isset($_GET['referrer']) ? urldecode($_GET['referrer']) : null; $formProcessed = Session::get('FormProcessed'); @@ -1083,10 +1093,10 @@ JS Session::clear('FormProcessed'); return $this->customise(array( - 'Content' => $this->customise( - array( - 'Link' => $referrer - ))->renderWith('ReceivedFormSubmission'), + 'Content' => $this->customise(array( + 'Submission' => $submission, + 'Link' => $referrer + ))->renderWith('ReceivedFormSubmission'), 'Form' => '', )); } @@ -1245,4 +1255,4 @@ class UserDefinedForm_SubmittedFormEmail extends Email { public function setReplyTo($email) { $this->customHeaders['Reply-To'] = $email; } -} +} \ No newline at end of file