/**
  * 
  * Add a new contact...
  */
 public function addContactAction()
 {
     $return = array();
     $pageSession = new Zend_Session_Namespace('letting_agents_application');
     $agent = new LettingAgents_Manager_AgentApplication();
     $agentData = new LettingAgents_Object_AgentApplication();
     $agentData = $agent->fetchByUid($pageSession->agentUniqueId);
     $agencyid = $agentData->get_id();
     $postData = $this->getRequest()->getParams();
     $contactManager = new LettingAgents_Manager_Contacts();
     $agent = new LettingAgents_Manager_AgentApplication();
     $agentData = new LettingAgents_Object_AgentApplication();
     $agentData = $agent->fetchByUid($pageSession->agentUniqueId);
     $organisation_type = $agentData->get_organisation_type();
     switch ($organisation_type) {
         case LettingAgents_Object_CompanyTypes::LimitedCompany:
             $data = new LettingAgents_Object_Contact();
             $partialFile = "limited-company-list.phtml";
             break;
         case LettingAgents_Object_CompanyTypes::LimitedLiabilityPartnership:
         case LettingAgents_Object_CompanyTypes::Partnership:
             $data = new LettingAgents_Object_PartnershipContact();
             $partialFile = "partnership-list.phtml";
             break;
     }
     $data->set_agency_id($agencyid);
     if (isset($postData['contact_name'])) {
         $data->set_contact_name($postData['contact_name']);
     }
     if (isset($postData['address1'])) {
         $data->set_address1($postData['address1']);
     }
     if (isset($postData['address2'])) {
         $data->set_address2($postData['address2']);
     }
     if (isset($postData['address3'])) {
         $data->set_address3($postData['address3']);
     }
     if (isset($postData['birth_date'])) {
         $data->set_birth_date($postData['birth_date']);
     }
     if (isset($postData['ni_number'])) {
         $data->set_ni_number($postData['ni_number']);
     }
     if (isset($postData['passport_number'])) {
         $data->set_passport_number($postData['passport_number']);
     }
     if (isset($postData['postcode'])) {
         $data->set_postcode($postData['postcode']);
     }
     $lastid = $contactManager->save($data);
     # $contactManager->fetchByAgencyUid($pageSession->agentUniqueId);
     $return['contactHtml'] = $this->view->partialLoop("partials/{$partialFile}", $contactManager->fetchByAgencyUid($pageSession->agentUniqueId));
     echo Zend_Json::encode($return);
 }
 /**
  * 
  * Returns all the member variables as an array
  * @param &$props reference array, the properties of this object
  * @param $trim bool if true removes the left most _ on private variable names
  * 
  */
 public function toArray($props = array(), $trim = true)
 {
     #Zend_Debug::dump($props);
     $props = array_merge($props, get_object_vars($this));
     $props = parent::toArray($props);
     //Zend_Debug::dump($props);die("Soletrader");
     return $props;
 }