Ejemplo n.º 1
0
 /**
  * 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;
     }
 }