public function getOptions()
 {
     $type = 'T';
     // We just want Tenants options from the datasource
     $optionsDatasource = new Datasource_Insurance_Policy_Options($type);
     $options = $optionsDatasource->fetchOptions();
     $returnArray = array();
     foreach ($options as $option) {
         // Filter for just the options which are relevant to tenants contents PLUS product
         if (substr($option->policyOption, -1) == "p") {
             $returnArray[] = $option->policyOption;
             //$returnArray[]['minimumSumInsured'] =  $option->minimumSumInsured;
         }
     }
     return $returnArray;
 }
Exemple #2
0
 /**
  * Set cover amount
  *
  * @param int $sumInsured
  * @return void
  */
 public function setCoverAmount($sumInsured, $type)
 {
     // Get the current amounts covered
     $amountsCovered = explode('|', $this->_quoteModel->amountsCovered);
     $amountsCovered[$type] = $sumInsured;
     $this->_quoteModel->amountsCovered = implode('|', $amountsCovered);
     // Re-calculate priced
     $this->calculatePremiums();
     if (!is_null($this->_quoteModel->policyNumber) && $this->_quoteModel->policyNumber != '') {
         // We have a policy number so we need to update the legacy policy cover table
         $optionPremiums = explode('|', $this->_quoteModel->optionPremiums);
         // We also have to update the legacy policy cover table
         $policyCover = new Datasource_Insurance_Policy_Cover();
         $policyOptions = new Datasource_Insurance_Policy_Options('T');
         $options = $policyOptions->fetchOptions();
         $optionIDsArray = array();
         foreach ($options as $option) {
             $optionIDsArray[$option->policyOption] = $option->policyOptionID;
         }
         // Contents cover
         $coverArray[] = array('policyOptionID' => $optionIDsArray['contentstp'], 'sumInsured' => is_null($amountsCovered[self::CONTENTS]) ? 0 : $amountsCovered[self::CONTENTS], 'premium' => is_null($optionPremiums[self::CONTENTS]) ? 0 : $optionPremiums[self::CONTENTS], 'policyNumber' => $this->_quoteModel->policyNumber);
         $coverArray[] = array('policyOptionID' => $optionIDsArray['pedalcyclesp'], 'sumInsured' => is_null($amountsCovered[self::PEDALCYCLES]) ? 0 : $amountsCovered[self::PEDALCYCLES], 'premium' => is_null($optionPremiums[self::PEDALCYCLES]) ? 0 : $optionPremiums[self::PEDALCYCLES], 'policyNumber' => $this->_quoteModel->policyNumber);
         $coverArray[] = array('policyOptionID' => $optionIDsArray['specpossessionsp'], 'sumInsured' => is_null($amountsCovered[self::SPECIFIEDPOSSESSIONS]) ? 0 : $amountsCovered[self::SPECIFIEDPOSSESSIONS], 'premium' => is_null($optionPremiums[self::SPECIFIEDPOSSESSIONS]) ? 0 : $optionPremiums[self::SPECIFIEDPOSSESSIONS], 'policyNumber' => $this->_quoteModel->policyNumber);
         $coverArray[] = array('policyOptionID' => $optionIDsArray['possessionsp'], 'sumInsured' => is_null($amountsCovered[self::UNSPECIFIEDPOSSESSIONS]) ? 0 : $amountsCovered[self::UNSPECIFIEDPOSSESSIONS], 'premium' => is_null($optionPremiums[self::UNSPECIFIEDPOSSESSIONS]) ? 0 : $optionPremiums[self::UNSPECIFIEDPOSSESSIONS], 'policyNumber' => $this->_quoteModel->policyNumber);
         $policyCover->setCover($this->_quoteModel->policyNumber, $coverArray);
     }
     $this->_save();
 }