Пример #1
0
 /**
  * Move all rent guarantee claim details to keyHouse database, but does not
  * complete the claim
  *
  * @param int $referenceNum
  *
  * @return void
  */
 public function submitClaim($referenceNum)
 {
     // Get Claim Information
     $dsClaim = new Datasource_Insurance_RentGuaranteeClaim_Claim();
     $claimInfo = $dsClaim->getClaimByReferenceNumber($referenceNum);
     // Get Guarantors Information
     $dsGuarantors = new Datasource_Insurance_RentGuaranteeClaim_Guarantor();
     $guarantorsInfo = $dsGuarantors->getGuarantors($referenceNum);
     // Get Rent Payments Information
     $dsRentPayments = new Datasource_Insurance_RentGuaranteeClaim_RentalPayment();
     $rentPaymentsInfo = $dsRentPayments->getRentPaymentsByReferenceNumber($referenceNum);
     // Get Tenants Information
     $dsTenants = new Datasource_Insurance_RentGuaranteeClaim_Tenant();
     $tenantsInfo = $dsTenants->getTenants($referenceNum);
     // Get Supporting Documents Information
     $supportingDocuments = new Datasource_Insurance_RentGuaranteeClaim_SupportingDocuments();
     $documentsInfo = $supportingDocuments->getByReferenceNumber($referenceNum);
     // Submit all the data to keyhouse DB
     $dsKHClaim = new Datasource_Insurance_KeyHouse_Claim();
     $validData = array();
     if ($dsKHClaim->save($claimInfo)) {
         $dsKHGuarantors = new Datasource_Insurance_KeyHouse_Guarantors();
         if (count($guarantorsInfo) > 0) {
             foreach ($guarantorsInfo as $guarantor) {
                 $dsKHGuarantors->save($guarantor);
             }
         }
         $dsKHRentPayments = new Datasource_Insurance_KeyHouse_RentPayments();
         if (count($rentPaymentsInfo) > 0) {
             foreach ($rentPaymentsInfo as $rentalPayment) {
                 $dsKHRentPayments->save($rentalPayment);
             }
         }
         $dsKHTenants = new Datasource_Insurance_KeyHouse_Tenants();
         if (count($tenantsInfo) > 0) {
             foreach ($tenantsInfo as $tenant) {
                 $dsKHTenants->save($tenant);
             }
         }
         $dsKHSupportingDocuments = new Datasource_Insurance_KeyHouse_SupportingDocuments();
         if (count($documentsInfo) > 0) {
             foreach ($documentsInfo as $document) {
                 // Convert from StdClass to array as expected.
                 $doc = array();
                 $doc['reference_number'] = $referenceNum;
                 $doc['supporting_document_name'] = $document->type;
                 $doc['attachment_filename'] = $this->_pathConvert($document->fullPath);
                 $dsKHSupportingDocuments->save($doc);
             }
         }
     }
 }
Пример #2
0
 /**
  * Gets all the RentPayments for the given Claim Reference Number
  *
  * @param int $referenceNumber
  *
  * @return array
  */
 public function getRentPaymentsByReferenceNumber($referenceNumber)
 {
     $dsRentPayments = new Datasource_Insurance_RentGuaranteeClaim_RentalPayment();
     $rentPayments = $dsRentPayments->getRentPaymentsByReferenceNumber($referenceNumber);
     return $rentPayments;
 }