[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.borequest.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.borequest.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 15:33:21 -0000 |
Update of /property
Modified Files:
Branch:
class.borequest.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +558 -558
Log Message:
no message
=====================================================================
Index: property/class.borequest.php
diff -u property/class.borequest.php:1.1.1.2
property/class.borequest.php:1.1.1.3
--- property/class.borequest.php:1.1.1.2 Fri Apr 23 20:25:25 2004
+++ property/class.borequest.php Fri Apr 23 21:26:33 2004
@@ -1,558 +1,558 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by the
*
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
-
- class property_borequest
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function property_borequest($session=False)
- {
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'_sorequest');
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->solocation =
CreateObject($this->currentapp.'_solocation');
- $this->historylog =
CreateObject($this->currentapp.'_historylog','request');
- $this->contacts =
CreateObject('phpgwapi_contacts');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $status_id =
get_var('status_id',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($status_id))
- {
- $this->status_id = $status_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$this->fm_session->appsession('session_data','request',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$this->fm_session->appsession('session_data','request');
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->status_id = $data['status_id'];
- }
-
- function
select_degree_list($degree_value='',$degreedefault_type='')
- {
- if ($degree_value)
- {
- $selected=$degree_value;
- }
- else
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$degreedefault_type];
- }
-
- $degree_comment[0]=' - '.lang('None');
- $degree_comment[1]=' - '.lang('Minor');
- $degree_comment[2]=' - '.lang('Medium');
- $degree_comment[3]=' - '.lang('Serious');
- for ($i=0; $i<=3; $i++)
- {
- $degree_list[$i][id] = $i;
- $degree_list[$i]['name'] = $i .
$degree_comment[$i];
- if ($i==$selected)
- {
- $degree_list[$i]['selected']=
'selected';
- }
- }
-
- return $degree_list;
- }
-
- function select_probability_list($probability_value='')
- {
- $selected=$probability_value;
-
- $probability_comment[1]=' - '.lang('Small');
- $probability_comment[2]=' - '.lang('Medium');
- $probability_comment[3]=' - '.lang('Large');
- for ($i=1; $i<=3; $i++)
- {
- $probability_list[$i][id] = $i;
- $probability_list[$i]['name'] = $i .
$probability_comment[$i];
- if ($i==$selected)
- {
- $probability_list[$i]['selected']=
'selected';
- }
- }
-
- return $probability_list;
- }
-
- function
select_consequence_list($consequence_value='',$consequencedefault_type='')
- {
- if ($consequence_value)
- {
- $selected=$consequence_value;
- }
- else
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$consequencedefault_type];
- }
-
- $consequence_comment[0]=' - '.lang('None Consequences');
- $consequence_comment[1]=' - '.lang('Minor
Consequences');
- $consequence_comment[2]=' - '.lang('Medium
Consequences');
- $consequence_comment[3]=' - '.lang('Serious
Consequences');
- for ($i=0; $i<=3; $i++)
- {
- $consequence_list[$i][id] = $i;
- $consequence_list[$i]['name'] = $i .
$consequence_comment[$i];
- if ($i==$selected)
- {
- $consequence_list[$i]['selected']=
'selected';
- }
- }
-
- return $consequence_list;
- }
-
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$this->bocommon->xsl_add_file(array('status_select'));
- break;
- case 'filter':
-
$this->bocommon->xsl_add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function select_branch_list($selected='')
- {
-
- $branch_entries= $this->so->select_branch_list();
-
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $sel_branch = '';
- if ($branch['id']==$selected)
- {
- $sel_branch = 'selected';
- }
-
- $branch_list[] = array
- (
- 'id' => $branch['id'],
- 'name' => $branch['name'],
- 'selected' => $sel_branch
- );
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
- function select_branch_p_list($request_id='')
- {
-
- $selected =
$this->so->branch_p_list($request_id);
- $branch_entries = $this->so->select_branch_list();
-
- $j=0;
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $branch_list[$j]['id'] = $branch['id'];
- $branch_list[$j]['name'] = $branch['name'];
-
- for ($i=0;$i<count($selected);$i++)
- {
- if($selected[$i]['branch_id'] ==
$branch['id'])
- {
- $branch_list[$j]['selected'] =
'selected';
- }
- }
- $j++;
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
-
- function select_key_location_list($selected='')
- {
-
- $key_location_entries=
$this->so->select_key_location_list();
-
- while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
- {
- $sel_key_location = '';
- if ($key_location['id']==$selected)
- {
- $sel_key_location = 'selected';
- }
-
- $key_location_list[] = array
- (
- 'id' => $key_location['id'],
- 'name' =>
$key_location['name'],
- 'selected' => $sel_key_location
- );
- }
-
- for ($i=0;$i<count($key_location_list);$i++)
- {
- if ($key_location_list[$i]['selected'] !=
'selected')
- {
-
unset($key_location_list[$i]['selected']);
- }
- }
-
- return $key_location_list;
- }
-
- function select_category_request_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$this->bocommon->xsl_add_file(array('cat_select'));
- break;
- case 'filter':
-
$this->bocommon->xsl_add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->so->select_category_workorder_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read_priority_key()
- {
- return $this->so->read_priority_key();
- }
-
- function update_priority_key($values)
- {
- return $this->so->update_priority_key($values);
- }
-
- function read($project_id)
- {
- $request = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'project_id' => $project_id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
- $cols_extra = $this->so->cols_extra;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($request); $i++)
- {
- $request[$i]['coordinator'] =
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
- $request[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
-
$location_data=$this->solocation->read_single($request[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $request[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
- }
-
- return $request;
- }
-
- function read_single($request_id)
- {
- $request
= $this->so->read_single($request_id);
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $request['start_date'] =
$GLOBALS['phpgw']->common->show_date($request['start_date'],$dateformat);
- $request['end_date'] =
$GLOBALS['phpgw']->common->show_date($request['end_date'],$dateformat);
-
- if($request['location_code'])
- {
- $request['location_data']
=$this->solocation->read_single($request['location_code']);
- }
-
- if($request['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($request['tenant_id']);
- $request['location_data']['tenant_id']=
$request['tenant_id'];
- $request['location_data']['contact_phone']=
$tenant_data['contact_phone'];
- $request['location_data']['last_name'] =
$tenant_data['last_name'];
- $request['location_data']['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($request['location_data']['tenant_id']);
-
unset($request['location_data']['contact_phone']);
- unset($request['location_data']['last_name']);
- unset($request['location_data']['first_name']);
- }
-
- if($request['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'_soadmin_entity');
- $category =
$soadmin_entity->read_single_category($request['p_entity_id'],$request['p_cat_id']);
-
-
$request['p'][$request['p_entity_id']]['p_num']=$request['p_num'];
-
$request['p'][$request['p_entity_id']]['p_entity_id']=$request['p_entity_id'];
-
$request['p'][$request['p_entity_id']]['p_cat_id']=$request['p_cat_id'];
-
$request['p'][$request['p_entity_id']]['p_cat_name'] = $category['name'];
- }
- return $request;
- }
-
-
- function read_record_history($id)
- {
- $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'CO': $type = lang('Initial
Coordinator'); break;
- case 'C': $type = lang('Coordinator
changed'); break;
- case 'TO': $type = lang('Initial
Category'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'SO': $type = lang('Initial
Status'); break;
- case 'S': $type = lang('Status
changed'); break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
-
- if ($value['status'] == 'A')
- {
- if (! $value['new_value'])
- {
-
$record_history[$i]['value_new_value'] = lang('None');
- }
- else
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- }
- else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
- {
- $record_history[$i]['value_new_value']
= $this->so->read_single_request_category($value['new_value']);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
-
- function next_id()
- {
- return $this->so->next_id();
- }
-
- function save($request,$action='')
- {
- while (is_array($request['location']) && list(,$value)
= each($request['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $request['location_code']=implode("-", $location);
- $start_date =
$this->bocommon->date_array($request['start_date']);
- $end_date =
$this->bocommon->date_array($request['end_date']);
-
- $request['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
- $request['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
-
-//html_print_r($request);
- if ($action=='edit')
- {
- $receipt = $this->so->edit($request);
- }
- else
- {
- $receipt = $this->so->add($request);
- }
- return $receipt;
- }
-
- function delete($request_id)
- {
- $this->so->delete($request_id);
- }
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ class property_borequest
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function property_borequest($session=False)
+ {
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'_sorequest');
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->solocation =
CreateObject($this->currentapp.'_solocation');
+ $this->historylog =
CreateObject($this->currentapp.'_historylog','request');
+ $this->contacts =
CreateObject('phpgwapi_contacts');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $status_id =
get_var('status_id',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($status_id))
+ {
+ $this->status_id = $status_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$this->fm_session->appsession('session_data','request',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$this->fm_session->appsession('session_data','request');
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->status_id = $data['status_id'];
+ }
+
+ function
select_degree_list($degree_value='',$degreedefault_type='')
+ {
+ if ($degree_value)
+ {
+ $selected=$degree_value;
+ }
+ else
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$degreedefault_type];
+ }
+
+ $degree_comment[0]=' - '.lang('None');
+ $degree_comment[1]=' - '.lang('Minor');
+ $degree_comment[2]=' - '.lang('Medium');
+ $degree_comment[3]=' - '.lang('Serious');
+ for ($i=0; $i<=3; $i++)
+ {
+ $degree_list[$i][id] = $i;
+ $degree_list[$i]['name'] = $i .
$degree_comment[$i];
+ if ($i==$selected)
+ {
+ $degree_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $degree_list;
+ }
+
+ function select_probability_list($probability_value='')
+ {
+ $selected=$probability_value;
+
+ $probability_comment[1]=' - '.lang('Small');
+ $probability_comment[2]=' - '.lang('Medium');
+ $probability_comment[3]=' - '.lang('Large');
+ for ($i=1; $i<=3; $i++)
+ {
+ $probability_list[$i][id] = $i;
+ $probability_list[$i]['name'] = $i .
$probability_comment[$i];
+ if ($i==$selected)
+ {
+ $probability_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $probability_list;
+ }
+
+ function
select_consequence_list($consequence_value='',$consequencedefault_type='')
+ {
+ if ($consequence_value)
+ {
+ $selected=$consequence_value;
+ }
+ else
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$consequencedefault_type];
+ }
+
+ $consequence_comment[0]=' - '.lang('None Consequences');
+ $consequence_comment[1]=' - '.lang('Minor
Consequences');
+ $consequence_comment[2]=' - '.lang('Medium
Consequences');
+ $consequence_comment[3]=' - '.lang('Serious
Consequences');
+ for ($i=0; $i<=3; $i++)
+ {
+ $consequence_list[$i][id] = $i;
+ $consequence_list[$i]['name'] = $i .
$consequence_comment[$i];
+ if ($i==$selected)
+ {
+ $consequence_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $consequence_list;
+ }
+
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$this->bocommon->xsl_add_file(array('status_select'));
+ break;
+ case 'filter':
+
$this->bocommon->xsl_add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function select_branch_list($selected='')
+ {
+
+ $branch_entries= $this->so->select_branch_list();
+
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $sel_branch = '';
+ if ($branch['id']==$selected)
+ {
+ $sel_branch = 'selected';
+ }
+
+ $branch_list[] = array
+ (
+ 'id' => $branch['id'],
+ 'name' => $branch['name'],
+ 'selected' => $sel_branch
+ );
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+ function select_branch_p_list($request_id='')
+ {
+
+ $selected =
$this->so->branch_p_list($request_id);
+ $branch_entries = $this->so->select_branch_list();
+
+ $j=0;
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $branch_list[$j]['id'] = $branch['id'];
+ $branch_list[$j]['name'] = $branch['name'];
+
+ for ($i=0;$i<count($selected);$i++)
+ {
+ if($selected[$i]['branch_id'] ==
$branch['id'])
+ {
+ $branch_list[$j]['selected'] =
'selected';
+ }
+ }
+ $j++;
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+
+ function select_key_location_list($selected='')
+ {
+
+ $key_location_entries=
$this->so->select_key_location_list();
+
+ while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
+ {
+ $sel_key_location = '';
+ if ($key_location['id']==$selected)
+ {
+ $sel_key_location = 'selected';
+ }
+
+ $key_location_list[] = array
+ (
+ 'id' => $key_location['id'],
+ 'name' =>
$key_location['name'],
+ 'selected' => $sel_key_location
+ );
+ }
+
+ for ($i=0;$i<count($key_location_list);$i++)
+ {
+ if ($key_location_list[$i]['selected'] !=
'selected')
+ {
+
unset($key_location_list[$i]['selected']);
+ }
+ }
+
+ return $key_location_list;
+ }
+
+ function select_category_request_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$this->bocommon->xsl_add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$this->bocommon->xsl_add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->so->select_category_workorder_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read_priority_key()
+ {
+ return $this->so->read_priority_key();
+ }
+
+ function update_priority_key($values)
+ {
+ return $this->so->update_priority_key($values);
+ }
+
+ function read($project_id)
+ {
+ $request = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'project_id' => $project_id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ for ($i=0; $i<count($request); $i++)
+ {
+ $request[$i]['coordinator'] =
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
+ $request[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
+
$location_data=$this->solocation->read_single($request[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $request[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+ }
+
+ return $request;
+ }
+
+ function read_single($request_id)
+ {
+ $request
= $this->so->read_single($request_id);
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $request['start_date'] =
$GLOBALS['phpgw']->common->show_date($request['start_date'],$dateformat);
+ $request['end_date'] =
$GLOBALS['phpgw']->common->show_date($request['end_date'],$dateformat);
+
+ if($request['location_code'])
+ {
+ $request['location_data']
=$this->solocation->read_single($request['location_code']);
+ }
+
+ if($request['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($request['tenant_id']);
+ $request['location_data']['tenant_id']=
$request['tenant_id'];
+ $request['location_data']['contact_phone']=
$tenant_data['contact_phone'];
+ $request['location_data']['last_name'] =
$tenant_data['last_name'];
+ $request['location_data']['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($request['location_data']['tenant_id']);
+
unset($request['location_data']['contact_phone']);
+ unset($request['location_data']['last_name']);
+ unset($request['location_data']['first_name']);
+ }
+
+ if($request['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'_soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($request['p_entity_id'],$request['p_cat_id']);
+
+
$request['p'][$request['p_entity_id']]['p_num']=$request['p_num'];
+
$request['p'][$request['p_entity_id']]['p_entity_id']=$request['p_entity_id'];
+
$request['p'][$request['p_entity_id']]['p_cat_id']=$request['p_cat_id'];
+
$request['p'][$request['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+ return $request;
+ }
+
+
+ function read_record_history($id)
+ {
+ $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'CO': $type = lang('Initial
Coordinator'); break;
+ case 'C': $type = lang('Coordinator
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_request_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+
+ function next_id()
+ {
+ return $this->so->next_id();
+ }
+
+ function save($request,$action='')
+ {
+ while (is_array($request['location']) && list(,$value)
= each($request['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $request['location_code']=implode("-", $location);
+ $start_date =
$this->bocommon->date_array($request['start_date']);
+ $end_date =
$this->bocommon->date_array($request['end_date']);
+
+ $request['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
+ $request['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
+
+//html_print_r($request);
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit($request);
+ }
+ else
+ {
+ $receipt = $this->so->add($request);
+ }
+ return $receipt;
+ }
+
+ function delete($request_id)
+ {
+ $this->so->delete($request_id);
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.borequest.php, 1.1.1.3,
nomail <=