public function serialize(rental_contract $contract = null)
 {
     $is_payer = '';
     if (isset($contract) && $contract->get_payer_id() == $this->id) {
         $is_payer = lang('is_payer');
     }
     $address_elements = array($this->address_1, $this->address_2, "{$this->postal_code} {$this->place}");
     $address = '';
     foreach ($address_elements as $element) {
         if ($element != null && $element != '') {
             if ($address != '') {
                 $address .= ', ';
             }
             $address .= $element;
         }
     }
     $location_name = $GLOBALS['phpgw']->locations->get_name($this->location_id);
     $result_unit_number = result_unit::get_identifier_from_name($location_name['location']);
     return array('id' => $this->id, 'name' => $this->get_name(), 'identifier' => $this->identifier, 'firstname' => $this->first_name, 'lastname' => $this->last_name, 'title' => $this->title, 'company_name' => $this->company_name, 'department' => $this->department, 'address' => $address, 'address1' => $this->address_1, 'address2' => $this->address_2, 'postal_code' => $this->postal_code, 'place' => $this->place, 'phone' => $this->phone, 'mobile_phone' => $this->mobile_phone, 'fax' => $this->fax, 'email' => $this->email, 'url' => $this->url, 'location_id' => $this->location_id, 'account_number' => $this->account_number, 'reskontro' => $this->reskontro, 'is_inactive' => $this->is_inactive, 'is_payer' => $is_payer, 'result_unit_number' => $result_unit_number, 'service_id' => $this->sync_data['service_id'], 'responsibility_id' => $this->sync_data['responsibility_id'], 'org_enhet_id' => $this->get_org_enhet_id(), 'unit_leader' => $this->get_unit_leader(), 'sync_message' => implode('<br/>', $this->get_sync_problems()));
 }