phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.borequest.inc.php,NONE,1.1 class.sorequest.inc.php,NONE,1.1 class.uirequest.inc.php,NONE,1.1 class.bocommon.inc.php,1.33,1.34 class.historylog.inc.php,1.1,1.2 class.solookup.inc.php,1.15,1.16 class.soproject.inc.php,1.7,1.8 class.uilookup.inc.php,1.11,1.12 class.uiproject.inc.php,1.9,1.10 class.uitts.inc.php,1.15,1.16
Date: Sat, 12 Apr 2003 13:55:07 -0400

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

Modified Files:
        class.bocommon.inc.php class.historylog.inc.php 
        class.solookup.inc.php class.soproject.inc.php 
        class.uilookup.inc.php class.uiproject.inc.php 
        class.uitts.inc.php 
Added Files:
        class.borequest.inc.php class.sorequest.inc.php 
        class.uirequest.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 borequest
        {
                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
                );

                function borequest($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so                       = 
CreateObject($this->currentapp.'.sorequest');
                        $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','request');
                        $this->contacts         = 
CreateObject('phpgwapi.contacts');

                        $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'));
                        $status_id      = 
get_var('status_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;
                        }
                        if(isset($status_id))
                        {
                                $this->status_id = $status_id;
                        }
                }


                function 
select_degree_list($degree_value='',$degreedefault_type='')
                {
                        if ($degree_value)
                        {
                                $selected=$degree_value;
                        }
                        else
                        {
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property'][$degreedefault_type];
                        }

                        $degree_comment[0]=' - '.lang('None');
                        $degree_comment[1]=' - '.lang('Minor');
                        $degree_comment[2]=' - '.lang('Medium');
                        $degree_comment[3]=' - '.lang('Serious');
                        for ($i=0; $i<=3; $i++)
                        {
                                $degree_list[$i][id] = $i;
                                $degree_list[$i]['name'] = $i . 
$degree_comment[$i];
                                if ($i==$selected)
                                {
                                        $degree_list[$i]['selected']= 
'selected';
                                }
                        }

                        return $degree_list;
                }

                function select_probability_list($probability_value='')
                {
                        $selected=$probability_value;

                        $probability_comment[1]=' - '.lang('Small');
                        $probability_comment[2]=' - '.lang('Medium');
                        $probability_comment[3]=' - '.lang('Large');
                        for ($i=1; $i<=3; $i++)
                        {
                                $probability_list[$i][id] = $i;
                                $probability_list[$i]['name'] = $i . 
$probability_comment[$i];
                                if ($i==$selected)
                                {
                                        $probability_list[$i]['selected']= 
'selected';
                                }
                        }

                        return $probability_list;
                }

                function 
select_consequence_list($consequence_value='',$consequencedefault_type='')
                {
                        if ($consequence_value)
                        {
                                $selected=$consequence_value;
                        }
                        else
                        {
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property'][$consequencedefault_type];
                        }

                        $consequence_comment[0]=' - '.lang('None Consequences');
                        $consequence_comment[1]=' - '.lang('Minor 
Consequences');
                        $consequence_comment[2]=' - '.lang('Medium 
Consequences');
                        $consequence_comment[3]=' - '.lang('Serious 
Consequences');
                        for ($i=0; $i<=3; $i++)
                        {
                                $consequence_list[$i][id] = $i;
                                $consequence_list[$i]['name'] = $i . 
$consequence_comment[$i];
                                if ($i==$selected)
                                {
                                        $consequence_list[$i]['selected']= 
'selected';
                                }
                        }

                        return $consequence_list;
                }


                function select_status_list($format='',$selected='')
                {
                        switch($format)
                        {
                                case 'select':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
                                        break;
                                case 'filter':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
                                        break;
                        }

                        $status_entries= $this->so->select_status_list();

                        while (is_array($status_entries) && list(,$status) = 
each($status_entries))
                        {
                                $sel_status = '';
                                if ($status['id']==$selected)
                                {
                                        $sel_status = 'selected';
                                }

                                $status_list[] = array
                                (
                                        'id'            => $status['id'],
                                        'name'          => $status['name'],
                                        'selected'      => $sel_status
                                );
                        }

                        for ($i=0;$i<count($status_list);$i++)
                        {
                                if ($status_list[$i]['selected'] != 'selected')
                                {
                                        unset($status_list[$i]['selected']);
                                }
                        }

                        return $status_list;
                }

                function select_branch_list($selected='')
                {

                        $branch_entries= $this->so->select_branch_list();

                        while (is_array($branch_entries) && list(,$branch) = 
each($branch_entries))
                        {
                                $sel_branch = '';
                                if ($branch['id']==$selected)
                                {
                                        $sel_branch = 'selected';
                                }

                                $branch_list[] = array
                                (
                                        'id'            => $branch['id'],
                                        'name'          => $branch['name'],
                                        'selected'      => $sel_branch
                                );
                        }

                        for ($i=0;$i<count($branch_list);$i++)
                        {
                                if ($branch_list[$i]['selected'] != 'selected')
                                {
                                        unset($branch_list[$i]['selected']);
                                }
                        }

                        return $branch_list;
                }

                function select_branch_p_list($request_id='')
                {

                        $selected               = 
$this->so->branch_p_list($request_id);
                        $branch_entries = $this->so->select_branch_list();

                        $j=0;
                        while (is_array($branch_entries) && list(,$branch) = 
each($branch_entries))
                        {
                                $branch_list[$j]['id'] = $branch['id'];
                                $branch_list[$j]['name'] = $branch['name'];

                                for ($i=0;$i<count($selected);$i++)
                                {
                                        if($selected[$i]['branch_id'] == 
$branch['id'])
                                        {
                                                $branch_list[$j]['selected'] = 
'selected';
                                        }
                                }
                                $j++;
                        }

                        for ($i=0;$i<count($branch_list);$i++)
                        {
                                if ($branch_list[$i]['selected'] != 'selected')
                                {
                                        unset($branch_list[$i]['selected']);
                                }
                        }

                        return $branch_list;
                }


                function select_key_location_list($selected='')
                {

                        $key_location_entries= 
$this->so->select_key_location_list();

                        while (is_array($key_location_entries) && 
list(,$key_location) = each($key_location_entries))
                        {
                                $sel_key_location = '';
                                if ($key_location['id']==$selected)
                                {
                                        $sel_key_location = 'selected';
                                }

                                $key_location_list[] = array
                                (
                                        'id'            => $key_location['id'],
                                        'name'          => 
$key_location['name'],
                                        'selected'      => $sel_key_location
                                );
                        }

                        for ($i=0;$i<count($key_location_list);$i++)
                        {
                                if ($key_location_list[$i]['selected'] != 
'selected')
                                {
                                        
unset($key_location_list[$i]['selected']);
                                }
                        }

                        return $key_location_list;
                }

                function select_category_request_list($format='',$selected='')
                {
                        switch($format)
                        {
                                case 'select':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
                                        break;
                                case 'filter':
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
                                        break;
                        }

                        $categories= 
$this->so->select_category_workorder_list();

                        while (is_array($categories) && list(,$category) = 
each($categories))
                        {
                                $sel_category = '';
                                if ($category['id']==$selected)
                                {
                                        $sel_category = 'selected';
                                }

                                $category_list[] = array
                                (
                                        'cat_id'        => $category['id'],
                                        'name'          => $category['name'],
                                        'selected'      => $sel_category
                                );
                        }

                        for ($i=0;$i<count($category_list);$i++)
                        {
                                if ($category_list[$i]['selected'] != 
'selected')
                                {
                                        unset($category_list[$i]['selected']);
                                }
                        }

                        return $category_list;
                }


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

                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];

                        for ($i=0; $i<count($request); $i++)
                        {
                                $request[$i]['coordinator'] = 
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
                                $request[$i]['start_date'] = 
$GLOBALS['phpgw']->common->show_date($request[$i]['start_date'],$dateformat);
                        }

                        return $request;
                }

                function read_single($request_id)
                {
                        $request                                                
= $this->so->read_single($request_id);
                        $dateformat                                             
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $request['start_date']                  = 
$GLOBALS['phpgw']->common->show_date($request['start_date'],$dateformat);
                        $request['end_date']                    = 
$GLOBALS['phpgw']->common->show_date($request['end_date'],$dateformat);

                        if($request['tenant_id'])
                        {
                                
$tenant_data=$this->socommon->read_single_tenant($request['tenant_id']);
                                $request['tenant_phone']= 
$tenant_data['tenant_phone'];
                                $request['tenant_name']= 
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
                        }

                        
$location_data=$this->socommon->read_location_data($request['location_code']);

                        $request=$request + $location_data;

//_debug_array($location_data);
                        return $request;
                }


                function read_record_history($id)
                {
                        $history_array = 
$this->historylog->return_array(array('O'),array(),'','',$id);
                        $i=0;
                        while (is_array($history_array) && list(,$value) = 
each($history_array))
                        {

                                $record_history[$i]['value_date']       = 
$GLOBALS['phpgw']->common->show_date($value['datetime']);
                                $record_history[$i]['value_user']       = 
$value['owner'];

                                switch ($value['status'])
                                {
                                        case 'R': $type = lang('Re-opened'); 
break;
                                        case 'X': $type = lang('Closed');    
break;
                                        case 'O': $type = lang('Opened');    
break;
                                        case 'A': $type = lang('Re-assigned'); 
break;
                                        case 'P': $type = lang('Priority 
changed'); break;
                                        case 'CO': $type = lang('Initial 
Coordinator'); break;
                                        case 'C': $type = lang('Coordinator 
changed'); break;
                                        case 'TO': $type = lang('Initial 
Category'); break;
                                        case 'T': $type = lang('Category 
changed'); break;
                                        case 'SO': $type = lang('Initial 
Status'); break;
                                        case 'S': $type = lang('Status 
changed'); break;
                                        default: break;
                                }

                                
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
                                
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}


                                $record_history[$i]['value_action']     = 
$type?$type:'';
                                unset($type);

                                if ($value['status'] == 'A')
                                {
                                        if (! $value['new_value'])
                                        {
                                                
$record_history[$i]['value_new_value']  = lang('None');
                                        }
                                        else
                                        {
                                                
$record_history[$i]['value_new_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
                                        }
                                }
                                else if ($value['status'] == 'C' || 
$value['status'] == 'CO')
                                {
                                        $record_history[$i]['value_new_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
                                }
                                else if ($value['status'] == 'T' || 
$value['status'] == 'TO')
                                {
                                        $record_history[$i]['value_new_value']  
= $this->so->read_single_request_category($value['new_value']);
                                }
                                else if ($value['status'] != 'O' && 
$value['new_value'])
                                {
                                        $record_history[$i]['value_new_value']  
= $value['new_value'];
                                }
                                else
                                {
                                        $record_history[$i]['value_new_value']  
= '';
                                }

                                $i++;
                        }

                        return $record_history;
                }


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

                function save($request,$action='')
                {
                        $start_date     = 
$this->bocommon->date_array($request['start_date']);
                        $end_date       = 
$this->bocommon->date_array($request['end_date']);

                        $request['start_date']  = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
                        $request['end_date']    = mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
                        
$request['location_code']=$this->bocommon->location_code($request['property_id'],$request['building_id'],$request['entrance_id'],$request['apartment_id']);

//_debug_array($request);
                        if ($action=='edit')
                        {
                                        $receipt = $this->so->edit($request);
                        }
                        else
                        {
                                $receipt = $this->so->add($request);
                        }
                        return $receipt;
                }

                function read_single_equipment_type($equipment_type_id)
                {
                        return 
$this->so->read_single_equipment_type($equipment_type_id);
                }

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

--- 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 sorequest
        {
                var $grants;

                function sorequest()
                {
                        $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'];
                        $this->soproject        = 
CreateObject($this->currentapp.'.soproject');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','request');

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


                function select_category_workorder_list()
                {

                        $this->db->query("SELECT id, descr FROM 
fm_wo_workorder_category  ORDER BY descr ");

                        $i = 0;
                        while ($this->db->next_record())
                        {
                                $categories[$i]['id']                           
= $this->db->f('id');
                                $categories[$i]['name']                         
= stripslashes($this->db->f('descr'));
                                $i++;
                        }
                        return $categories;
                }

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

                function select_status_list()
                {
                        $this->db->query("SELECT id, descr FROM 
fm_wo_wrkorders_status ORDER BY id ");

                        $i = 0;
                        while ($this->db->next_record())
                        {
                                $status_entries[$i]['id']                       
        = $this->db->f('id');
                                $status_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
                                $i++;
                        }
                        return $status_entries;
                }

                function select_branch_list()
                {
                        $this->db->query("SELECT id, descr FROM fm_wo_branch 
ORDER BY id ");

                        $i = 0;
                        while ($this->db->next_record())
                        {
                                $branch_entries[$i]['id']                       
        = $this->db->f('id');
                                $branch_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
                                $i++;
                        }
                        return $branch_entries;
                }

                function select_key_location_list()
                {
                        $this->db->query("SELECT id, descr FROM fm_wo_key_loc 
ORDER BY descr ");

                        $i = 0;
                        while ($this->db->next_record())
                        {
                                $key_location_entries[$i]['id']                 
        = $this->db->f('id');
                                $key_location_entries[$i]['name']               
        = stripslashes($this->db->f('descr'));
                                $i++;
                        }
                        return $key_location_entries;
                }

                function read($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $start=0;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'');
                                $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);
                                $status_id = 
(isset($data['status_id'])?$data['status_id']:0);
                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by fm_wo_request.id ASC';
                        }

                        $filtermethod = ' ( fm_wo_request.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_wo_request.access='public' OR fm_wo_request.owner IN(" . 
implode(',',$public_user_list) . ")))";
                        }
                        else
                        {
                                $filtermethod .= ' )';
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND 
fm_wo_request.category='$cat_id' ";
                        }

                        if ($status_id)
                        {
                                $filtermethod .= " AND 
fm_wo_request.status='$status_id' ";
                        }

                        if ($filter)
                        {
                                $filtermethod .= " AND 
fm_wo_request.coordinator='$filter' ";
                        }

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

                                $querymethod = " AND fm_wo_request.name LIKE 
'%$query%' or fm_wo_request.descr LIKE '%$query%' or fm_wo_request.address LIKE 
'%$query%' or fm_wo_request.location_code LIKE '%$query%'";
                        }

                        $sql = "SELECT * FROM fm_wo_request 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('fm_wo_request.owner')];
                                $request_list[] = array
                                (
                                        'request_id'    => $this->db->f('id'),
                                        'name'                  => 
stripslashes($this->db->f('name')),
                                        'start_date'    => 
$this->db->f('start_date'),
                                        'coordinator'   => 
$this->db->f('coordinator'),
                                        'equipment_id'  => 
$this->db->f('equipment_id'),
                                        'location_code' => 
$this->db->f('location_code'),
                                        'floor'                 => 
$this->db->f('floor'),
                                        'address'               => 
$this->db->f('address'),
                                        'category'              => 
$this->db->f('category'),
                                        'title'                 => 
$this->db->f('title'),
                                        'grants'                => $ngrants
                                        );
                        }
//_debug_array($request_list);
                        return $request_list;
                }

                function read_single($request_id)
                {
                        $sql = "SELECT * from fm_wo_request where 
id='$request_id'";

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

                        if ($this->db->next_record())
                        {
                                $request['request_id']                          
        = $this->db->f('id');
                                $request['title']                               
                = $this->db->f('title');
                                $request['equipment_id']                        
        = $this->db->f('equipment_id');
                                $request['location_code']                       
        = $this->db->f('location_code');
                                $request['descr']                               
                = $this->db->f('descr');
                                $request['status']                              
                = $this->db->f('status');
                                $request['budget']                              
                = (int)$this->db->f('budget');
                                $request['actual_cost']                         
        = $this->db->f('actual_cost');
                                $request['tenant_id']                           
        = $this->db->f('tenant_id');
                                $request['owner']                               
                = $this->db->f('owner');
                                $request['coordinator']                         
        = $this->db->f('coordinator');
                                $request['access']                              
                = $this->db->f('access');
                                $request['start_date']                          
        = $this->db->f('start_date');
                                $request['end_date']                            
        = $this->db->f('end_date');
                                $request['cat_id']                              
                = $this->db->f('category');

                                $request['branch_id']                           
        = $this->db->f('branch_id');
                                $request['d_safety']                            
        = $this->db->f('d_safety');
                                $request['d_aesthetics']                        
        = $this->db->f('d_aesthetics');
                                $request['d_indoor_climate']                    
= $this->db->f('d_indoor_climate');
                                $request['d_consequential_damage']              
= $this->db->f('d_consequential_damage');
                                $request['d_user_gratification']                
= $this->db->f('d_user_gratification');
                                $request['d_residential_environment']   = 
$this->db->f('d_residential_environment');
                                $request['c_safety']                            
        = $this->db->f('c_safety');
                                $request['c_aesthetics']                        
        = $this->db->f('c_aesthetics');
                                $request['c_indoor_climate']                    
= $this->db->f('c_indoor_climate');
                                $request['c_consequential_damage']              
= $this->db->f('c_consequential_damage');
                                $request['c_user_gratification']                
= $this->db->f('c_user_gratification');
                                $request['c_residential_environment']   = 
$this->db->f('c_residential_environment');
                                $request['p_safety']                            
        = $this->db->f('p_safety');
                                $request['p_aesthetics']                        
        = $this->db->f('p_aesthetics');
                                $request['p_indoor_climate']                    
= $this->db->f('p_indoor_climate');
                                $request['p_consequential_damage']              
= $this->db->f('p_consequential_damage');
                                $request['p_user_gratification']                
= $this->db->f('p_user_gratification');
                                $request['p_residential_environment']   = 
$this->db->f('p_residential_environment');
                                $request['auth_demand']                         
        = $this->db->f('authorities_demands');

                                $request['power_meter'] = 
$this->soproject->get_power_meter($this->db->f('location_code'));
                        }

//_debug_array($request);
                                return $request;
                }


                function request_workorder_data($request_id = '')
                {
                        $this->db->query("select budget, id as workorder_id, 
vendor_id from fm_wo_wrkorders where request_id='$request_id'");
                        while ($this->db->next_record())
                        {
                                $budget[] = array(
                                        'workorder_id'  => 
$this->db->f('workorder_id'),
                                        'budget'                => 
sprintf("%01.2f",$this->db->f('budget')),
                                        'vendor_id'     => 
$this->db->f('vendor_id')
                                        );
                        }
                        return $budget;
                }

                function branch_p_list($request_id = '')
                {

                        $this->db2->query("SELECT branch_id from 
fm_wo_requestbranch WHERE request_id='$request_id' ",__LINE__,__FILE__);
                        while ($this->db2->next_record())
                        {
                                $selected[] = array('branch_id' => 
$this->db2->f('branch_id'));
                        }

                        return $selected;
                }

                function check_equipment($equipment_id='')
                {
                        $this->db->query("SELECT count(*) FROM fm_equipment 
where equipment_id='$equipment_id'");

                        $this->db->next_record();

                        if ( $this->db->f(0))
                        {
                                return True;
                        }
                }

                function read_single_equipment_type($equipment_type_id)
                {
                        $this->db->query("SELECT name FROM fm_equipment_type  
where id='$equipment_type_id'");
                        $this->db->next_record();
                        return $this->db->f('name');
                }

                function increment_request_id()
                {
                        $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'request'");
                        $this->db->query("select value from fm_idgenerator 
where name = 'request'");
                        $this->db->next_record();
                        $request_id = $this->db->f('value');
                        return $request_id;
                }


                function add($request)
                {

                        
$this->historylog->add('SO',$request['request_id'],$request['status']);
                        
$this->historylog->add('TO',$request['request_id'],$request['cat_id']);
                        
$this->historylog->add('CO',$request['request_id'],$request['coordinator']);

                        if($request['street_number'])
                        {
                                $address= $request['street_name'] . ' ' . 
$request['street_number'];
                        }
                        else
                        {
                                $address= $request['street_name'];
                        }

                        $request['descr'] = 
$this->db->db_addslashes($request['descr']);
                        $request['name'] = 
$this->db->db_addslashes($request['name']);
//                      $request['title'] = 
$this->db->db_addslashes($request['title']);
//_debug_array($request);
                        $this->db->query("insert into fm_wo_request 
(id,title,owner,category,descr,location_code,equipment_id,property_id,floor,"
                                . 
"address,tenant_id,entry_date,budget,status,branch_id,coordinator,"
                                . 
"d_safety,d_aesthetics,d_indoor_climate,d_consequential_damage,d_user_gratification,d_residential_environment,"
                                . 
"c_safety,c_aesthetics,c_indoor_climate,c_consequential_damage,c_user_gratification,c_residential_environment,"
                                . 
"p_safety,p_aesthetics,p_indoor_climate,p_consequential_damage,p_user_gratification,p_residential_environment,authorities_demands)
 "
                                . "VALUES ('"
                                . $request['request_id']. "','"
                                . $request['title']. "','"
                                . $this->account. "','"
                                . $request['cat_id']. "','"
                                . $request['descr']. "','"
                                . $request['location_code']. "','"
                                . $request['equipment_id']. "','"
                                . $request['property_id']. "','"
                                . $request['floor']. "','"
                                . $address. "','"
                                . $request['tenant_id']. "','"
                                . time(). "','"
                                . $request['budget']. "','"
                                . $request['status']. "','"
                                . $request['branch_id']. "','"
                                . $request['coordinator']. "','"
                                . $request['d_safety']. "','"
                                . $request['d_aesthetics']. "','"
                                . $request['d_indoor_climate']. "','"
                                . $request['d_consequential_damage']. "','"
                                . $request['d_user_gratification']. "','"
                                . $request['d_residential_environment']. "','"
                                . $request['c_safety']. "','"
                                . $request['c_aesthetics']. "','"
                                . $request['c_indoor_climate']. "','"
                                . $request['c_consequential_damage']. "','"
                                . $request['c_user_gratification']. "','"
                                . $request['c_residential_environment']. "','"
                                . $request['p_safety']. "','"
                                . $request['p_aesthetics']. "','"
                                . $request['p_indoor_climate']. "','"
                                . $request['p_consequential_damage']. "','"
                                . $request['p_user_gratification']. "','"
                                . $request['p_residential_environment']. "','"
                                . $request['auth_demand']. 
"')",__LINE__,__FILE__);


                        if($request['tenant_phone'])
                        {
                                $this->db->query("update fm_tenant set 
contact_phone='". $request['tenant_phone']. "' where tenant_id='". 
$request['tenant_id']. "'",__LINE__,__FILE__);
                        }

                        if ($request['power_meter'] )
                        {
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code']);
                        }

                        $receipt['message'][] = array('msg'=>lang('request %1 
has been saved',$request['request_id']));
                        return $receipt;
                }

                function edit($request)
                {
                        $this->db->query("SELECT status,category,coordinator 
FROM fm_wo_request where id='" .$request['request_id']."'",__LINE__,__FILE__);

                        $this->db->next_record();

                        $old_status = $this->db->f('status');
                        $old_categroy = $this->db->f('category');
                        $old_coordinator = $this->db->f('coordinator');
                        if ($old_status != $request['status'])
                        {
                                
$this->historylog->add('S',$request['request_id'],$request['status']);
                        }
                        if ($old_categroy != $request['cat_id'])
                        {
                                
$this->historylog->add('T',$request['request_id'],$request['cat_id']);
                        }
                        if ($old_coordinator != $request['coordinator'])
                        {
                                
$this->historylog->add('C',$request['request_id'],$request['coordinator']);
                        }

                        if($request['street_number'])
                        {
                                $address= $request['street_name'] . ' ' . 
$request['street_number'];
                        }
                        else
                        {
                                $address= $request['street_name'];
                        }

                        $request['descr'] = 
$this->db->db_addslashes($request['descr']);
                        $request['name'] = 
$this->db->db_addslashes($request['name']);
                        $request['title'] = 
$this->db->db_addslashes($request['title']);
//_debug_array($request);

                        $this->db->query("UPDATE fm_wo_request set
                                status                  ='" . 
$request['status'] . "',
                                category                ='" . 
$request['cat_id'] . "',
                                coordinator             ='" . 
$request['coordinator'] . "',
                                descr                   ='" . $request['descr'] 
. "',
                                title                   ='"     . 
$request['title'] . "',
                                budget                  ='" . 
(int)$request['budget'] . "',
                                tenant_id               ='" . 
$request['tenant_id'] . "',
                                location_code   ='" . $request['location_code'] 
. "',
                                floor                   ='" . $request['floor'] 
. "',
                                equipment_id    ='" . $request['equipment_id'] 
. "',
                                branch_id       ='" . $request['branch_id'] . 
"',
                                d_safety        ='" . $request['d_safety'] . "',
                                d_aesthetics    ='" . $request['d_aesthetics'] 
. "',
                                d_indoor_climate        ='" . 
$request['d_indoor_climate'] . "',
                                d_consequential_damage  ='" . 
$request['d_consequential_damage'] . "',
                                d_user_gratification    ='" . 
$request['d_user_gratification'] . "',
                                d_residential_environment       ='" . 
$request['d_residential_environment'] . "',

                                c_safety        ='" . $request['c_safety'] . "',
                                c_aesthetics    ='" . $request['c_aesthetics'] 
. "',
                                c_indoor_climate        ='" . 
$request['c_indoor_climate'] . "',
                                c_consequential_damage  ='" . 
$request['c_consequential_damage'] . "',
                                c_user_gratification    ='" . 
$request['c_user_gratification'] . "',
                                c_residential_environment       ='" . 
$request['c_residential_environment'] . "',

                                p_safety        ='" . $request['p_safety'] . "',
                                p_aesthetics    ='" . $request['p_aesthetics'] 
. "',
                                p_indoor_climate        ='" . 
$request['p_indoor_climate'] . "',
                                p_consequential_damage  ='" . 
$request['p_consequential_damage'] . "',
                                p_user_gratification    ='" . 
$request['p_user_gratification'] . "',
                                p_residential_environment       ='" . 
$request['p_residential_environment'] . "',

                                authorities_demands     ='" . 
$request['auth_demand'] . "',
                                address                 ='" . $address
                                . "' WHERE id= '" . $request['request_id'] 
."'",__LINE__,__FILE__);

                        if($request['tenant_phone'])
                        {
                                $this->db->query("update fm_tenant set 
contact_phone='". $request['tenant_phone']. "' where tenant_id='". 
$request['tenant_id']. "'",__LINE__,__FILE__);
                        }

                        if ($request['power_meter'] )
                        {
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code']);
                        }

                        $receipt['message'][] = array('msg'=>lang('request %1 
has been edited',$request['request_id']));
                        return $receipt;

                }

                function delete($request_id )
                {
                        $this->db->query("DELETE FROM fm_wo_request WHERE id='" 
. $request_id . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_wo_request_history  
WHERE  history_record_id='" . $request_id   . "'",__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 uirequest
        {
                var $grants;
                var $cat_id;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;
                var $part_of_town_id;
                var $sub;
                var $currentapp;

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

                function uirequest()
                {
                        $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.'.borequest',True);
                        $this->boproject                        = 
CreateObject($this->currentapp.'.boproject',True);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon',True);
                        $this->config                           = 
CreateObject('phpgwapi.config');

                        $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->status_id                        = 
$this->bo->status_id;

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

                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('request',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $lookup = get_var('lookup',array('POST','GET'));
                        $links = $this->bocommon->menu();

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

//_debug_array($request_list);

                        while (is_array($request_list) && list(,$request) = 
each($request_list))
                        {
                                $location       = split("-", 
$request['location_code']);

                                $content[] = array
                                (
                                        'name'                                  
        => $request['name'],
                                        'request_id'                            
=> $request['request_id'],
                                        'descr'                                 
        => $request['descr'],
                                        'property_id'                           
=> $location[0],
                                        'building_id'                           
=> $location[1],
                                        'entrance_id'                           
=> $location[2],
                                        'floor'                                 
        => $request['floor'],
                                        'apartment_id'                          
=> $location[3],
                                        'address'                               
        => $request['address'],
                                        'start_date'                            
=> $request['start_date'],
                                        'coordinator'                           
=> $request['coordinator'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view&id='
 . $request['request_id']),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
 . $request['request_id']),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&request_id='
 . $request['request_id']),
                                        'lang_view_statustext'          => 
lang('view the request'),
                                        'lang_edit_statustext'          => 
lang('edit the request'),
                                        'lang_delete_statustext'        => 
lang('delete this request'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }


                        $table_header[] = array
                        (
                                'sort_request'  => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra' => array('menuaction'           => 
$this->currentapp.'.uirequest.index',
                                                                                
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
                                                                                
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
                                'lang_request'  => lang('request'),
                                'lang_name'             => lang('Name'),
                                'sort_property' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'property_id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uirequest.index',
                                                                                
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
                                                                                
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
                                'lang_property'         => lang('Property'),
                                'lang_building'         => lang('Building'),
                                'lang_entrance'         => lang('Entrance'),
                                'lang_floor'            => lang('Floor'),
                                'lang_apartment'        => lang('Apartment'),
                                'sort_address'  => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'address',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uirequest.index',
                                                                                
                                                        'cat_id'                
=>$this->cat_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
                                                                                
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
                                'lang_address'  => lang('Address'),
                                'lang_start_date'       => lang('Start date'),
                                'lang_coordinator'      => lang('Coordinator'),
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'lang_select'           => lang('Select')
                                );

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

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

                        $data = array
                        (
                                'link_history'                                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index&lookup='
 . $lookup),
                                'lang_history_statustext'               => 
lang('searh for history at this location'),
                                'lang_select'                                   
=> lang('select'),
                                'lookup_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'lookup'                                        
        => $lookup,
                                'links'                                         
        => $links,
                                'allow_allrows'                                 
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($request_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 request'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the request belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->bo->select_category_request_list('filter',$this->cat_id),
                                'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
                                'lang_no_district'                              
=> lang('no district'),
                                'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
                                'select_district_name'                  => 
'district_id',
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),

                                'lang_status_statustext'                => 
lang('Select the status the agreement belongs to. To do not use a category 
select NO STATUS'),
                                'status_name'                                   
=> 'status_id',
                                'lang_no_status'                                
=> lang('No status'),
                                'status_list'                                   
=> $this->bo->select_status_list('filter',$this->status_id),

                                'lang_user_statustext'                  => 
lang('Select the user the request belongs to. To do not use a category select 
NO USER'),
                                'select_user_name'                              
=> 'filter',
                                'lang_no_user'                                  
=> lang('No user'),
                                'user_list'                                     
        => $this->bocommon->get_user_list('filter',$this->filter),

                                '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_request'                  => 
$table_header,
                                'values_request'                                
=> $content,
                                'table_add'                                     
        => $table_add
                        );

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

                function edit()
                {
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));

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

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

                        if($values && !$bypass)
                        {
                                $values = $values + 
$this->bocommon->get_location();
                        }
                        else
                        {
                                $location_code                          = 
get_var('location_code',array('POST','GET'));
                                $values['tenant_id']            = 
get_var('tenant_id',array('POST','GET'));
                                $values['equipment_id']         = 
get_var('equipment_id',array('POST','GET'));

                                if($values['tenant_id'])
                                {
                                        
$tenant_data=$this->bocommon->read_single_tenant($values['tenant_id']);
                                        $values['tenant_phone']= 
$tenant_data['tenant_phone'];
                                        $values['tenant_name']= 
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
                                }

                                if($location_code)
                                {
                                        
$location_data=$this->bocommon->read_location_data($location_code);

                                        $values=$values + $location_data;
                                }

                        }

                        $values['start_date']           = 
get_var('start_date',array('POST'));
                        $values['end_date']                     = 
get_var('end_date',array('POST'));

//_debug_array($values);
                        $this->config->read_repository();

                        if ($values['save'])
                        {
                                if(!$values['title'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a request TITLE !'));
                                        $error_id=true;
                                }

                                if(!$values['cat_id'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
                                        $error_id=true;
                                }

                                if(!$values['status'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }

                                if($id)
                                {
                                        $values['request_id']=$id;
                                        $action='edit';
                                }
                                else
                                {
                                        
$values['request_id']=$this->bo->increment_request_id();
                                        $id     = $values['request_id'];
                                }

                                if(!$receipt['error'])
                                {
                                        if($values['copy_request'])
                                        {
                                                $action='add';
                                                $values['request_id']   = 
$this->bo->increment_request_id();
                                                $id     = $values['request_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
                                        $id = $values['request_id'];
                                        $function_msg = lang('Edit request');

                                        if ($values['notify'])
                                        {
                                                
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                                
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences']['email']['address'];
                                                $headers = "Return-Path: <". 
$coordinator_email .">\r\n";
                                                $headers .= "From: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
                                                $headers .= "Bcc: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";

                                                $subject = lang(notify).": ". 
$values['request_id'];
                                                $message = lang(request) . " " 
. $values['request_id'] ." ". lang('is registered');

                                                $mail_method= 
$this->config->config_data['fmwrkorder_mail'];
                                                if ($mail_method=='smtp'):
                                                {
                                                        $bcc = 
$coordinator_email;
                                                        $send = 
CreateObject('phpgwapi.send');
                                                        $rcpt = 
$send->msg('email', $to_notify_from_email, $subject, stripslashes($message), 
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
                                                }
                                                elseif 
($mail_method=='sendmail'):
                                                {
                                                        
$rcpt=mail($to_notify_from_email,$subject,$message, $headers);
                                                }
                                                else:
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! ("admin" 
section)'));
                                                }
                                                endif;
                                        }

                                }
                        }

                        if(!$receipt['error'] && !$bypass)
                        {
                                $values = $this->bo->read_single($id);
                        }

                        $record_history = $this->bo->read_record_history($id);

                        $table_header_history[] = array
                        (
                                'lang_date'                     => lang('Date'),
                                'lang_user'                     => lang('User'),
                                'lang_action'           => lang('Action'),
                                'lang_new_value'        => lang('New value')
                        );

                        if ($id)
                        {
                                $function_msg = lang('Edit request');
                        }
                        else
                        {
                                $function_msg = lang('Add request');
                        }

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


                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 'form',
                                                'equipment'             => true,
                                                'apartment'             => true,
                                                'equipment_id'  => 
$values['equipment_id'],
                                                'property_id'   => 
$values['property_id'],
                                                'property_name' => 
$values['property_name'],
                                                'building_id'   => 
$values['building_id'],
                                                'entrance_id'   => 
$values['entrance_id'],
                                                'floor'                 => 
$values['floor'],
                                                'street_name'   => 
$values['street_name'],
                                                'street_number' => 
$values['street_number'],
                                                'tenant_id'             => 
$values['tenant_id'],
                                                'tenant_name'   => 
$values['tenant_name'],
                                                'tenant_phone'  => 
$values['tenant_phone'],
                                                'apartment_id'  => 
$values['apartment_id']));


                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uirequest.edit',
                                'id'                    => $id
                        );

                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $sep = '/';
                        $dlarr[strpos($dateformat,'y')] = 'yyyy';
                        $dlarr[strpos($dateformat,'m')] = 'MM';
                        $dlarr[strpos($dateformat,'d')] = 'DD';
                        ksort($dlarr);

                        $dateformat= (implode($sep,$dlarr));


                        
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences']['property']['workorder_approval_from'];

                        $notify = 
$this->config->config_data['workorder_approval'];

                        if ($supervisor_id && ($notify=='yes'))
                        {
                                $prefs = 
$GLOBALS['phpgw']->preferences->create_email_preferences($supervisor_id);
                                $supervisor_email = $prefs['email']['address'];
                        }



                        $table_header_importance[] = array
                        (
                                'lang_subject'                  => 
lang('Subject'),
                                'lang_condition_degree' => lang('Condidtion 
degree'),
                                'lang_prob_worsening'   => lang('Probability'),
                                'lang_consequence'              => 
lang('Consequence')
                        );

                        $importance_weight[] = array
                        (
                                'lang_safety'                                   
                        => lang('Safety'),
                                'lang_aesthetics'                               
                        => lang('Aesthetics'),
                                'lang_indoor_climate'                           
                => lang('Indoor climate'),
                                'lang_consequential_damage'                     
                => lang('Consequential damage'),
                                'lang_user_gratification'                       
                => lang('User gratification'),
                                'lang_residential_environment'                  
        => lang('Residential environment'),

                                'lang_degree_statustext'                        
                => lang('Select the appropriate condition degree'),
                                'lang_probability_statustext'                   
        => lang('Select the appropriate propability for worsening of the 
condition'),
                                'lang_consequence_statustext'                   
        => lang('Select the appropriate consequence by breakdown of this 
component for this theme'),


                                'degree_list_safety'                            
                => 
$this->bo->select_degree_list($values['d_safety'],'default_safety'),
                                'degree_list_aesthetics'                        
                => 
$this->bo->select_degree_list($values['d_aesthetics'],'default_aesthetics'),
                                'degree_list_indoor_climate'                    
        => 
$this->bo->select_degree_list($values['d_indoor_climate'],'default_climate'),
                                'degree_list_consequential_damage'              
        => 
$this->bo->select_degree_list($values['d_consequential_damage'],'default_consequential_damage'),
                                'degree_list_user_gratification'                
        => 
$this->bo->select_degree_list($values['d_user_gratification'],'default_gratification'),
                                'degree_list_residential_environment'           
=> 
$this->bo->select_degree_list($values['d_residential_environment'],'default_environment'),


                                'probability_list_safety'                       
                => $this->bo->select_probability_list($values['p_safety']),
                                'probability_list_aesthetics'                   
        => $this->bo->select_probability_list($values['p_aesthetics']),
                                'probability_list_indoor_climate'               
        => $this->bo->select_probability_list($values['p_indoor_climate']),
                                'probability_list_consequential_damage'         
=> $this->bo->select_probability_list($values['p_consequential_damage']),
                                'probability_list_user_gratification'           
=> $this->bo->select_probability_list($values['p_user_gratification']),
                                'probability_list_residential_environment'      
=> $this->bo->select_probability_list($values['p_residential_environment']),

                                'consequence_list_safety'                       
                => $this->bo->select_consequence_list($values['c_safety']),
                                'consequence_list_aesthetics'                   
        => $this->bo->select_consequence_list($values['c_aesthetics']),
                                'consequence_list_indoor_climate'               
        => $this->bo->select_consequence_list($values['c_indoor_climate']),
                                'consequence_list_consequential_damage'         
=> $this->bo->select_consequence_list($values['c_consequential_damage']),
                                'consequence_list_user_gratification'           
=> $this->bo->select_consequence_list($values['c_user_gratification']),
                                'consequence_list_residential_environment'      
=> $this->bo->select_consequence_list($values['c_residential_environment']),

                                'lang_authorities_demands'                      
                => lang('Authorities Demands'),
                                'lang_auth_demand_statustext'                   
        => lang('Is there a demand from the authorities to correct this 
condition?'),
                                'auth_demand'                                   
=> $values['auth_demand']
                        );


                        $data = array
                        (
                                'add_workorder_action'                          
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'lang_add_workorder'                            
=> lang('Add Workorder'),
                                'lang_add_workorder_statustext'         => 
lang('Add a workorder to this request'),

                                'lang_importance'                               
=> lang('Importance'),
                                'table_header_importance'               => 
$table_header_importance,
                                'importance_weight'                             
=> $importance_weight,

                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
                                'workorder_link'                                
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'record_history'                                
=> $record_history,
                                'table_header_history'                  => 
$table_header_history,
                                'lang_history'                                  
=> lang('History'),
                                'lang_no_history'                               
=> lang('No history'),


                                'calendar_gif'                                  
=> './'.$this->currentapp.'/templates/default/images/calendar.gif',
                                'calendar_source'                               
=> './'.$this->currentapp.'/inc/calendar.js',
                                'dateformat'                                    
=> $dateformat,
                                'lang_popup_calendar'                   => 
lang('Popup Calendar'),

                                'link_calendar_start_date'              => 
'setDateField(document.form.start_date);top.newWin=window.open('."'.".'/'.$this->currentapp.'/inc/calendar.html'."'".','."'".'cal'."'".','."'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes'".')',
                                'lang_start_date_statustext'    => lang('Select 
the estimated end date for the request'),
                                'lang_start_date'                               
=> lang('request start date'),
                                'value_start_date'                              
=> $values['start_date'],

                                'link_calendar_end_date'                => 
'setDateField(document.form.end_date);top.newWin=window.open('."'.".'/'.$this->currentapp.'/inc/calendar.html'."'".','."'".'cal'."'".','."'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes'".')',
                                'lang_end_date_statustext'              => 
lang('Select the estimated end date for the request'),
                                'lang_end_date'                                 
=> lang('request end date'),
                                'value_end_date'                                
=> $values['end_date'],

                                'lang_copy_request'                             
=> lang('Copy request ?'),
                                'lang_copy_request_statustext'  => lang('Choose 
Copy request to copy this request to a new request'),

                                'lang_power_meter'                              
=> lang('Power meter'),
                                'lang_power_meter_statustext'   => lang('Enter 
the power_meter'),
                                'value_power_meter'                             
=> $values['power_meter'],

                                'lang_budget'                                   
=> lang('Budget'),
                                'value_budget'                                  
=> $values['budget'],
                                'lang_budget_statustext'                => 
lang('Enter the budget'),

                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'form',
                                'appname'                                       
        => lang('request'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),

                                'lang_request_id'                               
=> lang('request ID'),
                                'value_request_id'                              
=> $values['request_id'],

                                'lang_title'                                    
=> lang('Title'),
                                'value_title'                                   
=> $values['title'],
                                'lang_title_statustext'                 => 
lang('Enter request Title'),

                                'error'                                         
        => $receipt['error'],
                                'message'                                       
        => $receipt['message'],
                                'lang_descr_statustext'                 => 
lang('Enter a description of the request'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the request'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the request belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'value_cat_id'                                  
=> $values['cat_id'],
                                'cat_list'                                      
        => $this->bo->select_category_request_list('select',$values['cat_id']),

                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_user_statustext'                  => 
lang('Select the coordinator the request belongs to. To do not use a category 
select NO USER'),
                                'select_user_name'                              
=> 'values[coordinator]',
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
        => $this->bocommon->get_user_list('select',$values['coordinator']),

                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'select_status_name'                    => 
'values[status]',
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
                                'lang_status_statustext'                => 
lang('What is the current status of this request ?'),

                                'branch_list'                                   
=> $this->boproject->select_branch_list($values['branch_id']),
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_no_branch'                                
=> lang('Select branch'),
                                'lang_branch_statustext'                => 
lang('Select the branches for this request'),

                                'notify'                                        
        => $notify,
                                'lang_notify'                                   
=> lang('Notify'),
                                'lang_notify_statustext'                => 
lang('Check this to notify your supervisor by email'),
                                'value_notify_mail_address'             => 
$supervisor_email,

                                'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );

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

                function delete()
                {
                        $request_id = get_var('request_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));

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

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($request_id);
                                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('request'),
                                'function_msg'                  => lang('delete 
request'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&request_id='
 . $request_id),
                                '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()
                {
                        $id     = get_var('id',array('POST','GET'));

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

                        $this->config->read_repository();

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

                        $record_history = $this->bo->read_record_history($id);

                        $table_header_history[] = array
                        (
                                'lang_date'                     => lang('Date'),
                                'lang_user'                     => lang('User'),
                                'lang_action'           => lang('Action'),
                                'lang_new_value'        => lang('New value')
                        );

                        $table_header_workorder_budget[] = array
                        (
                                'lang_workorder_id'     => lang('Workorder'),
                                'lang_sum'      => lang('Sum')
                        );

                        $function_msg = lang('View request');

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


                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 'view',
                                                'equipment'             => true,
                                                'tenant'                => true,
                                                'address'               => true,
                                                'equipment_id'  => 
$values['equipment_id'],
                                                'property_id'   => 
$values['property_id'],
                                                'property_name' => 
$values['property_name'],
                                                'building_id'   => 
$values['building_id'],
                                                'entrance_id'   => 
$values['entrance_id'],
                                                'floor'                 => 
$values['floor'],
                                                'street_name'   => 
$values['street_name'],
                                                'street_number' => 
$values['street_number'],
                                                'tenant_id'             => 
$values['tenant_id'],
                                                'tenant_name'   => 
$values['tenant_name'],
                                                'tenant_phone'  => 
$values['tenant_phone'],
                                                'apartment_id'  => 
$values['apartment_id']));

                        $data = array
                        (
                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
                                'workorder_link'                                
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
                                'record_history'                                
=> $record_history,
                                'table_header_history'                  => 
$table_header_history,
                                'lang_history'                                  
=> lang('History'),
                                'lang_no_history'                               
=> lang('No history'),

                                'lang_start_date'                               
=> lang('request start date'),
                                'value_start_date'                              
=> $values['start_date'],

                                'lang_end_date'                                 
=> lang('request end date'),
                                'value_end_date'                                
=> $values['end_date'],

                                'lang_charge_tenant'                    => 
lang('Charge tenant'),
                                'charge_tenant'                                 
=> $values['charge_tenant'],

                                'lang_power_meter'                              
=> lang('Power meter'),
                                'value_power_meter'                             
=> $values['power_meter'],

                                'lang_budget'                                   
=> lang('Budget'),
                                'value_budget'                                  
=> $values['budget'],

                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'view',
                                'appname'                                       
        => lang('request'),
                                'function_msg'                                  
=> $function_msg,
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
                                'lang_year'                                     
        => lang('Year'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'lang_name'                                     
        => lang('Name'),

                                'lang_request_id'                               
=> lang('request ID'),
                                'value_request_id'                              
=> $values['request_id'],
                                'value_name'                                    
=> $values['name'],

                                'lang_other_branch'                             
        => lang('Other branch'),
                                'value_other_branch'                            
=> $values['other_branch'],

                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'cat_list'                                      
        => $this->bo->select_category_request_list('select',$values['cat_id']),

                                'lang_workorder_id'                             
=> lang('Workorder ID'),
                                'sum_workorder_budget'                  => 
$values['sum_workorder_budget'],
                                'workorder_budget'                              
=> $values['workorder_budget'],

                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
                                'select_user_name'                              
=> 'values[coordinator]',
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
        => $this->bocommon->get_user_list('select',$values['coordinator']),

                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),

                                'branch_list'                                   
=> $this->bo->select_branch_p_list($values['request_id']),
                                'lang_branch'                                   
=> lang('branch'),

                                'key_responsible_list'                          
        => $this->bo->select_branch_list($values['key_responsible']),
                                'lang_key_responsible'                          
        => lang('key responsible'),

                                'key_fetch_list'                                
        => $this->bo->select_key_location_list($values['key_fetch']),
                                'lang_key_fetch'                                
        => lang('key fetch location'),

                                'key_deliver_list'                              
        => $this->bo->select_key_location_list($values['key_deliver']),
                                'lang_key_deliver'                              
        => lang('key deliver location'),

                                'edit_action'                                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
 . $id),
                                'lang_edit_statustext'                          
=> lang('Edit this entry request'),
                                'lang_edit'                                     
                => lang('Edit'),
                                'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );

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

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** class.bocommon.inc.php      10 Apr 2003 10:14:27 -0000      1.33
--- class.bocommon.inc.php      12 Apr 2003 17:55:03 -0000      1.34
***************
*** 624,629 ****
                        {
                                
$menu['sub_workorder_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
!                               
$menu['sub_workorder_request']=$GLOBALS['phpgw']->link('/property/list_request.php','sub=workorder');
!                               
$menu['sub_workorder_archive']=$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder&status=Avsluttet');
                                
$menu['sub_workorder_template']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
                                
$menu['sub_workorder_project']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
--- 624,629 ----
                        {
                                
$menu['sub_workorder_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
!                               
$menu['sub_workorder_request']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
!               //              
$menu['sub_workorder_archive']=$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder&status=Avsluttet');
                                
$menu['sub_workorder_template']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
                                
$menu['sub_workorder_project']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
***************
*** 631,635 ****
                                
$menu['sublang_workorder_list']=lang('Workorder');
                                
$menu['sublang_workorder_request']=lang('Request');
!                               
$menu['sublang_workorder_archive']=lang('Archive');
                                
$menu['sublang_workorder_template']=lang('Workorder template');
                                if($this->acl2->check('.project',16))
--- 631,635 ----
                                
$menu['sublang_workorder_list']=lang('Workorder');
                                
$menu['sublang_workorder_request']=lang('Request');
!               //              
$menu['sublang_workorder_archive']=lang('Archive');
                                
$menu['sublang_workorder_template']=lang('Workorder template');
                                if($this->acl2->check('.project',16))

Index: class.historylog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.historylog.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.historylog.inc.php    16 Mar 2003 11:41:17 -0000      1.1
--- class.historylog.inc.php    12 Apr 2003 17:55:03 -0000      1.2
***************
*** 44,47 ****
--- 44,50 ----
                        switch($appname)
                        {
+                               case 'request':
+                                       $this->table='fm_wo_request_history';
+                                       break;
                                case 'workorder':
                                        $this->table='fm_wo_workorder_history';

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.solookup.inc.php      8 Apr 2003 12:38:09 -0000       1.15
--- class.solookup.inc.php      12 Apr 2003 17:55:03 -0000      1.16
***************
*** 1004,1008 ****
  
  
!                       $sql = "SELECT equipment_id,fm_equipment.descr 
,fm_equipment.property_id,building_id,entrance_id,floor,apartment_id,street_name,
 fm_equipment_type.name as category"
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
--- 1004,1008 ----
  
  
!                       $sql = "SELECT 
equipment_id,fm_equipment.descr,fm_equipment.location_code,fm_equipment.floor 
as floor,fm_equipment.address as address ,fm_equipment_type.name as category"
                        . "     FROM fm_equipment $this->join"
                        . " fm_property ON fm_equipment.property_id = 
fm_property.property_id $this->join"
***************
*** 1021,1030 ****
                                (
                                        'equipment_id'  => 
$this->db->f('equipment_id'),
!                                       'property_id'   => 
$this->db->f('property_id'),
!                                       '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'                => 
$this->db->f('street_name'),
                                        'category'              => 
$this->db->f('category'),
                                        'descr'                 => 
$this->db->f('descr'),
--- 1021,1027 ----
                                (
                                        'equipment_id'  => 
$this->db->f('equipment_id'),
!                                       'location_code' => 
$this->db->f('location_code'),
                                        'floor'                 => 
$this->db->f('floor'),
!                                       'address'       => 
$this->db->f('address'),
                                        'category'              => 
$this->db->f('category'),
                                        'descr'                 => 
$this->db->f('descr'),

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soproject.inc.php     10 Apr 2003 10:14:27 -0000      1.7
--- class.soproject.inc.php     12 Apr 2003 17:55:03 -0000      1.8
***************
*** 222,229 ****
                                $project['cat_id']                              
= $this->db->f('category');
  
!                               $this->db2->query("SELECT name as power_meter 
FROM fm_meter where location_code='" . $this->db->f('location_code'). "' and 
type='power_meter'",__LINE__,__FILE__);
! 
!                               $this->db2->next_record();
!                               $project['power_meter']                         
= $this->db2->f('power_meter');
                        }
  
--- 222,226 ----
                                $project['cat_id']                              
= $this->db->f('category');
  
!                               $project['power_meter'] = 
$this->get_power_meter($this->db->f('location_code'));
                        }
  
***************
*** 232,235 ****
--- 229,241 ----
                }
  
+ 
+               function get_power_meter($location_code = '')
+               {
+                       $this->db2->query("SELECT name as power_meter FROM 
fm_meter where location_code='$location_code' and 
type='power_meter'",__LINE__,__FILE__);
+ 
+                       $this->db2->next_record();
+ 
+                       return $this->db2->f('power_meter');
+               }
  
                function project_workorder_data($project_id = '')

Index: class.uilookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilookup.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.uilookup.inc.php      18 Mar 2003 10:51:28 -0000      1.11
--- class.uilookup.inc.php      12 Apr 2003 17:55:03 -0000      1.12
***************
*** 660,678 ****
                        while (is_array($equipment_list) && 
list(,$equipment_entry) = each($equipment_list))
                        {
                                $content[] = array
                                (
                                        'equipment_id'                          
=> $equipment_entry['equipment_id'],
                                        'descr'                                 
        => $equipment_entry['descr'],
!                                       'property_id'                           
=> $equipment_entry['property_id'],
!                                       'building_id'                           
=> $equipment_entry['building_id'],
!                                       'entrance_id'                           
=> $equipment_entry['entrance_id'],
                                        'floor'                                 
        => $equipment_entry['floor'],
!                                       'apartment_id'                          
=> $equipment_entry['apartment_id'],
!                                       'street'                                
        => $equipment_entry['street'],
                                        'category'                              
        => $equipment_entry['category']
                                );
                        }
  
! //_debug_array($content);
                        $table_header[] = array
                        (
--- 660,680 ----
                        while (is_array($equipment_list) && 
list(,$equipment_entry) = each($equipment_list))
                        {
+                               $location       = split("-", 
$equipment_entry['location_code']);
+ 
                                $content[] = array
                                (
                                        'equipment_id'                          
=> $equipment_entry['equipment_id'],
                                        'descr'                                 
        => $equipment_entry['descr'],
!                                       'property_id'                           
=> $location[0],
!                                       'building_id'                           
=> $location[1],
!                                       'entrance_id'                           
=> $location[2],
                                        'floor'                                 
        => $equipment_entry['floor'],
!                                       'apartment_id'                          
=> $location[3],
!                                       'address'                               
        => $equipment_entry['address'],
                                        'category'                              
        => $equipment_entry['category']
                                );
                        }
  
! //_debug_array($equipment_list);
                        $table_header[] = array
                        (
***************
*** 702,709 ****
                                'lang_floor'            => lang('Floor'),
                                'lang_apartment'        => lang('Apartment'),
!                               'sort_street_name'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'street',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uilookup.equipment',
--- 704,711 ----
                                'lang_floor'            => lang('Floor'),
                                'lang_apartment'        => lang('Apartment'),
!                               'sort_address'  => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'fm_equipment.address',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'           => 
$this->currentapp.'.uilookup.equipment',
***************
*** 711,716 ****
                                                                                
                                                        'district_id'   => 
$this->district_id)
                                                                                
)),
!                               'lang_street_name'              => lang('Street 
Name'),
!                               'lang_street_num'               => lang('Num'),
                                'lang_category'         => lang('Category')
                        );
--- 713,717 ----
                                                                                
                                                        'district_id'   => 
$this->district_id)
                                                                                
)),
!                               'lang_address'          => lang('Address'),
                                'lang_category'         => lang('Category')
                        );

Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uiproject.inc.php     10 Apr 2003 10:14:27 -0000      1.9
--- class.uiproject.inc.php     12 Apr 2003 17:55:03 -0000      1.10
***************
*** 39,43 ****
                        $this->so                                       = 
CreateObject($this->currentapp.'.soproject',True);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon',True);
-                       $this->socommon                         = 
CreateObject($this->currentapp.'.socommon',True);
                        $this->config                           = 
CreateObject('phpgwapi.config');
  
--- 39,42 ----

Index: class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uitts.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.uitts.inc.php 10 Apr 2003 10:14:27 -0000      1.15
--- class.uitts.inc.php 12 Apr 2003 17:55:03 -0000      1.16
***************
*** 429,449 ****
                        $request_link_data = array
                        (
!                               'menuaction'            => 
$this->currentapp.'.uitts.view',
!                               'id'                            => $id,
!                               'sub'                           => 'order',
                                'location_code'         => 
$ticket['location_code'],
                                'equipment_id'          => 
$ticket['equipment_id'],
!                               'property_id'           => 
$ticket['property_id'],
!                               'property_name'         => 
$ticket['property_name'],
!                               'building_id'           => 
$ticket['building_id'],
!                               'building_name'         => 
$ticket['building_name'],
!                               'entrance_id'           => 
$ticket['entrance_id'],
!                               'floor'                         => 
$ticket['floor'],
!                               'apartment_id'          => 
$ticket['apartment_id'],
!                               'street_name'           => 
$ticket['street_name'],
!                               'street_number'         => 
$ticket['street_number'],
!                               'tenant_id'                     => 
$ticket['tenant_id'],
!                               'tenant_name'           => 
$ticket['tenant_name'],
!                               'tenant_phone'          => 
$ticket['contact_phone']
                        );
  
--- 429,437 ----
                        $request_link_data = array
                        (
!                               'menuaction'            => 
$this->currentapp.'.uirequest.edit',
!                               'bypass'                        => true,
                                'location_code'         => 
$ticket['location_code'],
                                'equipment_id'          => 
$ticket['equipment_id'],
!                               'tenant_id'                     => 
$ticket['tenant_id']
                        );
  





reply via email to

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