コード例 #1
0
 /**
  * Completes the claim by reference number
  *
  * @param int $refNo rent guarantee claim reference number
  * @return bool success
  */
 public function completeClaimByRefNo($refNo)
 {
     // Completed flag
     $completed = false;
     // This returns the validity status of the claim to update MySQL
     $dsKHClaim = new Datasource_Insurance_KeyHouse_Validation();
     $khResult = $dsKHClaim->getValidatedByRefNo($refNo);
     // Get claim from MySQL
     $claimManager = new Manager_Insurance_RentGuaranteeClaim_Claim($refNo);
     $claim = $claimManager->getKHClaim($refNo);
     // Update claim in MySQL with validity status from SQL Server
     // If validity status has some value
     if (is_object($claim) && $khResult['validity_status'] != '') {
         // Success
         $claim->setSubmittedToKeyHouse(1);
         // Update claim status
         $claimManager->updateClaim($claim);
         // Update validation table
         $validator = new Manager_Insurance_RentGuaranteeClaim_KeyhouseValidation();
         // Insert claim result
         if ($khResult['validity_status'] == "YES") {
             // Send submission confirmation email to agent
             $claimManager->sendConfirmationEmail($refNo, $khResult['kcrn']);
             // Insert results
             $validator->insertData($refNo, 'Success', 'In progress', $khResult['kcrn']);
         } else {
             // Insert results
             $validator->insertData($refNo, 'Failure', $khResult['reason'], 'None');
         }
         // We have success
         $completed = true;
         //}
     }
     // Done.
     return $completed;
 }
コード例 #2
0
ファイル: Claim.php プロジェクト: AlexEvesDeveloper/hl-stuff
 /**
  * Retrieves the specified claim record, encapsulates the details in a
  * Claim object and returns this. Impoved to include agents scheme number, 
  * 
  *
  * @param int $referenceNumber
  * Identifies the claim record in the rent_guarantee_claims table.
  * @param int $agentSchemeNumber
  * Identifies the agent to prevent horizontal privledge escalation 
  * 
  * @return Model_Insurance_RentGuaranteeClaim_Claim
  * The claim details encapsulated in a Claim object.
  */
 public function getClaim($referenceNumber, $agentSchemeNumber = null)
 {
     //Retrieve the claim record.
     $select = $this->select();
     $select->where("reference_number = ?", $referenceNumber);
     if (!is_null($agentSchemeNumber)) {
         $select->where('agentschemenumber = ?', $agentSchemeNumber);
     }
     $claimRow = $this->fetchRow($select);
     if ($claimRow) {
         //Populate the details into a Claim object.
         $claim = new Model_Insurance_RentGuaranteeClaim_Claim();
         $claimManager = new Manager_Insurance_RentGuaranteeClaim_Claim();
         $claim->setReferenceNumber($referenceNumber);
         $claim->setAgentName($claimRow->agent_name);
         $claim->setAgentSchemeNumber($claimRow->agentschemenumber);
         $claim->setAgentContactName($claimRow->agent_contact_name);
         $claim->setAgentAddress($claimManager->concatDetails(array($claimRow->agent_housename, $claimRow->agent_street, $claimRow->agent_town, $claimRow->agent_city)));
         $claim->setAgentHousename($claimRow->agent_housename);
         $claim->setAgentStreet($claimRow->agent_street);
         $claim->setAgentTown($claimRow->agent_town);
         $claim->setAgentCity($claimRow->agent_city);
         $claim->setAgentPostcode($claimRow->agent_postcode);
         $claim->setAgentTelephone($claimRow->agent_telephone);
         $claim->setAgentFax($claimRow->agent_fax);
         $claim->setAgentEmail($claimRow->agent_email);
         $claim->setIsAr($claimRow->agent_isar);
         $claim->setIsDir($claimRow->agent_isdir);
         $claim->setLandlord1Name($claimRow->landlord1_name);
         $claim->setLandlordCompanyName($claimRow->landlord_company_name);
         $claim->setLandlordAddress($claimManager->concatDetails(array($claimRow->landlord_housename, $claimRow->landlord_street, $claimRow->landlord_town, $claimRow->landlord_city)));
         $claim->setLandlordHouseName($claimRow->landlord_housename);
         $claim->setLandlordStreet($claimRow->landlord_street);
         $claim->setLandlordTown($claimRow->landlord_town);
         $claim->setLandlordCity($claimRow->landlord_city);
         $claim->setLandlordAddressId($claimRow->landlord_address_id);
         $claim->setLandlordPostcode($claimRow->landlord_postcode);
         $claim->setLandlordTelephone($claimRow->landlord_telephone);
         $claim->setLandlordFax($claimRow->landlord_fax);
         $claim->setLandlordEmail($claimRow->landlord_email);
         $claim->setRecentComplaints($claimRow->recent_complaints);
         $claim->setRecentComplaintsDetails($claimRow->recent_complaints_further_details);
         $claim->setPolicyNumber($claimRow->policy_number);
         $claim->setGroundsForClaim($claimRow->grounds_for_claim);
         $claim->setGroundsForClaimDetails($claimRow->grounds_for_claim_further_details);
         $claim->setArrearsAtVacantPossession($claimRow->arrears_at_vacant_possession);
         $claim->setTenantsOccupationOfPropertyConfirmedByTel($claimRow->tenant_occupation_confirmed_by_tel);
         if ($claimRow->tenant_occupation_confirmed_by_tel_dateofcontact != null) {
             $claim->setTenantsOccupationOfPropertyConfirmedByTelDate(date('d/m/Y', strtotime($claimRow->tenant_occupation_confirmed_by_tel_dateofcontact)));
         }
         $claim->setTenantsOccupationOfPropertyConfirmedByTelContact($claimRow->tenant_occupation_confirmed_by_tel_tenantname);
         $claim->setTenantsOccupationOfPropertyConfirmedByEmail($claimRow->tenant_occupation_confirmed_by_email);
         if ($claimRow->tenant_occupation_confirmed_by_email_dateofcontact != null) {
             $claim->setTenantsOccupationOfPropertyConfirmedByEmailDate(date('d/m/Y', strtotime($claimRow->tenant_occupation_confirmed_by_email_dateofcontact)));
         }
         $claim->setTenantsOccupationOfPropertyConfirmedByEmailContact($claimRow->tenant_occupation_confirmed_by_email_tenantname);
         $claim->setTenantsOccupationOfPropertyConfirmedByVisit($claimRow->tenant_occupation_confirmed_by_visit);
         if ($claimRow->tenant_occupation_confirmed_by_visit_dateofvisit != null) {
             $claim->setTenantsOccupationOfPropertyConfirmedByVisitDate(date('d/m/Y', strtotime($claimRow->tenant_occupation_confirmed_by_visit_dateofvisit)));
         }
         $claim->setTenantsOccupationOfPropertyConfirmedByVisitIndividual($claimRow->tenant_occupation_confirmed_by_visit_individualattending);
         $claim->setTenantsOccupationOfPropertyConfirmedByVisitContact($claimRow->tenant_occupation_confirmed_by_visit_tenantname);
         $claim->setS21NoticeServed($claimRow->section21_served);
         if ($claimRow->section21_expiry != null) {
             $claim->setS21NoticeExpiry(date('d/m/Y', strtotime($claimRow->section21_expiry)));
         }
         $claim->setS21NoticeMoneyDepositReceived($claimRow->section21_moneydepositreceived);
         $claim->setS21NoticeMoneyDepositHeldUnderTdsScheme($claimRow->section21_money_held_under_tds_deposit_scheme);
         $claim->setS21NoticeTdsCompliedWith($claimRow->section21_tds_complied_with);
         $claim->setS21NoticeTdsPrescribedToTenant($claimRow->section21_tds_prescribed_information_to_tenant);
         $claim->setS21NoticeLandlordDepositInPropertyForm($claimRow->section21_landlord_deposit_in_property_form);
         $claim->setS21NoticePropertyReturnedAtNoticeServeDate($claimRow->section21_returned_at_notice_serve_date);
         $claim->setS8NoticeServed($claimRow->section8_served);
         if ($claimRow->section8_expiry != null) {
             $claim->setS8NoticeExpiry(date('d/m/Y', strtotime($claimRow->section8_expiry)));
         }
         $claim->setS8NoticeDemandLetterSent($claimRow->section8_demand_letter_sent);
         $claim->setS8NoticeOver18Occupants($claimRow->section8_over18_occupants);
         $claim->setLandlordIsPropertyProprietor($claimRow->landlord_property_proprietor);
         $claim->setChequePayableTo($claimRow->cheque_payable_to);
         $claim->setSubmittedToKeyHouse($claimRow->submitted_to_keyhouse);
         $claim->setDataComplete($claimRow->data_complete);
         $claim->setHousingActAdherence($claimRow->housing_act_adherence);
         // Prevent strtotime make the date 1970-01-01 when parsing an empty date or when date string is zeros
         if ($claimRow->tenancy_start_date != "" || $claimRow->tenancy_start_date == '0000-00-00') {
             $claim->setTenancyStartDate(date('d/m/Y', strtotime($claimRow->tenancy_start_date)));
         }
         if ($claimRow->tenancy_renewal_date != "" || $claimRow->tenancy_renewal_date == '0000-00-00') {
             $claim->setTenancyEndDate(date('d/m/Y', strtotime($claimRow->tenancy_renewal_date)));
         }
         if ($claimRow->original_cover_start_date != "" || $claimRow->original_cover_start_date == '0000-00-00') {
             $claim->setOriginalCoverStartDate(date('d/m/Y', strtotime($claimRow->original_cover_start_date)));
         }
         $claim->setTenancyPostcode($claimRow->tenancy_postcode);
         $claim->setTenancyAddress($claimManager->concatDetails(array($claimRow->tenancy_housename, $claimRow->tenancy_street, $claimRow->tenancy_town, $claimRow->tenancy_city)));
         $claim->setTenancyAddressId($claimRow->tenancy_address_id);
         $claim->setTenancyHouseName($claimRow->tenancy_housename);
         $claim->setTenancyStreet($claimRow->tenancy_street);
         $claim->setTenancyTown($claimRow->tenancy_town);
         $claim->setTenancyCity($claimRow->tenancy_city);
         $claim->setTenantVacated($claimRow->tenant_vacated);
         $claim->setMonthlyRent($claimRow->monthly_rent);
         $claim->setDepositAmount($claimRow->deposit_amount);
         $claim->setRentArrears($claimRow->rent_arrears);
         $claim->setTenantsForwardingAddress($claimManager->concatDetails(array($claimRow->tenantsforwarding_housename, $claimRow->tenantsforwarding_street, $claimRow->tenantsforwarding_town, $claimRow->tenantsforwarding_city)));
         $claim->setTenantsForwardingAddressId($claimRow->tenantsforwarding_address_id);
         $claim->setTenantsForwardingHouseName($claimRow->tenantsforwarding_housename);
         $claim->setTenantsForwardingStreet($claimRow->tenantsforwarding_street);
         $claim->setTenantsForwardingTown($claimRow->tenantsforwarding_town);
         $claim->setTenantsForwardingCity($claimRow->tenantsforwarding_city);
         $claim->setTenantsForwardingPostcode($claimRow->tenantsforwarding_postcode);
         if ($claimRow->tenant_vacated_date != "" || $claimRow->tenant_vacated_date == '0000-00-00') {
             $claim->setTenantVacatedDate(date('d/m/Y', strtotime($claimRow->tenant_vacated_date)));
         }
         if ($claimRow->first_arrear_date != "" || $claimRow->first_arrear_date == '0000-00-00') {
             $claim->setFirstArrearDate(date('d/m/Y', strtotime($claimRow->first_arrear_date)));
         }
         if ($claimRow->deposit_received_date != "" || $claimRow->deposit_received_date == '0000-00-00') {
             $claim->setDepositReceivedDate(date('d/m/Y', strtotime($claimRow->deposit_received_date)));
         }
         $claim->setDocConfirmationAgentName($claimRow->doc_confirmation_agent_name);
         $claim->setAdditionalInfo($claimRow->additional_information);
         // Claim payment details
         $claim->setClaimPaymentBankAccountName($claimRow->payment_account_name);
         $claim->setClaimPaymentBankAccountNumber($claimRow->payment_account_number);
         $claim->setClaimPaymentBankAccountSortCode($claimRow->payment_account_sortcode);
         if ($claimRow->authority_confirmed != null) {
             $claim->setAuthorityConfirmed($claimRow->authority_confirmed);
         }
         if ($claimRow->dec_confirmed != null) {
             $claim->setDeclarationConfirmed($claimRow->dec_confirmed);
         }
         return $claim;
     } else {
         return null;
     }
 }
コード例 #3
0
 public function continueAction()
 {
     if ($this->getRequest()->isPost()) {
         // Sanitise ref_num
         $filters = array('*' => array('StringTrim', 'HtmlEntities', 'StripTags'));
         $validators = array('*' => array('allowEmpty' => true));
         $input['referenceNumber'] = $this->_request->getParam('ref_num');
         $validate = new Zend_Filter_Input($filters, $validators, $input);
         Zend_Debug::dump($input['referenceNumber']);
         $referenceNumber = $validate->getEscaped('referenceNumber');
         $pageSession = new Zend_Session_Namespace('online_claims');
         $pageSession->ClaimReferenceNumber = $referenceNumber;
         /*
         We are always going to go back to step1 for claims when continuing but we have to set the session variables up
         to know how far into the process we got. Otherwise this crap f*cking Sword code doesn't bother
         populating any of the forms with data already saved.
         
         I hate this - so much it gives me headache just thinking about it…
         */
         //Claim Manager
         $claimManager = new Manager_Insurance_RentGuaranteeClaim_Claim();
         //Identify the Step
         $pageSession->completed[1] = true;
         $pageSession->identifier[1] = true;
         $claimData = $claimManager->getClaim($referenceNumber, $this->_agentSchemeNumber);
         if ($claimData->getTenancyStartDate() != "") {
             $step = 2;
             $pageSession->completed[2] = true;
             $pageSession->identifier[2] = true;
         }
         $rentPayments = $claimManager->getRentPaymentsByReferenceNumber($referenceNumber);
         if (count($rentPayments) > 0) {
             $step = 3;
             $pageSession->completed[3] = true;
             $pageSession->identifier[3] = true;
         }
         $supportingDocs = $claimManager->getSupportingDocumentsByReferenceNumber($referenceNumber);
         if (count($supportingDocs) > 0) {
             $step = 4;
             $pageSession->completed[4] = true;
             $pageSession->identifier[4] = true;
         }
         $this->_helper->redirector->gotoUrl('rentguaranteeclaims/step1');
     }
 }