[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.botemplate.inc.php,NONE,1.1 c
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.botemplate.inc.php,NONE,1.1 class.sotemplate.inc.php,NONE,1.1 class.uitemplate.inc.php,NONE,1.1 class.bocommon.inc.php,1.30,1.31 class.bowo_hour.inc.php,1.6,1.7 class.sowo_hour.inc.php,1.6,1.7class.uistandard_entity.inc.php,1.6,1.7 class.uiwo_hour.inc.php,1.10,1.11 |
Date: |
Mon, 07 Apr 2003 03:21:59 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv4529/inc
Modified Files:
class.bocommon.inc.php class.bowo_hour.inc.php
class.sowo_hour.inc.php class.uistandard_entity.inc.php
class.uiwo_hour.inc.php
Added Files:
class.botemplate.inc.php class.sotemplate.inc.php
class.uitemplate.inc.php
Log Message:
no message
--- NEW FILE ---
<?php
/***************************************************************************\
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\***************************************************************************/
class botemplate
{
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 botemplate($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sotemplate');
$this->socommon =
CreateObject($this->currentapp.'.socommon');
$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'));
$allrows =
get_var('allrows',array('POST','GET'));
if ($start)
{
$this->start=$start;
}
else
{
$this->start=0;
}
if(isset($query))
{
$this->query = $query;
}
if(!empty($filter))
{
$this->filter = $filter;
}
if(isset($sort))
{
$this->sort = $sort;
}
if(isset($order))
{
$this->order = $order;
}
if(isset($cat_id))
{
$this->cat_id = $cat_id;
}
if(isset($allrows))
{
$this->allrows = $allrows;
}
}
function read()
{
$template = $this->so->read(array('filter' =>
$this->filter,'start' => $this->start,'query' => $this->query,'sort' =>
$this->sort,'order' => $this->order,
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
$this->total_records = $this->so->total_records;
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
for ($i=0; $i<count($template); $i++)
{
$template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
$template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
}
return $template;
}
function read_template_hour($template_id)
{
$template = $this->so->read_template_hour(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
$this->total_records = $this->so->total_records;
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
for ($i=0; $i<count($template); $i++)
{
$template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
$template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
}
return $template;
}
function read_single_template($template_id)
{
return $this->so->read_single_template($template_id);
}
function read_single_hour($hour_id)
{
return $this->so->read_single_hour($hour_id);
}
function get_grouping_list($selected='',$template_id)
{
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
$groupings= $this->so->get_grouping_list($template_id);
while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
{
$sel_grouping_entry = '';
if ($grouping_entry['id']==$selected)
{
$sel_grouping_entry = 'selected';
}
$grouping_list[] = array
(
'id' =>
$grouping_entry['id'],
'name' =>
$grouping_entry['name'],
'selected' => $sel_grouping_entry
);
}
for ($i=0;$i<count($grouping_list);$i++)
{
if ($grouping_list[$i]['selected'] !=
'selected')
{
unset($grouping_list[$i]['selected']);
}
}
return $grouping_list;
}
function save_template($values)
{
if ($values['template_id'])
{
if ($values['template_id'] != 0)
{
$receipt =
$this->so->edit_template($values);
$receipt['template_id']=$values['template_id'];
}
}
else
{
$receipt = $this->so->add_template($values);
}
return $receipt;
}
function save_hour($values,$template_id)
{
$values['billperae'] =
str_replace(",",".",$values['billperae']);
$values['quantity'] =
str_replace(",",".",$values['quantity']);
$values['cost'] =
$values['billperae']*$values['quantity'];
if($values['ns3420_descr'])
{
$values['descr']=$values['ns3420_descr'];
}
if ($values['hour_id'])
{
if ($values['hour_id'] != 0)
{
$receipt =
$this->so->edit_hour($values,$template_id);
}
}
else
{
$receipt =
$this->so->add_custom_hour($values,$template_id);
}
return $receipt;
}
function delete($params)
{
if (is_array($params))
{
$this->so->delete($params[0]);
}
else
{
$this->so->delete($params);
}
}
function delete_hour($hour_id,$template_id)
{
return $this->so->delete_hour($hour_id,$template_id);
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\***************************************************************************/
class sotemplate
{
var $grants;
function sotemplate()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
{
$this->join = " JOIN ";
}
else
{
$this->join = " LEFT JOIN ";
}
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$filter =
(isset($data['filter'])?$data['filter']:'');
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$chapter_id =
(isset($data['chapter_id'])?$data['chapter_id']:0);
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
$template_id =
(isset($data['template_id'])?$data['template_id']:0);
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id desc';
}
$filtermethod = ' ( fm_wo_template.owner=' .
$this->account;
if (is_array($this->grants))
{
$grants = $this->grants;
while (list($user) = each($grants))
{
$public_user_list[] = $user;
}
reset($public_user_list);
$filtermethod .= " OR ( fm_wo_template.owner
IN(" . implode(',',$public_user_list) . ")))";
}
else
{
$filtermethod .= ' )';
}
if ($chapter_id > 0)
{
$filtermethod .= " AND chapter_id='$chapter_id'
";
}
if ($filter)
{
$filtermethod .= " AND
fm_wo_template.owner='$filter' ";
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND (fm_wo_template.descr LIKE
'%$query%')";
}
$sql = "SELECT
fm_wo_template.id,fm_wo_template.descr,fm_wo_template.name,fm_wo_template.owner,fm_wo_template.entry_date,"
. " fm_wo_chapter.descr as chapter FROM
fm_wo_template $this->join fm_wo_chapter on
fm_wo_template.chapter_id=fm_wo_chapter.id"
. " WHERE $filtermethod $querymethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
while ($this->db->next_record())
{
$ngrants =
(int)$this->grants[$this->db->f('fm_wo_wrkorders.owner')];
$template_list[] = array
(
'template_id' =>
$this->db->f('id'),
'name' =>
stripslashes($this->db->f('name')),
'descr' =>
stripslashes($this->db->f('descr')),
'owner' =>
$this->db->f('owner'),
'entry_date' =>
$this->db->f('entry_date'),
'chapter' =>
$this->db->f('chapter'),
'grants' =>
$ngrants
);
}
return $template_list;
}
function read_template_hour($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$chapter_id =
(isset($data['chapter_id'])?$data['chapter_id']:0);
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
$template_id =
(isset($data['template_id'])?$data['template_id']:0);
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by record ';
}
$filtermethod .= " where template_id='$template_id' ";
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND (hours_descr LIKE
'%$query%' or fm_wo_template_hours.remark LIKE '%$query%' or ns3420_id LIKE
'%$query%')";
}
$sql = "SELECT fm_wo_template_hours.*, chapter_id from
fm_wo_template_hours $this->join fm_wo_template on
fm_wo_template.id=fm_wo_template_hours.template_id $filtermethod $querymethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
while ($this->db->next_record())
{
$ngrants =
(int)$this->grants[$this->db->f('fm_wo_wrkorders.owner')];
$hour_list[] = array
(
'hour_id' =>
$this->db->f('id'),
'chapter_id' =>
$this->db->f('chapter_id'),
'activity_num' =>
$this->db->f('activity_num'),
'hours_descr' =>
stripslashes($this->db->f('hours_descr')),
'remark' =>
stripslashes($this->db->f('remark')),
'grouping_id' =>
$this->db->f('grouping_id'),
'grouping_descr' =>
$this->db->f('grouping_descr'),
'ns3420_id' =>
$this->db->f('ns3420_id'),
'tolerance' =>
$this->db->f('tolerance'),
'activity_id' =>
$this->db->f('activity_id'),
'unit' =>
$this->db->f('unit'),
'record' =>
$this->db->f('record'),
'cost' =>
$this->db->f('cost'),
'billperae' =>
$this->db->f('billperae'),
'building_part' =>
$this->db->f('building_part'),
'dim_d' =>
$this->db->f('dim_d'),
'grants' =>
$ngrants
);
}
return $hour_list;
}
function read_single_template($template_id)
{
$sql = "SELECT * FROM fm_wo_template where
id='$template_id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$template['template_id'] =
$this->db->f('id');
$template['name']
= stripslashes($this->db->f('name'));
$template['descr']
= stripslashes($this->db->f('descr'));
$template['chapter_id'] =
(int)$this->db->f('chapter_id');
}
return $template;
}
function read_single_hour($hour_id)
{
$sql = "SELECT * from fm_wo_template_hours where
id='$hour_id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$hour['hour_id']
= $this->db->f('id');
$hour['record']
= $this->db->f('record');
$hour['activity_id'] =
$this->db->f('activity_id');
$hour['activity_num'] =
$this->db->f('activity_num');
$hour['grouping_id'] =
$this->db->f('grouping_id');
$hour['hours_descr'] =
$this->db->f('hours_descr');
$hour['remark']
= $this->db->f('remark');
$hour['billperae']
= $this->db->f('billperae');
$hour['unit']
= $this->db->f('unit');
$hour['ns3420_id']
= $this->db->f('ns3420_id');
$hour['tolerance_id'] =
(int)$this->db->f('tolerance');
$hour['building_part_id'] =
(int)$this->db->f('building_part');
$hour['quantity']
= $this->db->f('quantity');
$hour['cost']
= $this->db->f('cost');
$hour['dim_d']
= $this->db->f('dim_d');
}
return $hour;
}
function next_record($template_id)
{
$this->db->query("SELECT max(record) as record FROM
fm_wo_template_hours where template_id='$template_id'",__LINE__,__FILE__);
$this->db->next_record();
$record = $this->db->f('record')+1;
return $record;
}
function add_custom_hour($hour,$template_id)
{
$hour['record'] = $this->next_record($template_id);
$this->db->query("UPDATE fm_wo_template set
chapter_id ='" . $hour['chapter_id'] . "'
WHERE id= '$template_id'",__LINE__,__FILE__);
if($hour['grouping_id'])
{
$this->db->query("SELECT grouping_descr ,
max(record) as record FROM fm_wo_template_hours where grouping_id='"
.$hour['grouping_id'] . "' and template_id= '$template_id' GROUP by
grouping_descr",__LINE__,__FILE__);
$this->db->next_record();
$hour['grouping_descr'] =
$this->db->f('grouping_descr');
}
if($hour['new_grouping'])
{
$this->db->query("SELECT grouping_id FROM
fm_wo_template_hours where grouping_descr ='" .$hour['new_grouping'] . "' and
template_id= '$template_id'",__LINE__,__FILE__);
$this->db->next_record();
if ( $this->db->f('grouping_id'))
{
$hour['grouping_id'] =
$this->db->f('grouping_id');
}
else
{
$this->db->query("SELECT
max(grouping_id) as grouping_id FROM fm_wo_template_hours where template_id=
'$template_id'",__LINE__,__FILE__);
$this->db->next_record();
$hour['grouping_id'] =
$this->db->f('grouping_id')+1;
}
$hour['grouping_descr'] = $hour['new_grouping'];
}
$this->db->query("insert into fm_wo_template_hours
(owner,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
. "
grouping_id,grouping_descr,record,building_part,tolerance,remark,entry_date,template_id)
"
. " values ('" .
$this->account . "','" .
$hour['descr'] . "','" .
$hour['unit'] . "','" .
$hour['cost'] . "','" .
$hour['quantity'] . "','" .
$hour['billperae'] . "','" .
$hour['ns3420_id'] . "','" .
$hour['dim_d'] . "','" .
$hour['grouping_id'] . "','" .
$hour['grouping_descr'] . "','" .
$hour['record'] . "','" .
$hour['building_part_id'] . "','" .
$hour['tolerance_id'] . "','" .
$hour['remark'] . "','" .
time() . "','" .
$template_id . "')",__LINE__,__FILE__);
$receipt['hour_id'] =
$this->db->get_last_insert_id('fm_wo_template_hours','id');
$receipt['message'][] = array('msg'=>lang('hour %1 is
added!',$hour['record']));
return $receipt;
}
function edit_hour($hour,$template_id)
{
$hour['descr'] =
$this->db->db_addslashes($hour['descr']);
$hour['remark'] =
$this->db->db_addslashes($hour['remark']);
$this->db->query("UPDATE fm_wo_template set
chapter_id ='" . $hour['chapter_id'] . "'
WHERE id= '$template_id'",__LINE__,__FILE__);
if($hour['new_grouping'])
{
$this->db->query("SELECT grouping_id FROM
fm_wo_template_hours where grouping_descr ='" .$hour['new_grouping'] . "' and
template_id= '$template_id'",__LINE__,__FILE__);
$this->db->next_record();
if ( $this->db->f('grouping_id'))
{
$hour['grouping_id'] =
$this->db->f('grouping_id');
}
else
{
$this->db->query("UPDATE
fm_wo_template_hours set grouping_id = NULL WHERE id ='" .$hour['hour_id'] .
"'",__LINE__,__FILE__);
$this->db->query("SELECT
count(grouping_id) as num_grouping FROM fm_wo_template_hours where template_id=
'$template_id' and grouping_id >0 ",__LINE__,__FILE__);
$this->db->next_record();
if ($this->db->f('num_grouping')==1)
{
$hour['grouping_id']=1;
}
else
{
$this->db->query("SELECT
max(grouping_id) as grouping_id FROM fm_wo_template_hours where template_id=
'$template_id'",__LINE__,__FILE__);
$this->db->next_record();
$hour['grouping_id'] =
$this->db->f('grouping_id')+1;
}
}
$hour['grouping_descr'] = $hour['new_grouping'];
}
else
{
$this->db->query("SELECT
grouping_id,grouping_descr FROM fm_wo_template_hours where id ='"
.$hour['hour_id'] . "'",__LINE__,__FILE__);
$this->db->next_record();
$old_grouping_id =
$this->db->f('grouping_id');
if ( $old_grouping_id == $hour['grouping_id'])
{
$hour['grouping_descr'] =
$this->db->f('grouping_descr');
}
else
{
$this->db->query("SELECT grouping_descr
, max(record) as record FROM fm_wo_template_hours where grouping_id='"
.$hour['grouping_id'] . "' and template_id= '$template_id' GROUP by
grouping_descr",__LINE__,__FILE__);
$this->db->next_record();
if($this->db->f('grouping_descr'))
{
$hour['grouping_descr'] =
$this->db->f('grouping_descr');
}
else
{
$hour['grouping_id']='';
$hour['grouping_descr']='';
}
}
}
$this->db->query("SELECT record FROM
fm_wo_template_hours where id ='" .$hour['hour_id'] . "'",__LINE__,__FILE__);
$this->db->next_record();
$hour['record'] = $this->db->f('record');
$this->db->query("UPDATE fm_wo_template_hours set
hours_descr ='" .
$hour['descr'] . "',
remark ='" .
$hour['remark'] . "',
billperae ='" .
$hour['billperae'] . "',
unit ='" .
$hour['unit'] . "',
quantity ='" .
$hour['quantity'] . "',
cost ='" .
$hour['cost'] . "',
ns3420_id ='" .
$hour['ns3420_id'] . "',
tolerance ='" .
$hour['tolerance_id'] . "',
building_part ='" .
$hour['building_part_id'] . "',
dim_d ='" .
$hour['dim_d'] . "',
grouping_id ='" .
$hour['grouping_id'] . "',
grouping_descr ='" .
$hour['grouping_descr']
. "' WHERE id= '" . $hour['hour_id']
."'",__LINE__,__FILE__);
$receipt['hour_id'] = $hour['hour_id'];
$receipt['message'][] = array('msg'=>lang('hour %1 has
been edited',$hour['record']));
return $receipt;
}
function get_grouping_list($template_id='')
{
$this->db->query("SELECT grouping_id, grouping_descr
FROM fm_wo_template_hours where template_id='$template_id' and grouping_id >0
group by grouping_id, grouping_descr");
$i = 0;
while ($this->db->next_record())
{
$grouping_entries[$i]['id']
= $this->db->f('grouping_id');
$grouping_entries[$i]['name']
= stripslashes($this->db->f('grouping_descr'));
$i++;
}
return $grouping_entries;
}
function add_template($values)
{
$values['name'] =
$this->db->db_addslashes($values['name']);
$this->db->query("insert into fm_wo_template
(owner,name,descr,chapter_id,entry_date) "
. " values ('" .
$this->account . "','" .
$values['name'] . "','" .
$values['descr'] . "','" .
$values['chapter_id'] . "','" .
time() . "')",__LINE__,__FILE__);
$template_id =
$this->db->get_last_insert_id('fm_wo_template','id');
$receipt['template_id'] = $template_id;
$receipt['message'][] = array('msg'=>lang('template %1
is added!',$values['name']));
return $receipt;
}
function edit_template($values)
{
$values['name'] =
$this->db->db_addslashes($values['name']);
$values['descr'] =
$this->db->db_addslashes($values['descr']);
$this->db->query("UPDATE fm_wo_template set name='" .
$values['name'] . "', descr='" . $values['descr'] . "', chapter_id='"
.
(int)$values['chapter_id']
. "' WHERE id='" .
$values['template_id'] . "'",__LINE__,__FILE__);
$receipt['message'][]=array('msg'=>lang('Property has
been edited'));
return $receipt;
}
function delete($id)
{
$this->db->query("DELETE FROM fm_wo_template WHERE
id='$id'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_wo_template_hours
WHERE template_id='$id'",__LINE__,__FILE__);
}
function delete_hour($hour_id,$template_id )
{
$this->db->query("SELECT record FROM
fm_wo_template_hours where id ='$hour_id'",__LINE__,__FILE__);
$this->db->next_record();
$old_record = $this->db->f('record');
$this->db->query("DELETE FROM fm_wo_template_hours
WHERE id='" . $hour_id . "'",__LINE__,__FILE__);
if($old_record)
{
$this->db->query("UPDATE fm_wo_template_hours
set record = record - 1 where template_id= '$template_id' and record >
$old_record ",__LINE__,__FILE__);
}
$receipt['message'][] = array('msg'=>lang('hour %1 has
been deleted',$hour_id));
return $receipt;
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* -------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\***************************************************************************/
class uitemplate
{
var $grants;
var $cat_id;
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $currentapp;
var $public_functions = array
(
'index' => True,
'view' => True,
'edit_template' => True,
'edit_hour' => True,
'delete' => True,
'hour' => True
);
function uitemplate()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->grants[$this->account] = PHPGW_ACL_READ +
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
$this->bo =
CreateObject($this->currentapp.'.botemplate');
$this->bowo_hour =
CreateObject($this->currentapp.'.bowo_hour');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
$this->bopricebook =
CreateObject($this->currentapp.'.bopricebook',True);
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
$this->chapter_id =
$this->bo->chapter_id;
$this->allrows =
$this->bo->allrows;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'project');
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id,
'chapter_id' => $this->chapter_id,
'allrows' => $this->allrows
);
$this->bocommon->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('template',
'menu',
'nextmatchs',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
$workorder_id =
get_var('workorder_id',array('POST','GET'));
$lookup = get_var('lookup',array('POST','GET'));
$links = $this->bocommon->menu();
$template_list = $this->bo->read();
while (is_array($template_list) && list(,$template) =
each($template_list))
{
$content_template[] = array
(
'workorder_id' =>
$workorder_id,
'template_id' =>
$template['template_id'],
'name'
=> $template['name'],
'descr'
=> $template['descr'],
'owner'
=> $template['owner'],
'entry_date' =>
$template['entry_date'],
'chapter'
=> $template['chapter'],
'lang_select' =>
lang('Select'),
'form_action_select' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.template'),
'lang_select_statustext' =>
lang('Select this template to view the details'),
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template['template_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template&template_id='
. $template['template_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $template['template_id']),
'lang_view_statustext' =>
lang('view the template'),
'lang_edit_statustext' =>
lang('edit the template'),
'lang_delete_statustext' =>
lang('delete the template'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
$i++;
}
$table_header_template[] = array
(
'sort_template_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'fm_wo_template.id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.list_template',
'chapter_id'
=>$this->chapter_id,
'query'
=>$this->query,
'workorder_id'
=>$workorder_id,
'allrows'
=>$this->allrows)
)),
'lang_template_id' =>
lang('ID'),
'lang_name' => lang('Name'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.list_template',
'chapter_id'
=>$this->chapter_id,
'query'
=>$this->query,
'workorder_id'
=>$workorder_id,
'allrows'
=>$this->allrows)
)),
'lang_name' => lang('Name'),
'lang_chapter' => lang('Chapter'),
'lang_owner' => lang('owner'),
'lang_entry_date' => lang('Entry Date'),
'lang_descr' => lang('Description'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'lang_select' => lang('select')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'chapter_id'
=>$this->chapter_id,
'workorder_id' =>$workorder_id,
'query'
=>$this->query
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a
template'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template')
);
$table_done[] = array
(
'lang_done' =>
lang('Done'),
'lang_done_statustext' => lang('Back to list'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
);
$data = array
(
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_add_statustext' =>
lang('Add the selected items'),
'lang_add'
=> lang('Add'),
'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
'chapter_list'
=> $this->bowo_hour->get_chapter_list('filter',$this->chapter_id),
'select_chapter'
=> 'chapter_id',
'lang_no_chapter'
=> lang('Select chapter'),
'lang_chapter_statustext' =>
lang('Select the template-chapter'),
'lookup'
=> $lookup,
'function'
=> 'template',
'links'
=> $links,
'allrows'
=> $this->allrows,
'allow_allrows'
=> true,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($template_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'appname'
=> lang($this->currentapp),
'function_msg'
=> lang('list template'),
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_user_statustext' =>
lang('Select the user the template belongs to. To do not use a category select
NO USER'),
'select_user_name'
=> 'filter',
'lang_no_user'
=> lang('No user'),
'user_list'
=> $this->bocommon->get_user_list('filter',$this->filter),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_submit'
=> lang('submit'),
'table_header_template' =>
$table_header_template,
'values_template'
=> $content_template,
'table_add'
=> $table_add,
'table_done'
=> $table_done
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
}
function hour()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('template',
'menu',
'nextmatchs',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
$delete = get_var('delete',array('POST','GET'));
$hour_id = get_var('hour_id',array('POST','GET'));
$template_id =
get_var('template_id',array('POST','GET'));
if($delete && $hour_id)
{
$receipt =
$this->bo->delete_hour($hour_id,$template_id);
}
$links = $this->bocommon->menu();
$template_list =
$this->bo->read_template_hour($template_id);
$i=0;
$grouping_descr_old='';
while (is_array($template_list) && list(,$template) =
each($template_list))
{
if($template['grouping_descr']!=$grouping_descr_old)
{
$new_grouping = true;
}
else
{
$new_grouping = false;
}
$grouping_descr_old =
$template['grouping_descr'];
if($template['activity_num'])
{
$code = $template['activity_num'];
}
else
{
$code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
}
$content[] = array
(
'counter'
=> $i,
'record'
=> $template['record'],
'chapter_id' =>
$template['chapter_id'],
'grouping_descr' =>
$template['grouping_descr'],
'building_part' =>
$template['building_part'],
'new_grouping' =>
$new_grouping,
'code'
=> $code,
'activity_id' =>
$template['activity_id'],
'activity_num' =>
$template['activity_num'],
'hours_descr' =>
$template['hours_descr'],
'remark'
=> $template['remark'],
'ns3420_id'
=> $template['ns3420_id'],
'tolerance'
=> $template['tolerance'],
'cost'
=> $template['cost'],
'unit'
=> $template['unit'],
'billperae'
=> $template['billperae'],
'building_part' =>
$template['building_part'],
'dim_d'
=> $template['dim_d'],
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&hour_id='
. $template['hour_id'] . '&template_id=' . $template_id),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&delete=true&template_id='
. $template_id . '&hour_id=' . $template['hour_id']),
'lang_edit_statustext' =>
lang('edit the template'),
'lang_delete_statustext' =>
lang('delete the template'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
$i++;
}
$table_header[] = array
(
'lang_record' => lang('Record'),
'lang_code' => lang('Code'),
'lang_descr' => lang('Description'),
'lang_unit' => lang('Unit'),
'lang_quantity' => lang('Quantity'),
'lang_billperae' => lang('Bill per
unit'),
'lang_cost' => lang('Cost'),
'sort_billperae' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'billperae',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
'workorder_id'
=>$workorder_id,
'template_id'
=>$template_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'lang_select' => lang('Select'),
'sort_building_part' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'building_part',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
'workorder_id'
=>$workorder_id,
'template_id'
=>$template_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'lang_building_part' =>
lang('Building part'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete')
);
$table_done[] = array
(
'lang_done' =>
lang('Done'),
'lang_done_statustext' => lang('Back to list'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.hour',
'sort'
=>$this->sort,
'order'
=>$this->order,
'workorder_id' =>$workorder_id,
'template_id' =>$template_id,
'allrows'
=>$this->allrows,
'query'
=>$this->query
);
$link_data_nextmatch = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.hour',
'sort'
=>$this->sort,
'order'
=>$this->order,
'workorder_id' =>$workorder_id,
'template_id' =>$template_id,
'query'
=>$this->query
);
$link_data_delete = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.hour',
'sort'
=>$this->sort,
'order'
=>$this->order,
'workorder_id' =>$workorder_id,
'allrows'
=>$this->allrows,
'delete' =>true,
'query'
=>$this->query
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a hour'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$data = array
(
'error'
=> $receipt['error'],
'message'
=> $receipt['message'],
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_add_statustext' =>
lang('Add the selected items'),
'lang_add'
=> lang('Add'),
'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
'function'
=> 'template',
'links'
=> $links,
'allrows'
=> $this->allrows,
'allow_allrows'
=> true,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($template_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'appname'
=> lang($this->currentapp),
'function_msg'
=> lang('list template'),
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'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'),
'workorder_data'
=> $common_data['workorder_data'],
'table_header_template_hour' =>
$table_header,
'values_template_hour' =>
$content,
'table_add'
=> $table_add,
'table_done'
=> $table_done
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
$this->save_sessiondata();
}
function edit_template()
{
$template_id =
get_var('template_id',array('POST','GET'));
$values =
get_var('values',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('template',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
if ($values['save'])
{
$values['template_id'] = $template_id;
if(!$receipt['error'])
{
$receipt =
$this->bo->save_template($values);
$template_id=$receipt['template_id'];
}
}
if ($template_id)
{
$values =
$this->bo->read_single_template($template_id);
$function_msg = lang('Edit template');
}
else
{
$function_msg = lang('Add template');
}
if($error_id)
{
unset($values['template_id']);
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.edit_template',
'template_id' => $template_id
);
$data = array
(
'appname'
=> lang('Workorder template'),
'function_msg'
=> $function_msg,
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&template_id='
. $template_id),
'lang_template_id'
=> lang('Template ID'),
'value_template_id'
=> $template_id,
'lang_name'
=> lang('Name'),
'value_name'
=> $values['name'],
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_descr'
=> lang('description'),
'value_descr'
=> $values['descr'],
'lang_descr_statustext' =>
lang('Enter the description for this template'),
'error'
=> $receipt['error'],
'message'
=> $receipt['message'],
'lang_done_statustext' =>
lang('Back to the list'),
'lang_save_statustext' =>
lang('Save the building'),
'lang_remark'
=> lang('Remark'),
'value_remark'
=> $values['remark'],
'lang_remark_statustext' =>
lang('Enter addtional remarks to the description - if any'),
'lang_chapter'
=> lang('chapter'),
'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$values['chapter_id']),
'select_chapter'
=> 'values[chapter_id]',
'lang_no_chapter'
=> lang('Select chapter'),
'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
'lang_add'
=> lang('add a hour'),
'lang_add_statustext' =>
lang('add a hour to this template'),
'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_template' => $data));
}
function edit_hour()
{
$template_id =
get_var('template_id',array('POST','GET'));
$activity_id =
get_var('activity_id',array('POST','GET'));
$hour_id =
get_var('hour_id',array('POST','GET'));
$values =
get_var('values',array('POST','GET'));
$values['ns3420_id'] =
get_var('ns3420_id',array('POST','GET'));
$values['ns3420_descr'] =
get_var('ns3420_descr',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('template',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
if ($values['save'])
{
if($values['copy_hour'])
{
unset($hour_id);
}
$values['hour_id'] = $hour_id;
if(!$receipt['error'])
{
$receipt =
$this->bo->save_hour($values,$template_id);
$hour_id=$receipt['hour_id'];
}
}
if ($hour_id)
{
$values = $this->bo->read_single_hour($hour_id);
$function_msg = lang('Edit hour');
}
else
{
$function_msg = lang('Add hour');
}
$template =
$this->bo->read_single_template($template_id);
if($error_id)
{
unset($values['hour_id']);
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.edit_hour',
'template_id' => $template_id,
'hour_id' => $hour_id
);
$data = array
(
'appname'
=> lang('Template'),
'function_msg'
=> $function_msg,
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template_id),
'lang_template'
=> lang('template'),
'value_template_id'
=> $template['template_id'],
'value_template_name' =>
$template['name'],
'lang_hour_id'
=> lang('Hour ID'),
'value_hour_id'
=> $hour_id,
'lang_copy_hour' =>
lang('Copy hour ?'),
'lang_copy_hour_statustext' => lang('Choose
Copy Hour to copy this hour to a new hour'),
'lang_activity_num'
=> lang('Activity code'),
'value_activity_num' =>
$values['activity_num'],
'value_activity_id'
=> $values['activity_id'],
'lang_unit'
=> lang('Unit'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_descr'
=> lang('description'),
'value_descr'
=> $values['hours_descr'],
'lang_descr_statustext' =>
lang('Enter the description for this activity'),
'error'
=> $receipt['error'],
'message'
=> $receipt['message'],
'lang_done_statustext' =>
lang('Back to the list'),
'lang_save_statustext' =>
lang('Save the building'),
'lang_remark'
=> lang('Remark'),
'value_remark'
=> $values['remark'],
'lang_remark_statustext' =>
lang('Enter addtional remarks to the description - if any'),
'lang_quantity'
=> lang('quantity'),
'value_quantity'
=> $values['quantity'],
'lang_quantity_statustext' =>
lang('Enter quantity of unit'),
'lang_billperae'
=> lang('Cost per unit'),
'value_billperae'
=> $values['billperae'],
'lang_billperae_statustext' =>
lang('Enter the cost per unit'),
'lang_total_cost'
=> lang('Total cost'),
'value_total_cost'
=> $values['cost'],
'lang_total_cost_statustext' => lang('Enter
the total cost of this activity - if not to be calculated from unit-cost'),
'lang_dim_d'
=> lang('Dim D'),
'dim_d_list'
=> $this->bopricebook->get_dim_d_list($values['dim_d']),
'select_dim_d'
=> 'values[dim_d]',
'lang_no_dim_d'
=> lang('No Dim D'),
'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
'lang_unit'
=> lang('Unit'),
'unit_list'
=> $this->bopricebook->get_unit_list($values['unit']),
'select_unit'
=> 'values[unit]',
'lang_no_unit'
=> lang('Select Unit'),
'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
'lang_chapter'
=> lang('chapter'),
'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$template['chapter_id']),
'select_chapter'
=> 'values[chapter_id]',
'lang_no_chapter'
=> lang('Select chapter'),
'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
'lang_tolerance'
=> lang('tolerance'),
'tolerance_list'
=> $this->bowo_hour->get_tolerance_list($values['tolerance_id']),
'select_tolerance'
=> 'values[tolerance_id]',
'lang_no_tolerance'
=> lang('Select tolerance'),
'lang_tolerance_statustext' =>
lang('Select the tolerance for this activity.'),
'lang_grouping'
=> lang('grouping'),
'grouping_list'
=> $this->bo->get_grouping_list($values['grouping_id'],$template_id),
'select_grouping'
=> 'values[grouping_id]',
'lang_no_grouping'
=> lang('Select grouping'),
'lang_grouping_statustext' =>
lang('Select the grouping for this activity.'),
'lang_new_grouping'
=> lang('New grouping'),
'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
'lang_building_part'
=> lang('building_part'),
'building_part_list'
=> $this->bowo_hour->get_building_part_list($values['building_part_id']),
'select_building_part'
=> 'values[building_part_id]',
'lang_no_building_part'
=> lang('Select building part'),
'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
'lang_ns3420'
=> lang('NS3420'),
'value_ns3420_id'
=> $values['ns3420_id'],
'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_hour' => $data));
}
function delete()
{
$id = get_var('id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitemplate.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($id);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_delete',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header'));
$data = array
(
'appname' =>
lang('property'),
'function_msg' => lang('delete
template'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
'lang_no_statustext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
}
?>
Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** class.bocommon.inc.php 1 Apr 2003 16:37:37 -0000 1.30
--- class.bocommon.inc.php 7 Apr 2003 07:21:56 -0000 1.31
***************
*** 608,612 ****
$menu['sub_workorder_request']=$GLOBALS['phpgw']->link('/property/list_request.php','sub=workorder');
$menu['sub_workorder_archive']=$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder&status=Avsluttet');
!
$menu['sub_workorder_template']=$GLOBALS['phpgw']->link('/property/list_wo_template.php','sub=workorder');
$menu['sub_workorder_project']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
$menu['sublang_workorder_project']=lang('Project');
--- 608,612 ----
$menu['sub_workorder_request']=$GLOBALS['phpgw']->link('/property/list_request.php','sub=workorder');
$menu['sub_workorder_archive']=$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder&status=Avsluttet');
!
$menu['sub_workorder_template']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
$menu['sub_workorder_project']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
$menu['sublang_workorder_project']=lang('Project');
Index: class.bowo_hour.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bowo_hour.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.bowo_hour.inc.php 4 Apr 2003 10:34:43 -0000 1.6
--- class.bowo_hour.inc.php 7 Apr 2003 07:21:56 -0000 1.7
***************
*** 229,269 ****
}
- function read_template()
- {
- $template = $this->so->read_template(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($template); $i++)
- {
- $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
- $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
- }
- //_debug_array($template);
-
-
- return $template;
- }
-
- function read_template_hour($template_id)
- {
- $template = $this->so->read_template_hour(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($template); $i++)
- {
- $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
- $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
- }
- //_debug_array($template);
-
-
- return $template;
- }
function add_template($values,$workorder_id)
--- 229,232 ----
Index: class.sowo_hour.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sowo_hour.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.sowo_hour.inc.php 4 Apr 2003 10:34:43 -0000 1.6
--- class.sowo_hour.inc.php 7 Apr 2003 07:21:56 -0000 1.7
***************
*** 134,297 ****
}
- function read_template($data)
- {
-
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $query =
(isset($data['query'])?$data['query']:'');
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $chapter_id =
(isset($data['chapter_id'])?$data['chapter_id']:0);
- $allrows =
(isset($data['allrows'])?$data['allrows']:'');
- $template_id =
(isset($data['template_id'])?$data['template_id']:0);
- }
-
- if ($order)
- {
- $ordermethod = " order by $order $sort";
- }
- else
- {
- $ordermethod = ' order by name';
- }
-
- $where = 'where';
- if ($chapter_id > 0)
- {
- $filtermethod .= " $where
chapter_id='$chapter_id' ";
- $where = 'and';
- }
- if($query)
- {
- $query = ereg_replace("'",'',$query);
- $query = ereg_replace('"','',$query);
-
- $querymethod = " $where (fm_wo_template.descr
LIKE '%$query%')";
- }
-
- $sql = "SELECT
fm_wo_template.id,fm_wo_template.descr,fm_wo_template.name,fm_wo_template.owner,fm_wo_template.entry_date,fm_wo_chapter.descr
as chapter FROM fm_wo_template $this->join fm_wo_chapter on
fm_wo_template.chapter_id=fm_wo_chapter.id $filtermethod $querymethod";
-
- $this->db2->query($sql,__LINE__,__FILE__);
- $this->total_records = $this->db2->num_rows();
-
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- while ($this->db->next_record())
- {
- $ngrants =
(int)$this->grants[$this->db->f('fm_wo_wrkorders.owner')];
- $template_list[] = array
- (
- 'template_id' =>
$this->db->f('id'),
- 'name' =>
stripslashes($this->db->f('name')),
- 'descr' =>
stripslashes($this->db->f('descr')),
- 'owner' =>
$this->db->f('owner'),
- 'entry_date' =>
$this->db->f('entry_date'),
- 'chapter' =>
$this->db->f('chapter'),
- 'grants' =>
$ngrants
- );
- }
- //_debug_array($template_list);
- return $template_list;
- }
-
-
- function read_template_hour($data)
- {
-
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $query =
(isset($data['query'])?$data['query']:'');
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $chapter_id =
(isset($data['chapter_id'])?$data['chapter_id']:0);
- $allrows =
(isset($data['allrows'])?$data['allrows']:'');
- $template_id =
(isset($data['template_id'])?$data['template_id']:0);
- }
-
- if ($order)
- {
- $ordermethod = " order by $order $sort";
- }
- else
- {
- $ordermethod = ' order by record ';
- }
-
-
- $filtermethod .= " where template_id='$template_id' ";
-
- if($query)
- {
- $query = ereg_replace("'",'',$query);
- $query = ereg_replace('"','',$query);
-
- $querymethod = " AND (hours_descr LIKE
'%$query%' or fm_wo_template_hours.remark LIKE '%$query%' or ns3420_id LIKE
'%$query%')";
- }
-
- $sql = "SELECT fm_wo_template_hours.*, chapter_id from
fm_wo_template_hours $this->join fm_wo_template on
fm_wo_template.id=fm_wo_template_hours.template_id $filtermethod $querymethod";
-
- $this->db2->query($sql,__LINE__,__FILE__);
- $this->total_records = $this->db2->num_rows();
-
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- while ($this->db->next_record())
- {
- $ngrants =
(int)$this->grants[$this->db->f('fm_wo_wrkorders.owner')];
- $hour_list[] = array
- (
- 'hour_id' =>
$this->db->f('id'),
- 'chapter_id' =>
$this->db->f('chapter_id'),
- 'activity_num' =>
$this->db->f('activity_num'),
- 'hours_descr' =>
stripslashes($this->db->f('hours_descr')),
- 'remark' =>
stripslashes($this->db->f('remark')),
- 'grouping_id' =>
$this->db->f('grouping_id'),
- 'grouping_descr' =>
$this->db->f('grouping_descr'),
- 'ns3420_id' =>
$this->db->f('ns3420_id'),
- 'tolerance' =>
$this->db->f('tolerance'),
- 'activity_id' =>
$this->db->f('activity_id'),
- 'unit' =>
$this->db->f('unit'),
- 'record' =>
$this->db->f('record'),
- 'cost' =>
$this->db->f('cost'),
- 'billperae' =>
$this->db->f('billperae'),
- 'building_part' =>
$this->db->f('building_part'),
- 'dim_d' =>
$this->db->f('dim_d'),
- 'grants' =>
$ngrants
- );
- }
- //_debug_array($hour_list);
- return $hour_list;
- }
-
function next_record($workorder_id)
{
--- 134,137 ----
Index: class.uistandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uistandard_entity.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uistandard_entity.inc.php 15 Feb 2003 19:51:39 -0000 1.6
--- class.uistandard_entity.inc.php 7 Apr 2003 07:21:56 -0000 1.7
***************
*** 63,69 ****
--- 63,71 ----
'standard_entity',
'nextmatchs',
+
'menu',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
//
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'nextmatchs'));
+ $links = $this->bocommon->menu();
$standard_list = $this->bo->read($type);
***************
*** 136,139 ****
--- 138,142 ----
$data = array
(
+ 'links'
=> $links,
'allow_allrows'
=> False,
'start_record'
=> $this->start,
Index: class.uiwo_hour.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiwo_hour.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.uiwo_hour.inc.php 4 Apr 2003 10:34:43 -0000 1.10
--- class.uiwo_hour.inc.php 7 Apr 2003 07:21:56 -0000 1.11
***************
*** 26,30 ****
'view' => True,
'template' => True,
- 'list_template' => True,
'save_template' => True,
--- 26,29 ----
***************
*** 48,51 ****
--- 47,51 ----
$this->boworkorder =
CreateObject($this->currentapp.'.boworkorder',True);
$this->boproject =
CreateObject($this->currentapp.'.boproject',True);
+ $this->botemplate =
CreateObject($this->currentapp.'.botemplate',True);
$this->bopricebook =
CreateObject($this->currentapp.'.bopricebook',True);
$this->soproperty =
CreateObject($this->currentapp.'.soproperty',True);
***************
*** 79,83 ****
'order' => $this->order,
'filter' => $this->filter,
! 'cat_id' => $this->cat_id
);
$this->bocommon->save_sessiondata($data);
--- 79,85 ----
'order' => $this->order,
'filter' => $this->filter,
! 'cat_id' => $this->cat_id,
! 'chapter_id' => $this->chapter_id,
! 'allrows' => $this->allrows
);
$this->bocommon->save_sessiondata($data);
***************
*** 294,298 ****
'lang_add_template'
=> lang('Add from template'),
'lang_add_template_statustext' =>
lang('add items from a predefined template'),
! 'add_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.list_template&workorder_id='
. $workorder_id),
'lang_add_custom'
=> lang('Add custom'),
--- 296,300 ----
'lang_add_template'
=> lang('Add from template'),
'lang_add_template_statustext' =>
lang('add items from a predefined template'),
! 'add_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&lookup=true&workorder_id='
. $workorder_id),
'lang_add_custom'
=> lang('Add custom'),
***************
*** 947,951 ****
$workorder = $common_data['workorder'];
! $template_list =
$this->bo->read_template_hour($template_id);
$i=0;
--- 949,953 ----
$workorder = $common_data['workorder'];
! $template_list =
$this->botemplate->read_template_hour($template_id);
$i=0;
***************
*** 1130,1275 ****
//_debug_array($data);
!
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('template' => $data));
! $this->save_sessiondata();
! }
!
! function list_template()
! {
! $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
!
'menu',
!
'nextmatchs',
!
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
!
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
!
! $workorder_id =
get_var('workorder_id',array('POST','GET'));
!
! $links = $this->bocommon->menu();
!
! $common_data=$this->common_data($workorder_id);
!
! $template_list = $this->bo->read_template();
!
! while (is_array($template_list) && list(,$template) =
each($template_list))
! {
! $content_template[] = array
! (
! 'workorder_id' =>
$workorder_id,
! 'template_id' =>
$template['template_id'],
! 'name'
=> $template['name'],
! 'descr'
=> $template['descr'],
! 'owner'
=> $template['owner'],
! 'entry_date' =>
$template['entry_date'],
! 'chapter'
=> $template['chapter'],
! 'lang_select' =>
lang('Select'),
! 'form_action_select' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.template'),
! 'lang_select_statustext' =>
lang('Select this template to view the details')
! );
!
! $i++;
! }
!
! $table_header_template[] = array
! (
!
! 'sort_template_id' =>
$this->nextmatchs->show_sort_order(array
!
(
!
'sort' => $this->sort,
!
'var' => 'fm_wo_template.id',
!
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.list_template',
!
'chapter_id'
=>$this->chapter_id,
!
'query'
=>$this->query,
!
'workorder_id'
=>$workorder_id,
!
'allrows'
=>$this->allrows)
!
)),
! 'lang_template_id' =>
lang('ID'),
! 'lang_name' => lang('Name'),
! 'sort_name' =>
$this->nextmatchs->show_sort_order(array
!
(
!
'sort' => $this->sort,
!
'var' => 'name',
!
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.list_template',
!
'chapter_id'
=>$this->chapter_id,
!
'query'
=>$this->query,
!
'workorder_id'
=>$workorder_id,
!
'allrows'
=>$this->allrows)
!
)),
! 'lang_name' => lang('Name'),
! 'lang_chapter' => lang('Chapter'),
! 'lang_owner' => lang('owner'),
! 'lang_entry_date' => lang('Entry Date'),
! 'lang_descr' => lang('Description'),
! 'lang_view' => lang('view'),
! 'lang_select' => lang('Select'),
! 'lang_edit' => lang('edit')
! );
!
! $link_data = array
! (
! 'menuaction' =>
$this->currentapp.'.uiwo_hour.list_template',
! 'sort'
=>$this->sort,
! 'order'
=>$this->order,
! 'chapter_id'
=>$this->chapter_id,
! 'workorder_id' =>$workorder_id,
! 'query'
=>$this->query
! );
!
! if(!$this->allrows)
! {
! $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
! }
! else
! {
! $record_limit = $this->bo->total_records;
! }
!
! $table_done[] = array
! (
! 'lang_done' =>
lang('Done'),
! 'lang_done_statustext' => lang('Back to list'),
! 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
! );
!
!
! $data = array
! (
! 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
! 'lang_add_statustext' =>
lang('Add the selected items'),
! 'lang_add'
=> lang('Add'),
! 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
!
! 'chapter_list'
=> $this->bo->get_chapter_list('filter',$this->chapter_id),
! 'select_chapter'
=> 'chapter_id',
! 'lang_no_chapter'
=> lang('Select chapter'),
! 'lang_chapter_statustext' =>
lang('Select the template-chapter'),
!
! 'function'
=> 'template',
! 'links'
=> $links,
! 'allrows'
=> $this->allrows,
! 'allow_allrows'
=> true,
! 'start_record'
=> $this->start,
! 'record_limit'
=> $record_limit,
! 'num_records'
=> count($template_list),
! 'all_records'
=> $this->bo->total_records,
! 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
! 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
! 'appname'
=> lang($this->currentapp),
! 'function_msg'
=> lang('list template'),
! 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
!
! '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'),
! 'workorder_data'
=> $common_data['workorder_data'],
! 'table_header_template' =>
$table_header_template,
! 'values_template'
=> $content_template,
! 'table_done'
=> $table_done
!
! );
! //_debug_array($data);
!
!
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template' => $data));
$this->save_sessiondata();
}
--- 1132,1136 ----
//_debug_array($data);
!
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
$this->save_sessiondata();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.botemplate.inc.php,NONE,1.1 class.sotemplate.inc.php,NONE,1.1 class.uitemplate.inc.php,NONE,1.1 class.bocommon.inc.php,1.30,1.31 class.bowo_hour.inc.php,1.6,1.7 class.sowo_hour.inc.php,1.6,1.7class.uistandard_entity.inc.php,1.6,1.7 class.uiwo_hour.inc.php,1.10,1.11,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/templates/default menu.xsl,1.6,1.7 project.xsl,1.4,1.5 standard_entity.xsl,1.6,1.7wo_hour.xsl,1.9,1.10
- Next by Date:
[Phpgroupware-cvs] CVS: property/templates/default pricebook.xsl,1.5,1.6 tts.xsl,1.4,1.5
- Previous by thread:
[Phpgroupware-cvs] CVS: property/templates/default menu.xsl,1.6,1.7 project.xsl,1.4,1.5 standard_entity.xsl,1.6,1.7wo_hour.xsl,1.9,1.10
- Next by thread:
[Phpgroupware-cvs] CVS: property/templates/default pricebook.xsl,1.5,1.6 tts.xsl,1.4,1.5
- Index(es):