[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc class.sotenant_claim.inc.php, 1.1 class.
From: |
sigurdne |
Subject: |
[Phpgroupware-cvs] property/inc class.sotenant_claim.inc.php, 1.1 class.botenant_claim.inc.php, 1.1 class.uitenant_claim.inc.php, 1.1 |
Date: |
Tue, 12 Apr 2005 16:12:00 +0200 |
Update of property/inc
Added Files:
Branch: MAIN
class.sotenant_claim.inc.php
class.botenant_claim.inc.php
class.uitenant_claim.inc.php
Log Message:
no message
====================================================
Index: class.sotenant_claim.inc.php
<?php
/**
* phpGroupWare - property
* address@hidden http://www.phpgroupware.org}
*
* Property: a Facilities Management System.
*
* Copyright 2000 - 2003 Free Software Foundation, Inc
* This program is part of the GNU project, see address@hidden
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.
*
* To contact the author write to address@hidden mailto:address@hidden
Sigurd Nes}
* @author Sigurd Nes
* @package property
* @subpackage project
* @version $Id: class.sotenant_claim.inc.php,v 1.1 2005/04/12 14:12:20
sigurdne Exp $
*/
/**
* Description
* @package property
*/
class sotenant_claim
{
function sotenant_claim()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->join = $this->bocommon->join;
}
function select_category_list()
{
$this->db->query("SELECT id,descr FROM
fm_tenant_claim_category ORDER BY descr ");
$i = 0;
while ($this->db->next_record())
{
$categories[$i]['id'] =
$this->db->f('id');
$categories[$i]['name'] =
stripslashes($this->db->f('descr'));
$i++;
}
return $categories;
}
function read_category_name($cat_id)
{
$this->db->query("SELECT descr FROM
fm_tenant_claim_category where id='$cat_id'");
$this->db->next_record();
return $this->db->f('descr');
}
function read($data)
{
if(is_array($data))
{
$start =
(isset($data['start'])?$data['start']:0);
$filter =
(isset($data['filter'])?$data['filter']:'none');
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id DESC';
}
$where = 'WHERE';
if ($cat_id > 0)
{
$filtermethod .= " $where category='$cat_id' ";
$where = 'AND';
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " $where ( abid = '$query' or
org_name LIKE '%$query%')";
}
$sql = "SELECT fm_tenant_claim.*, descr as category
FROM fm_tenant_claim $this->join fm_tenant_claim_category on
fm_tenant_claim.category=fm_tenant_claim_category.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())
{
$claims[] = array
(
'claim_id' =>
$this->db->f('id'),
'tenant_id' =>
$this->db->f('tenant_id'),
'remark' =>
stripslashes($this->db->f('remark')),
'entry_date' =>
$this->db->f('entry_date'),
'category' =>
$this->db->f('category')
);
}
return $claims;
}
function read_single($id)
{
$this->db->query("select * from fm_tenant_claim where
id='$id'",__LINE__,__FILE__);
if ($this->db->next_record())
{
$claim['id'] = $id;
$claim['project_id'] =
$this->db->f('project_id');
$claim['tenant_id'] =
$this->db->f('tenant_id');
$claim['remark'] =
stripslashes($this->db->f('remark'));
$claim['entry_date'] =
$this->db->f('entry_date');
$claim['cat_id'] =
(int)$this->db->f('category');
$claim['amount'] =
$this->db->f('amount');
$claim['b_account_id'] =
$this->db->f('b_account_id');
$claim['cat_id'] =
(int)$this->db->f('category');
}
$this->db->query("select * from fm_origin WHERE
destination ='tenant_claim' AND destination_id='$id'",__LINE__,__FILE__);
while ($this->db->next_record())
{
$claim['workorder_id'][] =
$this->db->f('origin_id');
}
return $claim;
}
function add($claim)
{
//_debug_array($claim);
$this->db->transaction_begin();
$claim['name'] =
$this->db->db_addslashes($claim['name']);
$values_insert= array(
$claim['project_id'],
$claim['tenant_id'],
$claim['amount'],
$claim['b_account_id'],
$claim['cat_id'],
$claim['remark'],
$this->account,
time()
);
$values_insert =
$this->bocommon->validate_db_insert($values_insert);
$this->db->query("INSERT INTO fm_tenant_claim
(project_id,tenant_id,amount,b_account_id,category,remark,user_id,entry_date) "
. "VALUES ($values_insert)",__LINE__,__FILE__);
$claim_id =
$this->db->get_last_insert_id('fm_tenant_claim','id');
$receipt['claim_id'] = $claim_id;
foreach ($claim['workorder_id'] as $workorder_id)
{
$this->db->query("INSERT INTO fm_origin
(origin,origin_id,destination,destination_id,entry_date,user_id) "
. "VALUES ('workorder',"
. $workorder_id .","
. "'tenant_claim',"
. $claim_id . ","
. time().","
. $this->account .")",__LINE__,__FILE__);
$this->db->query("UPDATE fm_workorder set
claim_id = $claim_id WHERE id=$workorder_id" ,__LINE__,__FILE__);
}
$this->db->transaction_commit();
$receipt['message'][] = array('msg'=>lang('claim %1 has
been saved',$claim_id));
return $receipt;
}
function edit($claim)
{
$this->db->transaction_begin();
$claim['name'] =
$this->db->db_addslashes($claim['name']);
$value_set=array(
'amount' =>
$claim['amount'],
'tenant_id' =>
$claim['tenant_id'],
'b_account_id' =>
$claim['b_account_id'],
'amount' =>
$claim['amount'],
'category' =>
$claim['cat_id'],
'user_id' =>
$this->account,
'remark' =>
$this->db->db_addslashes($claim['remark'])
);
$value_set =
$this->bocommon->validate_db_update($value_set);
$this->db->query("UPDATE fm_tenant_claim set $value_set
WHERE id=" . intval($claim['claim_id']),__LINE__,__FILE__);
$claim_id = $claim['claim_id'];
$this->db->query("DELETE FROM fm_origin WHERE
destination ='tenant_claim' AND destination_id=$claim_id",__LINE__,__FILE__);
$this->db->query("UPDATE fm_workorder set claim_id =
NULL WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);
foreach ($claim['workorder_id'] as $workorder_id)
{
$this->db->query("INSERT INTO fm_origin
(origin,origin_id,destination,destination_id,entry_date,user_id) "
. "VALUES ('workorder',"
. $workorder_id .","
. "'tenant_claim',"
. $claim_id . ","
. time().","
. $this->account .")",__LINE__,__FILE__);
$this->db->query("UPDATE fm_workorder set
claim_id = $claim_id WHERE id=$workorder_id" ,__LINE__,__FILE__);
}
$this->db->transaction_commit();
$receipt['claim_id']= $claim['claim_id'];
$receipt['message'][] = array('msg'=>lang('claim %1 has
been edited',$claim['claim_id']));
return $receipt;
}
function delete($id)
{
$this->db->transaction_begin();
$this->db->query('DELETE FROM fm_tenant_claim WHERE
id=' . intval($id),__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_origin WHERE
destination ='tenant_claim' AND destination_id=$id",__LINE__,__FILE__);
$this->db->transaction_commit();
}
}
?>
====================================================
Index: class.botenant_claim.inc.php
<?php
/**
* phpGroupWare - property
* address@hidden http://www.phpgroupware.org}
*
* Property: a Facilities Management System.
*
* Copyright 2000 - 2003 Free Software Foundation, Inc
* This program is part of the GNU project, see address@hidden
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.
*
* To contact the author write to address@hidden mailto:address@hidden
Sigurd Nes}
* @author Sigurd Nes
* @package property
* @subpackage project
* @version $Id: class.botenant_claim.inc.php,v 1.1 2005/04/12 14:12:20
sigurdne Exp $
*/
/**
* Description
* @package property
*/
class botenant_claim
{
var $start;
var $query;
var $filter;
var $sort;
var $order;
var $cat_id;
function botenant_claim($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sotenant_claim');
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'));
$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) && !empty($cat_id))
{
$this->cat_id = $cat_id;
}
else
{
unset($this->cat_id);
}
if(isset($allrows))
{
$this->allrows = $allrows;
}
}
function save_sessiondata($data)
{
if ($this->use_session)
{
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim');
$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'];
}
function check_perms($has, $needed)
{
return (!!($has & $needed) == True);
}
function read_category_name($cat_id='')
{
return $this->so->read_category_name($cat_id);
}
function select_category_list($format='',$selected='')
{
switch($format)
{
case 'select':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
break;
case 'filter':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
break;
}
$categories= $this->so->select_category_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()
{
$claim = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
$this->total_records = $this->so->total_records;
for ($i=0; $i<count($claim); $i++)
{
$claim[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($claim[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
return $claim;
}
function read_single($claim_id)
{
return $this->so->read_single($claim_id);
}
function save($claim)
{
if ($claim['claim_id'])
{
if ($claim['claim_id'] != 0)
{
$claim_id = $claim['claim_id'];
$receipt=$this->so->edit($claim);
}
}
else
{
$receipt = $this->so->add($claim);
}
return $receipt;
}
function delete($params)
{
if (is_array($params))
{
$this->so->delete($params[0]);
}
else
{
$this->so->delete($params);
}
}
}
?>
====================================================
Index: class.uitenant_claim.inc.php
<?php
/**
* phpGroupWare - property
* address@hidden http://www.phpgroupware.org}
*
* Property: a Facilities Management System.
*
* Copyright 2000 - 2003 Free Software Foundation, Inc
* This program is part of the GNU project, see address@hidden
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.
*
* To contact the author write to address@hidden mailto:address@hidden
Sigurd Nes}
* @author Sigurd Nes
* @package property
* @subpackage project
* @version $Id: class.uitenant_claim.inc.php,v 1.1 2005/04/12 14:12:20
sigurdne Exp $
*/
/**
* Description
* @package property
*/
class uitenant_claim
{
var $grants;
var $cat_id;
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $public_functions = array
(
'index' => True,
'view' => True,
'edit' => True,
'delete' => True
);
function uitenant_claim()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bo =
CreateObject($this->currentapp.'.botenant_claim',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->menu =
CreateObject($this->currentapp.'.menu');
$this->acl2 =
CreateObject($this->currentapp.'.acl2');
$this->acl2_location= '.tenant_claim';
$this->acl_read =
$this->acl2->check($this->acl2_location,1);
$this->acl_add =
$this->acl2->check($this->acl2_location,2);
$this->acl_edit =
$this->acl2->check($this->acl2_location,4);
$this->acl_delete =
$this->acl2->check($this->acl2_location,8);
$this->acl_manage =
$this->acl2->check($this->acl2_location,16);
$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->allrows = $this->bo->allrows;
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id,
'this->allrows' => $this->allrows
);
$this->bo->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim',
'menu',
'receipt',
'search_field',
'nextmatchs'));
if(!$this->acl_read)
{
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
}
$this->menu->sub = 'project';
$links = $this->menu->links('tenant_claim');
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt','');
$claim_list = $this->bo->read();
while (is_array($claim_list) && list(,$claim) =
each($claim_list))
{
if($claim['tenant_id'])
{
$tenant=
$this->bocommon->read_single_tenant($claim['tenant_id']);
$name = $tenant['last_name'] . ', ' .
$tenant['first_name'];
}
$content[] = array
(
'claim_id'
=> $claim['claim_id'],
'name'
=> $name,
'entry_date'
=> $claim['entry_date'],
'category'
=> $claim['category'],
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.view&claim_id='
. $claim['claim_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&claim_id='
. $claim['claim_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim['claim_id']),
'lang_view_statustext' =>
lang('view the claim'),
'lang_edit_statustext' =>
lang('edit the claim'),
'lang_delete_statustext' =>
lang('delete the claim'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
unset ($tenant);
unset ($name);
}
$table_header = array
(
'lang_name' => lang('name'),
'lang_time_created' => lang('time created'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'lang_claim_id' => lang('claim id'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'org_name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
'cat_id' =>
$this->cat_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'sort_claim_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'claim_id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
'cat_id' =>
$this->cat_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'sort_time_created' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'entry_date',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
'cat_id'
=>$this->cat_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'sort_category' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'descr',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
'cat_id'
=>$this->cat_id,
'query'
=>$this->query,
'allrows'
=>$this->allrows)
)),
'lang_category' => lang('category')
);
$table_add = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a claim'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitenant_claim.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'cat_id'
=>$this->cat_id,
'filter'
=>$this->filter,
'query'
=>$this->query
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'links'
=> $links,
'allow_allrows'
=> true,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($claims_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','default'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
'select_name'
=> 'cat_id',
'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_add'
=> $table_add
);
$this->save_sessiondata();
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . lang('list claim');
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$GLOBALS['phpgw']->xslttpl->pp();
}
function edit()
{
$claim_id =
get_var('claim_id',array('POST','GET'));
$values = get_var('values',array('POST'));
$values['project_id'] =
get_var('project_id',array('POST','GET'));
$values['b_account_id'] =
get_var('b_account_id',array('POST'));
$values['b_account_name'] =
get_var('b_account_name',array('POST'));
$values['tenant_id'] =
get_var('tenant_id',array('POST'));
$values['last_name'] =
get_var('last_name',array('POST'));
$values['first_name'] =
get_var('first_name',array('POST'));
$this->boproject=
CreateObject($this->currentapp.'.boproject');
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
if ($values['save'] || $values['apply'])
{
if(!$values['cat_id'])
{
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
}
if(!$values['b_account_id'])
{
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
}
if(!$values['workorder_id'])
{
$receipt['error'][]=array('msg'=>lang('Please select a workorder !'));
}
if(!$receipt['error'])
{
$values['claim_id'] = $claim_id;
$receipt = $this->bo->save($values);
$claim_id = $receipt['claim_id'];
$this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
if ($values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
}
}
}
if ($values['cancel'])
{
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
}
if ($claim_id)
{
$values = $this->bo->read_single($claim_id);
}
//_debug_array($values);
$project_values =
$this->boproject->read_single($values['project_id']);
$table_header_workorder[] = array
(
'lang_workorder_id' => lang('Workorder'),
'lang_budget' => lang('Budget'),
'lang_calculation' => lang('Calculation'),
'lang_vendor' => lang('Vendor'),
'lang_select' => lang('Select')
);
$bolocation =
CreateObject($this->currentapp.'.bolocation');
$location_data=$bolocation->initiate_ui_location(array(
'values' =>
$project_values['location_data'],
'type_id' =>
count(explode('-',$project_values['location_data']['location_code'])),
'no_link' =>
False, // disable lookup links for location type less than type_id
'tenant' =>
$project_values['location_data']['tenant_id'],
'lookup_type' => 'view',
'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
'entity_data' =>
$project_values['p']
));
if($project_values['contact_phone'])
{
for
($i=0;$i<count($location_data['location']);$i++)
{
if($location_data['location'][$i]['input_name'] == 'contact_phone')
{
unset($location_data['location'][$i]['value']);
}
}
}
if($project_values['location_data']['tenant_id'] &&
!$values['tenant_id']):
{
$values['tenant_id'] =
$project_values['location_data']['tenant_id'];
$values['last_name'] =
$project_values['location_data']['last_name'];
$values['first_name'] =
$project_values['location_data']['first_name'];
}
elseif($values['tenant_id']):
{
$tenant=
$this->bocommon->read_single_tenant($values['tenant_id']);
$values['last_name'] =
$tenant['last_name'];
$values['first_name'] =
$tenant['first_name'];
}
endif;
if($values['workorder_id'] &&
$project_values['workorder_budget'])
{
foreach ($values['workorder_id'] as
$workorder_id)
{
for
($i=0;$i<count($project_values['workorder_budget']);$i++)
{
if($project_values['workorder_budget'][$i]['workorder_id'] == $workorder_id)
{
$project_values['workorder_budget'][$i]['selected'] = True;
}
}
}
}
$this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
'b_account_id' =>
$values['b_account_id'],
'b_account_name' =>
$values['b_account_name']));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitenant_claim.edit',
'claim_id' => $claim_id,
'project_id' => $values['project_id']
);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'table_header_workorder' =>
$table_header_workorder,
'lang_no_workorders' =>
lang('No workorder bugdet'),
'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
'lang_start_date'
=> lang('Project start date'),
'value_start_date'
=> $project_values['start_date'],
'lang_end_date'
=> lang('Project end date'),
'value_end_date'
=> $project_values['end_date'],
'lang_charge_tenant' =>
lang('Charge tenant'),
'charge_tenant'
=> $project_values['charge_tenant'],
'lang_power_meter'
=> lang('Power meter'),
'value_power_meter'
=> $project_values['power_meter'],
'lang_budget'
=> lang('Budget'),
'value_budget'
=> $project_values['budget'],
'lang_reserve'
=> lang('reserve'),
'value_reserve'
=> $project_values['reserve'],
'lang_reserve_statustext' =>
lang('Enter the reserve'),
'lang_reserve_remainder' =>
lang('reserve remainder'),
'value_reserve_remainder' =>
$reserve_remainder,
'value_reserve_remainder_percent'=>
$remainder_percent,
'vendor_data'
=> $vendor_data,
'location_data'
=> $location_data,
'location_type'
=> 'view',
'lang_project_id'
=> lang('Project ID'),
'value_project_id'
=> $project_values['project_id'],
'lang_name'
=> lang('Name'),
'value_name'
=> $project_values['name'],
'lang_descr'
=> lang('Description'),
'sum_workorder_budget' =>
$project_values['sum_workorder_budget'],
'sum_workorder_calculation' =>
$project_values['sum_workorder_calculation'],
'workorder_budget'
=> $project_values['workorder_budget'],
'sum_workorder_actual_cost' =>
$project_values['sum_workorder_actual_cost'],
'lang_actual_cost'
=> lang('Actual cost'),
'lang_coordinator'
=> lang('Coordinator'),
'lang_sum'
=> lang('Sum'),
'select_user_name'
=> 'project_values[coordinator]',
'lang_no_user'
=> lang('Select coordinator'),
'user_list'
=>
$this->bocommon->get_user_list('select',$project_values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
'status_list'
=> $this->boproject->select_status_list('select',$project_values['status']),
'lang_no_status'
=> lang('Select status'),
'lang_status'
=> lang('Status'),
'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
'lang_contact_phone' =>
lang('Contact phone'),
'contact_phone'
=> $project_values['contact_phone'],
'b_account_data'
=> $b_account_data,
'lang_select_workorder_statustext' =>
lang('Include the workorder to this claim'),
'cat_list_project'
=>
$this->boproject->select_category_project_list('select',$project_values['cat_id']),
//------------------
'lang_amount'
=> lang('amount'),
'lang_amount_statustext' =>
lang('The total amount to claim'),
'value_amount'
=> $values['amount'],
'tenant_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
'lang_tenant'
=> lang('tenant'),
'value_tenant_id'
=> $values['tenant_id'],
'value_last_name'
=> $values['last_name'],
'value_first_name'
=> $values['first_name'],
'lang_tenant_statustext' =>
lang('Select a tenant'),
'size_last_name'
=> strlen($values['last_name']),
'size_first_name'
=> strlen($values['first_name']),
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_claim_id'
=> lang('ID'),
'value_claim_id'
=> $claim_id,
'lang_remark'
=> lang('remark'),
'lang_category'
=> lang('category'),
'lang_save'
=> lang('save'),
'lang_cancel'
=> lang('cancel'),
'lang_apply'
=> lang('apply'),
'value_remark'
=> $values['remark'],
'value_cat'
=> $values['cat'],
'lang_remark_statustext' =>
lang('Enter a remark for this claim'),
'lang_apply_statustext' =>
lang('Apply the values'),
'lang_cancel_statustext' =>
lang('Leave the claim untouched and return back to the list'),
'lang_save_statustext' =>
lang('Save the claim and return back to the list'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
'select_name'
=> 'values[cat_id]',
'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id)
);
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
$GLOBALS['phpgw']->xslttpl->pp();
}
function delete()
{
$claim_id =
get_var('claim_id',array('POST','GET'));
$delete = get_var('delete',array('POST'));
$confirm = get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uitenant_claim.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($claim_id);
// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim_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')
);
$appname
= lang('Tenant claim');
$function_msg =
lang('delete claim');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
$GLOBALS['phpgw']->xslttpl->pp();
}
function view()
{
$claim_id = get_var('claim_id',array('GET'));
$action = get_var('action',array('GET'));
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . lang('view claim');
$GLOBALS['phpgw']->xslttpl->add_file('tenant_claim');
$claim = $this->bo->read_single($claim_id);
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index'),
'lang_name' => lang('name'),
'lang_category' => lang('category'),
'lang_time_created' => lang('time created'),
'lang_done' => lang('done'),
'value_name' =>
$tenant_claim['name'],
'value_cat' =>
$this->bo->read_category_name($tenant_claim['cat_id']),
'value_date' =>
$GLOBALS['phpgw']->common->show_date($tenant_claim['entry_date'])
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
$GLOBALS['phpgw']->xslttpl->pp();
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc class.sotenant_claim.inc.php, 1.1 class.botenant_claim.inc.php, 1.1 class.uitenant_claim.inc.php, 1.1,
sigurdne <=