/**
  *Step 5 Action
  * @param
  * @return
  * @author John Burrin
  * @since
  */
 public function step5Action()
 {
     $pageSession = new Zend_Session_Namespace('portfolio_insurance_quote');
     $pageForm = new Form_PortfolioInsuranceQuote_Step5();
     if ($this->_formStepCommonPopulate($pageForm, 5)) {
         $quoteManager = new Manager_Insurance_Portfolio_Quote();
         $quoteData = $quoteManager->quote($this->_customerReferenceNumber);
         $this->_doMail($quoteData);
         // Want to capture all the data and shove it all the old tables (Muntify)
         $quoteManager->convertLegacy($this->_customerReferenceNumber);
         //Update the WebLead summary and create a STEP4 blob.
         $webLeadManager = new Manager_Core_WebLead();
         $webLeadSummary = $webLeadManager->getSummary($pageSession->webLeadSummaryId);
         $webLeadSummary->lastUpdatedTime = $this->_offsetDate();
         $webLeadManager->updateSummary($webLeadSummary);
         //Determine if a new STEP5 blob needs to be created, or an existing one retrieved.
         if ($webLeadManager->getBlobExists($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP5)) {
             $webLeadBlob = $webLeadManager->getBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP5);
         } else {
             $webLeadBlob = $webLeadManager->createNewBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP5);
         }
         //Update the blob and store
         $webLeadBlob->blob = Zend_Json::encode($_POST);
         $webLeadBlob->blobChecksum = crc32($webLeadBlob->blob);
         $webLeadManager->updateBlob($webLeadBlob);
         if ($quoteData['referred'] == true) {
             $this->_helper->redirector->gotoUrl('/portfolio/insurance-quote/referred');
         } else {
             $this->_helper->redirector->gotoUrl('/portfolio/insurance-quote/complete');
         }
         exit;
     }
 }
Ejemplo n.º 2
0
 public function step4Action()
 {
     $pageForm = new LandlordsInsuranceQuote_Form_Step4();
     // Tell page to use AJAX validation as we go
     $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = 4;');
     // Check to make sure the user has actually added a product - if they haven't stop them going forward
     $session = new Zend_Session_Namespace('landlords_insurance_quote');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
     if ($quoteManager->productCount() == 0 && !isset($_POST['back'])) {
         $this->view->stepNum = "no-product";
         // AJD - Not happy about this, but it's the way HLF was built.
         $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
         $policyNumber = $quoteManager->getLegacyID();
         $this->view->quoteID = $policyNumber;
         $this->render('no-cover-selected');
         return;
     } elseif ($quoteManager->productCount() == 0 && isset($_POST['back'])) {
         // No products/options selected, send them back to step 2
         $this->_helper->redirector->gotoUrl('/landlords/insurance-quote/step2');
         return;
     } elseif ($this->getRequest()->isPost()) {
         // We need to validate and save the data
         $valid = $this->_formStepCommonValidate($pageForm, 4);
         if ($valid) {
             //Update the WebLead summary and create a STEP4 blob.
             $session = new Zend_Session_Namespace('landlords_insurance_quote');
             $webLeadManager = new Manager_Core_WebLead();
             $webLeadSummary = $webLeadManager->getSummary($session->webLeadSummaryId);
             $webLeadSummary->lastUpdatedTime = $this->_offsetDate();
             $webLeadManager->updateSummary($webLeadSummary);
             //Determine if a new STEP4 blob needs to be created, or an existing one retrieved.
             if ($webLeadManager->getBlobExists($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP4)) {
                 $webLeadBlob = $webLeadManager->getBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP4);
             } else {
                 $webLeadBlob = $webLeadManager->createNewBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP4);
             }
             //Update the blob and store
             $webLeadBlob->blob = Zend_Json::encode($_POST);
             $webLeadBlob->blobChecksum = crc32($webLeadBlob->blob);
             $webLeadManager->updateBlob($webLeadBlob);
             //Store the underwriting datas not already stored.
             $pageForm->applyAnswersLogics();
             $pageForm->applyAdditionalInformationLogics();
             $endorsementManager = new Manager_Insurance_LandlordsPlus_Endorsement();
             $endorsements = $endorsementManager->getEndorsementsRequired($session->quoteID);
             //Look for a flood endorsement, and if found, identify if it is applicable (the
             //customer may have chosen to pay a premium to cover flood).
             $finalEndorsementArray = array();
             foreach ($endorsements as $currentEndorsement) {
                 if ($currentEndorsement->getEndorsementType()->getName() == Model_Insurance_EndorsementTypes::FLOOD_EXCLUSION) {
                     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
                     $propertiesArray = $quoteManager->getProperties();
                     if ($propertiesArray[0]['exclude_flood_cover'] == 0) {
                         //Flood cover IS provided, which means the endorsement is not applicable.
                         continue;
                     }
                 }
                 if ($endorsementManager->getIsEndorsementAlreadyApplied($currentEndorsement)) {
                     //No need to add the endorsement again...
                     continue;
                 }
                 $finalEndorsementArray[] = $currentEndorsement;
             }
             if (count($finalEndorsementArray) > 0) {
                 $endorsementManager->insertEndorsements($finalEndorsementArray);
             }
             //Execute the underwriting referral logics.
             $referralManager = new Manager_Insurance_LandlordsPlus_Referral();
             $reasons = $referralManager->getReferralReasons($session->quoteID);
             if (!empty($reasons)) {
                 // Notify Underwriting of the referral.
                 $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
                 $policyNumber = $quoteManager->getLegacyID();
                 $refNo = $quoteManager->getLegacyCustomerReference();
                 $notificationManager = new Manager_Core_Notification();
                 $notesManager = new Manager_Core_Notes();
                 $otherReason = '';
                 for ($i = 0; $i < count($reasons); $i++) {
                     if ('Referral due to buildings type' === $reasons[$i]) {
                         $otherReason = "Policy has been referred due to property type of Other.";
                         break;
                     }
                 }
                 if ($otherReason) {
                     $notesManager->save($policyNumber, "Refer to UW - " . $otherReason);
                     $notificationManager->_reason = "Other";
                 } else {
                     $notesManager->save($policyNumber, "Refer to UW - The application has fallen outside UW criteria.");
                 }
                 $notificationManager->notifyUnderwriting($policyNumber, $refNo);
                 $referralManager->setToRefer($session->quoteID);
                 //Redirect to referredAction.
                 $this->_helper->redirector->gotoUrl('/landlords/insurance-quote/referred');
                 return;
             }
             // Everything has been saved ok so navigate to next step
             $this->_formStepCommonNavigate(4);
             return;
         } elseif (isset($_POST['back'])) {
             $this->_formStepCommonNavigate(4);
             return;
         }
     }
     // If there's no quote manager, then set it up so we can make use of the
     // QHLI in the templates.
     if (!isset($quoteManager)) {
         $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
     }
     $this->view->qhli = $quoteManager->getLegacyID();
     // Load the element data from the database if we can
     if ($this->_formStepCommonPopulate($pageForm, 4)) {
         // Render the page unless we have been redirected
         $this->view->form = $pageForm;
         $this->render('step');
     }
 }
Ejemplo n.º 3
0
 /**
  * Validates the underwriting state, then proceeds to the Step 4 form.
  *
  * Long desc.
  *
  * Populate this step with the underwriting
  */
 public function step4Action()
 {
     $pageForm = new TenantsInsuranceQuoteB_Form_Step4();
     // Tell page to use AJAX validation as we go
     $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = 4;');
     /*
     			Moved this here as the validation and advance to next page was being processed before back
     			therefore a back on a valid page went forward
     */
     if (isset($_POST['back'])) {
         $this->_formStepCommonNavigate(4);
         return;
     }
     if ($this->getRequest()->isPost()) {
         $valid = $this->_formStepCommonValidate($pageForm, 4);
         if ($valid) {
             //Update the WebLead summary and create a STEP4 blob.
             $webLeadManager = new Manager_Core_WebLead();
             $webLeadSummary = $webLeadManager->getSummary($this->_webLeadSummaryId);
             $webLeadSummary->lastUpdatedTime = $this->_offsetDate();
             $webLeadManager->updateSummary($webLeadSummary);
             //Determine if a new STEP4 blob needs to be created, or an existing one retrieved.
             if ($webLeadManager->getBlobExists($this->_webLeadSummaryId, Model_Core_WebLeadStep::STEP4)) {
                 $webLeadBlob = $webLeadManager->getBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP4);
             } else {
                 $webLeadBlob = $webLeadManager->createNewBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP4);
             }
             //Update the blob and store
             $webLeadBlob->blob = Zend_Json::encode($_POST);
             $webLeadBlob->blobChecksum = crc32($webLeadBlob->blob);
             $webLeadManager->updateBlob($webLeadBlob);
             //Specialized validation of the underwriting inputs.
             $proceed = $this->_processUnderwriting($pageForm);
             if (!$proceed) {
                 //If the quote has been referred, do nothing further.
                 // Redirect the browser to the quote referred page
                 $this->_helper->redirector->gotoUrl('/tenants/insurance-quote-b/referred');
                 return;
             }
             // Everything has been saved ok so navigate to next step
             $this->_formStepCommonNavigate(4);
             return;
         }
     }
     // Load the element data from the database if we can
     if ($this->_formStepCommonPopulate($pageForm, 4)) {
         // Render the page unless we have been redirected
         $this->view->form = $pageForm;
         $this->render('step');
     }
 }
Ejemplo n.º 4
0
 /**
  * Initialise the step 3 form [Important Information Form]
  *
  * @return void
  */
 public function step3Action()
 {
     // First of all check that this form should be viewable and the user isn't trying to skip ahead
     // This step has the check explicitly early otherwise it can fall over with trying to invoke the customer
     //   manager etc
     if (!$this->checkPageAccessAllowed(3)) {
         return false;
     }
     $pageForm = new TenantsInsuranceQuote_Form_Step3();
     // Tell page to use AJAX validation as we go
     $this->view->headScript()->appendScript('var ajaxValidate = true; var ajaxValidatePage = 3;');
     //Update the WebLead summary and create a STEP3 blob.
     $webLeadManager = new Manager_Core_WebLead();
     $webLeadSummary = $webLeadManager->getSummary($this->_webLeadSummaryId);
     $this->view->qhli = $webLeadSummary->quoteNumber;
     if ($this->getRequest()->isPost()) {
         $valid = $this->_formStepCommonValidate($pageForm, 3);
         if ($valid) {
             $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
             $pageSession->IsNewCustomer = false;
             $data = $pageForm->getValues();
             $webLeadSummary->lastUpdatedTime = $this->_offsetDate();
             $webLeadSummary->promotionCode = $data["subform_howhear"]['campaign_code'];
             $webLeadManager->updateSummary($webLeadSummary);
             //Determine if a new STEP3 blob needs to be created, or an existing one retrieved.
             if ($webLeadManager->getBlobExists($this->_webLeadSummaryId, Model_Core_WebLeadStep::STEP3)) {
                 $webLeadBlob = $webLeadManager->getBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP3);
             } else {
                 $webLeadBlob = $webLeadManager->createNewBlob($webLeadSummary->webLeadSummaryId, Model_Core_WebLeadStep::STEP3);
             }
             //Update the blob and store
             $webLeadBlob->blob = Zend_Json::encode($_POST);
             $webLeadBlob->blobChecksum = crc32($webLeadBlob->blob);
             $webLeadManager->updateBlob($webLeadBlob);
             //Specialized validation of the underwriting inputs.
             $proceed = $this->_processUnderwriting($pageForm);
             if (!$proceed) {
                 //If the quote has been referred, do nothing further.
                 // Redirect the browser to the quote referred page
                 $this->_helper->redirector->gotoUrl('/tenants/insurance-quote/referred');
                 return;
             }
             // Save MI information - how did you hear about us
             $marketQuestion = new Manager_Core_ManagementInformation();
             $marketQuestion->saveMarketingAnswers($this->_policyNumber, $this->_customerReferenceNumber, $data["subform_howhear"]["how_hear"]);
             // Everything has been saved OK so navigate to next step
             $this->_formStepCommonNavigate(3);
             return;
         } elseif (isset($_POST['back'])) {
             $this->_formStepCommonNavigate(3);
             return;
         }
     }
     // Load the element data from the database if we can
     if ($this->_formStepCommonPopulate($pageForm, 3)) {
         // Render the page unless we have been redirected
         $this->view->form = $pageForm;
         $this->render('step');
     }
 }