phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.28,1.29 cl


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.28,1.29 class.bolookup.inc.php,1.5,1.6 class.boproject.inc.php,1.1,1.2 class.boworkorder.inc.php,1.6,1.7 class.solookup.inc.php,1.12,1.13 class.soproject.inc.php,1.2,1.3 class.soworkorder.inc.php,1.7,1.8 class.uilookup.inc.php,1.10,1.11 class.uiproject.inc.php,1.1,1.2 class.uiworkorder.inc.php,1.6,1.7
Date: Tue, 18 Mar 2003 05:51:30 -0500

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

Modified Files:
        class.bocommon.inc.php class.bolookup.inc.php 
        class.boproject.inc.php class.boworkorder.inc.php 
        class.solookup.inc.php class.soproject.inc.php 
        class.soworkorder.inc.php class.uilookup.inc.php 
        class.uiproject.inc.php class.uiworkorder.inc.php 
Log Message:
no message

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** class.bocommon.inc.php      16 Mar 2003 17:49:33 -0000      1.28
--- class.bocommon.inc.php      18 Mar 2003 10:51:28 -0000      1.29
***************
*** 304,308 ****
--- 304,323 ----
  //_debug_array($vendor);
                        return $vendor;
+               }
  
+               function initiate_ui_budget_account_lookup($data)
+               {
+ //_debug_array($data);
+ 
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account_form'));
+                       $b_account['value_b_account_id']                        
= $data['b_account_id'];
+                       $b_account['value_b_account_name']                      
= $data['b_account_name'];
+                       $b_account['b_account_link']                            
= 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.b_account');
+                       $b_account['lang_b_account']                            
= lang('b_account');
+                       $b_account['lang_select_b_account_help']        = 
lang('Klick this link to select budget account');
+                       $b_account['lang_b_account']                            
= lang('Budget account');
+ 
+ //_debug_array($b_account);
+                       return $b_account;
                }
  

Index: class.bolookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bolookup.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.bolookup.inc.php      4 Mar 2003 10:48:52 -0000       1.5
--- class.bolookup.inc.php      18 Mar 2003 10:51:28 -0000      1.6
***************
*** 103,106 ****
--- 103,115 ----
                }
  
+               function read_b_account()
+               {
+                       $b_account = $this->so->read_b_account(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                       $this->total_records = $this->so->total_records;
+ 
+                       return $b_account;
+               }
+ 
                function read_street()
                {

Index: class.boproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boproject.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.boproject.inc.php     16 Mar 2003 11:41:16 -0000      1.1
--- class.boproject.inc.php     18 Mar 2003 10:51:28 -0000      1.2
***************
*** 32,35 ****
--- 32,36 ----
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','project');
+                       $this->contacts         = 
CreateObject('phpgwapi.contacts');
  
                        $start  = get_var('start',array('POST','GET'));
***************
*** 280,290 ****
                        $project['start_date']                  = 
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
                        $project['end_date']                    = 
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
!                       $workorder_budget                               = 
$this->so->project_budget_from_workorder($project_id);
  
!                       for ($i=0;$i<count($workorder_budget);$i++)
                        {
!                               $sum_workorder_budget= 
$sum_workorder_budget+$workorder_budget[$i]['budget'];
!                               
$project['workorder_budget'][$i]['workorder_id']=$workorder_budget[$i]['workorder_id'];
!                               
$project['workorder_budget'][$i]['budget']=number_format($workorder_budget[$i]['budget'],
 2, ',', ' ');
                        }
                        if($sum_workorder_budget)
--- 281,293 ----
                        $project['start_date']                  = 
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
                        $project['end_date']                    = 
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
!                       $workorder_data                         = 
$this->so->project_workorder_data($project_id);
  
!                       for ($i=0;$i<count($workorder_data);$i++)
                        {
!                               $sum_workorder_budget= 
$sum_workorder_budget+$workorder_data[$i]['budget'];
!                               
$project['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
!                               
$project['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
 2, ',', ' ');
!                               $vendor = 
$this->contacts->read_single_entry($workorder_data[$i]['vendor_id'],array('org_name'=>'org_name'));
!                               $project['workorder_budget'][$i]['vendor_name'] 
= $vendor[0]['org_name'];
                        }
                        if($sum_workorder_budget)

Index: class.boworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boworkorder.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.boworkorder.inc.php   16 Mar 2003 17:49:33 -0000      1.6
--- class.boworkorder.inc.php   18 Mar 2003 10:51:28 -0000      1.7
***************
*** 32,35 ****
--- 32,36 ----
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog       = 
CreateObject($this->currentapp.'.historylog','workorder');
+                       $this->contacts         = 
CreateObject('phpgwapi.contacts');
  
                        $start  = get_var('start',array('POST','GET'));
***************
*** 274,311 ****
                }
  
!               function read_single($project_id)
                {
!                       $project                                                
= $this->so->read_single($project_id);
                        $dateformat                                             
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
!                       $project['start_date']                  = 
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
!                       $project['end_date']                    = 
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
!                       $workorder_budget                               = 
$this->so->project_budget_from_workorder($project_id);
  
!                       for ($i=0;$i<count($workorder_budget);$i++)
!                       {
!                               $sum_workorder_budget= 
$sum_workorder_budget+$workorder_budget[$i]['budget'];
!                               
$project['workorder_budget'][$i]['workorder_id']=$workorder_budget[$i]['workorder_id'];
!                               
$project['workorder_budget'][$i]['budget']=number_format($workorder_budget[$i]['budget'],
 2, ',', ' ');
!                       }
!                       if($sum_workorder_budget)
!                       {
!                               $project['sum_workorder_budget']= 
number_format($sum_workorder_budget, 2, ',', ' ');
!                       }
! 
!                       if($project['tenant_id'])
!                       {
!                               
$tenant_data=$this->socommon->read_single_tenant($project['tenant_id']);
!                               $project['tenant_phone']= 
$tenant_data['tenant_phone'];
!                               $project['tenant_name']= 
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
!                       }
! 
! //                    
$location_data=$this->socommon->read_location_data($project['location_code']);
! //                    
$project['power_meter']=$location_data['power_meter_id'];
! 
! //_debug_array($project);
!                       return $project;
                }
  
- 
                function read_record_history($id)
                {
--- 275,291 ----
                }
  
!               function read_single($workorder_id)
                {
!                       $workorder                                              
= $this->so->read_single($workorder_id);
                        $dateformat                                             
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
!                       $workorder['start_date']                = 
$GLOBALS['phpgw']->common->show_date($workorder['start_date'],$dateformat);
!                       $workorder['end_date']                  = 
$GLOBALS['phpgw']->common->show_date($workorder['end_date'],$dateformat);
!                       $vendor                                                 
= 
$this->contacts->read_single_entry($workorder['vendor_id'],array('org_name'=>'org_name'));
!                       $workorder['vendor_name']               = 
$vendor[0]['org_name'];
!                       $workorder['b_account_name']    = 
$this->so->get_b_account_name($workorder['b_account_id']);
  
!                       return $workorder;
                }
  
                function read_record_history($id)
                {
***************
*** 325,328 ****
--- 305,309 ----
                                        case 'A': $type = lang('Re-assigned'); 
break;
                                        case 'P': $type = lang('Priority 
changed'); break;
+                                       case 'B': $type = lang('Budget 
changed'); break;
                                        case 'CO': $type = lang('Initial 
Coordinator'); break;
                                        case 'C': $type = lang('Coordinator 
changed'); break;
***************
*** 364,367 ****
--- 345,352 ----
                                        $record_history[$i]['value_new_value']  
= $value['new_value'];
                                }
+                               else if ($value['status'] != 'B' && 
$value['new_value'])
+                               {
+                                       $record_history[$i]['value_new_value']  
= $value['new_value'];
+                               }
                                else
                                {
***************
*** 376,400 ****
  
  
!               function increment_project_id()
                {
!                       return $this->so->increment_project_id();
                }
  
!               function save($project,$action='')
                {
!                       $start_date     = 
$this->bocommon->date_array($project['start_date']);
!                       $end_date       = 
$this->bocommon->date_array($project['end_date']);
  
!                       $project['start_date']  = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
!                       $project['end_date']    = mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
!                       
$project['location_code']=$this->bocommon->location_code($project['property_id'],$project['building_id'],$project['entrance_id'],$project['apartment_id']);
  
                        if ($action=='edit')
                        {
!                                       $receipt = $this->so->edit($project);
                        }
                        else
                        {
!                               $receipt = $this->so->add($project);
                        }
                        return $receipt;
--- 361,384 ----
  
  
!               function increment_workorder_id()
                {
!                       return $this->so->increment_workorder_id();
                }
  
!               function save($workorder,$action='')
                {
!                       $start_date     = 
$this->bocommon->date_array($workorder['start_date']);
!                       $end_date       = 
$this->bocommon->date_array($workorder['end_date']);
  
!                       $workorder['start_date']        = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
!                       $workorder['end_date']  = mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
  
                        if ($action=='edit')
                        {
!                                       $receipt = $this->so->edit($workorder);
                        }
                        else
                        {
!                               $receipt = $this->so->add($workorder);
                        }
                        return $receipt;
***************
*** 406,412 ****
                }
  
!               function delete($project_id)
                {
!                       $this->so->delete($project_id);
                }
        }
--- 390,396 ----
                }
  
!               function delete($workorder_id)
                {
!                       $this->so->delete($workorder_id);
                }
        }

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.solookup.inc.php      4 Mar 2003 10:48:52 -0000       1.12
--- class.solookup.inc.php      18 Mar 2003 10:51:28 -0000      1.13
***************
*** 119,122 ****
--- 119,178 ----
                }
  
+ 
+               function read_b_account($data)
+               {
+                       if(is_array($data))
+                       {
+                               if ($data['start'])
+                               {
+                                       $start=$data['start'];
+                               }
+                               else
+                               {
+                                       $start=0;
+                               }
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                       }
+ 
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by id DESC';
+                       }
+ 
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+ 
+                               $querymethod = " where (id LIKE '%$query%' or 
descr LIKE '%$query%')";
+                       }
+ 
+                       $sql = "SELECT * FROM fm_wo_accounts $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())
+                       {
+                               $b_account[] = array
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'descr' => $this->db->f('descr')
+                                       );
+                       }
+ 
+                       return $b_account;
+               }
+ 
+ 
                function read_location($data)
                {

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.soproject.inc.php     16 Mar 2003 17:49:33 -0000      1.2
--- class.soproject.inc.php     18 Mar 2003 10:51:28 -0000      1.3
***************
*** 247,258 ****
  
  
!               function project_budget_from_workorder($project_id = '')
                {
!                       $this->db->query("select budget, id as workorder_id 
from fm_wo_wrkorders where project_id='$project_id'");
                        while ($this->db->next_record())
                        {
                                $budget[] = array(
                                        'workorder_id'  => 
$this->db->f('workorder_id'),
!                                       'budget'                => 
sprintf("%01.2f",$this->db->f('budget'))
                                        );
                        }
--- 247,259 ----
  
  
!               function project_workorder_data($project_id = '')
                {
!                       $this->db->query("select budget, id as workorder_id, 
vendor as vendor_id from fm_wo_wrkorders where project_id='$project_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')
                                        );
                        }
***************
*** 473,476 ****
--- 474,478 ----
                                charge_tenant   ='" . $project['charge_tenant'] 
. "',
                                location_code   ='" . $project['location_code'] 
. "',
+                               equipment_id    ='" . $project['equipment_id'] 
. "',
                                property_id             ='" . 
$project['property_id'] . "',
                                property_name   ='" . $project['property_name'] 
. "',

Index: class.soworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soworkorder.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soworkorder.inc.php   16 Mar 2003 17:49:33 -0000      1.7
--- class.soworkorder.inc.php   18 Mar 2003 10:51:28 -0000      1.8
***************
*** 54,57 ****
--- 54,64 ----
                }
  
+               function get_b_account_name($id='')
+               {
+                       $this->db->query("SELECT descr FROM fm_wo_accounts 
where id='$id' ");
+                       $this->db->next_record();
+                       return $this->db->f('descr');
+               }
+ 
                function select_status_list()
                {
***************
*** 201,207 ****
                }
  
!               function read_single($project_id)
                {
!                       $sql = "SELECT * from fm_wo_project where 
id='$project_id'";
  
                        $this->db->query($sql,__LINE__,__FILE__);
--- 208,214 ----
                }
  
!               function read_single($workorder_id)
                {
!                       $sql = "SELECT * from fm_wo_wrkorders where 
id='$workorder_id'";
  
                        $this->db->query($sql,__LINE__,__FILE__);
***************
*** 209,251 ****
                        if ($this->db->next_record())
                        {
!                               $project['project_id']                          
= $this->db->f('id');
!                               $project['title']                               
= $this->db->f('title');
!                               $project['name']                                
= $this->db->f('name');
!                               $project['equipment_id']                = 
$this->db->f('equipment_id');
!                               $project['location_code']               = 
$this->db->f('location_code');
!                               $project['property_id']                 = 
$this->db->f('property_id');
!                               $project['property_name']               = 
$this->db->f('property_name');
!                               $project['building_id']                 = 
$this->db->f('building_id');
!                               $project['entrance_id']                 = 
$this->db->f('entrance_id');
!                               $project['apartment_id']                = 
$this->db->f('apartment_id');
!                               $project['floor']                               
= $this->db->f('floor');
!                               $project['contact_phone']               = 
$this->db->f('contact_phone');
!                               $project['key_fetch']                   = 
$this->db->f('key_fetch');
!                               $project['key_deliver']                 = 
$this->db->f('key_deliver');
!                               $project['other_branch']                = 
$this->db->f('other_branch');
!                               $project['key_responsible']             = 
$this->db->f('key_responsible');
!                               $project['charge_tenant']               = 
$this->db->f('charge_tenant');
!                               $project['descr']                               
= $this->db->f('descr');
!                               $project['status']                              
= $this->db->f('status');
!                               $project['budget']                              
= (int)$this->db->f('budget');
!                               $project['actual_cost']                 = 
$this->db->f('actual_cost');
!                               $project['tenant_id']                   = 
$this->db->f('tenant_id');
!                               $project['street_name']                 = 
$this->db->f('street_name');
!                               $project['street_number']               = 
$this->db->f('street_number');
!                               $project['owner']                               
= $this->db->f('owner');
!                               $project['coordinator']                 = 
$this->db->f('coordinator');
!                               $project['access']                              
= $this->db->f('access');
!                               $project['start_date']                  = 
$this->db->f('start_date');
!                               $project['end_date']                    = 
$this->db->f('end_date');
!                               $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');
                        }
  
! //_debug_array($project);
!                               return $project;
                }
  
--- 216,245 ----
                        if ($this->db->next_record())
                        {
!                               $workorder['workorder_id']              = 
$this->db->f('id');
!                               $workorder['project_id']                = 
$this->db->f('project_id');
!                               $workorder['title']                             
= $this->db->f('title');
!                               $workorder['name']                              
= $this->db->f('name');
!                               $workorder['key_fetch']                 = 
$this->db->f('key_fetch');
!                               $workorder['key_deliver']               = 
$this->db->f('key_deliver');
!                               $workorder['key_responsible']   = 
$this->db->f('key_responsible');
!                               $workorder['charge_tenant']             = 
$this->db->f('charge_tenant');
!                               $workorder['descr']                             
= $this->db->f('descr');
!                               $workorder['status']                    = 
$this->db->f('status');
!                               $workorder['budget']                    = 
(int)$this->db->f('budget');
!                               $workorder['b_account_id']                      
= (int)$this->db->f('account_id');
!                               $workorder['addition_percentage']       = 
(int)$this->db->f('addition');
!                               $workorder['addition_rs']                       
= (int)$this->db->f('rig_addition');
!                               $workorder['actual_cost']               = 
$this->db->f('actual_cost');
!                               $workorder['owner']                             
= $this->db->f('owner');
!                               $workorder['vendor_id']                 = 
$this->db->f('vendor');
!                               $workorder['coordinator']               = 
$this->db->f('coordinator');
!                               $workorder['access']                    = 
$this->db->f('access');
!                               $workorder['start_date']                = 
$this->db->f('start_date');
!                               $workorder['end_date']                  = 
$this->db->f('end_date');
!                               $workorder['cat_id']                    = 
$this->db->f('category');
                        }
  
! //_debug_array($workorder);
!                               return $workorder;
                }
  
***************
*** 315,521 ****
  
  
!               function increment_project_id()
                {
!                       $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'project'");
!                       $this->db->query("select value from fm_idgenerator 
where name = 'project'");
                        $this->db->next_record();
!                       $project_id = $this->db->f('value');
!                       return $project_id;
                }
  
! 
! 
!               function add($project)
                {
  
!                       
$this->historylog->add('SO',$project['project_id'],$project['status']);
!                       
$this->historylog->add('TO',$project['project_id'],$project['cat_id']);
!                       
$this->historylog->add('CO',$project['project_id'],$project['coordinator']);
  
!                       $project['descr'] = 
$this->db->db_addslashes($project['descr']);
!                       $project['name'] = 
$this->db->db_addslashes($project['name']);
!                       $project['title'] = 
$this->db->db_addslashes($project['title']);
! //_debug_array($project);
!                       $this->db->query("INSERT INTO fm_wo_project 
(id,name,equipment_id,access,category,entry_date,start_date,end_date,coordinator,status,"
!                               . 
"descr,title,budget,location_code,property_id,property_name,building_id,entrance_id,floor,apartment_id,"
!                               . 
"street_name,street_number,key_deliver,key_fetch,other_branch,key_responsible,tenant_id,charge_tenant,owner)
 "
                                . "VALUES ('"
!                               . $project['project_id']. "','"
!                               . $project['name']. "','"
!                               . $project['equipment_id']. "','"
                                . "public','"
-                               . $project['cat_id']. "','"
                                . time() . "','"
!                               . $project['start_date']. "','"
!                               . $project['end_date']. "','"
!                               . $project['coordinator']. "','"
!                               . $project['status']. "','"
!                               . $project['descr']. "','"
!                               . $project['title']. "','"
!                               . $project['budget']. "','"
!                               . $project['location_code']. "','"
!                               . $project['property_id']. "','"
!                               . $project['property_name']. "','"
!                               . $project['building_id']. "','"
!                               . $project['entrance_id']. "','"
!                               . $project['floor']. "','"
!                               . $project['apartment_id'] . "','"
!                               . $project['street_name'] . "','"
!                               . $project['street_number'] . "','"
!                               . $project['key_deliver']. "','"
!                               . $project['key_fetch']. "','"
!                               . $project['other_branch']. "','"
!                               . $project['key_responsible']. "','"
!                               . $project['tenant_id']. "','"
!                               . $project['charge_tenant'] . "','"
                                . $this->account. "')",__LINE__,__FILE__);
  
! 
!                       if($project['tenant_phone'])
!                       {
!                               $this->db->query("update fm_tenant set 
contact_phone='". $project['tenant_phone']. "' where tenant_id='". 
$project['tenant_id']. "'",__LINE__,__FILE__);
!                       }
! 
!                       if ($project['power_meter'] )
!                       {
!                               
$this->update_power_meter($project['power_meter'],$project['location_code']);
!                       }
! 
!       // -----------------which branch is represented
!                       if (count($project['branch']) != 0)
!                       {
!                               while($branch=each($project['branch']))
!                               {
!                                       $this->db->query("insert into 
fm_wo_projectbranch (project_id,branch_id) values ('" . $project['project_id']. 
"','$branch[1]')",__LINE__,__FILE__);
!                               }
!                       }
! 
!                       $receipt['message'][] = array('msg'=>lang('project %1 
has been saved',$project['project_id']));
                        return $receipt;
                }
  
!               function update_power_meter($power_meter,$location_code)
                {
! 
!                       $this->db->query("SELECT count(*) FROM fm_meter where 
location_code='$location_code' and type='power_meter'",__LINE__,__FILE__);
! 
!                       $this->db->next_record();
! 
!                       if ( $this->db->f(0))
!                       {
!                               $this->db->query("update fm_meter set name='" . 
$power_meter. "' where location_code='" . $location_code. "' and 
type='power_meter'",__LINE__,__FILE__);
!                       }
!                       else
!                       {
!                               $meter_id       = $this->generate_meter_id();
!                               $this->db->query("insert into fm_meter 
(id,name,type,location_code,entry_date,user_created) "
!                                       . "VALUES ('"
!                                       . $meter_id. "','"
!                                       . $power_meter. "','"
!                                       . "power_meter','"
!                                       . $location_code. "','"
!                                       . time() . "','"
!                                       . $this->account. 
"')",__LINE__,__FILE__);
!                       }
!               }
! 
!               function generate_meter_id()
!               {
!                       $prefix = 'meter';
!                       $pos    = strlen($prefix);
!                       $this->db->query("select max(id) from fm_meter where id 
like ('$prefix%')");
!                       $this->db->next_record();
! 
!                       $max = 
$this->bocommon->add_leading_zero(substr($this->db->f(0),$pos));
! 
!                       $meter_id= $prefix . $max;
!                       return $meter_id;
!               }
! 
!               function edit($project)
!               {
!                       $this->db->query("SELECT status,category,coordinator 
FROM fm_wo_project where id='" .$project['project_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 != $project['status'])
                        {
!                               
$this->historylog->add('S',$project['project_id'],$project['status']);
                        }
!                       if ($old_categroy != $project['cat_id'])
                        {
!                               
$this->historylog->add('T',$project['project_id'],$project['cat_id']);
                        }
-                       if ($old_coordinator != $project['coordinator'])
-                       {
-                               
$this->historylog->add('C',$project['project_id'],$project['coordinator']);
-                       }
- 
-                       $project['descr'] = 
$this->db->db_addslashes($project['descr']);
-                       $project['name'] = 
$this->db->db_addslashes($project['name']);
-                       $project['title'] = 
$this->db->db_addslashes($project['title']);
- //_debug_array($project);
  
!                       $this->db->query("UPDATE fm_wo_project set
!                               name                    ='" . $project['name'] 
. "',
!                               status                  ='" . 
$project['status'] . "',
!                               category                ='" . 
$project['cat_id'] . "',
!                               start_date              ='" . 
$project['start_date'] . "',
!                               end_date                ='" . 
$project['end_date'] . "',
!                               coordinator             ='" . 
$project['coordinator'] . "',
!                               descr                   ='" . $project['descr'] 
. "',
!                               title                   ='"     . 
$project['title'] . "',
!                               budget                  ='" . 
(int)$project['budget'] . "',
!                               key_deliver             ='" . 
$project['key_deliver'] . "',
!                               key_fetch               ='" . 
$project['key_fetch'] . "',
!                               other_branch    ='" . $project['other_branch'] 
. "',
!                               key_responsible ='" . 
$project['key_responsible'] . "',
!                               tenant_id               ='" . 
$project['tenant_id'] . "',
!                               charge_tenant   ='" . $project['charge_tenant'] 
. "',
!                               location_code   ='" . $project['location_code'] 
. "',
!                               property_id             ='" . 
$project['property_id'] . "',
!                               property_name   ='" . $project['property_name'] 
. "',
!                               building_id             ='" . 
$project['building_id'] . "',
!                               entrance_id             ='" . 
$project['entrance_id'] . "',
!                               floor                   ='" . $project['floor'] 
. "',
!                               apartment_id    ='" . $project['apartment_id'] 
. "',
!                               street_name             ='" . 
$project['street_name'] . "',
!                               street_number   ='" . $project['street_number']
!                               . "' WHERE id= '" . $project['project_id'] 
."'",__LINE__,__FILE__);
! 
!                       if($project['tenant_phone'])
!                       {
!                               $this->db->query("update fm_tenant set 
contact_phone='". $project['tenant_phone']. "' where tenant_id='". 
$project['tenant_id']. "'",__LINE__,__FILE__);
!                       }
! 
!                       if ($project['power_meter'] )
!                       {
!                               
$this->update_power_meter($project['power_meter'],$project['location_code']);
!                       }
!       // -----------------which branch is represented
!                       $this->db->query("delete from fm_wo_projectbranch where 
project_id='" . $project['project_id'] ."'",__LINE__,__FILE__);
! 
!                       if (count($project['branch']) != 0)
!                       {
!                               while($branch=each($project['branch']))
!                               {
!                                       $this->db->query("insert into 
fm_wo_projectbranch (project_id,branch_id) values ('" . $project['project_id']. 
"','$branch[1]')",__LINE__,__FILE__);
!                               }
!                       }
  
  
!                       $receipt['message'][] = array('msg'=>lang('project %1 
has been edited',$project['project_id']));
                        return $receipt;
  
                }
  
!               function delete($project_id )
                {
!                       $this->db->query("DELETE FROM fm_wo_project WHERE id='" 
. $project_id . "'",__LINE__,__FILE__);
!                       $this->db->query("DELETE FROM fm_wo_project_history  
WHERE  history_record_id='" . $project_id   . "'",__LINE__,__FILE__);
!                       $this->db->query("DELETE FROM fm_wo_projectbranch  
WHERE  project_id='" . $project_id   . "'",__LINE__,__FILE__);
  
                }
--- 309,403 ----
  
  
!               function increment_workorder_id()
                {
!                       $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'workorder'");
!                       $this->db->query("select value from fm_idgenerator 
where name = 'workorder'");
                        $this->db->next_record();
!                       $workorder_id = $this->db->f('value');
!                       return $workorder_id;
                }
  
!               function add($workorder)
                {
  
!                       
$this->historylog->add('SO',$workorder['workorder_id'],$workorder['status']);
  
!                       $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
!                       $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
! //_debug_array($workorder);
!                       $this->db->query("INSERT INTO fm_wo_wrkorders 
(id,project_id,title,access,entry_date,start_date,end_date,status,"
!                               . 
"descr,budget,account_id,rig_addition,addition,key_deliver,key_fetch,vendor,charge_tenant,owner)
 "
                                . "VALUES ('"
!                               . $workorder['workorder_id']. "','"
!                               . $workorder['project_id']. "','"
!                               . $workorder['title']. "','"
                                . "public','"
                                . time() . "','"
!                               . $workorder['start_date']. "','"
!                               . $workorder['end_date']. "','"
!                               . $workorder['status']. "','"
!                               . $workorder['descr']. "','"
!                               . $workorder['budget']. "','"
!                               . $workorder['b_account_id']. "','"
!                               . $workorder['addition_rs']. "','"
!                               . $workorder['addition_percentage']. "','"
!                               . $workorder['key_deliver']. "','"
!                               . $workorder['key_fetch']. "','"
!                               . $workorder['vendor_id']. "','"
!                               . $workorder['charge_tenant'] . "','"
                                . $this->account. "')",__LINE__,__FILE__);
  
!                       $receipt['message'][] = array('msg'=>lang('workorder %1 
has been saved',$workorder['workorder_id']));
                        return $receipt;
                }
  
!               function edit($workorder)
                {
!                       $this->db->query("SELECT status,budget FROM 
fm_wo_wrkorders where id='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
  
                        $this->db->next_record();
  
                        $old_status = $this->db->f('status');
!                       $old_budget = $this->db->f('budget');
!                       if ($old_status != $workorder['status'])
                        {
!                               
$this->historylog->add('S',$workorder['workorder_id'],$workorder['status']);
                        }
!                       if ($old_budget != $workorder['budget'])
                        {
!                               
$this->historylog->add('B',$workorder['workorder_id'],$workorder['budget']);
                        }
  
!                       $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
!                       $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
! //_debug_array($workorder);
! 
!                       $this->db->query("UPDATE fm_wo_wrkorders set
!                               title                   ='" . 
$workorder['title'] . "',
!                               status                  ='" . 
$workorder['status'] . "',
!                               start_date              ='" . 
$workorder['start_date'] . "',
!                               end_date                ='" . 
$workorder['end_date'] . "',
!                               descr                   ='" . 
$workorder['descr'] . "',
!                               budget                  ='" . 
(int)$workorder['budget'] . "',
!                               key_deliver             ='" . 
$workorder['key_deliver'] . "',
!                               key_fetch               ='" . 
$workorder['key_fetch'] . "',
!                               account_id              ='" . 
$workorder['b_account_id'] . "',
!                               rig_addition    ='" . $workorder['addition_rs'] 
. "',
!                               addition                ='" . 
$workorder['addition_percentage'] . "',
!                               charge_tenant   ='" . 
$workorder['charge_tenant'] . "',
!                               vendor                  ='" . 
$workorder['vendor_id']
!                               . "' WHERE id= '" . $workorder['workorder_id'] 
."'",__LINE__,__FILE__);
  
  
!                       $receipt['message'][] = array('msg'=>lang('workorder %1 
has been edited',$workorder['workorder_id']));
                        return $receipt;
  
                }
  
!               function delete($workorder_id )
                {
!                       $this->db->query("DELETE FROM fm_wo_wrkorders WHERE 
id='" . $workorder_id . "'",__LINE__,__FILE__);
!                       $this->db->query("DELETE FROM fm_wo_workorder_history  
WHERE  history_record_id='" . $workorder_id   . "'",__LINE__,__FILE__);
!                       $this->db->query("DELETE FROM fm_wo_hours WHERE 
workorder_id='" . $workorder_id   . "'",__LINE__,__FILE__);
  
                }

Index: class.uilookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilookup.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.uilookup.inc.php      4 Mar 2003 10:48:52 -0000       1.10
--- class.uilookup.inc.php      18 Mar 2003 10:51:28 -0000      1.11
***************
*** 24,27 ****
--- 24,28 ----
                (
                        'addressbook'  => True,
+                       'b_account'  => True,
                        'location'   => True,
                        'equipment'   => True,
***************
*** 177,180 ****
--- 178,278 ----
  
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_addressbook' => $data));
+                       $this->save_sessiondata();
+               }
+ 
+               function b_account()
+               {
+ 
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+                                                                               
'nextmatchs',
+                                                                               
'headonly',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
+ 
+                       $sub = get_var('sub',array('POST','GET'));
+ 
+                       $b_account_list = $this->bo->read_b_account();
+ 
+                       while (is_array($b_account_list) && 
list(,$b_account_entry) = each($b_account_list))
+                       {
+                               $content[] = array
+                               (
+                                       'id'                            => 
$b_account_entry['id'],
+                                       'b_account_name'                => 
$b_account_entry['descr'],
+                                       'lang_select'           => 
lang('Select'),
+                                       'lang_select_statustext' => 
lang('Select this budget account')
+                               );
+                       }
+ 
+                       $table_header[] = array
+                       (
+                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'descr',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.b_account',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
)),
+                               'lang_name'             => lang('Name'),
+                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uilookup.b_account',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
)),
+                               'lang_id'               => lang('ID'),
+                               'lang_select'           => lang('Select')
+                       );
+ 
+                       $table_done[] = array
+                       (
+                               'lang_done'                             => 
lang('Done'),
+                               'lang_done_statustext'  => lang('Close this 
window')
+                       );
+ 
+                       $link_select = array
+                       (
+                               'menuaction'            => 
$this->currentapp.'.uilookup.b_account',
+                               'second_display'        => true,
+                               'order'                         => $this->order,
+                               'sort'                          => $this->sort,
+                               'cat_id'                        => 
$this->cat_id,
+                               'query'                         => $this->query,
+                               'filter'                        => $this->filter
+                       );
+ 
+ 
+                       $data = array
+                       (
+                               'allow_allrows'                                 
=> false,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+                               'num_records'                                   
=> count($b_account_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
+                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
+       //                      'appname'                                       
        => '',
+                               'function_msg'                                  
=> lang('list vendors'),
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'cat_id',
+                               'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
+                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
+                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_submit'                                   
=> lang('submit'),
+                               'table_header_b_account'                => 
$table_header,
+                               'values_b_account'                      => 
$content,
+                               'table_done'                                    
=> $table_done
+                       );
+ 
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_b_account' => $data));
                        $this->save_sessiondata();
                }

Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uiproject.inc.php     16 Mar 2003 11:41:17 -0000      1.1
--- class.uiproject.inc.php     18 Mar 2003 10:51:28 -0000      1.2
***************
*** 76,81 ****
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
  
!                       $sub = get_var('sub',array('POST','GET'));
!                       $links = $this->bocommon->menu($sub);
  
                        $project_list = $this->bo->read();
--- 76,81 ----
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
  
!                       $lookup = get_var('lookup',array('POST','GET'));
!                       $links = $this->bocommon->menu();
  
                        $project_list = $this->bo->read();
***************
*** 122,125 ****
--- 122,126 ----
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
+                                                                               
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
***************
*** 135,138 ****
--- 136,140 ----
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
+                                                                               
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
***************
*** 151,154 ****
--- 153,157 ----
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'filter'                
=>$this->filter,
+                                                                               
                                                        'lookup'                
=>$lookup,
                                                                                
                                                        'query'                 
=>$this->query)
                                                                                
)),
***************
*** 159,163 ****
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
!                               'lang_delete'           => lang('delete')
                                );
  
--- 162,167 ----
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
!                               'lang_delete'           => lang('delete'),
!                               'lang_select'           => lang('Select')
                                );
  
***************
*** 178,181 ****
--- 182,186 ----
                                                'filter'                
=>$this->filter,
                                                'status_id'             
=>$this->status_id,
+                                               'lookup'                
=>$lookup,
                                                'query'                 
=>$this->query
                        );
***************
*** 183,186 ****
--- 188,194 ----
                        $data = array
                        (
+                               'lang_select'                                   
=> lang('select'),
+                               'lookup_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+                               'lookup'                                        
        => $lookup,
                                'links'                                         
        => $links,
                                'allow_allrows'                                 
=> false,
***************
*** 233,237 ****
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('project',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
!                       $values['equipment_id']         = 
get_var('equipment_idd',array('POST'));
                        $values['property_id']          = 
get_var('property_id',array('POST'));
                        $values['property_name']        = 
get_var('property_name',array('POST'));
--- 241,245 ----
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('project',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
!                       $values['equipment_id']         = 
get_var('equipment_id',array('POST'));
                        $values['property_id']          = 
get_var('property_id',array('POST'));
                        $values['property_name']        = 
get_var('property_name',array('POST'));
***************
*** 276,280 ****
                                else
                                {
!                                       
$values['project_id']=$this->socommon->next_id('fm_wo_project');
                                        $id     = $values['project_id'];
                                }
--- 284,288 ----
                                else
                                {
!                                       
$values['project_id']=$this->bo->increment_project_id();
                                        $id     = $values['project_id'];
                                }
***************
*** 343,347 ****
                        (
                                'lang_workorder_id'     => lang('Workorder'),
!                               'lang_sum'      => lang('Sum')
                        );
  
--- 351,356 ----
                        (
                                'lang_workorder_id'     => lang('Workorder'),
!                               'lang_sum'                      => lang('Sum'),
!                               'lang_vendor'   => lang('Vendor')
                        );
  
***************
*** 409,412 ****
--- 418,425 ----
                        $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 project'),
+ 
                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
***************
*** 450,454 ****
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'form',
!                               'appname'                                       
        => lang('equipment'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
--- 463,467 ----
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'form',
!                               'appname'                                       
        => lang('project'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
***************
*** 471,479 ****
                                'error'                                         
        => $receipt['error'],
                                'message'                                       
        => $receipt['message'],
!                               'lang_descr_statustext'                 => 
lang('Enter a description of the equipment'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'lang_save_statustext'                  => 
lang('Save the equipment'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project belongs to. To do not use a category 
select NO CATEGORY'),
--- 484,492 ----
                                'error'                                         
        => $receipt['error'],
                                'message'                                       
        => $receipt['message'],
!                               'lang_descr_statustext'                 => 
lang('Enter a description of the project'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'lang_save_statustext'                  => 
lang('Save the project'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project belongs to. To do not use a category 
select NO CATEGORY'),
***************
*** 497,501 ****
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
!                               'lang_status_statustext'                => 
lang('What is the current status of this equipment ?'),
  
                                'branch_list'                                   
=> $this->bo->select_branch_p_list($values['project_id']),
--- 510,514 ----
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
!                               'lang_status_statustext'                => 
lang('What is the current status of this project ?'),
  
                                'branch_list'                                   
=> $this->bo->select_branch_p_list($values['project_id']),
***************
*** 551,556 ****
                        $data = array
                        (
!                               'appname'                               => 
lang('equipment'),
!                               'function_msg'                  => lang('delete 
equipment'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
 . $project_id),
--- 564,569 ----
                        $data = array
                        (
!                               'appname'                               => 
lang('project'),
!                               'function_msg'                  => lang('delete 
project'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
 . $project_id),
***************
*** 664,668 ****
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
-                               'lang_save_statustext'                  => 
lang('Save the equipment'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'cat_list'                                      
        => $this->bo->select_category_project_list('select',$values['cat_id']),
--- 677,680 ----
***************
*** 695,699 ****
  
                                'edit_action'                                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $id),
!                               'lang_edit_statustext'                          
=> lang('Edit this entry equipment'),
                                'lang_edit'                                     
                => lang('Edit'),
                                'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
--- 707,711 ----
  
                                'edit_action'                                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $id),
!                               'lang_edit_statustext'                          
=> lang('Edit this entry project'),
                                'lang_edit'                                     
                => lang('Edit'),
                                'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']

Index: class.uiworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiworkorder.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uiworkorder.inc.php   16 Mar 2003 17:49:33 -0000      1.6
--- class.uiworkorder.inc.php   18 Mar 2003 10:51:28 -0000      1.7
***************
*** 24,27 ****
--- 24,28 ----
                        'index'  => True,
                        'view'   => True,
+                       'add'   => True,
                        'edit'   => True,
                        'delete' => True
***************
*** 37,40 ****
--- 38,42 ----
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.boworkorder',True);
+                       $this->boproject                        = 
CreateObject($this->currentapp.'.boproject',True);
                        $this->so                                       = 
CreateObject($this->currentapp.'.soworkorder',True);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon',True);
***************
*** 182,186 ****
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
workorder'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit')
                        );
  
--- 184,188 ----
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
workorder'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.add')
                        );
  
***************
*** 241,260 ****
                {
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
  
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
!                       $values['equipment_id']         = 
get_var('equipment_idd',array('POST'));
!                       $values['property_id']          = 
get_var('property_id',array('POST'));
!                       $values['property_name']        = 
get_var('property_name',array('POST'));
!                       $values['building_id']          = 
get_var('building_id',array('POST'));
!                       $values['entrance_id']          = 
get_var('entrance_id',array('POST'));
!                       $values['floor']                        = 
get_var('floor',array('POST'));
!                       $values['apartment_id']         = 
get_var('apartment_id',array('POST'));
!                       $values['street_name']          = 
get_var('street_name',array('POST'));
!                       $values['street_number']        = 
get_var('street_number',array('POST'));
!                       $values['tenant_id']            = 
get_var('tenant_id',array('POST'));
!                       $values['tenant_name']          = 
get_var('tenant_name',array('POST'));
!                       $values['tenant_phone']         = 
get_var('tenant_phone',array('POST'));
                        $values['start_date']           = 
get_var('start_date',array('POST'));
                        $values['end_date']                     = 
get_var('end_date',array('POST'));
--- 243,257 ----
                {
                        $id                             = 
get_var('id',array('POST','GET'));
+                       $project_id             = 
get_var('project_id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
  
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
!                       $values['vendor_id']            = 
get_var('vendor_id',array('POST'));
!                       $values['vendor_name']          = 
get_var('vendor_name',array('POST'));
!                       $values['b_account_id']         = 
get_var('b_account_id',array('POST'));
!                       $values['b_account_name']       = 
get_var('b_account_name',array('POST'));
! 
! 
                        $values['start_date']           = 
get_var('start_date',array('POST'));
                        $values['end_date']                     = 
get_var('end_date',array('POST'));
***************
*** 264,276 ****
                        if ($values['save'])
                        {
!                               if(!$values['name'])
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
                                        $error_id=true;
                                }
! 
!                               if(!$values['cat_id'])
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
                                        $error_id=true;
                                }
--- 261,272 ----
                        if ($values['save'])
                        {
!                               if(!$values['title'])
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('Please enter a workorder title !'));
                                        $error_id=true;
                                }
!                               if(!$values['project_id'])
                                {
!                                       
$receipt['error'][]=array('msg'=>lang('Please select a valid project !'));
                                        $error_id=true;
                                }
***************
*** 283,306 ****
                                if($id)
                                {
!                                       $values['project_id']=$id;
                                        $action='edit';
                                }
                                else
                                {
!                                       
$values['project_id']=$this->socommon->next_id('fm_wo_project');
!                                       $id     = $values['project_id'];
                                }
  
                                if(!$receipt['error'])
                                {
!                                       if($values['copy_project'])
                                        {
                                                $action='add';
!                                               $values['project_id']   = 
$this->bo->increment_project_id();
!                                               $id     = $values['project_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
!                                       $id = $values['project_id'];
!                                       $function_msg = lang('Edit Project');
  
                                        if ($values['approval'])
--- 279,302 ----
                                if($id)
                                {
!                                       $values['workorder_id']=$id;
                                        $action='edit';
                                }
                                else
                                {
!                                       
$values['workorder_id']=$this->bo->increment_workorder_id();
!                                       $id     = $values['workorder_id'];
                                }
  
                                if(!$receipt['error'])
                                {
!                                       if($values['copy_workorder'])
                                        {
                                                $action='add';
!                                               $values['workorder_id'] = 
$this->bo->increment_workorder_id();
!                                               $id     = 
$values['workorder_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
!                                       $id = $values['workorder_id'];
!                                       $function_msg = lang('Edit Workorder');
  
                                        if ($values['approval'])
***************
*** 313,318 ****
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";
  
!                                               $subject = lang(Approval).": ". 
$values['project_id'];
!                                               $message = lang(Project) . " " 
. $values['project_id'] ." ". lang(needs_approval);
  
                                                $mail_method= 
$this->config->config_data['fmwrkorder_mail'];
--- 309,314 ----
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";
  
!                                               $subject = lang(Approval).": ". 
$values['workorder_id'];
!                                               $message = lang(Workorder) . " 
" . $values['workorder_id'] ." ". lang(needs_approval);
  
                                                $mail_method= 
$this->config->config_data['fmwrkorder_mail'];
***************
*** 339,343 ****
                        if(!$receipt['error'])
                        {
!                               $values = $this->bo->read_single($id);
                        }
  
--- 335,356 ----
                        if(!$receipt['error'])
                        {
!                               $values         = $this->bo->read_single($id);
!                               if($project_id && !$values['project_id'])
!                               {
!                                       $values['project_id']=$project_id;
!                               }
!                               $project        = 
$this->boproject->read_single($values['project_id']);
! 
!                               if( $project['key_fetch'] && 
!$values['key_fetch'])
!                               {
!                                       
$values['key_fetch']=$project['key_fetch'];
!                               }
! 
!                               if( $project['key_deliver'] && 
!$values['key_deliver'])
!                               {
!                                       
$values['key_deliver']=$project['key_deliver'];
!                               }
! 
! //_debug_array($project);
                        }
  
***************
*** 360,368 ****
                        if ($id)
                        {
!                               $function_msg = lang('Edit Project');
                        }
                        else
                        {
!                               $function_msg = lang('Add Project');
                        }
  
--- 373,381 ----
                        if ($id)
                        {
!                               $function_msg = lang('Edit Workorder');
                        }
                        else
                        {
!                               $function_msg = lang('Add Workorder');
                        }
  
***************
*** 374,414 ****
  
                        
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'form',
                                                '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']));
  
- /*
                        
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
                                                'vendor_id'             => 
$values['vendor_id'],
                                                'vendor_name'   => 
$values['vendor_name']));
  
! 
!                       if($values['equipment_id'])
!                       {
!                               $cat_text                               = 
$this->bo->read_single_equipment_type($values['cat_id']);
!                               $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>true,'type'=>equipment,'type_id'=>$values['cat_id'],'id'=>$values['equipment_id']));
!                               $attributes_header[]    = array
!                               (
!                                       'lang_name'             => lang('Name'),
!                                       'lang_descr'    => lang('Description'),
!                                       'lang_datatype' => lang('Datatype'),
!                                       'lang_value'    => lang('Value')
!                                       );
!                       }
! 
! */
  
  
--- 387,415 ----
  
                        
$location_data=$this->bocommon->initiate_ui_location(array(
!                                               'location_type' => 'view',
                                                'equipment'             => true,
                                                'tenant'                => true,
                                                'address'               => true,
!                                               'equipment_id'  => 
$project['equipment_id'],
!                                               'property_id'   => 
$project['property_id'],
!                                               'property_name' => 
$project['property_name'],
!                                               'building_id'   => 
$project['building_id'],
!                                               'entrance_id'   => 
$project['entrance_id'],
!                                               'floor'                 => 
$project['floor'],
!                                               'street_name'   => 
$project['street_name'],
!                                               'street_number' => 
$project['street_number'],
!                                               'tenant_id'             => 
$project['tenant_id'],
!                                               'tenant_name'   => 
$project['tenant_name'],
!                                               'tenant_phone'  => 
$project['tenant_phone'],
!                                               'apartment_id'  => 
$project['apartment_id']));
! 
  
                        
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
                                                'vendor_id'             => 
$values['vendor_id'],
                                                'vendor_name'   => 
$values['vendor_name']));
  
!                       
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
!                                               'b_account_id'          => 
$values['b_account_id'],
!                                               'b_account_name'        => 
$values['b_account_name']));
  
  
***************
*** 442,445 ****
--- 443,453 ----
                        $data = array
                        (
+                               'calculate_action'                              
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+                               'lang_calculate'                                
=> lang('Calculate Workorder'),
+                               'lang_calculate_statustext'             => 
lang('Calculate workorder by adding items from vendors prizebook or adding 
general hours'),
+ 
+                               'project_link'                                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
+                               'b_account_data'                                
=> $b_account_data,
+                               'vendor_data'                                   
=> $vendor_data,
                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
***************
*** 457,470 ****
                                '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 Project'),
!                               'lang_start_date'                               
=> lang('Project 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 Project'),
!                               'lang_end_date'                                 
=> lang('Project end date'),
                                'value_end_date'                                
=> $values['end_date'],
  
!                               'lang_copy_project'                             
=> lang('Copy project ?'),
!                               'lang_copy_project_statustext'  => lang('Choose 
Copy Project to copy this project to a new project'),
  
                                'lang_charge_tenant'                    => 
lang('Charge tenant'),
--- 465,478 ----
                                '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 Project'),
!                               'lang_start_date'                               
=> lang('Workorder 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 Project'),
!                               'lang_end_date'                                 
=> lang('Workorder end date'),
                                'value_end_date'                                
=> $values['end_date'],
  
!                               'lang_copy_workorder'                   => 
lang('Copy workorder ?'),
!                               'lang_copy_workorder_statustext'        => 
lang('Choose Copy Workorder to copy this workorder to a new workorder'),
  
                                'lang_charge_tenant'                    => 
lang('Charge tenant'),
***************
*** 474,478 ****
                                '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'),
--- 482,494 ----
                                'lang_power_meter'                              
=> lang('Power meter'),
                                'lang_power_meter_statustext'   => lang('Enter 
the power_meter'),
!                               'value_power_meter'                             
=> $project['power_meter'],
! 
!                               'lang_addition_rs'                              
=> lang('Rig adition'),
!                               'lang_addition_rs_statustext'   => lang('Enter 
any round sum addition per order'),
!                               'value_addition_rs'                             
=> $values['addition_rs'],
! 
!                               'lang_addition_percentage'                      
=> lang('Percentage adition'),
!                               'lang_addition_percentage_statustext'   => 
lang('Enter any persentage addition per unit'),
!                               'value_addition_percentage'                     
        => $values['addition_percentage'],
  
                                'lang_budget'                                   
=> lang('Budget'),
***************
*** 482,487 ****
                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
!                               'location_type'                                 
=> 'form',
!                               'appname'                                       
        => lang('equipment'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
--- 498,503 ----
                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
!                               'location_type'                                 
=> 'view',
!                               'appname'                                       
        => lang('workorder'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
***************
*** 491,517 ****
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
!                               'lang_name'                                     
        => lang('Name'),
  
                                'lang_project_id'                               
=> lang('Project ID'),
                                'value_project_id'                              
=> $values['project_id'],
!                               'value_name'                                    
=> $values['name'],
!                               'lang_name_statustext'                  => 
lang('Enter Project Name'),
  
                                'lang_other_branch'                             
        => lang('Other branch'),
                                'lang_other_branch_statustext'          => 
lang('Enter other branch if not found in the list'),
!                               'value_other_branch'                            
=> $values['other_branch'],
  
                                'error'                                         
        => $receipt['error'],
                                'message'                                       
        => $receipt['message'],
!                               'lang_descr_statustext'                 => 
lang('Enter a description of the equipment'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'lang_save_statustext'                  => 
lang('Save the equipment'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project 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_workorder_list('select',$values['cat_id']),
  
                                'lang_workorder_id'                             
=> lang('Workorder ID'),
--- 507,539 ----
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
!                               'lang_title'                                    
=> lang('Title'),
!                               'value_title'                                   
=> $values['title'],
!                               'lang_project_name'                             
=> lang('Project name'),
!                               'value_project_name'                    => 
$project['name'],
  
                                'lang_project_id'                               
=> lang('Project ID'),
                                'value_project_id'                              
=> $values['project_id'],
! 
!                               'lang_workorder_id'                             
=> lang('Workorder ID'),
!                               'value_workorder_id'                    => 
$values['workorder_id'],
! 
!                               'lang_title_statustext'                 => 
lang('Enter Workorder title'),
  
                                'lang_other_branch'                             
        => lang('Other branch'),
                                'lang_other_branch_statustext'          => 
lang('Enter other branch if not found in the list'),
!                               'value_other_branch'                            
=> $project['other_branch'],
  
                                'error'                                         
        => $receipt['error'],
                                'message'                                       
        => $receipt['message'],
!                               'lang_descr_statustext'                 => 
lang('Enter a short description of the workorder'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'lang_save_statustext'                  => 
lang('Save the workorder'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project 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_workorder_list('select',$project['cat_id']),
  
                                'lang_workorder_id'                             
=> lang('Workorder ID'),
***************
*** 521,528 ****
                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
-                               'lang_user_statustext'                  => 
lang('Select the coordinator the project 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']),
--- 543,548 ----
                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
                                'select_user_name'                              
=> 'values[coordinator]',
!                               'user_list'                                     
        => $this->bocommon->get_user_list('select',$project['coordinator']),
  
                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
***************
*** 530,543 ****
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
!                               'lang_status_statustext'                => 
lang('What is the current status of this equipment ?'),
  
!                               'branch_list'                                   
=> $this->bo->select_branch_p_list($values['project_id']),
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_branch_statustext'                => 
lang('Select the branches for this project'),
  
!                               'key_responsible_list'                          
        => $this->bo->select_branch_list($values['key_responsible']),
!                               'lang_no_key_responsible'                       
        => lang('Select key responsible'),
!                               'lang_key_responsible'                          
        => lang('key responsible'),
!                               'lang_key_responsible_statustext'               
=> lang('Select the key responsible for this project'),
  
                                'key_fetch_list'                                
        => $this->bo->select_key_location_list($values['key_fetch']),
--- 550,561 ----
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
!                               'lang_status_statustext'                => 
lang('What is the current status of this workorder ?'),
  
!                               'branch_list'                                   
=> $this->boproject->select_branch_p_list($project['project_id']),
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_branch_statustext'                => 
lang('Select the branches for this project'),
  
!                               'key_responsible_list'                          
=> $this->boproject->select_branch_list($project['key_responsible']),
!                               'lang_key_responsible'                          
=> lang('key responsible'),
  
                                'key_fetch_list'                                
        => $this->bo->select_key_location_list($values['key_fetch']),
***************
*** 563,569 ****
                }
  
                function delete()
                {
!                       $project_id = get_var('project_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));
  
--- 581,620 ----
                }
  
+               function add()
+               {
+ 
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->currentapp.'.uiworkorder.index'
+                       );
+ 
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('workorder',
+                                                                               
'menu',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
+ 
+                       $data = array
+                       (
+                               'appname'                               => 
lang('Workorder'),
+                               'function_msg'                  => lang('Add 
workorder'),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
+                               'search_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true'),
+ 
+                               'lang_done_statustext'                  => 
lang('Back to the workorder list'),
+                               'lang_add_statustext'                   => 
lang('Adds a new project - then a new workorder'),
+                               'lang_search_statustext'                => 
lang('Adds a new workorder to an existing project'),
+ 
+                               'lang_done'                             => 
lang('Done'),
+                               'lang_add'                              => 
lang('Add'),
+                               'lang_search'                   => 
lang('Search')
+                       );
+ 
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add' 
=> $data));
+               }
+ 
                function delete()
                {
!                       $id = get_var('id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));
  
***************
*** 575,579 ****
                        if (get_var('confirm',array('POST')))
                        {
!                               $this->bo->delete($project_id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }
--- 626,630 ----
                        if (get_var('confirm',array('POST')))
                        {
!                               $this->bo->delete($id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }
***************
*** 584,591 ****
                        $data = array
                        (
!                               'appname'                               => 
lang('equipment'),
!                               'function_msg'                  => lang('delete 
equipment'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&project_id='
 . $project_id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
--- 635,642 ----
                        $data = array
                        (
!                               'appname'                               => 
lang('workorder'),
!                               'function_msg'                  => lang('delete 
workorder'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&id='
 . $id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
***************
*** 606,611 ****
                        $this->config->read_repository();
  
!                       $values = $this->bo->read_single($id);
  
                        $record_history = $this->bo->read_record_history($id);
  
--- 657,664 ----
                        $this->config->read_repository();
  
!                       $values         = $this->bo->read_single($id);
!                       $project        = 
$this->boproject->read_single($values['project_id']);
  
+ //_debug_array($values);
                        $record_history = $this->bo->read_record_history($id);
  
***************
*** 624,628 ****
                        );
  
!                       $function_msg = lang('View Project');
  
                        if ($values['cat_id'])
--- 677,681 ----
                        );
  
!                       $function_msg = lang('View Workorder');
  
                        if ($values['cat_id'])
***************
*** 637,655 ****
                                                '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'),
--- 690,709 ----
                                                'tenant'                => true,
                                                'address'               => true,
!                                               'equipment_id'  => 
$project['equipment_id'],
!                                               'property_id'   => 
$project['property_id'],
!                                               'property_name' => 
$project['property_name'],
!                                               'building_id'   => 
$project['building_id'],
!                                               'entrance_id'   => 
$project['entrance_id'],
!                                               'floor'                 => 
$project['floor'],
!                                               'street_name'   => 
$project['street_name'],
!                                               'street_number' => 
$project['street_number'],
!                                               'tenant_id'             => 
$project['tenant_id'],
!                                               'tenant_name'   => 
$project['tenant_name'],
!                                               'tenant_phone'  => 
$project['tenant_phone'],
!                                               'apartment_id'  => 
$project['apartment_id']));
  
                        $data = array
                        (
+                               'project_link'                                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view'),
                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
***************
*** 660,663 ****
--- 714,726 ----
                                'lang_no_history'                               
=> lang('No history'),
  
+                               'lang_vendor'                                   
=> lang('Vendor'),
+                               'value_vendor_id'                               
=> $values['vendor_id'],
+                               'value_vendor_name'                             
=> $values['vendor_name'],
+ 
+                               'lang_b_account'                                
=> lang('Budget account'),
+                               'value_b_account_id'                    => 
$values['b_account_id'],
+                               'value_b_account_name'                  => 
$values['b_account_name'],
+ 
+ 
                                'lang_start_date'                               
=> lang('Project start date'),
                                'value_start_date'                              
=> $values['start_date'],
***************
*** 670,682 ****
  
                                '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('Project'),
                                'function_msg'                                  
=> $function_msg,
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
--- 733,752 ----
  
                                'lang_power_meter'                              
=> lang('Power meter'),
!                               'value_power_meter'                             
=> $project['power_meter'],
! 
!                               'lang_addition_rs'                              
=> lang('Rig adition'),
!                               'lang_addition_rs_statustext'   => lang('Enter 
any round sum addition per order'),
!                               'value_addition_rs'                             
=> $values['addition_rs'],
! 
!                               'lang_addition_percentage'                      
=> lang('Percentage adition'),
!                               'lang_addition_percentage_statustext'   => 
lang('Enter any persentage addition per unit'),
!                               'value_addition_percentage'                     
        => $values['addition_percentage'],
  
                                'lang_budget'                                   
=> lang('Budget'),
                                'value_budget'                                  
=> $values['budget'],
  
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'view',
!                               'appname'                                       
        => lang('Workorder'),
                                'function_msg'                                  
=> $function_msg,
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
***************
*** 687,690 ****
--- 757,763 ----
                                'lang_name'                                     
        => lang('Name'),
  
+                               'lang_title'                                    
=> lang('Title'),
+                               'value_title'                                   
=> $values['title'],
+ 
                                'lang_project_id'                               
=> lang('Project ID'),
                                'value_project_id'                              
=> $values['project_id'],
***************
*** 692,713 ****
  
                                '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'),
!                               'lang_save_statustext'                  => 
lang('Save the equipment'),
!                               'select_name'                                   
=> 'values[cat_id]',
!                               'cat_list'                                      
        => 
$this->bo->select_category_workorder_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']),
--- 765,780 ----
  
                                'lang_other_branch'                             
        => lang('Other branch'),
!                               'value_other_branch'                            
=> $project['other_branch'],
  
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
!                               'cat_list'                                      
        => 
$this->bo->select_category_workorder_list('select',$project['cat_id']),
  
                                'lang_workorder_id'                             
=> lang('Workorder ID'),
  
                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
!                               'user_list'                                     
        => $this->bocommon->get_user_list('select',$project['coordinator']),
  
                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
***************
*** 718,735 ****
                                '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.'.uiworkorder.edit&id='
 . $id),
!                               'lang_edit_statustext'                          
=> lang('Edit this entry equipment'),
!                               'lang_edit'                                     
                => lang('Edit'),
!                               'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
--- 785,803 ----
                                'lang_branch'                                   
=> lang('branch'),
  
!                               'key_responsible_list'                  => 
$this->bo->select_branch_list($project['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.'.uiworkorder.edit&id='
 . $id),
!                               'lang_edit_statustext'                  => 
lang('Edit this entry workorder'),
!                               'lang_edit'                                     
        => lang('Edit'),
!                               'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );
+ //_debug_array($this->bo->select_key_location_list($values['key_fetch']));
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }





reply via email to

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