/**
  * Use this method to determine if the flood endorsement can be optionally swapped for a loading. 
  *
  * @param string $postCode
  * The postcode to test.
  *
  * @return boolean
  * Returns true/false according to whether or not the flood endorsement is optional on the
  * postcode passed in.
  */
 public function getIsFloodEndorsementOptional($postCode)
 {
     $params = Zend_Registry::get('params');
     $uwTermsDatasource = new Datasource_Insurance_LandlordsPlus_Terms();
     $floodScore = $uwTermsDatasource->getFloodRiskScore($postCode);
     if ($floodScore == $params->uw->et->landlordsp->optional->floodExclusion->score) {
         $returnVal = true;
     } else {
         $returnVal = false;
     }
     return $returnVal;
 }
 /**
  * Checks the underwriting answers.
  */
 protected function _checkAnswers($quoteId)
 {
     $params = Zend_Registry::get('params');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($quoteId);
     $policyNumber = $quoteManager->getLegacyID();
     $property = $quoteManager->getProperties();
     $postCode = $property[0]['postcode'];
     $referralReasons = array();
     //Test 3: Answering the underwriting questions.
     $answersManager = new Manager_Insurance_Answers();
     $answersArray = $answersManager->getUnderwritingAnswers($policyNumber);
     if (empty($answersArray)) {
         //You can't process for referral if no underwriting answers have first been provided.
         throw new Zend_Exception(get_class() . __FUNCTION__ . ": no underwriting answers provided.");
     }
     for ($i = 0; $i < count($answersArray); $i++) {
         $answerGiven = $answersArray[$i]->getAnswer();
         $expectedAnswer = $answersArray[$i]->getExpectedAnswer();
         $questionNumber = $answersArray[$i]->getQuestionNumber();
         //Process questions 53, 60, 61 specially.
         if ($questionNumber == '53') {
             continue;
         }
         //Question 6 is dealt with specially.
         if ($questionNumber == '60') {
             if ($answerGiven == Model_Insurance_Answer::YES) {
                 //Check the extra args.
                 $underwritingTerms = new Datasource_Insurance_LandlordsPlus_Terms();
                 $subsidenceScore = $underwritingTerms->getSubsidenceRiskScore($postCode);
                 if ($subsidenceScore == 0) {
                     $referralReasons[] = $params->uw->rr->landlordsp->answer;
                 }
             }
             continue;
         }
         if ($questionNumber == '61') {
             //Question 7 is the previous claims answer. The outcome of this is determiend by the
             //previous claims logic in the checkUwReferralState() method.
             continue;
         }
         //This is the referencing question. Some calls to this method may want this answer to
         //be ignored.
         if ($questionNumber == '64' && $this->_ignoreReferencingQuestion) {
             continue;
         }
         //All other questions should be processed here.
         if ($expectedAnswer == Model_Insurance_Answer::YES || $expectedAnswer == Model_Insurance_Answer::NO) {
             if ($answerGiven != $expectedAnswer) {
                 print "HERE2 {$questionNumber}<BR>";
                 $referralReasons[] = $params->uw->rr->landlordsp->answer;
             }
         }
     }
     //Return the results consistent with this method's contract.
     if (empty($referralReasons)) {
         $returnVal = null;
     } else {
         $returnVal = $referralReasons;
     }
     return $returnVal;
 }