public function init()
 {
     //Claim type element.
     $this->addElement('select', 'claim_type', array('label' => 'Type of claim:', 'required' => true, 'multiOptions' => array('' => self::PLEASE_SELECT), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your claim type', 'notEmptyInvalid' => 'Please select your claim type')))), 'attribs' => array('class' => 'form-control')));
     $claimsManager = new Manager_Insurance_PreviousClaims();
     $claimTypeObjects = $claimsManager->getPreviousClaimTypes(Model_Insurance_ProductNames::LANDLORDSPLUS);
     $claimTypeList = array();
     $claimTypeList[''] = self::PLEASE_SELECT;
     foreach ($claimTypeObjects as $claimType) {
         $id = $claimType->getClaimTypeID();
         $text = $claimType->getClaimTypeText();
         $claimTypeList[$id] = $text;
     }
     //Add the claim types.
     $claimTypesSelect = $this->getElement('claim_type');
     $claimTypesSelect->setMultiOptions($claimTypeList);
     //Claim month element.
     $this->addElement('select', 'claim_month', array('label' => 'Month of claim:', 'required' => true, 'multiOptions' => array('' => self::PLEASE_SELECT, '01' => 'Jan', '02' => 'Feb', '03' => 'Mar', '04' => 'Apr', '05' => 'May', '06' => 'Jun', '07' => 'Jul', '08' => 'Aug', '09' => 'Sep', '10' => 'Oct', '11' => 'Nov', '12' => 'Dec'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your claim month', 'notEmptyInvalid' => 'Please select your claim month')))), 'attribs' => array('class' => 'form-control')));
     $claimYears = array('' => self::PLEASE_SELECT);
     $nowYear = date('Y');
     for ($i = $nowYear; $i >= $nowYear - 5; $i--) {
         $claimYears[$i] = $i;
     }
     $this->addElement('select', 'claim_year', array('label' => 'Year of claim:', 'required' => true, 'multiOptions' => $claimYears, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your claim year', 'notEmptyInvalid' => 'Please select your claim year')))), 'attribs' => array('class' => 'form-control')));
     $this->addElement('text', 'claim_value', array('label' => 'Value of claim:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the claim value', 'notEmptyInvalid' => 'Please enter the claim value'))), array('GreaterThan', true, array('min' => 0, 'messages' => 'Claim value must be above zero'))), 'attribs' => array('data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'currency', 'class' => 'currency form-control')));
     // Add a filter suitable for currency input - this strips anything non-digit and non-decimal point such as pound
     //   symbols and commas
     $claimValue = $this->getElement('claim_value');
     $claimValue->addFilter('callback', function ($v) {
         return preg_replace('/[^\\d\\.]/', '', $v);
     });
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/claims-dialog.phtml'))));
     // Clear the default dt and dd element decorators
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
Esempio n. 2
0
 /**
  * Helper function for generating claims history summary HTML fragment
  *
  * @return string
  */
 public function yourClaims()
 {
     $output = '';
     $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
     // Invoke previous claims manager
     $claimsManager = new Manager_Insurance_PreviousClaims();
     // Fetch all claims
     $claimData = $claimsManager->getPreviousClaims($pageSession->CustomerRefNo);
     // Fetch claim descriptions
     $claimDescriptionsObj = $claimsManager->getPreviousClaimTypes(Model_Insurance_ProductNames::TENANTCONTENTSPLUS);
     // Transform object array into a somewhat more usefully indexed descriptions array
     $claimDescriptions = array();
     foreach ($claimDescriptionsObj as $claimDescriptionObj) {
         $claimDescriptions[$claimDescriptionObj->getClaimTypeID()] = $claimDescriptionObj->getClaimTypeText();
     }
     if (count($claimData) > 0) {
         $output .= '<table class="table table-bordered table-condensed table-possessions">';
         // Container with indent
         $output .= "  <tr>\n";
         // Line container with bottom edge
         $output .= "    <th>Claims you have added to your policy</th>\n";
         $output .= "    <th>Value</th>\n";
         $output .= "    <th></th>\n";
         $output .= "  </tr>\n";
         foreach ($claimData as $key => $claim) {
             $output .= "  <tr>\n";
             // Line container with bottom edge
             $output .= "    <td class=\"description\">" . $claimDescriptions[$claim->getClaimType()->getClaimTypeID()] . '<br />Date: ' . $claim->getClaimMonth() . '/' . $claim->getClaimYear() . "</td>\n";
             $output .= "    <td class=\"price\">&pound;" . number_format($claim->getClaimValue()->getValue()) . "</td>\n";
             $output .= "    <td><a id=\"removeClaim{$key}\" href=\"#\" onclick=\"removeClaimClick({$key}); return false;\" class=\"tertiary-colour\">Remove claim</a></td>\n";
             $output .= "  </tr>\n";
         }
         $output .= '</table>';
     }
     return $output;
 }
 /**
  * Overridden isValid() method for pre-validation code
  *
  * @param array $formData data typically from a POST or GET request
  *
  * @return bool
  */
 public function isValid($formData = array())
 {
     $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
     // Check if this is an AJAX request, and ignore unneeded fields for validation by making them non-mandatory
     if (isset($formData['addClaim']) || isset($formData['removeClaim'])) {
         $this->getElement('declaration1')->setRequired(false);
         $this->getElement('declaration2')->setRequired(false);
         $this->getElement('declaration3')->setRequired(false);
         $this->getElement('declaration4')->setRequired(false);
         $this->getElement('declaration_confirmation')->setRequired(false);
     } else {
         // Not an AJAX request
         // Selectively make details sections mandatory if their corresponding Qs are marked "Yes"
         if (isset($formData['declaration1']) && $formData['declaration1'] == 'yes') {
             $this->getElement('declaration1_details')->setRequired(true);
         }
         if (isset($formData['declaration2']) && $formData['declaration2'] == 'yes') {
             $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
             // Invoke the previous claims manager
             $claimsManager = new Manager_Insurance_PreviousClaims();
             // If no claims have been entered, make the claim input fields mandatory
             if ($claimsManager->countPreviousClaims($pageSession->CustomerRefNo) == 0) {
                 $this->getElement('claim_type')->setRequired(true);
                 $this->getElement('claim_month')->setRequired(true);
                 $this->getElement('claim_year')->setRequired(true);
                 $this->getElement('claim_value')->setRequired(true);
                 $this->getElement('claim_confirm')->setRequired(true);
             }
         }
         if (isset($formData['declaration3']) && $formData['declaration3'] == 'yes') {
             $this->getElement('declaration3_details')->setRequired(true);
         }
         if (isset($formData['declaration4']) && $formData['declaration4'] == 'yes') {
             $this->getElement('declaration4_details')->setRequired(true);
         }
     }
     // Check if a new claim's details is being added and if so make fields mandatory
     if (isset($formData['addClaim']) && $formData['addClaim'] == 1) {
         $this->getElement('claim_type')->setRequired(true);
         $this->getElement('claim_month')->setRequired(true);
         $this->getElement('claim_year')->setRequired(true);
         $this->getElement('claim_value')->setRequired(true);
         $this->getElement('claim_confirm')->setRequired(true);
     }
     // Call original isValid()
     return parent::isValid($formData);
 }
 /**
  * Validate and handle adding and removing claims via AJAX
  *
  * @return void
  */
 public function claimAction()
 {
     $output = array();
     $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
     $ajaxForm = new TenantsInsuranceQuote_Form_Json_Claims();
     $request = $this->getRequest();
     $postdata = $request->getPost();
     $ajaxForm->populate($postdata);
     if ($ajaxForm->isValid($postdata)) {
         // Invoke previous claims manager
         $claimsManager = new Manager_Insurance_PreviousClaims();
         // Check if a new claim's details are being added
         if (isset($postdata['addClaim']) && $postdata['addClaim'] == 1) {
             $cleanData = $ajaxForm->getValues();
             $claim = new Model_Insurance_PreviousClaim();
             $claim->setRefno($pageSession->CustomerRefNo);
             $claimType = new Model_Insurance_PreviousClaimType();
             $claimType->setClaimTypeID($cleanData['subform_importantinformation']['claim_type']);
             $claim->setClaimType($claimType);
             $claim->setClaimMonth($cleanData['subform_importantinformation']['claim_month']);
             $claim->setClaimYear($cleanData['subform_importantinformation']['claim_year']);
             $claim->setClaimValue(new Zend_Currency(array('value' => $cleanData['subform_importantinformation']['claim_value'])));
             $claimsManager->insertPreviousClaim($claim);
         }
         // Check if an existing claim's details are being removed
         if (isset($postdata['removeClaim']) && $postdata['removeClaim'] == 1) {
             // First fetch all claims
             $allClaims = $claimsManager->getPreviousClaims($pageSession->CustomerRefNo);
             // Now iterate through and remove the selected index
             $t_allClaims = array();
             foreach ($allClaims as $key => $claim) {
                 if ($key != $postdata['claimNum']) {
                     $t_allClaims[] = $claim;
                 }
             }
             // Delete all previous claims and replace with new list
             $claimsManager->removeAllPreviousClaims($pageSession->CustomerRefNo);
             $claimsManager->insertPreviousClaims($t_allClaims);
         }
     } else {
     }
     $errorMessages = $ajaxForm->getMessagesFlattened();
     $output['errorJs'] = $errorMessages;
     $output['errorCount'] = count($errorMessages);
     $output['errorHtml'] = $this->view->partial('partials/error-list.phtml', array('errors' => $errorMessages));
     $output['html'] = $this->view->getHelper('yourClaims')->yourClaims();
     echo Zend_Json::encode($output);
 }
 /**
  * Create important information subform
  * @todo the questions in subform-importantinformation.phtml are currently hard coded and should be pulled out of the DB/model
  *
  * @return void
  */
 public function init()
 {
     // Invoke the previous claims manager
     $claimsManager = new Manager_Insurance_PreviousClaims();
     // Create array of claim types
     $claimDescriptions = array('' => '--- please select ---');
     $claimDescriptionsObj = $claimsManager->getPreviousClaimTypes(Model_Insurance_ProductNames::LANDLORDSPLUS);
     foreach ($claimDescriptionsObj as $claimDescriptionObj) {
         $claimTypeId = $claimDescriptionObj->getClaimTypeID();
         $claimDescriptions[$claimTypeId] = $claimDescriptionObj->getClaimTypeText();
     }
     // Add declaration question 1 element
     $this->addElement('radio', 'declaration1', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 1', 'notEmptyInvalid' => 'Please select an answer for declaration question 1'))))));
     // Add declaration question 2 element
     $this->addElement('radio', 'declaration2', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 2', 'notEmptyInvalid' => 'Please select an answer for declaration question 2'))))));
     // Add declaration question 3 element
     $this->addElement('radio', 'declaration3', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 2b', 'notEmptyInvalid' => 'Please select an answer for declaration question 2b'))))));
     // Add declaration question 4 element
     $this->addElement('radio', 'declaration4', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 2c', 'notEmptyInvalid' => 'Please select an answer for declaration question 2c'))))));
     // Add declaration question 5 element
     $this->addElement('radio', 'declaration5', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 2d', 'notEmptyInvalid' => 'Please select an answer for declaration question 2d'))))));
     // Add declaration question 6 element
     $this->addElement('radio', 'declaration6', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 3', 'notEmptyInvalid' => 'Please select an answer for declaration question 3'))))));
     // Add declaration question 7 element
     $this->addElement('radio', 'declaration7', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 4', 'notEmptyInvalid' => 'Please select an answer for declaration question 4'))))));
     // Add declaration question 8 element
     $this->addElement('radio', 'declaration8', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 5', 'notEmptyInvalid' => 'Please select an answer for declaration question 5'))))));
     // Add declaration question 9 element
     $this->addElement('radio', 'declaration9', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 6', 'notEmptyInvalid' => 'Please select an answer for declaration question 6'))))));
     // Add declaration question 10 element
     $this->addElement('radio', 'declaration10', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 7', 'notEmptyInvalid' => 'Please select an answer for declaration question 7'))))));
     // Add declaration question 11 element
     $this->addElement('radio', 'declaration11', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 8', 'notEmptyInvalid' => 'Please select an answer for declaration question 8'))))));
     // Add declaration question 12 element
     $this->addElement('radio', 'declaration12', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 9', 'notEmptyInvalid' => 'Please select an answer for declaration question 9'))))));
     // Add declaration question 13 element
     $this->addElement('radio', 'declaration13', array('label' => '', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for declaration question 10', 'notEmptyInvalid' => 'Please select an answer for declaration question 10'))))));
     /****** ***/
     $this->addElement('hidden', 'additionCheck1', array('required' => false));
     $this->addElement('hidden', 'additionCheck2', array('required' => false));
     $this->addElement('hidden', 'additionCheck3', array('required' => false));
     $this->addElement('hidden', 'additionCheck4', array('required' => false));
     $this->addElement('hidden', 'additionCheck5', array('required' => false));
     $this->addElement('hidden', 'additionCheck6', array('required' => false));
     $this->addElement('hidden', 'additionCheck7', array('required' => false));
     $this->addElement('hidden', 'additionCheck8', array('required' => false));
     $this->addElement('hidden', 'additionCheck9', array('required' => false));
     $this->addElement('hidden', 'additionCheck10', array('required' => false));
     $this->addElement('hidden', 'additionCheck11', array('required' => false));
     $this->addElement('hidden', 'additionCheck12', array('required' => false));
     $this->addElement('hidden', 'additionCheck13', array('required' => false));
     /***** ****/
     // Add declaration confirmation element
     $this->addElement('radio', 'declaration_confirmation', array('required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select an answer for the confirmation statement', 'notEmptyInvalid' => 'Please select an answer for the confirmation statement'))), array('Identical', true, array('token' => 'yes', 'messages' => array('notSame' => 'Please agree to the confirmation statement'))))));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'portfolio-insurance-quote/subforms/important-information.phtml'))));
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
     // Grab view and add the declarations JavaScript into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     /*   $view->headScript()->appendFile(
              '/assets/cms/js/portfolio-insurance-quote/declarations.js',
              'text/javascript'
          );*/
 }
 public function removePreviousClaimAction()
 {
     $request = $this->getRequest();
     $postData = $request->getPost();
     $refNo = $postData['refNo'];
     $month = $postData['month'];
     $year = $postData['year'];
     $value = $postData['value'];
     $typeId = $postData['typeId'];
     //Remove the previous claim identified by the id
     if (!empty($refNo)) {
         $claimsManager = new Manager_Insurance_PreviousClaims();
         //Build a PreviousClaim object to pass to the PreviousClaims manager
         //to delete.
         $previousClaim = new Model_Insurance_PreviousClaim();
         $previousClaim->setRefno($refNo);
         $previousClaim->setClaimMonth($month);
         $previousClaim->setClaimYear($year);
         $value = new Zend_Currency(array('value' => $value, 'precision' => 2));
         $previousClaim->setClaimValue($value);
         $previousClaimTypes = $claimsManager->getPreviousClaimTypes();
         foreach ($previousClaimTypes as $claimType) {
             if ($typeId == $claimType->getClaimTypeID()) {
                 $previousClaim->setClaimType($claimType);
                 break;
             }
         }
         //Finally, remove the previous claim.
         $claimsManager->removePreviousClaim($previousClaim);
     }
     $claimsArray = $claimsManager->getPreviousClaims($refNo);
     $model = array();
     if (!empty($claimsArray)) {
         foreach ($claimsArray as $claim) {
             $model[] = array('claim' => $claim);
         }
     }
     $return = array();
     $return['html'] = $this->view->partialLoop('partials/claims-list.phtml', $model);
     $return['success'] = true;
     echo Zend_Json::encode($return);
 }
 /**
  * Handles the previous claims pop-up on the Underwriting questions form.
  */
 public function claimsDialogAction()
 {
     $claimsDialogForm = new LandlordsInsuranceQuote_Form_ClaimsDialog();
     // This controller is called within a popup (facebox style) so doesn't require a layout file
     $this->_helper->getHelper('layout')->disableLayout();
     $this->view->form = $claimsDialogForm;
     //Get the customer reference number and use this to retrieve all previous claims.
     $session = new Zend_Session_Namespace('landlords_insurance_quote');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
     $customerReferenceNumber = $quoteManager->getLegacyCustomerReference();
     $claimsManager = new Manager_Insurance_PreviousClaims();
     $claimsArray = $claimsManager->getPreviousClaims($customerReferenceNumber);
     //Display the previous claims on the dialog.
     $model = array();
     if (!empty($claimsArray)) {
         foreach ($claimsArray as $claim) {
             $model[] = array('claim' => $claim);
         }
     }
     $this->view->claimsList = $model;
 }
 public function isValid($formData)
 {
     //We only need additional information if some questions have been answered wrongly.
     $additionalInfoIsRequired = false;
     if (!empty($formData['declaration2']) && $formData['declaration2'] == 'no') {
         $additionalInfoIsRequired = true;
     } else {
         if (!empty($formData['declaration2b']) && $formData['declaration2b'] == 'no') {
             $additionalInfoIsRequired = true;
         } else {
             if (!empty($formData['declaration2c']) && $formData['declaration2c'] == 'yes') {
                 $additionalInfoIsRequired = true;
             } else {
                 if (!empty($formData['declaration2d']) && $formData['declaration2d'] == 'yes') {
                     $additionalInfoIsRequired = true;
                 } else {
                     if (!empty($formData['declaration3']) && $formData['declaration3'] == 'no') {
                         $additionalInfoIsRequired = true;
                     } else {
                         if (!empty($formData['declaration4']) && $formData['declaration4'] == 'no') {
                             $additionalInfoIsRequired = true;
                         } else {
                             if (!empty($formData['declaration6']) && $formData['declaration6'] == 'yes') {
                                 $additionalInfoIsRequired = true;
                             } else {
                                 if (!empty($formData['declaration8']) && $formData['declaration8'] == 'yes') {
                                     $additionalInfoIsRequired = true;
                                 } else {
                                     if (!empty($formData['declaration9']) && $formData['declaration9'] == 'yes') {
                                         $additionalInfoIsRequired = true;
                                     } else {
                                         if (!empty($formData['declaration10']) && $formData['declaration10'] == 'no') {
                                             $additionalInfoIsRequired = true;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($additionalInfoIsRequired) {
         $this->getElement('additional_information')->setRequired(true);
     } else {
         $this->getElement('additional_information')->setRequired(false);
     }
     //Superclass validations
     $returnVal = parent::isValid($formData);
     //Some compound processing. If the user has advised they have previous claims, then they must provide
     //details of these. Ensure this is the case.
     $session = new Zend_Session_Namespace('landlords_insurance_quote');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
     $customerReferenceNumber = $quoteManager->getLegacyCustomerReference();
     $policyNumber = $quoteManager->getLegacyID();
     if (!empty($formData['declaration7'])) {
         if ($formData['declaration7'] == 'yes') {
             //One or more previous claims must exist.
             $claimsManager = new Manager_Insurance_PreviousClaims();
             $previousClaims = $claimsManager->getPreviousClaims($customerReferenceNumber);
             if (empty($previousClaims)) {
                 //Record error.
                 $this->declaration7->addError('Please provide details of previous claims');
                 $returnVal = false;
             }
         }
     }
     //If the user advised they have bank interest, then they must provide details of these.
     //Ensure this is the case.
     if (!empty($formData['declaration11'])) {
         if ($formData['declaration11'] == 'yes') {
             //One or more bank interests.
             $bankInterestManager = new Manager_Insurance_LegacyBankInterest();
             $bankInterestArray = $bankInterestManager->getAllInterests($policyNumber, $customerReferenceNumber);
             if (empty($bankInterestArray)) {
                 //Record error.
                 $this->declaration11->addError('Please provide details of bank interest');
                 $returnVal = false;
             }
         }
     }
     return $returnVal;
 }