[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.boworkorder.inc.php,1.3,1.4 c
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.boworkorder.inc.php,1.3,1.4 class.sotts.inc.php,1.8,1.9 class.soworkorder.inc.php,1.4,1.5 class.uiworkorder.inc.php,1.3,1.4 |
Date: |
Fri, 14 Mar 2003 09:35:09 -0500 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv2076/inc
Modified Files:
class.boworkorder.inc.php class.sotts.inc.php
class.soworkorder.inc.php class.uiworkorder.inc.php
Log Message:
no message
Index: class.boworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boworkorder.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.boworkorder.inc.php 13 Mar 2003 10:25:03 -0000 1.3
--- class.boworkorder.inc.php 14 Mar 2003 14:32:18 -0000 1.4
***************
*** 47,53 ****
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.soworkorder');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
! $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$start = get_var('start',array('POST','GET'));
--- 47,54 ----
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! $this->so =
CreateObject($this->currentapp.'.soworkorder');
! $this->socommon =
CreateObject($this->currentapp.'.socommon');
! $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp .'_project');
$start = get_var('start',array('POST','GET'));
***************
*** 233,237 ****
}
-
function select_category_project_list($format='',$selected='')
{
--- 234,237 ----
***************
*** 355,358 ****
--- 355,360 ----
}
+ //
$location_data=$this->socommon->read_location_data($project['location_code']);
+ //
$project['power_meter']=$location_data['power_meter_id'];
//_debug_array($project);
***************
*** 360,363 ****
--- 362,428 ----
}
+
+ function read_record_history($id)
+ {
+ $history_array =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_project_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+
function select_part_of_town($part_of_town_id)
{
***************
*** 372,375 ****
--- 437,441 ----
$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')
***************
*** 379,383 ****
else
{
-
$project['location_code']=$this->bocommon->location_code($project['property_id'],$project['building_id'],$project['entrance_id'],$project['apartment_id']);
$receipt = $this->so->p_add($project);
}
--- 445,448 ----
Index: class.sotts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sotts.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.sotts.inc.php 21 Feb 2003 10:28:59 -0000 1.8
--- class.sotts.inc.php 14 Mar 2003 14:32:22 -0000 1.9
***************
*** 224,228 ****
$id =
$this->db->get_last_insert_id('fm_tts_tickets','id');
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp);
$this->historylog->add('O',$id,mktime(),'');
--- 224,228 ----
$id =
$this->db->get_last_insert_id('fm_tts_tickets','id');
! $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp .'_tts');
$this->historylog->add('O',$id,mktime(),'');
Index: class.soworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soworkorder.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.soworkorder.inc.php 13 Mar 2003 18:25:51 -0000 1.4
--- class.soworkorder.inc.php 14 Mar 2003 14:32:35 -0000 1.5
***************
*** 19,22 ****
--- 19,23 ----
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
+ $this->historylog =
createobject('phpgwapi.historylog',$this->currentapp .'_project');
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
***************
*** 46,49 ****
--- 47,56 ----
}
+ function read_single_project_category($id='')
+ {
+ $this->db->query("SELECT descr FROM
fm_wo_workorder_category where id='$id' ");
+ $this->db->next_record();
+ return $this->db->f('descr');
+ }
function select_status_list()
***************
*** 249,255 ****
$project['cat_id']
= $this->db->f('category');
//_debug_array($project);
return $project;
- }
}
--- 256,267 ----
$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;
}
***************
*** 321,324 ****
--- 333,339 ----
{
+
$this->historylog->add('SO',$project['project_id'],$project['status'],'');
+
$this->historylog->add('TO',$project['project_id'],$project['cat_id'],'');
+
$project['descr'] =
$this->db->db_addslashes($project['descr']);
$project['name'] =
$this->db->db_addslashes($project['name']);
***************
*** 365,380 ****
}
! if ($project['power_meter'] &&($project['apartment_id']
|| $project['entrance_id']))
{
! if($project['entrance_id'])
! {
! $el_meter_table='fm_entrance';
! }
! if($project['apartment_id'])
! {
! $el_meter_table='fm_apartment';
! }
!
! $this->db->query("update $el_meter_table set
power_meter_id='" . $project['power_meter']. "' where location_code='" .
$project['location_code']. "'",__LINE__,__FILE__);
}
--- 380,386 ----
}
! if ($project['power_meter'] )
{
!
$this->update_power_meter($project['power_meter'],$project['location_code']);
}
***************
*** 388,398 ****
}
-
$receipt['message'][] = array('msg'=>lang('project %1
has been saved',$project['project_id']));
return $receipt;
}
function p_edit($project)
{
$project['descr'] =
$this->db->db_addslashes($project['descr']);
$project['name'] =
$this->db->db_addslashes($project['name']);
--- 394,456 ----
}
$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 p_edit($project)
{
+ $this->db->query("SELECT status,category 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');
+ if ($old_status != $project['status'])
+ {
+
$this->historylog->add('S',$project['project_id'],$project['status'],$old_status);
+ }
+ if ($old_categroy != $project['cat_id'])
+ {
+
$this->historylog->add('T',$project['project_id'],$project['cat_id'],$old_categroy);
+ }
+
$project['descr'] =
$this->db->db_addslashes($project['descr']);
$project['name'] =
$this->db->db_addslashes($project['name']);
***************
*** 432,449 ****
}
! if ($project['power_meter'] &&($project['apartment_id']
|| $project['entrance_id']))
{
! if($project['entrance_id'])
! {
! $el_meter_table='fm_entrance';
! }
! if($project['apartment_id'])
! {
! $el_meter_table='fm_apartment';
! }
!
! $this->db->query("update $el_meter_table set
power_meter_id='" . $project['power_meter']. "' where location_code='" .
$project['location_code']. "'",__LINE__,__FILE__);
}
-
// -----------------which branch is represented
$this->db->query("delete from fm_wo_projectbranch where
project_id='" . $project['project_id'] ."'",__LINE__,__FILE__);
--- 490,497 ----
}
! 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__);
Index: class.uiworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiworkorder.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uiworkorder.inc.php 13 Mar 2003 10:25:06 -0000 1.3
--- class.uiworkorder.inc.php 14 Mar 2003 14:32:35 -0000 1.4
***************
*** 276,279 ****
--- 276,280 ----
{
$values['project_id']=$this->socommon->next_id('fm_wo_project');
+ $id = $values['project_id'];
}
***************
*** 322,332 ****
}
}
! else
! {
! if ($id)
! {
! $values = $this->bo->read_single_p($id);
! }
! }
if ($id)
--- 323,344 ----
}
}
!
! $values = $this->bo->read_single_p($id);
!
! $record_history = $this->bo->read_record_history($id);
!
! $table_header_history[] = array
! (
! 'lang_date' => lang('Date'),
! 'lang_user' => lang('User'),
! 'lang_action' => lang('Action'),
! 'lang_new_value' => lang('New value')
! );
!
! $table_header_workorder_budget[] = array
! (
! 'lang_workorder_id' => lang('Workorder'),
! 'lang_sum' => lang('Sum')
! );
if ($id)
***************
*** 414,417 ****
--- 426,433 ----
$data = array
(
+ 'table_header_workorder_budget' =>
$table_header_workorder_budget,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
'calendar_gif'
=> './'.$this->currentapp.'/templates/default/images/calendar.gif',
'calendar_source'
=> './'.$this->currentapp.'/inc/calendar.js',
***************
*** 466,470 ****
'value_other_branch'
=> $values['other_branch'],
- 'cat_text'
=> $cat_text,
'error'
=> $receipt['error'],
'error_flag'
=> $error_id,
--- 482,485 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.boworkorder.inc.php,1.3,1.4 class.sotts.inc.php,1.8,1.9 class.soworkorder.inc.php,1.4,1.5 class.uiworkorder.inc.php,1.3,1.4,
Sigurd Nes <address@hidden> <=