Exemplo n.º 1
0
 /**
  * Public function to save
  *
  * @param Model_Insurance_Portfolio_Property $data The Data to be saved
  * return int The last insert id
  */
 public function save($data)
 {
     #	Zend_Debug::dump($data);die();
     $property = new Datasource_Insurance_Portfolio_Property();
     $dsBuildingsRiskArea = new Datasource_Insurance_RiskAreas_Buildings();
     $dsContentsRiskArea = new Datasource_Insurance_RiskAreas_LandlordsContents();
     $data->buildingsRiskArea = $dsBuildingsRiskArea->getCurrentRate($data->postcode);
     $data->contentsRiskArea = $dsContentsRiskArea->getCurrentRate($data->postcode);
     return $property->save($data);
 }
Exemplo n.º 2
0
 /**
  * This will convert all the new data into the old lagacy tables
  * @param
  * @return
  * @author John Burrin
  * @since 1.3
  *
  * Munten ergo sum
  */
 public function convertLegacy($refNo)
 {
     // fetch quote premiums
     $premiums = $this->quote($refNo);
     // Fetch the Landlords details
     $landlord = new Manager_Insurance_Portfolio_LegacyCustomer();
     $landlordDetails = $landlord->fetchByRefNo($refNo);
     // Fetch all the properties
     $propertyManager = new Manager_Insurance_Portfolio_Property();
     $propertyObject = new Model_Insurance_Portfolio_Property();
     $propertyObject = $propertyManager->fetchAllProperties($refNo);
     // populate the legacy portfoliostat table
     $legacyPortfolioStat = new Model_Insurance_Portfolio_LegacyPortfolio();
     $legacyPortfolioStat->agentSchemeNo = 1403796;
     // $legacyPortfolioStat->csuId = "";
     $legacyPortfolioStat->customerRefNo = "";
     $legacyPortfolioStat->date = date("Y-m-d");
     $legacyPortfolioStat->email = $landlordDetails['email_address'];
     $legacyPortfolioStat->heardFrom = "";
     $legacyPortfolioStat->hpc = "";
     $legacyPortfolioStat->name = $landlordDetails['first_name'] . " " . $landlordDetails['last_name'];
     $legacyPortfolioStat->numOfHouse = count($propertyObject);
     $legacyPortfolioStat->policyNumber = "";
     $legacyPortfolioStat->quote = $premiums['premiums']['UserQuoteAnnualPremium'];
     $legacyPortfolioStat->referred = "";
     $legacyPortfolioStat->refNo = $refNo;
     $legacyPortfolioStat->telephone = $landlordDetails['telephone1'];
     // Set up datasources to the risk areas
     $dsBuildingsRiskArea = new Datasource_Insurance_RiskAreas_Buildings();
     $dsContentsRiskArea = new Datasource_Insurance_RiskAreas_LandlordsContents();
     //Save the portfoliostat data
     $legacyPortfolioManager = new Manager_Insurance_Portfolio_LegacyPortfolio();
     $legacyPortfolioManager->save($legacyPortfolioStat);
     $idd = new Datasource_Insurance_IddSupport();
     if (!$idd->isIddSupport($legacyPortfolioStat->refNo)) {
         $inserArray = array();
         $insertArray['policynumber'] = $legacyPortfolioStat->refNo;
         $insertArray['agentschemeno'] = $legacyPortfolioStat->agentSchemeNo;
         $insertArray['csuid'] = 0;
         $fsaAgentStatusDatasource = new Datasource_Fsa_AgentStatus();
         $fsaStatus = $fsaAgentStatusDatasource->getAgentFsaStatus($legacyPortfolioStat->agentSchemeNo);
         if (isset($fsaStatus['status_abbr'])) {
             $insertArray['FSA_status'] = $fsaStatus['status_abbr'];
         } else {
             $insertArray['FSA_status'] = "";
         }
         $insertArray['origsaleid'] = 9;
         $insertArray['callerid'] = 2;
         $idd->setIddSupport($insertArray);
     }
     // Setup an agent manager
     $agent = new Manager_Core_Agent();
     // get polict options
     $ds_rates = new Datasource_Insurance_Portfolio_PortfolioRates();
     $rates = $ds_rates->fetchRates();
     $optionsString = $this->_getPolicyOptions();
     // Save the property data into the legacy portfolio table
     $legacyPropertyManager = new Manager_Insurance_Portfolio_LegacyProperty();
     foreach ($propertyObject as $property) {
         // Create a new Model_Insurance_Portfolio_LegacyProperty Object
         $legacyPropertyObject = new Model_Insurance_Portfolio_LegacyProperty();
         $legacyPropertyObject->amountsCovered = $this->_getAmountsCovered($property);
         $legacyPropertyObject->discount = "";
         $legacyPropertyObject->excessId = "";
         $legacyPropertyObject->ipt = "";
         $legacyPropertyObject->optionDiscounts = "";
         $legacyPropertyObject->optionPremiums = "";
         $legacyPropertyObject->policyNumber = $refNo;
         $legacyPropertyObject->policyOptions = $optionsString;
         $legacyPropertyObject->premium = "";
         $legacyPropertyObject->propAddress1 = $property->address1;
         $legacyPropertyObject->propAddress3 = $property->address2;
         $legacyPropertyObject->propAddress5 = $property->address3;
         $legacyPropertyObject->propPostcode = $property->postcode;
         $legacyPropertyObject->quote = 0.0;
         $legacyPropertyObject->rateSetId = $agent->getRatesetIDByASN($refNo);
         $legacyPropertyObject->riskArea = $dsContentsRiskArea->getCurrentRate($property['postcode']);
         $legacyPropertyObject->riskAreaB = $dsBuildingsRiskArea->getCurrentRate($property['postcode']);
         $legacyPropertyObject->surcharge = "";
         $legacyPropertyManager->save($legacyPropertyObject);
     }
 }