/** * Define the OC form elements * * @return void */ public function init() { $this->setMethod('post'); // Add agent name element $this->addElement('span', 'agent_name', array('label' => 'Name of letting agency', 'required' => false, 'readonly' => true, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter letting agent name', 'notEmptyInvalid' => 'Please enter letting agent name')))))); // Add agent scheme number $this->addElement('span', 'agent_schemenumber', array('label' => 'Agent scheme number', 'required' => false, 'readonly' => true, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter agent scheme number', 'notEmptyInvalid' => 'Please enter agent scheme number')))))); // Add agent contact name element $this->addElement('text', 'agent_contact_name', array('label' => 'Contact name', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '100', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your contact name', 'notEmptyInvalid' => 'Please enter your contact name')))))); // Add the landlord find address button $this->addElement('submit', 'landlords_address_lookup', array('ignore' => true, 'label' => 'Find address', 'class' => 'button', 'onclick' => 'getPropertiesByPostcode($(\'#landlord_postcode\').val(), \'landlord_postcode\', \'landlord_address\',\'no_landlord_address_selector\'); return false;')); // Add agent postcode $this->addElement('text', 'agent_postcode', array('label' => 'Postcode', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your office postcode', 'notEmptyInvalid' => 'Please enter your office postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Postcode must be in postcode format'))))); Application_Core_FormUtils::createManualAddressInput($this, 'agent_housename', 'agent_street', 'agent_town', 'agent_city', false, '', true); // Add agent phone number element $this->addElement('text', 'agent_telephone', array('label' => 'Telephone number', 'required' => true, 'class' => 'input-pos-float', 'validators' => array('TelephoneNumber', array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your telephone number')))))); // Add agent e-mail element $this->addElement('text', 'agent_email', array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '100', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address')))))); $emailValidator = new Zend_Validate_EmailAddress(); $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address")); $this->getElement('agent_email')->addValidator($emailValidator); // Add agents directly authorised by FCA $this->addElement('span', 'agent_dir_by_fca', array('label' => 'Directly Authorised by the Financial Conduct Authority', 'filters' => array('StringTrim'), 'class' => 'formvalue')); $this->addElement('span', 'agent_ar_by_barbon', array('label' => 'Appointed Representative for Barbon Insurance Group Ltd', 'filters' => array('StringTrim'), 'class' => 'formvalue')); // Landlord1 $subHeaderHtml = '<span style="font-size:smaller;">Please provide title, first name and surname</span>'; $this->addElement('text', 'landlord1_name', array('label' => "Full name<br>{$subHeaderHtml}", 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '80', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please landlords name')))))); // landlor company Name $this->addElement('text', 'landlord_company_name', array('label' => 'Company name', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '100')); // Add Landlord postcode $subHeaderHtml = '<span style="font-size:smaller;">Landlords residential address (This cannot be a C/O address due to the requirements for Legal Proceedings)</span>'; $this->addElement('text', 'landlord_postcode', array('label' => "Landlord Home Address Postcode<br>{$subHeaderHtml}", 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter Landlord\'s postcode', 'notEmptyInvalid' => 'Please enter Landlord\'s postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Postcode must be in postcode format'))))); Application_Core_FormUtils::createManualAddressInput($this, 'landlord_housename', 'landlord_street', 'landlord_town', 'landlord_city', false); $this->addElement('select', 'landlord_address', array('required' => false, 'label' => '', 'filters' => array('StringTrim'), 'class' => 'postcode_address', 'multiOptions' => array('' => 'Please select'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select landlord address', 'notEmptyInvalid' => 'Please select landlord address')))))); // Remove 'nnn not found in haystack' error $this->getElement('landlord_address')->setRegisterInArrayValidator(false); // Add hidden element for postcode $this->addElement('hidden', 'landlord_address_id', array('value' => 1, 'class' => 'noborder')); // Add agent phone number element $this->addElement('text', 'landlord_telephone', array('label' => 'Telephone number', 'required' => false, 'class' => 'input-pos-float', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord phone number'))), array('regex', true, array('pattern' => $this->PHONE_RGX, 'messages' => 'Not a valid phone number'))))); // Add Landlord e-mail element $this->addElement('text', 'landlord_email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '100', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord email address')))))); $emailValidator = new Zend_Validate_EmailAddress(); $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address")); $this->getElement('landlord_email')->addValidator($emailValidator); // Set decorators $this->clearDecorators(); $this->setDecorators(array('Form')); $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors')); // Add the next button $this->addElement('submit', 'next', array('ignore' => true, 'label' => 'Continue to Step 2', 'onclick' => 'window.location="step2"')); // Add the save and exit button $this->addElement('button', 'save', array('ignore' => true, 'label' => 'Save & Exit')); // Landlord Address decorators $landlordAddressLookUp = $this->getElement('landlords_address_lookup'); $landlordAddressLookUp->clearDecorators(); $landlordAddressLookUp->setDecorators(array('ViewHelper')); // Nav decorators $next = $this->getElement('next'); $next->clearDecorators(); $next->setDecorators(array('ViewHelper')); $save_and_exit = $this->getElement('save'); $save_and_exit->clearDecorators(); $save_and_exit->setDecorators(array('ViewHelper')); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguaranteeclaims/subforms/you-and-landlords.phtml')))); //Allow HTML to be inserted into the labels. $this->getElement('landlord1_name')->getDecorator('Label')->setOption('escape', false); $this->getElement('landlord_postcode')->getDecorator('Label')->setOption('escape', false); }
/** * Define the OC step2 form elements * * @return void */ public function init() { $this->setMethod('post'); // Add Hosuing Acts $this->addElement('select', 'housing_act_adherence', array('label' => 'Is the property let in accordance with the Housing Acts of 1988, 1996, 2004 ' . 'and any subsequent or superseding legislation, AND, has the Landlord complied ' . ' with the requirements of the Tenancy Deposit Scheme (TDS)?', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('' => 'Please select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select housing act adherence', 'notEmptyInvalid' => 'Please select housing act adherence')))))); // Add tenant start date $this->addElement('text', 'tenancy_start_date', array('label' => 'Tenancy start date (DD/MM/YYYY)', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select tenancy start date', 'notEmptyInvalid' => 'Please select tenancy start date'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Tenancy start date must be in dd/mm/yyyy format'))))); // Add tenant start date $this->addElement('text', 'tenancy_end_date', array('label' => 'Tenancy end date (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select tenancy end date', 'notEmptyInvalid' => 'Please select end date'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Tenancy end date must be in dd/mm/yyyy format'))))); // Add original cover start date $this->addElement('text', 'original_cover_start_date', array('label' => 'Policy start date (DD/MM/YYYY)', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select original cover start date', 'notEmptyInvalid' => 'Please select original cover start date'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Original cover start date must be in dd/mm/yyyy format'))))); // Add rental property postcode $this->addElement('text', 'tenancy_postcode', array('label' => 'Rental property address postcode', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter rental property address postcode', 'notEmptyInvalid' => 'Please enter rental property address postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Rental property postcode must be in postcode format'))))); // Add the find address button $this->addElement('submit', 'tenancy_address_lookup', array('ignore' => true, 'label' => 'Find Address', 'class' => 'button', 'onclick' => 'getPropertiesByPostcode($(\'#tenancy_postcode\').val(), \'tenancy_postcode\', \'tenancy_address\',\'no_property_address_selector\'); return false;')); // Add agent address select element $this->addElement('select', 'tenancy_address', array('class' => 'postcode_address', 'required' => false, 'filters' => array('StringTrim'), 'multiOptions' => array('' => 'Please select'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select property address', 'notEmptyInvalid' => 'Please select property address')))))); // Remove 'nnn not found in haystack' error $this->getElement('tenancy_address')->setRegisterInArrayValidator(false); // Add hidden element for postcode $this->addElement('hidden', 'tenancy_address_id', array('label' => '', 'value' => 1, 'class' => 'noborder')); // Add in additional validation fields using utility class Application_Core_FormUtils::createManualAddressInput($this, 'tenancy_housename', 'tenancy_street', 'tenancy_town', 'tenancy_city', false, 'tenant\'s'); // Add monthly rental $this->addElement('text', 'monthly_rent', array('label' => 'Monthly rent on this property', 'required' => true, 'filters' => array('Digits'), 'class' => 'input-pos-float', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your monthly rent', 'notEmptyInvalid' => 'Please enter your monthly rent')))))); // Add Deposit Held $this->addElement('text', 'deposit_amount', array('label' => 'Deposit held', 'required' => true, 'filters' => array('Digits'), 'class' => 'input-pos-float', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your deposit amount', 'notEmptyInvalid' => 'Please enter your deposit amount')))))); // Add Rental Arrears $this->addElement('text', 'rent_arrears', array('label' => 'Total rent arrears', 'required' => false, 'filters' => array('Digits'), 'class' => 'input-pos-float', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your rent arrears', 'notEmptyInvalid' => 'Please enter rent arrears in number')))))); // Add date of first arrear $this->addElement('text', 'first_arrear_date', array('label' => 'Date of first arrears (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select first arrear date', 'notEmptyInvalid' => 'Please select first arrear date'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'First arrears date must be in dd/mm/yyyy format'))))); // Add date deposit received $this->addElement('text', 'deposit_received_date', array('label' => 'Date when deposit received (DD/MM/YYYY)', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your deposit received date', 'notEmptyInvalid' => 'Please enter your rent arrears in number'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Deposit received date must be in dd/mm/yyyy format'))))); $this->addElement('select', 'recent_complaints', array('label' => 'Have there been any recent complaints, for example regarding disrepair?', 'required' => true, 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Have there been any recent complaints, for example regarding disrepair?', 'notEmptyInvalid' => 'Have there been any recent complaints, for example regarding disrepair?')))))); $this->addElement('textarea', 'recent_complaints_further_details', array('label' => '', 'required' => false, 'class' => 'additionalinfo fullwidth', 'rows' => '5', 'cols' => '77', 'maxlength' => '250', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please provide further details for recent complaints', 'notEmptyInvalid' => 'Please provide further details for recent complaints')))))); $this->addElement('text', 'policy_number', array('label' => 'Policy number', 'required' => 'true', 'maxlength' => '15', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the policy number', 'notEmptyInvalid' => 'Please enter the policy number')))))); $this->addElement('select', 'grounds_for_claim', array('label' => 'What are the grounds for this claim?', 'required' => true, 'multiOptions' => array('' => 'Please Select', 'rent-arrears' => 'Rent arrears', 'other' => 'Other'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the grounds for the claim', 'notEmptyInvalid' => 'Please enter the grounds for the claim')))))); $this->addElement('textarea', 'grounds_for_claim_further_details', array('label' => '', 'required' => false, 'class' => 'additionalinfo fullwidth', 'rows' => '5', 'cols' => '77', 'maxlength' => '250', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please provide further details for grounds for claim', 'notEmptyInvalid' => 'Please provide further details for grounds for claim')))))); // Add element for tenants vacated $this->addElement('select', 'tenant_vacated', array('required' => true, 'label' => 'Has the tenant(s) vacated?', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Has the tenant(s) vacated?', 'notEmptyInvalid' => 'Has the tenant(s) vacated?')))), 'multiOptions' => array('' => 'Please select', '1' => 'Yes', '0' => 'No'))); $this->addElement('text', 'arrears_at_vacant_possession', array('required' => false, 'label' => 'Please state the arrears at the date vacant possession was obtained to the nearest pound (£)', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Arrears at the date vacant possession was obtained', 'notEmptyInvalid' => 'Arrears at the date vacant possession was obtained')))))); // Add tenant vacated date $this->addElement('text', 'tenant_vacated_date', array('label' => 'Date tenants vacated (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Date tenants vacated', 'notEmptyInvalid' => 'Date tenants vacated'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Tenant vacated date must be in dd/mm/yyyy format'))))); // Add rental property postcode $this->addElement('text', 'tenantsforwarding_postcode', array('label' => 'Tenant\'s forwarding address postcode', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tenant\'s forwarding address postcode', 'notEmptyInvalid' => 'Tenant\'s forwarding address postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Tenant\'s forwarding postcode must be in postcode format'))))); // Add the find address button $this->addElement('submit', 'tenantsforwarding_address_lookup', array('ignore' => true, 'label' => 'Find Address', 'class' => 'button', 'onclick' => 'getPropertiesByPostcode($(\'#tenantsforwarding_postcode\').val(), \'tenantsforwarding_postcode\', \'tenantsforwarding_address\',\'forwarding_property_address_selector\'); return false;')); // Add agent address select element $this->addElement('select', 'tenantsforwarding_address', array('class' => 'postcode_address', 'required' => false, 'filters' => array('StringTrim'), 'multiOptions' => array('' => 'Please select'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select forwarding address', 'notEmptyInvalid' => 'Please select forwarding address')))))); // Remove 'nnn not found in haystack' error $this->getElement('tenantsforwarding_address')->setRegisterInArrayValidator(false); // Add hidden element for postcode $this->addElement('hidden', 'tenantsforwarding_address_id', array('label' => '', 'value' => 1, 'class' => 'noborder')); // Add in additional validation fields using utility class Application_Core_FormUtils::createManualAddressInput($this, 'tenantsforwarding_housename', 'tenantsforwarding_street', 'tenantsforwarding_town', 'tenantsforwarding_city', false, 'tenant\'s'); $this->addElement('checkbox', 'tenant_occupation_confirmed_by_tel', array('label' => 'By telephone')); // Add date deposit received $this->addElement('text', 'tenant_occupation_confirmed_by_tel_dateofcontact', array('label' => 'Date of contact (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your date of contact when tenant occupation of the property was confirmed by telephone', 'notEmptyInvalid' => 'Please enter your date of contact when tenant occupation of the property was confirmed by telephone'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Date of contact must be in dd/mm/yyyy format'))))); $this->addElement('text', 'tenant_occupation_confirmed_by_tel_tenantname', array('label' => 'Name of tenant contacted', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '30', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant contacted when tenant occupation of the property was confirmed by telephone', 'notEmptyInvalid' => 'Please enter the tenant contacted when tenant occupation of the property was confirmed by telephone')))))); $this->addElement('checkbox', 'tenant_occupation_confirmed_by_email', array('label' => "By email<br><span style=\"font-size:smaller;\">Please provide a copy of the email</span>")); $this->addElement('text', 'tenant_occupation_confirmed_by_email_dateofcontact', array('label' => 'Date of contact (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your date of contact when tenant occupation of the property was confirmed by email', 'notEmptyInvalid' => 'Please enter your date of contact when tenant occupation of the property was confirmed by email'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Date of contact must be in dd/mm/yyyy format'))))); $this->addElement('text', 'tenant_occupation_confirmed_by_email_tenantname', array('label' => 'Name of tenant contacted', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '30', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant contacted when tenant occupation of the property was confirmed by email', 'notEmptyInvalid' => 'Please enter the tenant contacted when tenant occupation of the property was confirmed by email')))))); $this->addElement('checkbox', 'tenant_occupation_confirmed_by_visit', array('label' => 'In person')); $this->addElement('text', 'tenant_occupation_confirmed_by_visit_dateofvisit', array('label' => 'Date of visit (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your date of visit when tenant occupation of the property was confirmed', 'notEmptyInvalid' => 'Please enter your date of visit when tenant occupation of the property was confirmed'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Date of visit must be in dd/mm/yyyy format'))))); $this->addElement('text', 'tenant_occupation_confirmed_by_visit_individualattending', array('label' => 'Name of individual attending the visit', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '30', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the name of the individual who attended the visit to confirm tenant occupation of the property', 'notEmptyInvalid' => 'Please enter the name of the individual who attended the visit to confirm tenant occupation of the property')))))); $this->addElement('text', 'tenant_occupation_confirmed_by_visit_tenantname', array('label' => 'Name of tenant spoken to', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '30', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant spoken to when tenant occupation of the property was confirmed by a visit', 'notEmptyInvalid' => 'Please enter the tenant spoken to when tenant occupation of the property was confirmed by a visit')))))); $this->addElement('select', 'section21_served', array('label' => 'Have you served a Section 21 notice seeking possession?', 'required' => true, 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Have you served a Section 21 notice seeking possession?', 'notEmptyInvalid' => 'Have you served a Section 21 notice seeking possession?')))))); $this->addElement('text', 'section21_expiry', array('label' => 'Section 21 notice expiry date (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the date the Section 21 notice expires', 'notEmptyInvalid' => 'Please enter the date the Section 21 notice expires'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Section 21 notice expiry date must be in dd/mm/yyyy format'))))); $this->addElement('select', 'section21_moneydepositreceived', array('label' => 'Was a money deposit received on or after 6 April 2007?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Was a money deposit received on or after 6 April 2007?', 'notEmptyInvalid' => 'Was a money deposit received on or after 6 April 2007?')))))); $this->addElement('select', 'section21_money_held_under_tds_deposit_scheme', array('label' => 'Was the deposit held under a TDS authorised under part 6 of the Housing Act 2004?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Was the deposit held under a TDS authorised under part 6 of the Housing Act 2004?', 'notEmptyInvalid' => 'Was the deposit held under a TDS authorised under part 6 of the Housing Act 2004?')))))); $this->addElement('select', 'section21_tds_complied_with', array('label' => 'Had the initial requirements of the TDS been complied with in relation to the deposit?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Had the initial requirements of the TDS been complied with in relation to the deposit?', 'notEmptyInvalid' => 'Had the initial requirements of the TDS been complied with in relation to the deposit?')))))); $this->addElement('select', 'section21_tds_prescribed_information_to_tenant', array('label' => 'Had you or the landlord given the tenant(s), and anyone who paid the deposit on behalf ' . 'of the tenant(s), the prescribed information in relation to the deposit and the operation of the TDS?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Had you or the landlord given the tenant, and anyone who paid the deposit on behalf ' . 'of the tenant, the prescribed information in relation to the deposit and the operation of the TDS?', 'notEmptyInvalid' => 'Had you or the landlord given the tenant, and anyone who paid the deposit on behalf ' . 'of the tenant, the prescribed information in relation to the deposit and the operation of the TDS?')))))); $this->addElement('select', 'section21_landlord_deposit_in_property_form', array('label' => 'Did the landlord receive a deposit in the form of property on or after 6 April 2007?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Did the landlord receive a deposit in the form of property on or after 6 April 2007?', 'notEmptyInvalid' => 'Did the landlord receive a deposit in the form of property on or after 6 April 2007?')))))); $this->addElement('select', 'section21_returned_at_notice_serve_date', array('label' => 'At the date the Section 21 notice was served, had the property been returned to the person from whom it was received?', 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'At the date the Section 21 notice was served, had the property been returned to the person from whom it was received?', 'notEmptyInvalid' => 'At the date the Section 21 notice was served, had the property been returned to the person from whom it was received?')))))); $this->addElement('select', 'section8_served', array('label' => 'Have you served a Section 8 notice requiring possession?', 'required' => true, 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Have you served a Section 8 notice requiring possession?', 'notEmptyInvalid' => 'Have you served a Section 8 notice requiring possession?')))))); $this->addElement('text', 'section8_expiry', array('label' => 'Section 8 notice expiry date (DD/MM/YYYY)', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the date the Section 8 notice expires', 'notEmptyInvalid' => 'Please enter the date the Section 8 notice expires'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Section 8 notice expiry date must be in dd/mm/yyyy format'))))); $this->addElement('select', 'section8_demand_letter_sent', array('label' => 'Has a demand letter been sent to the tenant(s) requesting the outstanding arrears? ' . 'If yes, you will be required to provide copies.', 'required' => true, 'multiOptions' => array('' => 'Please Select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Has a demand letter been sent to the tenant(s) requesting the outstanding arrears?', 'notEmptyInvalid' => 'Has a demand letter been sent to the tenant(s) requesting the outstanding arrears?')))))); $this->addElement('textarea', 'section8_over18_occupants', array('label' => '', 'class' => 'additionalinfo fullwidth', 'maxlength' => '250')); // Hidden element for total guarantors to create dynamic guarantor elements $this->addElement('hidden', 'totalguarantors', array('label' => '', 'value' => '0', 'class' => 'noborder')); // How many guarantors are there? $this->addElement('select', 'total_guarantors', array('label' => 'How many Guarantors are there?', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('' => 'Please Select', '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please specify the number of guarantors', 'notEmptyInvalid' => 'Please specify the number of guarantors')))))); // Add guarantor name element $this->addElement('text', 'guarantor_name', array('label' => 'Full name', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '80', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter guarantor\'s full name', 'notEmptyInvalid' => 'Please enter guarantor\'s full name')))), 'onblur' => 'validateguarantor()')); // Guarantor Home Telno $this->addElement('text', 'guarantor_hometelno', array('label' => 'Home telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter the guarantor home telephone number", 'notEmptyInvalid' => "Please enter the guarantor home telephone number")))), 'onblur' => 'validateguarantor()')); // Guarantor Work Telno $this->addElement('text', 'guarantor_worktelno', array('label' => 'Work telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter the guarantor work telephone number", 'notEmptyInvalid' => "Please enter the guarantor work telephone number")))), 'onblur' => 'validateguarantor()')); // Guarantor Mobile Telno $this->addElement('text', 'guarantor_mobiletelno', array('label' => 'Mobile number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter the guarantor mobile telephone number", 'notEmptyInvalid' => "Please enter the guarantor mobile telephone number")))), 'onblur' => 'validateguarantor()')); // Guarantor Email $this->addElement('text', 'guarantor_email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '50', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter the guarantor email address", 'notEmptyInvalid' => "Please enter the guarantor email address")))), 'onblur' => 'validateguarantor()')); // Add guarantor postcode $this->addElement('text', 'guarantor_postcode', array('label' => 'Postcode', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter guarantor address postcode', 'notEmptyInvalid' => 'Please enter guarantor address postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Guarantors postcode must be in postcode format'))))); // Add the find address button $this->addElement('submit', 'address_lookup', array('ignore' => true, 'label' => 'Find Address', 'class' => 'button', 'onclick' => 'getPropertiesByPostcode($(\'#guarantor_postcode\').val(), \'guarantor_postcode\', \'guarantor_address\',\'guarantor_child\');$(\'#guarantor_add_selector\').show(); return false;')); // Add agent address select element $this->addElement('select', 'guarantor_address', array('required' => false, 'multiOptions' => array('' => 'Please select'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select guarantor address', 'notEmptyInvalid' => 'Please select guarantor address')))), 'onblur' => 'validateguarantor()')); $this->addElement('text', 'guarantor_homeletrefno', array('label' => 'HomeLet reference number', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '10', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please select the HomeLet reference number", 'notEmptyInvalid' => "Please select the HomeLet reference number")))))); // Tenants DOB $this->addElement('text', 'guarantors_dob', array('label' => "Date of birth (DD/MM/YYYY)", 'required' => false, 'class' => "hasDatepicker", 'maxlength' => '10', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please select the guarantor date of birth", 'notEmptyInvalid' => "Please select the guarantor date of birth"))), array('regex', true, array('pattern' => '/^\\d\\d\\/\\d\\d\\/\\d\\d\\d\\d$/', 'messages' => "Guarantor date of birth incomplete"))))); // Remove 'nnn not found in haystack' error $this->getElement('guarantor_address')->setRegisterInArrayValidator(false); // Add hidden element for postcode $this->addElement('hidden', 'guarantoraddress_id', array('label' => '', 'value' => 1, 'class' => 'noborder')); // Add in additional validation fields using utility class Application_Core_FormUtils::createManualAddressInput($this, 'guarantor_housename', 'guarantor_street', 'guarantor_town', 'guarantor_city', false, 'guarantor\'s'); //How many tenants are named on the tenancy agreement? $this->addElement('select', 'total_tenants', array('label' => "How many tenants are named on the tenancy agreement?", 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('' => 'Please Select', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please specify the number of tenants on the tenancy agreement', 'notEmptyInvalid' => 'Please specify the number of tenants on the tenancy agreement')))))); // Hidden element for total tenants to create dynamic tenant elements $this->addElement('hidden', 'totaltenants', array('label' => '', 'value' => '0', 'class' => 'noborder')); // Tenant Name $this->addElement('text', 'tenant_name', array('label' => 'Full name', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '80', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter tenant\'s full name', 'notEmptyInvalid' => 'Please enter tenant\'s full name')))), 'onblur' => 'validateguarantor()')); // Tenant Home Telno $this->addElement('text', 'tenant_hometelno', array('label' => 'Home telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant home telephone number", 'notEmptyInvalid' => "Please enter tenant home telephone number")))), 'onblur' => 'validateguarantor()')); // Tenant Work Telno $this->addElement('text', 'tenant_worktelno', array('label' => 'Work telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant work telephone number", 'notEmptyInvalid' => "Please enter tenant work telephone number")))), 'onblur' => 'validateguarantor()')); // Tenant Mobile Telno $this->addElement('text', 'tenant_mobiletelno', array('label' => 'Mobile number', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '11', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant mobile telephone number", 'notEmptyInvalid' => "Please enter tenant mobile telephone number")))), 'onblur' => 'validateguarantor()')); // Tenant Email $this->addElement('text', 'tenant_email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '50', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant email address", 'notEmptyInvalid' => "Please enter tenant email address")))), 'onblur' => 'validateguarantor()')); // Policy Number / IRN $this->addElement('text', 'rg_policy_ref', array('label' => "HomeLet reference number", 'required' => false, 'maxlength' => '10', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the HomeLet reference number', 'notEmptyInvalid' => 'Please enter the HomeLet reference number'))), array('regex', true, array('pattern' => '/\\d{7}/', 'messages' => 'The HomeLet reference number must be at least seven digits long'))), 'onblur' => 'validateguarantor()')); // Tenants DOB $this->addElement('text', 'tenants_dob', array('label' => "Date of birth (DD/MM/YYYY)", 'required' => false, 'class' => "", 'maxlength' => '10', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select tenant date of birth', 'notEmptyInvalid' => 'Please select tenant date of birth'))), array('regex', true, array('pattern' => '/(?P<d>\\d{2})(?P<sep>\\D)(?P<m>\\d{2})\\2(?P<y>\\d{4})/', 'messages' => 'Tenants date of birth must be in dd/mm/yyyy format'))), 'onblur' => 'validateguarantor()')); // Set decorators $this->clearDecorators(); $this->setDecorators(array('Form')); $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors')); // Add the back button $this->addElement('submit', 'back', array('ignore' => true, 'label' => 'Back')); // Tenant Address decorators $tenantAddressLookUp = $this->getElement('tenancy_address_lookup'); $tenantAddressLookUp->clearDecorators(); $tenantAddressLookUp->setDecorators(array('ViewHelper')); // Tenant Address decorators $tenantsForwardingAddressLookUp = $this->getElement('tenantsforwarding_address_lookup'); $tenantsForwardingAddressLookUp->clearDecorators(); $tenantsForwardingAddressLookUp->setDecorators(array('ViewHelper')); // Address decorators $addressLookUp = $this->getElement('address_lookup'); $addressLookUp->clearDecorators(); $addressLookUp->setDecorators(array('ViewHelper')); // Add the next button $this->addElement('submit', 'next', array('ignore' => true, 'label' => 'Continue to Step 3')); // Add the save & exit button $this->addElement('button', 'save_exit', array('ignore' => true, 'label' => 'Save & Exit ', 'onclick' => "window.location = '/rentguaranteeclaims/saveclaim';")); $next = $this->getElement('next'); $next->clearDecorators(); $next->setDecorators(array('ViewHelper')); $back = $this->getElement('back'); $back->clearDecorators(); $back->setDecorators(array('ViewHelper')); $saveExit = $this->getElement('save_exit'); $saveExit->clearDecorators(); $saveExit->setDecorators(array('ViewHelper')); // Hide errors Application_Core_FormUtils::removeFormErrors($this); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguaranteeclaims/subforms/tenant-and-property.phtml')))); // Strip all tags to prevent XSS errors $this->setElementFilters(array('StripTags')); $this->getElement('tenant_occupation_confirmed_by_email')->getDecorator('Label')->setOption('escape', false); }
/** * Helper function to populate the zend form elements with database data * * @param Zend_Form $pageForm form definition for this step * @param int $stepNum current step number * * @return void */ private function _formStepCommonPopulate($pageForm, $stepNum) { $pageSession = new Zend_Session_Namespace('online_claims'); // First of all check that this form should be viewable and the user isn't trying to skip ahead $this->view->stepNum = $stepNum; $this->view->stepMax = $this->_stepMax; // Check to see if the user is trying to skip ahead in the claim $tooFarAhead = false; $lastCompleted = 1; if ((!isset($pageSession->completed) || is_null($pageSession->completed)) && $stepNum != 1) { $tooFarAhead = true; $lastCompleted = 1; } elseif ($stepNum > 1) { // Check to see if any pages previous to the one the user's trying to get to are incomplete $tooFarAhead = false; for ($i = 1; $i < $stepNum; $i++) { if (!isset($pageSession->completed[$i]) || !$pageSession->completed[$i]) { $tooFarAhead = true; $lastCompleted = $i; break; } } } if ($tooFarAhead) { // Drop user onto page that needs completing $response = $this->getResponse(); $response->setRedirect('/rentguaranteeclaims/step' . $lastCompleted); $response->sendResponse(); return false; } $formData = array(); $agentManager = new Manager_Core_Agent(); $agentDetails = $agentManager->getAgent($this->_agentSchemeNumber); // Populate the agents details $formData['agent_schemenumber'] = $this->_agentSchemeNumber; $formData['agent_name'] = $agentDetails->getName(); $formData['agent_postcode'] = $agentDetails->contact[0]->address->getPostCode(); $formData['agent_housename'] = $agentDetails->contact[0]->address->getHouseName(); $agentStreet = $agentDetails->contact[0]->address->getAddressLine1(); if ($agentStreet) { $agentStreet .= $agentStreet . ', '; } $agentStreet .= $agentDetails->contact[0]->address->getAddressLine2(); $formData['agent_street'] = $agentStreet; $formData['agent_town'] = $agentDetails->contact[0]->address->getTown(); $phones = $agentDetails->contact[0]->phoneNumbers->getTelephone(); $formData['agent_telephone'] = $phones['telephone1']; $formData['agent_email'] = $agentManager->getEmailAddressByCategory(Model_Core_Agent_EmailMapCategory::GENERAL); $agentManager = new Manager_Core_Agent(); $statusAbr = $agentManager->getFsaStatusCode($this->_agentSchemeNumber); $formData['agent_ar_by_barbon'] = in_array($statusAbr, array('NAR', 'AR')) == true ? 'Yes' : 'No'; $formData['agent_dir_by_fca'] = in_array($statusAbr, array('DIR')) == true ? 'Yes' : 'No'; if (isset($pageSession->ClaimReferenceNumber)) { // Only populate from DB if we are in session and have a reference number $claimReferenceNumber = $pageSession->ClaimReferenceNumber; // Populate $formData with data from model, if available $claimManager = new Manager_Insurance_RentGuaranteeClaim_Claim(); $claim = $claimManager->getClaim($claimReferenceNumber, $this->_agentSchemeNumber); // Override agents data with data from claim if available if ($claim->getAgentHousename() != '') { $formData['agent_housename'] = $claim->getAgentHousename(); } if ($claim->getAgentStreet() != '') { $formData['agent_street'] = $claim->getAgentStreet(); } if ($claim->getAgentTown() != '') { $formData['agent_town'] = $claim->getAgentTown(); } if ($claim->getAgentPostcode() != '') { $formData['agent_postcode'] = $claim->getAgentPostcode(); } if ($claim->getAgentTelephone() != '') { $formData['agent_telephone'] = $claim->getAgentTelephone(); } if ($claim->getAgentEmail() != '') { $formData['agent_email'] = $claim->getAgentEmail(); } switch ($stepNum) { case 1: // You and your Landlord section $formData['agent_contact_name'] = $claim->getAgentContactName(); $formData['landlord1_name'] = $claim->getLandlord1Name(); $formData['landlord_company_name'] = $claim->getLandlordCompanyName(); $formData['landlord_postcode'] = $claim->getLandlordPostcode(); $formData['landlord_address_id'] = $claim->getLandlordAddressId(); $formData['landlord_address'] = $claim->getLandlordAddressId(); $formData['landlord_housename'] = $claim->getLandlordHouseName(); $formData['landlord_street'] = $claim->getLandlordStreet(); $formData['landlord_city'] = $claim->getLandlordCity(); $formData['landlord_town'] = $claim->getLandlordTown(); $formData['landlord_telephone'] = $claim->getLandlordTelephone(); $formData['landlord_email'] = $claim->getLandlordEmail(); $pageForm->isValid($formData); break; case 2: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { //set step2 identifier $pageSession->identifier[$stepNum] = true; // get tenant and property details $formData['housing_act_adherence'] = $claim->getHousingActAdherence(); $formData['tenancy_start_date'] = $claim->getTenancyStartDate(); $formData['tenancy_end_date'] = $claim->getTenancyEndDate(); $formData['original_cover_start_date'] = $claim->getOriginalCoverStartDate(); $formData['monthly_rent'] = $claim->getMonthlyRent(); $formData['tenancy_address_id'] = $claim->getTenancyAddressId(); $formData['tenancy_postcode'] = $claim->getTenancyPostcode(); $formData['tenancy_housename'] = $claim->getTenancyHouseName(); $formData['tenancy_street'] = $claim->getTenancyStreet(); $formData['tenancy_town'] = $claim->getTenancyTown(); $formData['tenancy_city'] = $claim->getTenancyCity(); $formData['tenancy_postcode'] = $claim->getTenancyPostcode(); $formData['tenancy_address'] = $claim->getTenancyAddress(); $formData['tenancy_housename'] = $claim->getTenancyHouseName(); $formData['tenancy_street'] = $claim->getTenancyStreet(); $formData['tenancy_town'] = $claim->getTenancyTown(); $formData['tenancy_city'] = $claim->getTenancyCity(); $formData['deposit_amount'] = $claim->getDepositAmount(); $formData['rent_arrears'] = $claim->getRentArrears(); $formData['tenant_vacated'] = $claim->getTenantVacated(); $formData['tenant_vacated_date'] = $claim->getTenantVacatedDate(); $formData['first_arrear_date'] = $claim->getFirstArrearDate(); $formData['deposit_received_date'] = $claim->getDepositReceivedDate(); $formData['recent_complaints'] = $claim->getRecentComplaints(); $formData['recent_complaints_further_details'] = $claim->getRecentComplaintsDetails(); $formData['policy_number'] = $claim->getPolicyNumber(); $formData['grounds_for_claim'] = $claim->getGroundsForClaim(); $formData['grounds_for_claim_further_details'] = $claim->getGroundsForClaimDetails(); $formData['arrears_at_vacant_possession'] = $claim->getArrearsAtVacantPossession(); $formData['tenantsforwarding_address_id'] = $claim->getTenantsForwardingAddressId(); $formData['tenantsforwarding_housename'] = $claim->getTenantsForwardingHouseName(); $formData['tenantsforwarding_street'] = $claim->getTenantsForwardingStreet(); $formData['tenantsforwarding_town'] = $claim->getTenantsForwardingTown(); $formData['tenantsforwarding_city'] = $claim->getTenantsForwardingCity(); $formData['tenantsforwarding_postcode'] = $claim->getTenantsForwardingPostcode(); $formData['tenant_occupation_confirmed_by_tel'] = $claim->getTenantsOccupationOfPropertyConfirmedByTel(); $formData['tenant_occupation_confirmed_by_tel_dateofcontact'] = $claim->getTenantsOccupationOfPropertyConfirmedByTelDate(); $formData['tenant_occupation_confirmed_by_tel_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByTelContact(); $formData['tenant_occupation_confirmed_by_email'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmail(); $formData['tenant_occupation_confirmed_by_email_dateofcontact'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmailDate(); $formData['tenant_occupation_confirmed_by_email_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmailContact(); $formData['tenant_occupation_confirmed_by_visit'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisit(); $formData['tenant_occupation_confirmed_by_visit_dateofvisit'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitDate(); $formData['tenant_occupation_confirmed_by_visit_individualattending'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitIndividual(); $formData['tenant_occupation_confirmed_by_visit_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitContact(); $formData['section21_served'] = $claim->getS21NoticeServed(); $formData['section21_expiry'] = $claim->getS21NoticeExpiry(); $formData['section21_moneydepositreceived'] = $claim->getS21NoticeMoneyDepositReceived(); $formData['section21_money_held_under_tds_deposit_scheme'] = $claim->getS21NoticeMoneyDepositHeldUnderTdsScheme(); $formData['section21_tds_complied_with'] = $claim->getS21NoticeTdsCompliedWith(); $formData['section21_tds_prescribed_information_to_tenant'] = $claim->getS21NoticeTdsPrescribedToTenant(); $formData['section21_landlord_deposit_in_property_form'] = $claim->getS21NoticeLandlordDepositInPropertyForm(); $formData['section21_returned_at_notice_serve_date'] = $claim->getS21NoticePropertyReturnedAtNoticeServeDate(); $formData['section8_served'] = $claim->getS8NoticeServed(); $formData['section8_expiry'] = $claim->getS8NoticeExpiry(); $formData['section8_demand_letter_sent'] = $claim->getS8NoticeDemandLetterSent(); $formData['section8_over18_occupants'] = $claim->getS8NoticeOver18Occupants(); // get guarantor details $guarantorManager = new Manager_Insurance_RentGuaranteeClaim_Guarantor(); $getGuarantorInfo = $guarantorManager->getGuarantors($claimReferenceNumber); $formData['total_guarantors'] = count($getGuarantorInfo); $formData['totalguarantors'] = count($getGuarantorInfo); $createDynamicGuarantorElement = 1; foreach ($getGuarantorInfo as $setGuarantorInfo) { Application_Core_FormUtils::createManualAddressInput($pageForm, 'guarantor_housename_' . $createDynamicGuarantorElement, 'guarantor_street_' . $createDynamicGuarantorElement, 'guarantor_town_' . $createDynamicGuarantorElement, 'guarantor_city_' . $createDynamicGuarantorElement); $formData['guarantor_name_' . $createDynamicGuarantorElement] = $setGuarantorInfo['guarantor_name']; $formData['guarantor_hometelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['hometelno']; $formData['guarantor_worktelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['worktelno']; $formData['guarantor_mobiletelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['mobiletelno']; $formData['guarantor_email_' . $createDynamicGuarantorElement] = $setGuarantorInfo['email']; $formData['guarantors_dob_' . $createDynamicGuarantorElement] = date('d/m/Y', strtotime($setGuarantorInfo['dob'])); $formData['guarantor_homeletrefno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['homeletrefno']; $formData['guarantor_housename_' . $createDynamicGuarantorElement] = $setGuarantorInfo['house_name']; $formData['guarantor_street_' . $createDynamicGuarantorElement] = $setGuarantorInfo['street']; $formData['guarantor_town_' . $createDynamicGuarantorElement] = $setGuarantorInfo['town']; $formData['guarantor_city_' . $createDynamicGuarantorElement] = $setGuarantorInfo['city']; $formData['guarantor_postcode_' . $createDynamicGuarantorElement] = $setGuarantorInfo['postcode']; $formData['guarantor_address_' . $createDynamicGuarantorElement] = $setGuarantorInfo['address_id']; $createDynamicGuarantorElement++; } // get tenant details $tenantManager = new Manager_Insurance_RentGuaranteeClaim_Tenant(); $getTenantInfo = $tenantManager->getTenants($claimReferenceNumber); $formData['total_tenants'] = count($getTenantInfo); $formData['totaltenants'] = count($getTenantInfo); $createDynamicTenantElement = 1; foreach ($getTenantInfo as $setTenantInfo) { $formData['tenant_name_' . $createDynamicTenantElement] = $setTenantInfo['tenant_name']; $formData['tenant_hometelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_hometelno']; $formData['tenant_worktelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_worktelno']; $formData['tenant_mobiletelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_mobiletelno']; $formData['tenant_email_' . $createDynamicTenantElement] = $setTenantInfo['tenant_email']; $formData['tenants_dob_' . $createDynamicTenantElement] = date('d/m/Y', strtotime($setTenantInfo['tenant_dob'])); $formData['rg_policy_ref_' . $createDynamicTenantElement] = $setTenantInfo['rg_policy_ref']; $createDynamicTenantElement++; } $pageForm->isValid($formData); } break; case 3: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { //set step3 identifier $pageSession->identifier[$stepNum] = true; $formData['additional_information'] = $claim->getAdditionalInfo(); $formData['dd_accountname'] = $claim->getClaimPaymentBankAccountName(); $formData['bank_account_number'] = $claim->getClaimPaymentBankAccountNumber(); $formData['bank_sortcode_number'] = $claim->getClaimPaymentBankAccountSortCode(); } break; case 4: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { $pageSession->identifier[$stepNum] = true; $formData['doc_confirmation_agent_name'] = $claim->getDocConfirmationAgentName(); $formData['landlord_proprietor_of_property'] = $claim->getLandlordIsPropertyProprietor(); $formData['chk_confirm'] = $claim->getAuthorityConfirmed(); $formData['dec_confirm'] = $claim->getDeclarationConfirmed(); $formData['hd_type'] = $claim->getSubmittedToKeyHouse(); } break; } } else { // Not in session but there are some defaults we need to set for step 1 // TODO: Write the javascript better so we don't need to do fudges like this $this->view->headScript()->appendScript("var sharersAllowed = 0;"); } $pageForm->populate($formData); $this->view->sidebar = $this->view->partial('partials/rent-guarantee-claim-sidebar.phtml', array('stepNum' => $stepNum, 'stepMax' => $this->_stepMax)); return true; }