phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: property/inc class.boapartment.inc.php,NONE,1.1


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.boapartment.inc.php,NONE,1.1 class.soapartment.inc.php,NONE,1.1 class.uiapartment.inc.php,NONE,1.1 class.boentrance.inc.php,1.1,1.2 class.socommon.inc.php,1.10,1.11 class.soentrance.inc.php,1.1,1.2 class.soequipment.inc.php,1.7,1.8class.soinvestment.inc.php,1.7,1.8 class.soinvoice.inc.php,1.13,1.14 class.solookup.inc.php,1.9,1.10 class.soproperty.inc.php,1.6,1.7 class.uientrance.inc.php,1.1,1.2
Date: Tue, 25 Feb 2003 06:29:31 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv24979/inc

Modified Files:
        class.boentrance.inc.php class.socommon.inc.php 
        class.soentrance.inc.php class.soequipment.inc.php 
        class.soinvestment.inc.php class.soinvoice.inc.php 
        class.solookup.inc.php class.soproperty.inc.php 
        class.uientrance.inc.php 
Added Files:
        class.boapartment.inc.php class.soapartment.inc.php 
        class.uiapartment.inc.php 
Log Message:
no message

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class boapartment
        {
                var $start;
                var $query;
                var $filter;
                var $sort;
                var $order;
                var $cat_id;

                var $public_functions = array
                (
                        'read'                          => True,
                        'read_single'           => True,
                        'save'                          => True,
                        'delete'                        => True,
                        'check_perms'           => True
                );

                var $soap_functions = array(
                        'list' => array(
                                'in'  => 
array('int','int','struct','string','int'),
                                'out' => array('array')
                        ),
                        'read' => array(
                                'in'  => array('int','struct'),
                                'out' => array('array')
                        ),
                        'save' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        ),
                        'delete' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        )
                );

                function boapartment($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.soapartment');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');
                        $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');

                        $start  = get_var('start',array('POST','GET'));
                        $query  = get_var('query',array('POST','GET'));
                        $sort   = get_var('sort',array('POST','GET'));
                        $order  = get_var('order',array('POST','GET'));
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));

                        if ($start)
                        {
                                $this->start=$start;
                        }
                        else
                        {
                                $this->start=0;
                        }

                        if(isset($query))
                        {
                                $this->query = $query;
                        }
                        if(!empty($filter))
                        {
                                $this->filter = $filter;
                        }
                        if(isset($sort))
                        {
                                $this->sort = $sort;
                        }
                        if(isset($order))
                        {
                                $this->order = $order;
                        }
                        if(isset($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
                }


                function read()
                {
                        $apartment = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id));
                        $this->total_records = $this->so->total_records;

                        for ($i=0; $i<count($apartment); $i++)
                        {
                                $apartment[$i]['date']  = 
$GLOBALS['phpgw']->common->show_date($apartment[$i]['date']);
                                $apartment[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($apartment[$i]['owner']);
                        }
                        return $apartment;
                }

                function read_single($location_code)
                {
                        return $this->so->read_single($location_code);
                }

                function read_category_name($cat_id)
                {
                        return $this->so->read_category_name($cat_id);
                }


                function save($apartment,$action='')
                {
                        if ($apartment['access'])
                        {
                                $apartment['access'] = 'private';
                        }
                        else
                        {
                                $apartment['access'] = 'public';
                        }

                        if ($action=='edit')
                        {
                                if 
($this->socommon->check_apartment($apartment['property_id'],$apartment['building_id'],$apartment['entrance_id'],$apartment['apartment_id']))
                                {
                                        $receipt = $this->so->edit($apartment);
                                }
                                else
                                {
                                        
$receipt['error'][]=array('msg'=>lang('This apartment_id ID does not exist!'));
                                }
                        }
                        else
                        {

                                
if(!$this->socommon->check_entrance($apartment['property_id'],$apartment['building_id'],$apartment['entrance_id']))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('This Entrance ID does not exist!'));
                                }

                                if(!$receipt['error'])
                                {
                                        $receipt = $this->so->add($apartment);
                                }
                        }
                        return $receipt;
                }

                function delete($location_code)
                {
                        $this->so->delete($location_code);
                }
        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class soapartment
        {
                var $grants;

                function soapartment()
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
                        {
                                $this->join = " JOIN ";
                        }
                        else
                        {
                                $this->join = " LEFT JOIN ";
                        }
                }

                function read_category_name($cat_id)
                {
                        $this->db->query("SELECT descr FROM  
fm_apartment_category  where id='$cat_id'");
                        $this->db->next_record();
                        return $this->db->f('descr');
                }

                function read($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $start=0;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'none');
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by property_id DESC';
                        }

                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( fm_apartment.owner=' . 
$this->account;
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
                                        while (list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
                                        $filtermethod .= " OR 
(fm_apartment.access='public' OR fm_apartment.owner IN(" . 
implode(',',$public_user_list) . ")))";
                                }
                                else
                                {
                                        $filtermethod .= ' )';
                                }
                        }
                        elseif ($filter == 'yours')
                        {
                                $filtermethod = " fm_apartment.owner='" . 
$this->account . "'";
                        }
                        else
                        {
                                $filtermethod = " fm_apartment.owner='" . 
$this->account . "' AND fm_apartment.access='private'";
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND 
fm_apartment.cat_id='$cat_id' ";
                        }
                        else
                        {
                                $filtermethod .= " AND  
fm_apartment.cat_id!='99' ";
                        }

                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);

                                $querymethod = " AND fm_apartment.property_id 
LIKE '%$query%' or street_name LIKE '%$query%' or fm_apartment.location_code 
LIKE '%$query%'";
                        }

                        $sql = "SELECT 
fm_apartment.property_id,fm_property.name,building_id,entrance_id,floor,apartment_id,street_number,street_name"
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
                                . " boei_bydel ON fm_property.bydel_id = 
boei_bydel.bydel_id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id $this->join"
                                . " fm_apartment_category ON 
fm_apartment.cat_id = fm_apartment_category.id "
                                . " WHERE  $filtermethod $querymethod  ";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);

                        while ($this->db->next_record())
                        {
                                $ngrants = 
(int)$this->grants[$this->db->f('apartment_owner')];
                                $apartment[] = array
                                (
                                        'location_code' => 
$this->db->f('location_code'),
                                        'property_id'   => 
$this->db->f('property_id'),
                                        'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
                                        'floor'                 => 
$this->db->f('floor'),
                                        'apartment_id'  => 
$this->db->f('apartment_id'),
                                        'street_name'   => 
$this->db->f('street_name'),
                                        'street_number' => 
$this->db->f('street_number'),
                                        'owner'                 => 
$this->db->f('owner'),
                                        'access'                => 
$this->db->f('access'),
                                        'date'                  => 
$this->db->f('entry_date'),
                                        'cat_id'                => 
(int)$this->db->f('cat_id'),
                                        'descr'                 => 
stripslashes($this->db->f('descr')),
                                        'grants'                => $ngrants
                                );
                        }
                        return $apartment;
                }

                function read_single($location_code)
                {
                        $sql = "SELECT 
fm_apartment.property_id,fm_property.name,building_id,entrance_id,floor,apartment_id,street_number,street_name,descr,fm_apartment.cat_id"
                                . "     FROM fm_apartment $this->join"
                                . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
                                . " boei_bydel ON fm_property.bydel_id = 
boei_bydel.bydel_id $this->join"
                                . " fm_streetaddress ON fm_apartment.street_id 
= fm_streetaddress.street_id"
                                . " where 
fm_apartment.location_code='$location_code'";

                        $this->db->query($sql,__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $apartment['location_code']             = 
$this->db->f('location_code');
                                $apartment['property_id']               = 
$this->db->f('property_id');
                                $apartment['property_name']             = 
$this->db->f('name');
                                $apartment['building_id']               = 
$this->db->f('building_id');
                                $apartment['entrance_id']               = 
$this->db->f('entrance_id');
                                $apartment['floor']                             
= $this->db->f('floor');
                                $apartment['apartment_id']              = 
$this->db->f('apartment_id');
                                $apartment['owner']                             
= $this->db->f('owner');
                                $apartment['descr']                             
= stripslashes($this->db->f('descr'));
                                $apartment['access']                            
= $this->db->f('access');
                                $apartment['date']                              
= $this->db->f('entry_date');
                                $apartment['cat_id']                            
= (int)$this->db->f('cat_id');
                                $apartment['remark']                            
= $this->db->f('remark');

                                return $apartment;
                        }
                }

                function add($apartment)
                {
                        $apartment['remark'] = 
$this->db->db_addslashes($apartment['remark']);

                        $this->db->query("INSERT INTO fm_apartment 
(location_code, 
property_id,building_id,entrance_id,apartment_id,floor,owner,access,descr,cat_id,remark)
 "
                                . "VALUES ('" .
                                $apartment['location_code']. "','" .
                                $apartment['property_id'] . "','" .
                                $apartment['building_id'] . "','" .
                                $apartment['entrance_id'] . "','" .
                                $apartment['apartment_id'] . "','" .
                                $apartment['floor'] . "','" .
                                $this->account . "','" .
                                $apartment['access'] . "','" .
                                $apartment['descr'] ."','" .
                                $apartment['cat_id'] ."','" .
                                $apartment['remark']. "')",__LINE__,__FILE__);

                        $receipt['message'][] = array('msg'=>lang('Apartment 
has been saved'));
                        return $receipt;
                }

                function edit($apartment)
                {
                        $apartment['remark'] = 
$this->db->db_addslashes($apartment['remark']);

                        $this->db->query("UPDATE fm_apartment set descr='" . 
$building['descr'] . "',
                                        cat_id='"       . $apartment['cat_id'] 
. "',
                                        floor='" . $apartment['floor'] . "',
                                        descr='" . $apartment['descr'] . "',
                                        access='" . $apartment['access'] . "',
                                        remark='" . $apartment['remark']
                                        . "' WHERE location_code= '" . 
$apartment['location_code'] ."'",__LINE__,__FILE__);

                        $receipt['message'][] = array('msg'=>lang('Apartment 
has been edited'));
                        return $receipt;
                }

                function delete($location_code )
                {
                        $this->db->query("DELETE FROM fm_apartment WHERE 
location_code='" . $location_code ."'",__LINE__,__FILE__);
                }
        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * -------------------------------------------------                     
    *
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
        class uiapartment
        {
                var $grants;
                var $cat_id;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;
                var $currentapp;

                var $public_functions = array
                (
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

                function uiapartment()
                {
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        $this->grants                           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boapartment',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);
                        $this->socommon                                 = 
CreateObject($this->currentapp.'.socommon',True);

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->filter                           = 
$this->bo->filter;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->part_of_town_id          = 
$this->bocommon->part_of_town_id;

                        
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'property');
                }

                function save_sessiondata()
                {
                        $data = array
                        (
                                'start'         => $this->start,
                                'query'         => $this->query,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
                                'filter'        => $this->filter,
                                'cat_id'        => $this->cat_id
                        );
                        $this->bocommon->save_sessiondata($data);
                }

                function index()
                {

                        $GLOBALS['phpgw']->xslttpl->add_file(array('apartment',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $links = $this->bocommon->menu($sub);

                        $apartment_list = $this->bo->read();

                        while (is_array($apartment_list) && list(,$apartment) = 
each($apartment_list))
                        {
                                $content[] = array
                                (
                                        'property_id'                           
=> $apartment['property_id'],
                                        'building_id'                           
=> $apartment['building_id'],
                                        'entrance_id'                           
=> $apartment['entrance_id'],
                                        'floor'                                 
        => $apartment['floor'],
                                        'apartment_id'                          
=> $apartment['apartment_id'],
                                        'street_name'                           
=> $apartment['street_name'],
                                        'street_number'                         
=> $apartment['street_number'],
                                        'descr'                                 
        => $apartment['descr'],
                                        'owner'                                 
        => $apartment['owner'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.view&location_code='
 . $apartment['location_code']),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.edit&location_code='
 . $apartment['location_code']),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.delete&location_code='
 . $apartment['location_code']),
                                        'lang_view_statustext'          => 
lang('view the apartment'),
                                        'lang_edit_statustext'          => 
lang('edit the apartment'),
                                        'lang_delete_statustext'        => 
lang('delete the apartment'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }

                        $table_header[] = array
                        (
                                'sort_street_name'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'street_name',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiapartment.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_floor'            => lang('Floor'),
                                'lang_street_name'      => lang('Street name'),
                                'lang_street_number'=> lang('Street number'),
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'sort_property_id'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'property_id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiapartment.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_property_id'      => lang('property id'),
                                'lang_property_id'              => 
lang('property id'),
                                'lang_building_id'              => 
lang('building id'),
                                'lang_entrance_id'              => 
lang('entrance id'),
                                'lang_apartment_id'             => 
lang('apartment id'),
                                'lang_owner'            => lang('owner')
                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
apartment'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.edit')
                        );

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiapartment.index',
                                                'sort'                  
=>$this->sort,
                                                'order'                 
=>$this->order,
                                                'cat_id'                
=>$this->cat_id,
                                                'district_id'   
=>$this->district_id,
                                                'filter'                
=>$this->filter,
                                                'query'                 
=>$this->query
                        );

                        $data = array
                        (
                                'links'                                         
        => $links,
                                'allow_allrows'                         => 
false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($apartment_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list apartment'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the apartment belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => 
$this->bocommon->select_category_apartment_list('filter',$this->cat_id),
                                'select_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.index'),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
                                'lang_submit'                                   
=> lang('submit'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                        $this->save_sessiondata();
                }

                function edit()
                {
                        $location_code                  = 
get_var('location_code',array('GET'));
                        $location = split('-',$location_code);
                        $property_id = $location[0];
                        $building_id = $location[1];
                        $entrance_id = $location[2];
                        $apartment_id = $location[3];

                        $values                                 = 
get_var('values',array('POST','GET'));
                        $values['property_id']  = 
get_var('property_id',array('POST'));
                        $values['property_name']        = 
get_var('property_name',array('POST'));
                        $values['building_id']  = 
get_var('building_id',array('POST'));

                        $values_attribute               = 
get_var('values_attribute',array('POST','GET'));

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('apartment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        if ($values['save'])
                        {
                                if(!$values['property_id']  && !$property_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a Property ID !'));
                                        $error_property_id=true;
                                        $error_id=true;
                                }

                                if(!$values['building_id']  && !$building_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a Building ID !'));
                                        $error_building_id=true;
                                        $error_id=true;
                                }

                                if(!$values['entrance_id']  && !$entrance_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a Entrance ID !'));
                                        $error_entrance_id=true;
                                        $error_id=true;
                                }

                                if(!$values['apartment_id']  && !$apartment_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a Apartment ID !'));
                                        $error_apartment_id=true;
                                        $error_id=true;
                                }

                                if($values['property_id']  && 
$values['building_id'] && $values['entrance_id'] && $values['apartment_id'])
                                {
                                        
if($this->socommon->check_apartment($values['property_id'],$values['building_id'],$values['entrance_id'],$values['apartment_id']))
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('This apartment is already registered!') 
. '[ 
'.$values['property_id'].'-'.$values['building_id'].'-'.$values['entrance_id'].'-'.$values['apartment_id'].'
 ]');
                                                $error_apartment_id=true;
                                                $error_id=true;
                                        }
                                }

                                if($apartment_id)
                                {
                                        $values['property_id']=$property_id;
                                        $values['building_id']=$building_id;
                                        $values['entrance_id']=$entrance_id;
                                        $values['apartment_id']=$apartment_id;
                                        $values['location_code']=$location_code;
                                        $action='edit';
                                }
                                else
                                {

                                        $values['location_code'] = 
$this->bocommon->location_code($values['property_id'],$values['building_id'],$values['entrance_id'],$values['apartment_id']);
                                        $location_code=$values['location_code'];
                                }

                                if(!$receipt['error'])
                                {
                                        $receipt = 
$this->bo->save($values,$action);

                                        if($values_attribute)
                                        {
                                                
$this->bocommon->save_attributes($values_attribute,'location');
                                        }
                                }
                        }

                        $values = $this->bo->read_single($location_code);

                        if ($apartment_id)
                        {
                                $function_msg = lang('edit apartment');
                        }
                        else
                        {
                                $function_msg = lang('add apartment');
                        }

                        if ($values['cat_id'] > 0)
                        {
                                $this->cat_id = $values['cat_id'];
                        }

                        if($error_property_id)
                        {
                                unset($values['property_id']);
                        }
                        if($error_apartment_id)
                        {
                                unset($values['apartment_id']);
                        }

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiapartment.edit',
                                'location_code' => $values['location_code']
                        );

                        if($values['apartment_id'])
                        {
                                $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>4,'id'=>$property_id
 . '-' . $building_id . '-' . $entrance_id . '-' . $apartment_id));
                                $attributes_header[]    = array
                                (
                                        'lang_name'             => lang('Name'),
                                        'lang_descr'    => lang('Description'),
                                        'lang_datatype' => lang('Datatype'),
                                        'lang_value'    => lang('Value')
                                        );
                                $location_type='view';
                        }
                        else
                        {
                                $location_type='form';
                        }

                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 
$location_type,
                                                'entrance'              => True,
                                                'property_id'   => 
$values['property_id'],
                                                'property_name' => 
$values['property_name'],
                                                'building_id'   => 
$values['building_id'],
                                                'entrance_id'   => 
$values['entrance_id'],
                                                ));

                        $data = array
                        (
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
                                'lang_attributes'                               
=> lang('Attributes'),
                                'attributes_header'                             
=> $attributes_header,
                                'attributes_values'                             
=> $attributes_values,
                                'appname'                                       
        => lang('apartment'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.index'),
                                'lang_apartment_id'                             
=> lang('Apartment ID'),
                                'lang_floor'                                    
=> lang('floor'),
                                'lang_name'                                     
        => lang('name'),
                                'lang_descr'                                    
=> lang('Description'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'lang_remark'                                   
=> lang('remark'),
                                'value_apartment_id'                    => 
$values['apartment_id'],
                                'value_floor'                                   
=> $values['floor'],
                                'value_name'                                    
=> $values['name'],
                                'value_descr'                                   
=> $values['descr'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
                                'error'                                         
        => $receipt['error'],
                                'error_flag'                                    
=> $error_id,
                                'message'                                       
        => $receipt['message'],
                                'lang_name_statustext'                  => 
lang('Enter the name of the apartment'),
                                'lang_apartment_id_statustext'  => lang('Enter 
apartment ID'),
                                'lang_floor_statustext'                 => 
lang('Enter the floor'),
                                'lang_descr_statustext'                 => 
lang('Enter the description'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the apartment'),
                                'lang_access_off_statustext'    => lang('The 
apartment is public. If the apartment should be private, check this box'),
                                'lang_access_on_statustext'             => 
lang('The apartment is private. If the apartment should be public, uncheck this 
box'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the apartment belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this apartment'),
                                'cat_list'                                      
        => 
$this->bocommon->select_category_apartment_list('select',$values['cat_id'])
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }

                function delete()
                {
                        $location_code          = 
get_var('location_code',array('GET'));
                        $location                       = 
split('-',$location_code);
                        $property_id            = $location[0];
                        $building_id            = $location[1];
                        $entrance_id            = $location[2];
                        $apartment_id           = $location[3];

                        $confirm        = get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uiapartment.index'
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($location_code);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_delete',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header'));

                        $data = array
                        (
                                'appname'                               => 
lang('apartment'),
                                'function_msg'                  => lang('delete 
apartment'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.delete&location_code='
 . $location_code),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
                                'lang_yes_statustext'   => lang('Delete the 
entry'),
                                'lang_no_statustext'    => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }

                function view()
                {
                        $location_code          = 
get_var('location_code',array('GET'));
                        $location                       = 
split('-',$location_code);
                        $property_id            = $location[0];
                        $building_id            = $location[1];
                        $entrance_id            = $location[2];
                        $apartment_id           = $location[3];

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('apartment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        $values = $this->bo->read_single($location_code);

                        $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>4,'id'=>$location_code));
                        $attributes_header[]    = array
                                (
                                        'lang_name'             => lang('Name'),
                                        'lang_descr'    => lang('Description'),
                                        'lang_datatype' => lang('Datatype'),
                                        'lang_value'    => lang('Value')
                                        );
                        $location_type='view';

                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 
$location_type,
                                                'apartment'     => True,
                                                'property_id'   => 
$values['property_id'],
                                                'building_id'   => 
$values['building_id'],
                                                'entrance_id'   => 
$values['entrance_id'],
                                                'floor'                 => 
$values['floor'],
                                                'apartment_id'  => 
$values['apartment_id'],
                                                'property_name' => 
$values['property_name']));

                        $data = array
                        (
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
                                'lang_attributes'                               
=> lang('Attributes'),
                                'attributes_header'                             
=> $attributes_header,
                                'attributes_values'                             
=> $attributes_values,
                                'appname'                                       
        => lang('apartment'),
                                'function_msg'                                  
=> lang('view apartment'),
                                'value_name'                                    
=> $values['name'],
                                'value_descr'                                   
=> $values['descr'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
                                'lang_remark'                                   
=> lang('remark'),
                                'value_category'                                
=> $this->bo->read_category_name($values['cat_id']),
                                'lang_name'                                     
        => lang('name'),
                                'lang_descr'                                    
=> lang('Description'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_done'                                     
=> lang('done'),
                                'lang_edit'                                     
=> lang('Edit'),
                                'edit_action'                           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.edit&location_code='
 . $location_code),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiapartment.index'),
                                'lang_done_statustext'          => lang('Back 
to the list'),
                                'lang_edit_statustext'          => lang('Edit 
this entry equipment'),
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
        }
?>

Index: class.boentrance.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boentrance.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.boentrance.inc.php    23 Feb 2003 21:45:34 -0000      1.1
--- class.boentrance.inc.php    25 Feb 2003 11:29:29 -0000      1.2
***************
*** 142,151 ****
                                
if(!$this->socommon->check_building($entrance['property_id'],$entrance['building_id']))
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('This property ID does not exist!'));
                                }
  
                                if(!$receipt['error'])
                                {
-                                       
$entrance['location_code']=$this->bocommon->location_code($entrance['property_id'],$entrance['building_id'],$entrance['entrance_id']);
                                        $receipt = $this->so->add($entrance);
                                }
--- 142,150 ----
                                
if(!$this->socommon->check_building($entrance['property_id'],$entrance['building_id']))
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('This Building ID does not exist!'));
                                }
  
                                if(!$receipt['error'])
                                {
                                        $receipt = $this->so->add($entrance);
                                }
***************
*** 154,160 ****
                }
  
!               function delete($property_id,$building_id,$entrance_id)
                {
!                       
$this->so->delete($property_id,$building_id,$entrance_id);
                }
        }
--- 153,159 ----
                }
  
!               function delete($location_code)
                {
!                       $this->so->delete($location_code);
                }
        }

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.socommon.inc.php      18 Feb 2003 20:38:17 -0000      1.10
--- class.socommon.inc.php      25 Feb 2003 11:29:29 -0000      1.11
***************
*** 127,131 ****
                function 
check_entrance($property_id='',$building_id='',$entrance_id='')
                {
!                       $this->db->query("SELECT count(*) FROM fm_entrance 
where property_id='$property_id' and building_id='$building_id' and 
entrance_id='$entrance_id='");
  
                        $this->db->next_record();
--- 127,131 ----
                function 
check_entrance($property_id='',$building_id='',$entrance_id='')
                {
!                       $this->db->query("SELECT count(*) FROM fm_entrance 
where property_id='$property_id' and building_id='$building_id' and 
entrance_id='$entrance_id'");
  
                        $this->db->next_record();

Index: class.soentrance.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soentrance.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.soentrance.inc.php    23 Feb 2003 21:45:34 -0000      1.1
--- class.soentrance.inc.php    25 Feb 2003 11:29:29 -0000      1.2
***************
*** 159,163 ****
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);
  
!                       $this->db->query("INSERT INTO fm_entrance 
(location_code, 
property_id,building_id,entrance_id,owner,access,entry_date,building_name,general_address,cat_id,remark)
 "
                                . "VALUES ('" .
                                $entrance['location_code']. "','" .
--- 159,163 ----
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);
  
!                       $this->db->query("INSERT INTO fm_entrance 
(location_code, 
property_id,building_id,entrance_id,owner,access,descr,cat_id,remark) "
                                . "VALUES ('" .
                                $entrance['location_code']. "','" .
***************
*** 167,173 ****
                                $this->account . "','" .
                                $entrance['access'] . "','" .
!                               time() . "','" .
!                               $entrance['name']. "','" .
!                               $entrance['general_address'] ."','" .
                                $entrance['cat_id'] ."','" .
                                $entrance['remark']. "')",__LINE__,__FILE__);
--- 167,171 ----
                                $this->account . "','" .
                                $entrance['access'] . "','" .
!                               $entrance['descr'] ."','" .
                                $entrance['cat_id'] ."','" .
                                $entrance['remark']. "')",__LINE__,__FILE__);
***************
*** 181,189 ****
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);
  
!                       $this->db->query("UPDATE fm_entrance set descr='" . 
$building['descr'] . "', entry_date='" . time()
!                                               . "', cat_id='" . 
$entrance['cat_id'] . "', general_address='" . $entrance['general_address'] . 
"', access='" . $entrance['access'] . "', remark='" . $entrance['remark']
!                                               . "' WHERE property_id= '" . 
$entrance['property_id']
!                                               . "' AND building_id=" . 
$entrance['building_id']
!                                               . "' AND entrance_id=" . 
$entrance['entrance_id'],__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('Entrance has 
been edited'));
--- 179,188 ----
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);
  
!                       $this->db->query("UPDATE fm_entrance set descr='" . 
$building['descr']  . "',
!                                       cat_id='"       . $entrance['cat_id'] . 
"',
!                                       descr='" . $entrance['descr'] . "',
!                                       access='" . $entrance['access'] . "',
!                                       remark='" . $entrance['remark']
!                                       . "' WHERE location_code= '" . 
$entrance['location_code'] ."'",__LINE__,__FILE__);
  
                        $receipt['message'][] = array('msg'=>lang('Entrance has 
been edited'));

Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soequipment.inc.php   18 Feb 2003 20:38:17 -0000      1.7
--- class.soequipment.inc.php   25 Feb 2003 11:29:29 -0000      1.8
***************
*** 129,133 ****
                        }
  
!                       $sql = "SELECT equipment_id,fm_equipment.descr, 
fm_property.navn,fm_equipment.property_id,building_id,entrance_id,floor,apartment_id,street_name,street_number,
 fm_equipment_type.name as category"
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
--- 129,133 ----
                        }
  
!                       $sql = "SELECT equipment_id,fm_equipment.descr, 
fm_property.name,fm_equipment.property_id,building_id,entrance_id,floor,apartment_id,street_name,street_number,
 fm_equipment_type.name as category"
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
***************
*** 147,151 ****
                                        'equipment_id'  => 
$this->db->f('equipment_id'),
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('navn'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
--- 147,151 ----
                                        'equipment_id'  => 
$this->db->f('equipment_id'),
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),

Index: class.soinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvestment.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soinvestment.inc.php  21 Feb 2003 10:28:59 -0000      1.7
--- class.soinvestment.inc.php  25 Feb 2003 11:29:29 -0000      1.8
***************
*** 92,96 ****
                        if ($cat_id=='property')
                        {
!                               $sql = "SELECT fm_investment.entity_id as 
entity_id, fm_investment.descr as descr, 
fm_investment_value.invest_id,initial_value, fm_property.navn, 
boei_bydel.district_id, boei_bydel.bydel,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index, "
                                . " fm_investment_value.index_count"
--- 92,96 ----
                        if ($cat_id=='property')
                        {
!                               $sql = "SELECT fm_investment.entity_id as 
entity_id, fm_investment.descr as descr, 
fm_investment_value.invest_id,initial_value, fm_property.name, 
boei_bydel.district_id, boei_bydel.bydel,"
                                . " fm_investment_value.value, 
fm_investment_value.date, fm_investment_value.this_index, "
                                . " fm_investment_value.index_count"
***************
*** 143,147 ****
                                if ($cat_id=='property')
                                {
!                                       $investment[$i]['entity_name']  = 
$this->db->f('navn');
                                }
                                else
--- 143,147 ----
                                if ($cat_id=='property')
                                {
!                                       $investment[$i]['entity_name']  = 
$this->db->f('name');
                                }
                                else

Index: class.soinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soinvoice.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.soinvoice.inc.php     18 Feb 2003 20:38:17 -0000      1.13
--- class.soinvoice.inc.php     25 Feb 2003 11:29:29 -0000      1.14
***************
*** 732,736 ****
                                $art_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('navn')
                                );
                        }
--- 732,736 ----
                                $art_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('name')
                                );
                        }
***************
*** 748,752 ****
                                $art_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('navn')
                                );
                        }
--- 748,752 ----
                                $art_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('name')
                                );
                        }
***************
*** 762,766 ****
                                $dimb_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('navn')
                                );
                        }
--- 762,766 ----
                                $dimb_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('name')
                                );
                        }
***************
*** 776,780 ****
                                $dimd_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('navn')
                                );
                        }
--- 776,780 ----
                                $dimd_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('name')
                                );
                        }
***************
*** 790,794 ****
                                $tax_code_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('navn')
                                );
                        }
--- 790,794 ----
                                $tax_code_list[] = Array(
                                        'id'        => $this->db->f('id'),
!                                       'num'       => $this->db->f('name')
                                );
                        }

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.solookup.inc.php      23 Feb 2003 21:45:34 -0000      1.9
--- class.solookup.inc.php      25 Feb 2003 11:29:29 -0000      1.10
***************
*** 307,311 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( navn LIKE '%$query%' OR 
location_code LIKE '%$query%' )";
                        }
  
--- 307,311 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( name LIKE '%$query%' OR 
location_code LIKE '%$query%' )";
                        }
  
***************
*** 323,327 ****
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name'         => 
$this->db->f('navn')
                                        );
                        }
--- 323,327 ----
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name'         => 
$this->db->f('name')
                                        );
                        }
***************
*** 405,412 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( street_name LIKE 
'%$query%' OR fm_building.location_code LIKE '%$query%' OR fm_property.navn 
LIKE '%$query%' ";
                        }
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.navn,building_id"
                        . "     FROM fm_building $this->join"
                        . " fm_property ON fm_building.property_id = 
fm_property.property_id $this->join"
--- 405,412 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( street_name LIKE 
'%$query%' OR fm_building.location_code LIKE '%$query%' OR fm_property.name 
LIKE '%$query%' ";
                        }
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.name,building_id"
                        . "     FROM fm_building $this->join"
                        . " fm_property ON fm_building.property_id = 
fm_property.property_id $this->join"
***************
*** 424,428 ****
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('navn'),
                                        'building_id'   => 
$this->db->f('building_id')
                                        );
--- 424,428 ----
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id')
                                        );
***************
*** 507,515 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( descr LIKE '%$query%' OR 
fm_property.location_code LIKE '%$query%' OR fm_property.navn LIKE '%$query%')";
                        }
  
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.navn,building_id,entrance_id,fm_entrance.descr"
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
--- 507,515 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( descr LIKE '%$query%' OR 
fm_property.location_code LIKE '%$query%' OR fm_property.name LIKE '%$query%')";
                        }
  
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.name,building_id,entrance_id,fm_entrance.descr"
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
***************
*** 527,531 ****
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('navn'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
--- 527,531 ----
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
***************
*** 616,620 ****
  
  
!                       $sql = "SELECT 
fm_apartment.property_id,fm_property.navn,building_id,entrance_id,floor,apartment_id,street_number,street_name,descr"
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
--- 616,620 ----
  
  
!                       $sql = "SELECT 
fm_apartment.property_id,fm_property.name,building_id,entrance_id,floor,apartment_id,street_number,street_name,descr"
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
***************
*** 634,638 ****
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('navn'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
--- 634,638 ----
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
***************
*** 727,731 ****
  
  
!                       $sql = "SELECT 
fm_apartment.property_id,fm_property.navn,building_id,entrance_id,floor,apartment_id,street_number,street_name,fm_apartment_category.descr,fm_apartment.tenant_id,
 first_name, last_name,contact_phone "
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
--- 727,731 ----
  
  
!                       $sql = "SELECT 
fm_apartment.property_id,fm_property.name,building_id,entrance_id,floor,apartment_id,street_number,street_name,fm_apartment_category.descr,fm_apartment.tenant_id,
 first_name, last_name,contact_phone "
                        . "     FROM fm_apartment $this->join"
                        . " fm_property ON fm_apartment.property_id = 
fm_property.property_id $this->join"
***************
*** 746,750 ****
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('navn'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
--- 746,750 ----
                                (
                                        'property_id'   => 
$this->db->f('property_id'),
!                                       'property_name' => $this->db->f('name'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),

Index: class.soproperty.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproperty.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.soproperty.inc.php    21 Feb 2003 10:28:59 -0000      1.6
--- class.soproperty.inc.php    25 Feb 2003 11:29:29 -0000      1.7
***************
*** 103,107 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND property_id LIKE 
'%$query%' or navn LIKE '%$query%'";
                        }
  
--- 103,107 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND property_id LIKE 
'%$query%' or name LIKE '%$query%'";
                        }
  
***************
*** 124,128 ****
                                        'date'                  => 
$this->db->f('entry_date'),
                                        'cat_id'                => 
(int)$this->db->f('cat_id'),
!                                       'name'                  => 
stripslashes($this->db->f('navn')),
                                        'district_id'   => 
$this->db->f('district_id'),
                                        'part_of_town'  => 
$this->db->f('bydel'),
--- 124,128 ----
                                        'date'                  => 
$this->db->f('entry_date'),
                                        'cat_id'                => 
(int)$this->db->f('cat_id'),
!                                       'name'                  => 
stripslashes($this->db->f('name')),
                                        'district_id'   => 
$this->db->f('district_id'),
                                        'part_of_town'  => 
$this->db->f('bydel'),
***************
*** 143,147 ****
                                $property['property_id']                        
                = (int)$this->db->f('property_id');
                                $property['owner']                              
= $this->db->f('owner');
!                               $property['name']                               
= stripslashes($this->db->f('navn'));
                                $property['general_address']            = 
stripslashes($this->db->f('general_address'));
                                $property['access']                             
= $this->db->f('access');
--- 143,147 ----
                                $property['property_id']                        
                = (int)$this->db->f('property_id');
                                $property['owner']                              
= $this->db->f('owner');
!                               $property['name']                               
= stripslashes($this->db->f('name'));
                                $property['general_address']            = 
stripslashes($this->db->f('general_address'));
                                $property['access']                             
= $this->db->f('access');
***************
*** 163,167 ****
                        $property['generellinfo'] = 
$this->db->db_addslashes($property['generellinfo']);
  
!                       $this->db->query("INSERT INTO fm_property 
(location_code, 
property_id,bydel_id,owner,access,entry_date,navn,general_address,cat_id,generellinfo)
 "
                                . "VALUES ('" . $property['property_id'] . 
"','" . $property['property_id'] . "','" . $property['part_of_town_id'] . "','" 
. $this->account . "','" . $property['access'] . "','" . time() . "','" . 
$property['name']
                                . "','" . $property['general_address'] ."','" . 
$property['cat_id'] ."','" . $property['generellinfo']. "')",__LINE__,__FILE__);
--- 163,167 ----
                        $property['generellinfo'] = 
$this->db->db_addslashes($property['generellinfo']);
  
!                       $this->db->query("INSERT INTO fm_property 
(location_code, 
property_id,bydel_id,owner,access,entry_date,name,general_address,cat_id,generellinfo)
 "
                                . "VALUES ('" . $property['property_id'] . 
"','" . $property['property_id'] . "','" . $property['part_of_town_id'] . "','" 
. $this->account . "','" . $property['access'] . "','" . time() . "','" . 
$property['name']
                                . "','" . $property['general_address'] ."','" . 
$property['cat_id'] ."','" . $property['generellinfo']. "')",__LINE__,__FILE__);
***************
*** 175,179 ****
                        $property['content'] = 
$this->db->db_addslashes($property['content']);
  
!                       $this->db->query("UPDATE fm_property set navn='" . 
$property['name'] . "', entry_date='" . time() . "', cat_id='"
                                                        . $property['cat_id'] . 
"', general_address='" . $property['general_address'] . "', access='" . 
$property['access'] . "', bydel_id='" . $property['part_of_town_id']. "', 
generellinfo='" . $property['generellinfo']
                                                        . "' WHERE 
property_id=" . intval($property['property_id']),__LINE__,__FILE__);
--- 175,179 ----
                        $property['content'] = 
$this->db->db_addslashes($property['content']);
  
!                       $this->db->query("UPDATE fm_property set name='" . 
$property['name'] . "', entry_date='" . time() . "', cat_id='"
                                                        . $property['cat_id'] . 
"', general_address='" . $property['general_address'] . "', access='" . 
$property['access'] . "', bydel_id='" . $property['part_of_town_id']. "', 
generellinfo='" . $property['generellinfo']
                                                        . "' WHERE 
property_id=" . intval($property['property_id']),__LINE__,__FILE__);

Index: class.uientrance.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uientrance.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uientrance.inc.php    23 Feb 2003 21:45:34 -0000      1.1
--- class.uientrance.inc.php    25 Feb 2003 11:29:29 -0000      1.2
***************
*** 16,21 ****
                var $order;
                var $filter;
-               var $part_of_town_id;
-               var $sub;
                var $currentapp;
  
--- 16,19 ----
***************
*** 89,94 ****
                                        'owner'                                 
        => $entrance['owner'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.view&location_code='
 . $entrance['location_code']),
!                                       'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.edit&location_code='
 . $entrance['location_code']),
!                                       'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.delete&location_code='
 . $entrance['location_code']),
                                        'lang_view_statustext'          => 
lang('view the entrance'),
                                        'lang_edit_statustext'          => 
lang('edit the entrance'),
--- 87,92 ----
                                        'owner'                                 
        => $entrance['owner'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.view&location_code='
 . $entrance['location_code']),
!                                       'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.edit&location_code='
 . $entrance['location_code']),
!                                       'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.delete&location_code='
 . $entrance['location_code']),
                                        'lang_view_statustext'          => 
lang('view the entrance'),
                                        'lang_edit_statustext'          => 
lang('edit the entrance'),
***************
*** 221,225 ****
                                if($values['property_id']  && 
$values['building_id'] && $values['entrance_id'])
                                {
!                                       
if($this->socommon->check_building($values['property_id'],$values['building_id'],$values['entrance_id']))
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('This entrance is already registered!') . 
'[ 
'.$values['property_id'].'-'.$values['building_id'].'-'.$values['entrance_id'].'
 ]');
--- 219,223 ----
                                if($values['property_id']  && 
$values['building_id'] && $values['entrance_id'])
                                {
!                                       
if($this->socommon->check_entrance($values['property_id'],$values['building_id'],$values['entrance_id']))
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('This entrance is already registered!') . 
'[ 
'.$values['property_id'].'-'.$values['building_id'].'-'.$values['entrance_id'].'
 ]');
***************
*** 234,250 ****
                                        $values['building_id']=$building_id;
                                        $values['entrance_id']=$entrance_id;
                                        $action='edit';
                                }
                                else
                                {
!                                       $property_id =  $values['property_id'];
!                                       $building_id =  $values['building_id'];
!                                       $entrance_id =  $values['entrance_id'];
                                }
  
- //_debug_array($values);
                                if(!$receipt['error'])
                                {
                                        $receipt = 
$this->bo->save($values,$action);
                                        if($values_attribute)
                                        {
--- 232,249 ----
                                        $values['building_id']=$building_id;
                                        $values['entrance_id']=$entrance_id;
+                                       $values['location_code']=$location_code;
                                        $action='edit';
                                }
                                else
                                {
! 
!                                       $values['location_code'] = 
$this->bocommon->location_code($values['property_id'],$values['building_id'],$values['entrance_id']);
!                                       $location_code=$values['location_code'];
                                }
  
                                if(!$receipt['error'])
                                {
                                        $receipt = 
$this->bo->save($values,$action);
+ 
                                        if($values_attribute)
                                        {
***************
*** 253,263 ****
                                }
                        }
!                       else
!                       {
!                               $values['property_id']= $property_id;
!                               $values['building_id']= $building_id;
!                               $values['entrance_id']= $entrance_id;
!                               $values = 
$this->bo->read_single($location_code);
!                       }
  
                        if ($entrance_id)
--- 252,257 ----
                                }
                        }
! 
!                       $values = $this->bo->read_single($location_code);
  
                        if ($entrance_id)
***************
*** 287,291 ****
                        (
                                'menuaction'    => 
$this->currentapp.'.uientrance.edit',
!                               'location_code' => $property_id . '-' . 
$building_id . '-' .$entrance_id
                        );
  
--- 281,285 ----
                        (
                                'menuaction'    => 
$this->currentapp.'.uientrance.edit',
!                               'location_code' => $values['location_code']
                        );
  
***************
*** 328,332 ****
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
!                               'lang_general_address'                  => 
lang('General Address'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
--- 322,326 ----
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
!                               'lang_descr'                                    
=> lang('Description'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
***************
*** 336,340 ****
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
!                               'value_general_address'                 => 
$values['general_address'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
--- 330,334 ----
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
!                               'value_descr'                                   
=> $values['descr'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
***************
*** 344,348 ****
                                'lang_name_statustext'                  => 
lang('Enter the name of the entrance'),
                                'lang_entrance_id_statustext'   => lang('Enter 
entrance ID'),
!                               'lang_general_address_statustext'=> lang('Enter 
the general address'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the entrance'),
--- 338,342 ----
                                'lang_name_statustext'                  => 
lang('Enter the name of the entrance'),
                                'lang_entrance_id_statustext'   => lang('Enter 
entrance ID'),
!                               'lang_descr_statustext'                 => 
lang('Enter the description'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the entrance'),
***************
*** 376,380 ****
                        if (get_var('confirm',array('POST')))
                        {
!                               
$this->bo->delete($property_id,$building_id,$entrance_id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }
--- 370,374 ----
                        if (get_var('confirm',array('POST')))
                        {
!                               $this->bo->delete($location_code);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }
***************
*** 439,443 ****
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
!                               'value_general_address'                 => 
$values['general_address'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
--- 433,437 ----
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
!                               'value_descr'                                   
=> $values['descr'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
***************
*** 446,450 ****
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
!                               'lang_general_address'                  => 
lang('General Address'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_done'                                     
=> lang('done'),
--- 440,444 ----
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
!                               'lang_descr'                                    
=> lang('Description'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_done'                                     
=> lang('done'),





reply via email to

[Prev in Thread] Current Thread [Next in Thread]