/** * Initialise the step 5 form * * @return void */ public function step5Action() { $pageForm = new TenantsInsuranceQuoteB_Form_Step5(); // Tell page to use AJAX validation as we go $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = 5;'); if ($this->getRequest()->isPost()) { $valid = $this->_formStepCommonValidate($pageForm, 5); if ($valid) { // $feeData = new Model_Insurance_Fee(); // $fees = new Manager_Insurance_Fee(); // $feeData = $fees->fetchFeesByRateSetId(45); $quoteManager = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $this->_policyNumber); $data = $pageForm->getValues(); $payBy = $data['subform_paymentselection']['payment_method'] == 'dd' ? "DirectDebit" : "CreditCard"; $quoteManager->setPayMethod($payBy); $quoteManager->setPayBy($data['subform_paymentselection']['payment_frequency']); $premiums = $quoteManager->calculatePremiums(); $quoteManager->setPolicyTerm(); $session = new Zend_Session_Namespace('homelet_global'); /* Save the csu and the quote number in the MI tables */ $generatedByData = new Model_Core_ManagementInformation_GeneratedBy(); $generatedByData->csuId = $session->csu; $generatedByData->policyNumber = $this->_policyNumber; $generatedBy = new Manager_Core_ManagementInformation(); $generatedBy->saveGeneratedBy($generatedByData); $this->_formStepCommonNavigate(5); return; } elseif (isset($_POST['back'])) { $this->_formStepCommonNavigate(5); return; } } // Load the element data from the database if we can if ($this->_formStepCommonPopulate($pageForm, 5)) { // Render the page unless we have been redirected $this->view->form = $pageForm; $this->render('step'); } }