/** * Displays the reference summary details page as a popup. */ public function summaryDialogAction() { $this->_helper->getHelper('layout')->disableLayout(); $session = new Zend_Session_Namespace('referencing_global'); $referenceManager = new Manager_Referencing_Reference(); $reference = $referenceManager->getReference($session->referenceId); //Prepare the prospective landlord details. $prospectiveLandlord = $reference->propertyLease->prospectiveLandlord; $pllArray = array(); $pllArray['name'] = $prospectiveLandlord->name->firstName . ' ' . $prospectiveLandlord->name->lastName; $pllArray['contactName'] = ''; $pllArray['address'] = $prospectiveLandlord->address->addressLine1 . ' ' . $prospectiveLandlord->address->addressLine2 . ' ' . $prospectiveLandlord->address->town; $pllArray['postCode'] = $prospectiveLandlord->address->postCode; $pllArray['telephone'] = $prospectiveLandlord->contactDetails->telephone1; $pllArray['mobile'] = $prospectiveLandlord->contactDetails->telephone2; $pllArray['email'] = $prospectiveLandlord->contactDetails->email1; $this->view->prospectiveLandlord = $pllArray; //Prepare the property details. $propertyArray = array(); $propertyArray['address'] = $reference->propertyLease->address->addressLine1 . ' ' . $reference->propertyLease->address->addressLine2 . ' ' . $reference->propertyLease->address->town; $propertyArray['postCode'] = $reference->propertyLease->address->postCode; $propertyArray['rent'] = $reference->propertyLease->rentPerMonth->getValue(); $propertyArray['startDate'] = $reference->propertyLease->tenancyStartDate->toString(); $propertyArray['duration'] = $reference->propertyLease->tenancyTerm; $propertyArray['noOfTenants'] = $reference->propertyLease->noOfTenants; $this->view->property = $propertyArray; //Prepare the reference subject details $referenceSubject = $reference->referenceSubject; $referenceSubjectArray = array(); $referenceSubjectArray['name'] = $referenceSubject->name->firstName . ' ' . $referenceSubject->name->lastName; $referenceSubjectArray['maidenName'] = $referenceSubject->name->maidenName; $referenceSubjectArray['dob'] = $referenceSubject->dob->toString(); if (!empty($referenceSubject->bankAccount)) { $referenceSubjectArray['bankAccountNumber'] = $referenceSubject->bankAccount->accountNumber; $referenceSubjectArray['bankSortCode'] = $referenceSubject->bankAccount->sortCode; } else { $referenceSubjectArray['bankAccountNumber'] = ''; $referenceSubjectArray['bankSortCode'] = ''; } $referenceSubjectArray['telephone'] = $referenceSubject->contactDetails->telephone1; $referenceSubjectArray['mobile'] = $referenceSubject->contactDetails->telephone2; $referenceSubjectArray['email'] = $referenceSubject->contactDetails->email1; $residenceManager = new Manager_Referencing_Residence(); $residence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT); $referenceSubjectArray['currentResidentialStatus'] = Model_Referencing_ResidenceStatus::toString($residence->status); $occupationManager = new Manager_Referencing_Occupation(); $occupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::CURRENT, Model_Referencing_OccupationImportance::FIRST); //Convert the occupation type to an 'occupation status' for display purposes. switch ($occupation->type) { case Model_Referencing_OccupationTypes::EMPLOYMENT: $occupationStatus = 'Employed'; break; case Model_Referencing_OccupationTypes::CONTRACT: $occupationStatus = 'On Contract'; break; case Model_Referencing_OccupationTypes::SELFEMPLOYMENT: $occupationStatus = 'Self Employed'; break; case Model_Referencing_OccupationTypes::INDEPENDENT: $occupationStatus = 'Financially Independent'; break; case Model_Referencing_OccupationTypes::RETIREMENT: $occupationStatus = 'Retired'; break; case Model_Referencing_OccupationTypes::STUDENT: $occupationStatus = 'Student'; break; case Model_Referencing_OccupationTypes::UNEMPLOYMENT: $occupationStatus = 'Unemployed'; break; case Model_Referencing_OccupationTypes::OTHER: $occupationStatus = 'Other'; break; default: throw new Zend_Exception(get_class() . '::' . __FUNCTION__ . ': unknonwn type provided.'); } $referenceSubjectArray['currentOccupationStatus'] = $occupationStatus; $referenceSubjectArray['isOccupationLikelyToChange'] = $occupation->isPermanent ? 'No' : 'Yes'; //Calculate the total income. $totalIncome = new Zend_Currency(array('value' => 0, 'precision' => 0)); foreach ($reference->referenceSubject->occupations as $occupation) { $totalIncome->add($occupation->income); } $referenceSubjectArray['income'] = $totalIncome->getValue(); $referenceSubjectArray['shareOfRent'] = $referenceSubject->shareOfRent->getValue(); $this->view->referenceSubject = $referenceSubjectArray; //Prepare the current landlord details. $currentResidence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT); $currentLandlordArray = array(); if (!empty($currentResidence->refereeDetails)) { $currentLandlordArray['name'] = $currentResidence->refereeDetails->name->firstName . ' ' . $currentResidence->refereeDetails->name->lastName; $currentLandlordArray['address'] = $currentResidence->refereeDetails->address->addressLine1 . ' ' . $currentResidence->refereeDetails->address->addressLine2 . ' ' . $currentResidence->refereeDetails->address->town; $currentLandlordArray['postCode'] = $currentResidence->refereeDetails->address->postCode; $currentLandlordArray['telephoneDay'] = $currentResidence->refereeDetails->contactDetails->telephone1; $currentLandlordArray['telephoneEvening'] = $currentResidence->refereeDetails->contactDetails->telephone2; $currentLandlordArray['fax'] = $currentResidence->refereeDetails->contactDetails->fax1; $currentLandlordArray['email'] = $currentResidence->refereeDetails->contactDetails->email1; } else { $currentLandlordArray['name'] = ''; $currentLandlordArray['address'] = ''; $currentLandlordArray['postCode'] = ''; $currentLandlordArray['telephoneDay'] = ''; $currentLandlordArray['telephoneEvening'] = ''; $currentLandlordArray['fax'] = ''; $currentLandlordArray['email'] = ''; } $this->view->currentLandlord = $currentLandlordArray; //Prepare the occupation details. for ($i = 0; $i < 2; $i++) { switch ($i) { case 0: $thisOccupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::CURRENT, Model_Referencing_OccupationImportance::FIRST); break; case 1: $thisOccupation = $occupationManager->findSpecificOccupation($reference->referenceSubject->occupations, Model_Referencing_OccupationChronology::FUTURE, Model_Referencing_OccupationImportance::FIRST); break; } $thisOccupationArray = array(); if (empty($thisOccupation)) { $thisOccupationArray['organisationName'] = ''; $thisOccupationArray['contactName'] = ''; $thisOccupationArray['contactPosition'] = ''; $thisOccupationArray['oranisationAddress'] = ''; $thisOccupationArray['postCode'] = ''; $thisOccupationArray['telephone'] = ''; $thisOccupationArray['fax'] = ''; $thisOccupationArray['email'] = ''; $thisOccupationArray['salary'] = ''; $thisOccupationArray['positionHeld'] = ''; $thisOccupationArray['payrollNumber'] = ''; $thisOccupationArray['startDate'] = ''; $thisOccupationArray['endDate'] = ''; $thisOccupationArray['isPermanent'] = ''; } else { if (!empty($thisOccupation->refereeDetails)) { $thisOccupationArray['organisationName'] = $thisOccupation->refereeDetails->organisationName; $thisOccupationArray['contactName'] = $thisOccupation->refereeDetails->name->firstName . ' ' . $thisOccupation->refereeDetails->name->lastName; $thisOccupationArray['contactPosition'] = $thisOccupation->refereeDetails->position; $thisOccupationArray['oranisationAddress'] = $thisOccupation->refereeDetails->address->addressLine1 . ' ' . $thisOccupation->refereeDetails->address->addressLine2 . ' ' . $thisOccupation->refereeDetails->address->town; $thisOccupationArray['postCode'] = $thisOccupation->refereeDetails->address->postCode; $thisOccupationArray['telephone'] = $thisOccupation->refereeDetails->contactDetails->telephone1; $thisOccupationArray['fax'] = $thisOccupation->refereeDetails->contactDetails->fax1; $thisOccupationArray['email'] = $thisOccupation->refereeDetails->contactDetails->email1; } else { $thisOccupationArray['organisationName'] = ''; $thisOccupationArray['contactName'] = ''; $thisOccupationArray['contactPosition'] = ''; $thisOccupationArray['oranisationAddress'] = ''; $thisOccupationArray['postCode'] = ''; $thisOccupationArray['telephone'] = ''; $thisOccupationArray['fax'] = ''; $thisOccupationArray['email'] = ''; } if (empty($thisOccupation->variables)) { $thisOccupationArray['positionHeld'] = ''; $thisOccupationArray['payrollNumber'] = ''; } else { $thisOccupationArray['positionHeld'] = $thisOccupation->variables[Model_Referencing_OccupationVariables::POSITION]; $thisOccupationArray['payrollNumber'] = $thisOccupation->variables[Model_Referencing_OccupationVariables::PAYROLL_NUMBER]; } $thisOccupationArray['salary'] = $thisOccupation->income->getValue(); $thisOccupationArray['positionHeld'] = ''; $thisOccupationArray['payrollNumber'] = ''; $thisOccupationArray['startDate'] = empty($thisOccupation->startDate) ? '' : $thisOccupation->startDate->toString(); $thisOccupationArray['endDate'] = ''; $thisOccupationArray['isPermanent'] = $thisOccupation->isPermanent ? 'Yes' : 'No'; } switch ($i) { case 0: $this->view->currentOccupation = $thisOccupationArray; break; case 1: $this->view->futureOccupation = $thisOccupationArray; break; } } //Prepare the residential details. for ($i = 0; $i < 3; $i++) { switch ($i) { case 0: $thisResidence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::CURRENT); break; case 1: $thisResidence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::FIRST_PREVIOUS); break; case 2: $thisResidence = $residenceManager->findSpecificResidence($reference->referenceSubject->residences, Model_Referencing_ResidenceChronology::SECOND_PREVIOUS); break; } $thisResidenceArray = array(); if (empty($thisResidence)) { $thisResidenceArray['address'] = ''; $thisResidenceArray['postCode'] = ''; $thisResidenceArray['duration'] = ''; } else { if ($thisResidence->address->isOverseasAddress) { $thisResidenceArray['address'] = 'Overseas'; $thisResidenceArray['postCode'] = 'Overseas'; } else { $thisResidenceArray['address'] = $thisResidence->address->addressLine1 . ' ' . $thisResidence->address->addressLine2 . ' ' . $thisResidence->address->town; $thisResidenceArray['postCode'] = $thisResidence->address->postCode; } $thisResidenceArray['duration'] = $thisResidence->durationAtAddress; } switch ($i) { case 0: $this->view->firstResidence = $thisResidenceArray; break; case 1: $this->view->secondResidence = $thisResidenceArray; break; case 2: $this->view->thirdResidence = $thisResidenceArray; break; } } }
/** * @ZF-9519 */ public function testSetValueWithoutLocale() { $currency = new Zend_Currency('RUB', 'ru_RU'); require_once 'Currency/ExchangeTest.php'; $this->assertEquals(null, $currency->getService()); $currency->setService(new ExchangeTest()); $this->assertTrue($currency->getService() instanceof Zend_Currency_CurrencyInterface); $currency->setValue(100, 'USD'); $this->assertEquals(50, $currency->getValue()); $this->assertEquals('RUB', $currency->getShortName()); }
public function insertReferenceSubject($referenceSubject) { //Get the bank account details. if (!empty($referenceSubject->bankAccount)) { $accountNumber = $referenceSubject->bankAccount->accountNumber; $sortCode = $referenceSubject->bankAccount->sortCode; if ($referenceSubject->bankAccount->isValidated) { $isValidated = 'Yes'; } else { $isValidated = 'No'; } } else { $accountNumber = ''; $sortCode = ''; $isValidated = 'N/A'; } //Get the current residential status. if (!empty($referenceSubject->residences)) { foreach ($referenceSubject->residences as $residence) { if ($residence->chronology == Model_Referencing_ResidenceChronology::CURRENT) { switch ($residence->status) { case Model_Referencing_ResidenceStatus::OWNER: $currentResidentialStatus = 'Owner'; break; case Model_Referencing_ResidenceStatus::TENANT: $currentResidentialStatus = 'Tenant'; break; case Model_Referencing_ResidenceStatus::LIVING_WITH_RELATIVES: $currentResidentialStatus = 'Living with Relative'; break; } break; } } } //Get the occupational income. $totalIncome = new Zend_Currency(array('value' => 0, 'precision' => 0)); foreach ($referenceSubject->occupations as $occupation) { $totalIncome->add($occupation->income); } //Get the current occupational status. $currentOccupationalStatus = ''; foreach ($referenceSubject->occupations as $occupation) { if ($occupation->chronology == Model_Referencing_OccupationChronology::CURRENT) { if ($occupation->importance == Model_Referencing_OccupationImportance::FIRST) { switch ($occupation->type) { case Model_Referencing_OccupationTypes::EMPLOYMENT: $currentOccupationalStatus = 'Employed'; break; case Model_Referencing_OccupationTypes::CONTRACT: $currentOccupationalStatus = 'On Contract'; break; case Model_Referencing_OccupationTypes::SELFEMPLOYMENT: $currentOccupationalStatus = 'Self Employed'; break; case Model_Referencing_OccupationTypes::INDEPENDENT: $currentOccupationalStatus = 'of Independent Means'; break; case Model_Referencing_OccupationTypes::RETIREMENT: $currentOccupationalStatus = 'Retired'; break; case Model_Referencing_OccupationTypes::STUDENT: $currentOccupationalStatus = 'Student'; break; case Model_Referencing_OccupationTypes::UNEMPLOYMENT: $currentOccupationalStatus = 'Unemployed'; break; } //Whilst we are here, determine if the occupation is permanent. if ($occupation->isPermanent) { $occupationChange = 'No'; } else { $occupationChange = 'Yes'; } break; } } } if (empty($referenceSubject->shareOfRent)) { $shareOfRent = 0; } else { $shareOfRent = $referenceSubject->shareOfRent->getValue(); } if (empty($referenceSubject->dob)) { $dob = '0000-00-00'; } else { $dob = $referenceSubject->dob->toString(Zend_Date::ISO_8601); } //Finally, push to munt $data = array('title' => empty($referenceSubject->name->title) ? '' : $referenceSubject->name->title, 'firstname' => empty($referenceSubject->name->firstName) ? '' : $referenceSubject->name->firstName, 'middlename' => empty($referenceSubject->name->middleName) ? '' : $referenceSubject->name->middleName, 'lastname' => empty($referenceSubject->name->lastName) ? '' : $referenceSubject->name->lastName, 'maidenname' => empty($referenceSubject->name->maidenName) ? '' : $referenceSubject->name->maidenName, 'dob' => $dob, 'tel' => empty($referenceSubject->contactDetails->telephone1) ? '' : $referenceSubject->contactDetails->telephone1, 'mobile' => empty($referenceSubject->contactDetails->telephone2) ? '' : $referenceSubject->contactDetails->telephone2, 'email' => empty($referenceSubject->contactDetails->email1) ? '' : $referenceSubject->contactDetails->email1, 'rstatus' => $currentResidentialStatus, 'estatus' => $currentOccupationalStatus, 'echange' => $occupationChange, 'RentShare' => $shareOfRent, 'income' => $totalIncome->getValue(), 'hasCCJs' => $referenceSubject->hasAdverseCredit == true ? 'Yes' : 'No', 'isForeignNational' => $referenceSubject->isForeignNational == true ? 'yes' : 'no', 'accountNo' => $accountNumber, 'sortcodeNo' => $sortCode, 'bankValidationCheckStatus' => $isValidated); return $this->insert($data); }