/**
  * Fetch a quote by its quote number.
  *
  * @param string $quoteNumber
  * @return Model_Insurance_LegacyQuote
  */
 public function getQuoteByPolicyNumber($quoteNumber)
 {
     if (null == $this->_legacyQuotes) {
         $this->_legacyQuotes = new Datasource_Insurance_LegacyQuotes();
     }
     return $this->_legacyQuotes->getByPolicyNumber($quoteNumber);
 }
 /**
  * View quote documents
  *
  * @return void
  */
 public function quotesViewDocumentsAction()
 {
     $quoteDocuments = array();
     $this->_setMetaTitle('View Documents');
     $this->view->isAjaxRequest = $this->getRequest()->isXmlHttpRequest();
     if ($this->view->isAjaxRequest) {
         $this->_helper->getHelper('layout')->disableLayout();
     }
     $request = $this->getRequest();
     $quoteNumber = base64_decode($request->getParam('policy_number'));
     // Get the customer session
     $customerSession = $this->auth->getStorage()->read();
     // Get the request policy
     $legacyPolicies = new Datasource_Insurance_LegacyQuotes();
     $quote = $legacyPolicies->getByPolicyNumber($quoteNumber);
     if ($quote) {
         // Check the policy customer refno is linked to the customer id through mapping
         $customerMaps = new Datasource_Core_CustomerMaps();
         $customerMap = $customerMaps->getMap(Model_Core_Customer::LEGACY_IDENTIFIER, $quote->refNo);
         // Confirm the policy number belongs to the logged in customer
         if ($customerMap !== false && $customerMap->getIdentifier() == $customerSession->id) {
             // Customer map found and customer is mapped to refno
             $documentHistory = new Datasource_Insurance_DocumentHistory();
             $quoteDocuments = $documentHistory->getDocumentsAll($quoteNumber, array('holder'));
         }
     }
     $this->view->policyNumber = $quoteNumber;
     $this->view->policyDocuments = $quoteDocuments;
     $this->render('view-document-history');
 }
 /**
  * Will convert all quote identifiers to policy identifiers, for a given
  * quote number, in all appropriate datasources.
  *
  * @param $string $quoteNumber The full QHLI number.
  *
  * @param string $policyNumber Optional. The full PHLI number. If not provided, then it will be assumed that the 'QHLI' should be changed to 'PHLI'.
  *
  * @return void
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //Test to see if a test account was used to enter the policy
     $tester = new Manager_Core_Test();
     if ($tester->isTestPolicy($quoteNumber)) {
         //Populate a TestPolicy object into the datasource.
         $testPolicy = new Model_Core_TestPolicy();
         $legacyQuoteDatasource = new Datasource_Insurance_LegacyQuotes();
         $quote = $legacyQuoteDatasource->getByPolicyNumber($quoteNumber);
         $testPolicy->agentschemeno = $quote->agentSchemeNumber;
         $testPolicy->csuid = 87;
         $testPolicy->isTestPolicy = "Yes";
         $testPolicy->policynumber = $quoteNumber;
         $testPolicyDatasource = new Datasource_Insurance_Policy_TestPolicy();
         $testPolicyDatasource->insertTestPolicy($testPolicy);
     }
     // We only have a legacy quote number so we need to find the new quote number
     $quoteDatasource = new Datasource_Insurance_Quotes();
     $quoteID = $quoteDatasource->getIDByLegacyID($quoteNumber);
     $changeableArray = array();
     $changeableArray[] = new Datasource_Insurance_Answers();
     $changeableArray[] = new Datasource_Insurance_Endorsements();
     $changeableArray[] = new Datasource_Insurance_AdditionalInformation();
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Core_UnderwritingEmailLog();
     $changeableArray[] = new Datasource_Core_DirectDebit_Payment();
     $changeableArray[] = new Datasource_Core_CreditCard_Transaction();
     $changeableArray[] = new Datasource_Core_CreditCard_Payment();
     $changeableArray[] = new Datasource_Insurance_Schedules();
     $changeableArray[] = new Manager_Insurance_LandlordsPlus_Quote($quoteID);
     $changeableArray[] = new Datasource_Core_CustomerContactPreferences();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_DocumentHistory();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_PolicyNotes();
     $changeableArray[] = new Datasource_Insurance_Policy_Cover();
     $changeableArray[] = new Datasource_Insurance_Policy_PolicyTermItemHist();
     $changeableArray[] = new Datasource_Insurance_LandlordsPlus_Legacy_Sivalue();
     $changeableArray[] = new Datasource_Insurance_LandlordsPlus_Legacy_PolicyVariables();
     $changeableArray[] = new Datasource_Insurance_LegacyBankInterest();
     $changeableArray[] = new Datasource_Insurance_IddSupport();
     $changeableArray[] = new Datasource_Insurance_CompletionNotes();
     $changeableArray[] = new Datasource_Insurance_Channel();
     foreach ($changeableArray as $currentChangeable) {
         $currentChangeable->changeQuoteToPolicy($quoteNumber, $policyNumber);
     }
 }
 /**
  * Full description given in the IChangeable interface.
  *
  * Will convert all quote identifiers to policy identifiers, for a given
  * quote number, in all appropriate datasources.
  *
  * @param $string $quoteNumber
  * The full QHLI number.
  *
  * @param string $policyNumber
  * Optional. The full PHLI number. If not provided, then it will be assumed that
  * the 'QHLI' should be changed to 'PHLI'.
  *
  * @return void
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //Test to see if a test account was uesed to enter the policy
     $tester = new Manager_Core_Test();
     if ($tester->isTestPolicy($quoteNumber)) {
         //Populate a TestPolicy object into the datasource.
         $testPolicy = new Model_Core_TestPolicy();
         $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
         $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
         $testPolicy->agentschemeno = $quote->agentSchemeNumber;
         $testPolicy->csuid = 87;
         $testPolicy->isTestPolicy = "Yes";
         $testPolicy->policynumber = $quoteNumber;
         $testPolicyDatasource = new Datasource_Insurance_Policy_TestPolicy();
         $testPolicyDatasource->insertTestPolicy($testPolicy);
     }
     $changeableArray = array();
     $changeableArray[] = new Datasource_Insurance_Answers();
     $changeableArray[] = new Datasource_Insurance_Endorsements();
     $changeableArray[] = new Datasource_Insurance_AdditionalInformation();
     $changeableArray[] = new Datasource_Insurance_TenantsContentsPlus_Sharers();
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Core_UnderwritingEmailLog();
     $changeableArray[] = new Datasource_Core_DirectDebit_Payment();
     $changeableArray[] = new Datasource_Core_CreditCard_Transaction();
     $changeableArray[] = new Datasource_Core_CreditCard_Payment();
     $changeableArray[] = new Datasource_Insurance_Schedules();
     $changeableArray[] = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $quoteNumber);
     $changeableArray[] = new Datasource_Core_CustomerContactPreferences();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_DocumentHistory();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_PolicyNotes();
     $changeableArray[] = new Datasource_Insurance_Policy_Cover();
     $changeableArray[] = new Datasource_Insurance_Policy_Cycles(null, $quoteNumber);
     $changeableArray[] = new Datasource_Insurance_Policy_SpecPossessions($quoteNumber);
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Insurance_IddSupport();
     $changeableArray[] = new Datasource_Insurance_CompletionNotes();
     foreach ($changeableArray as $currentChangeable) {
         $currentChangeable->changeQuoteToPolicy($quoteNumber, $policyNumber);
     }
 }
示例#5
0
 /**
  * Set Channel Name
  *
  * @param string $policynumber
  * @param string $channel
  * @param int $isNewQuote  
  *
  * @return boolean true/false
  */
 public function setChannel($policyNumber, $channelOn, $isNewQuote)
 {
     $quote = new Datasource_Insurance_LegacyQuotes();
     $quoteDetails = $quote->getByPolicyNumber($policyNumber);
     $params = Zend_Registry::get('params');
     $rateStartdate = $params->lip->rateStartdate;
     if ($quoteDetails->issueDate >= $rateStartdate) {
         $channelManager = new Datasource_Insurance_Channel();
         if (!$isNewQuote || !is_null($this->getChannelName($policyNumber))) {
             if (strcasecmp($channelOn, 'Web') == 0) {
                 $channelManager->updateChannel($policyNumber, 'web');
             }
             if (strcasecmp($channelOn, 'IAS') == 0 || strcasecmp($channelOn, 'Connect') == 0) {
                 // Do Nothing;
             }
         } else {
             $channelManager->insertChannel($policyNumber, $channelOn);
         }
         return true;
     }
     return false;
 }
示例#6
0
 /**
  * Converts quote to policy
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //If policyNumber is empty then assume the QHLI should be replaced with PHLI.
     if (empty($policyNumber)) {
         $policyNumber = preg_replace('/^Q/', 'P', $quoteNumber);
     }
     //Create a policy object from the data passed in.
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
     $quote->policyNumber = $policyNumber;
     $quote->status = "Policy";
     if ($this->getPayFrequency() == "ANNUALLY") {
         $quote->payBy = "Annually";
     }
     if ($this->getPayMethod() == "DD") {
         $quote->payMethod = "DirectDebit";
     } elseif ($this->getPayMethod() == "CC") {
         $quote->payMethod = "CreditCard";
     }
     //Set the issueDate and timecompleted fields (which oddly record the same value but
     //in different formats).
     $issueDate = Zend_Date::now();
     $quote->issueDate = $issueDate->toString(Zend_Date::ISO_8601);
     $quote->timeCompleted = $issueDate->toString(Zend_Date::TIMESTAMP);
     $quote->payStatus = "UpToDate";
     // Update the optionpremiums field in the database
     /* if($quote->payBy=="Annually") {
         $optionPremiums = explode('|',$quote->optionPremiums);
         for($i=0;$i<count($optionPremiums);$i++){
          $optionPremiums[$i] = round($optionPremiums[$i]*$quote->policyLength,2);
           }
         $optionPremiums = implode('|', $optionPremiums);
         $quote->optionPremiums = $optionPremiums;
        }*/
     //Write the policy to the datasource
     $policyDatasource = new Datasource_Insurance_LandlordsPlus_Policies();
     $policyDatasource->save($quote);
     //Delete the legacy quote.
     $quoteDatasource->remove(array(Manager_Insurance_TenantsContentsPlus_Quote::POLICY_NUMBER => $quoteNumber));
     // And finally - remove the new quote as well
     $this->delete();
 }
示例#7
0
 public function getPolicyName()
 {
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($this->_quoteModel->legacyID);
     return $quote->policyName;
 }
示例#8
0
 /**
  * Description given in the IChangeable interface.
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //If policyNumber is empty then assume the QHLI should be replaced with PHLI.
     if (empty($policyNumber)) {
         $policyNumber = preg_replace('/^Q/', 'P', $quoteNumber);
     }
     //Create a policy object from the data passed in.
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
     $quote->policyNumber = $policyNumber;
     $quote->status = "Policy";
     //Set the issueDate and timecompleted fields (which oddly record the same value but
     //in different formats).
     $issueDate = Zend_Date::now();
     $quote->issueDate = $issueDate->toString(Zend_Date::ISO_8601);
     $quote->timeCompleted = $issueDate->toString(Zend_Date::TIMESTAMP);
     // Update the optionpremiums field in the database
     if ($quote->payBy == "Annually") {
         $optionPremiums = explode('|', $quote->optionPremiums);
         $optionPremiums[0] = round($optionPremiums[0] * $quote->policyLength, 2);
         $optionPremiums[1] = round($optionPremiums[1] * $quote->policyLength, 2);
         $optionPremiums[2] = round($optionPremiums[2] * $quote->policyLength, 2);
         $optionPremiums[3] = round($optionPremiums[3] * $quote->policyLength, 2);
         $optionPremiums = implode('|', $optionPremiums);
         $quote->optionPremiums = $optionPremiums;
     }
     //Write the policy to the datasource
     $policyDatasource = new Datasource_Insurance_TenantsContentsPlus_Policies();
     $policyDatasource->save($quote);
     //Finally, delete the quote.
     $quoteDatasource->remove(array(Manager_Insurance_TenantsContentsPlus_Quote::POLICY_NUMBER => $quoteNumber));
 }