[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.bopricebook.inc.php,NONE,1.1
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.bopricebook.inc.php,NONE,1.1 class.sopricebook.inc.php,NONE,1.1 class.uipricebook.inc.php,NONE,1.1 class.bocommon.inc.php,1.20,1.21 class.boinvestment.inc.php,1.5,1.6class.boinvoice.inc.php,1.10,1.11 class.uiinvestment.inc.php,1.9,1.10class.uiinvoice.inc.php,1.12,1.13 |
Date: |
Fri, 28 Feb 2003 14:39:03 -0500 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv27933/inc
Modified Files:
class.bocommon.inc.php class.boinvestment.inc.php
class.boinvoice.inc.php class.uiinvestment.inc.php
class.uiinvoice.inc.php
Added Files:
class.bopricebook.inc.php class.sopricebook.inc.php
class.uipricebook.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 bopricebook
{
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
);
var $soap_functions = array(
'list' => array(
'in' =>
array('int','int','struct','string','int'),
'out' => array('array')
),
'read' => array(
'in' => array('int','struct'),
'out' => array('array')
),
'save' => array(
'in' => array('int','struct'),
'out' => array()
),
'delete' => array(
'in' => array('int','struct'),
'out' => array()
)
);
function bopricebook($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sopricebook');
$this->socommon =
CreateObject($this->currentapp.'.socommon');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$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()
{
$pricebook = $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($pricebook); $i++)
{
$pricebook[$i]['date'] =
$GLOBALS['phpgw']->common->show_date($pricebook[$i]['date']);
$pricebook[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($pricebook[$i]['owner']);
}
return $pricebook;
}
function read_single($property_id,$building_id)
{
return
$this->so->read_single($property_id,$building_id);
}
function read_category_name($cat_id)
{
return $this->so->read_category_name($cat_id);
}
function update_pricebook($values)
{
$date_array=$this->bocommon->date_array($values['date']);
$date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
$date= date($this->bocommon->dateformat,$date);
$new_index=str_replace(",",".",$values['new_index']);
while($entry=each($values['update']))
{
$n=$entry[0];
if(!$values['old_total_cost'][$n])
{
$new_total_cost=($values['old_m_cost'][$n]+$values['old_w_cost'][$n])*$values['new_index'];
}
else
{
$new_total_cost=$values['old_total_cost'][$n]*$values['new_index'];
}
if(!$values['old_m_cost'][$n])
{
$new_m_cost=0;
}
else
{
$new_m_cost=$values['old_m_cost'][$n]*$values['new_index'];
}
if(!$values['old_w_cost'][$n])
{
$new_w_cost=0;
}
else
{
$new_w_cost=$values['old_w_cost'][$n]*$values['new_index'];
}
$update[]=array(
'new_m_cost' => $new_m_cost,
'new_w_cost' => $new_w_cost,
'new_total_cost' =>
$new_total_cost,
'activity_id' =>
$values['activity_id'][$n],
'vendor_id' =>
$values['vendor_id'][$n],
'new_index' =>
$values['new_index'],
'new_date' =>
$date,
);
}
//_debug_array($update);
if($update)
{
$this->so->update_pricebook($update);
}
}
function get_vendor_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;
}
$vendors= $this->so->get_vendor_list();
while (is_array($vendors) && list(,$vendor_entry) =
each($vendors))
{
$sel_vendor_entry = '';
if ($vendor_entry['id']==$selected)
{
$sel_vendor_entry = 'selected';
}
$vendor_list[] = array
(
'cat_id' => $vendor_entry['id'],
'name' =>
$vendor_entry['name'],
'selected' => $sel_vendor_entry
);
}
for ($i=0;$i<count($vendor_list);$i++)
{
if ($vendor_list[$i]['selected'] != 'selected')
{
unset($vendor_list[$i]['selected']);
}
}
return $vendor_list;
}
function save($building,$action='')
{
if ($building['access'])
{
$building['access'] = 'private';
}
else
{
$building['access'] = 'public';
}
if ($action=='edit')
{
if
($this->socommon->check_building($building['property_id'],$building['building_id']))
{
$receipt = $this->so->edit($building);
}
else
{
$receipt['error'][]=array('msg'=>lang('This building_id ID does not exist!'));
}
}
else
{
if(!$this->socommon->check_property($building['property_id']))
{
$receipt['error'][]=array('msg'=>lang('This property ID does not exist!'));
}
if(!$receipt['error'])
{
$building['location_code']=$this->bocommon->location_code($building['property_id'],$building['building_id']);
$receipt = $this->so->add($building);
}
}
return $receipt;
}
function delete($property_id,$building_id)
{
$this->so->delete($property_id,$building_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 sopricebook
{
var $grants;
function sopricebook()
{
$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 update_pricebook($update)
{
for ($i=0; $i<count($update); $i++)
{
$this->db->query("select max(index_count) as
max_index_count from fm_wo_activity_price_index Where activity_id='".
$update[$i]['activity_id'] . "' and vendor_id='".$update[$i]['vendor_id'] .
"'",__LINE__,__FILE__);
$this->db->next_record();
$next_index_count =
$this->db->f('max_index_count')+1;
$this->db->query("update
fm_wo_activity_price_index set current_index = Null"
. " WHERE activity_id='" .
$update[$i]['activity_id'] . "' and vendor_id='" . $update[$i]['vendor_id'] .
"'",__LINE__,__FILE__);
$this->db->query("insert into
fm_wo_activity_price_index (activity_id, vendor_id, index_count, this_index,
m_cost, w_cost, total_cost, date,current_index) "
. " values ('" .
$update[$i]['activity_id'] . "','" .
$update[$i]['vendor_id'] . "','" .
$next_index_count . "','" .
$update[$i]['new_index'] . "','" .
$update[$i]['new_m_cost'] . "','" .
$update[$i]['new_w_cost'] . "','" .
$update[$i]['new_total_cost'] . "','" .
$update[$i]['new_date']. "',
'1')",__LINE__,__FILE__);
}
}
function get_vendor_list()
{
$this->db->query("SELECT phpgw_addressbook.org_name
,vendor_id "
. " FROM (fm_wo_activities $this->join
fm_wo_activity_price_index ON fm_wo_activities.id =
fm_wo_activity_price_index.activity_id) $this->join phpgw_addressbook ON
fm_wo_activity_price_index.vendor_id = phpgw_addressbook.id "
. " GROUP by org_name ,vendor_id "
. " ORDER BY phpgw_addressbook.org_name ");
while ($this->db->next_record())
{
$vendor_list[]=array
(
'id' =>
$this->db->f('vendor_id'),
'name' =>
$this->db->f('org_name'),
);
}
return $vendor_list;
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$filter =
(isset($data['filter'])?$data['filter']:'none');
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by
phpgw_addressbook.org_name,activity_id';
}
if ($cat_id > 0)
{
$filtermethod .= " AND cat_id='$cat_id' ";
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND (fm_wo_activities.descr
LIKE '%$query%' or fm_wo_activities.num LIKE '%$query%')";
}
$sql = "SELECT * FROM fm_building WHERE $filtermethod
$querymethod";
$sql = "SELECT
fm_wo_activities.num,fm_wo_activities.unit,fm_wo_activities.descr as
descr,activity_id, phpgw_addressbook.org_name,fm_wo_branch.descr as branch
,vendor_id,total_cost,m_cost,w_cost,index_count,fm_wo_activity_price_index.this_index
"
. " FROM (fm_wo_activities $this->join
fm_wo_activity_price_index ON fm_wo_activities.id =
fm_wo_activity_price_index.activity_id) $this->join phpgw_addressbook ON
fm_wo_activity_price_index.vendor_id = phpgw_addressbook.id "
. " $this->join fm_wo_branch ON
fm_wo_activities.branch_id = fm_wo_branch.id "
. " WHERE vendor_id='$cat_id' and current_index
is not null "
. " OR (fm_wo_activity_price_index.vendor_id =
'$cat_id') AND (fm_wo_activity_price_index.this_index IS NULL)";
$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('building_owner')];
$pricebook[] = array
(
'activity_id' =>
$this->db->f('activity_id'),
'num' =>
$this->db->f('num'),
'branch' =>
$this->db->f('branch'),
'vendor_id' =>
$this->db->f('vendor_id'),
'm_cost' =>
$this->db->f('m_cost'),
'w_cost' =>
$this->db->f('w_cost'),
'total_cost' =>
$this->db->f('total_cost'),
'this_index' =>
$this->db->f('this_index'),
'unit' =>
$this->db->f('unit'),
'descr' =>
stripslashes($this->db->f('descr')),
'index_count' =>
$this->db->f('index_count'),
'grants' =>
$ngrants
);
}
// _debug_array($pricebook);
return $pricebook;
}
function read_single($property_id,$building_id)
{
$sql = "SELECT * FROM fm_building where
property_id='$property_id' and building_id='$building_id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$building['property_id'] =
$this->db->f('property_id');
$building['building_id'] =
$this->db->f('building_id');
$building['owner']
= $this->db->f('owner');
$building['name']
= stripslashes($this->db->f('building_name'));
$building['general_address'] =
stripslashes($this->db->f('general_address'));
$building['access']
= $this->db->f('access');
$building['date']
= $this->db->f('entry_date');
$building['cat_id']
= (int)$this->db->f('cat_id');
$building['location_code'] =
$this->db->f('location_code');
$building['remark']
= $this->db->f('remark');
return $building;
}
}
function add($building)
{
$building['remark'] =
$this->db->db_addslashes($building['remark']);
$this->db->query("INSERT INTO fm_building
(location_code,
property_id,building_id,owner,access,entry_date,building_name,general_address,cat_id,remark)
"
. "VALUES ('" . $building['location_code'].
"','" . $building['property_id'] . "','" . $building['building_id'] . "','" .
$this->account . "','" . $building['access'] . "','" . time() . "','" .
$building['name']
. "','" . $building['general_address'] ."','" .
$building['cat_id'] ."','" . $building['remark']. "')",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>lang('Building has
been saved'));
return $receipt;
}
function edit($building)
{
$building['remark'] =
$this->db->db_addslashes($building['remark']);
$this->db->query("UPDATE fm_building set
building_name='" . $building['name'] . "', entry_date='" . time()
. "', cat_id='" .
$building['cat_id'] . "', general_address='" . $building['general_address'] .
"', access='" . $building['access'] . "', remark='" . $building['remark']
. "' WHERE property_id= '" .
$building['property_id']
. "' AND building_id=" .
$building['building_id'],__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>lang('Building has
been edited'));
return $receipt;
}
function delete($property_id,$building_id )
{
$this->db->query("DELETE FROM fm_building WHERE
property_id='" . $property_id . "' and building_id='" . $building_id
."'",__LINE__,__FILE__);
}
}
?>
--- 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 uipricebook
{
var $grants;
var $cat_id;
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $part_of_town_id;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'view' => True,
'edit' => True,
'delete' => True
);
function uipricebook()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->cats =
CreateObject('phpgwapi.categories');
$this->cats->app_name = 'p_building';
$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.'.bopricebook',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
$this->socommon =
CreateObject($this->currentapp.'.socommon',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->allrows =
$this->bo->allrows;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'pricebook');
}
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->bocommon->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
'menu',
'nextmatchs',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'filter_select',
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'search_field'));
$links = $this->bocommon->menu();
$values =
get_var('values',array('POST'));
$values['date'] = get_var('date',array('POST'));
//_debug_array($values);
if($values['submit_update'])
{
$receipt=$this->bo->update_pricebook($values);
}
$pricebook_list = $this->bo->read();
$i=0;
while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
{
$content[] = array
(
'counter'
=> $i,
'activity_id' =>
$pricebook['activity_id'],
'num'
=> $pricebook['num'],
'branch'
=> $pricebook['branch'],
'vendor_id'
=> $pricebook['vendor_id'],
'm_cost'
=> $pricebook['m_cost'],
'w_cost'
=> $pricebook['w_cost'],
'total_cost' =>
$pricebook['total_cost'],
'this_index' =>
$pricebook['this_index'],
'unit'
=> $pricebook['unit'],
'descr'
=> $pricebook['descr'],
'index_count' =>
$pricebook['index_count'],
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.view&property_id='
. $pricebook['property_id'].'&pricebook_id=' . $pricebook['building_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit&property_id='
. $pricebook['property_id'].'&pricebook_id=' . $pricebook['building_id']),
'link_prizing'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&property_id='
. $pricebook['property_id'].'&pricebook_id=' . $pricebook['building_id']),
'lang_view_statustext' =>
lang('view the pricebook'),
'lang_edit_statustext' =>
lang('edit the pricebook'),
'lang_prizing_statustext' =>
lang('view or edit prizing history of this element'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_prizing'
=> lang('prizing')
);
$i++;
}
$table_header[] = array
(
'sort_num' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'num',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
'cat_id'
=>$this->cat_id)
)),
'lang_index_count' => lang('Index Count'),
'lang_num' =>
lang('Activity Num'),
'lang_branch' => lang('Branch'),
'lang_vendor' => lang('Vendor'),
'lang_select' => lang('Select'),
'lang_total_cost' => lang('Total Cost'),
'lang_prizing' => lang('Prizing'),
'lang_last_index' => lang('Last index'),
'lang_descr' => lang('Description'),
'lang_m_cost' => lang('Material
cost'),
'lang_w_cost' => lang('Labour cost'),
'lang_prizing' => lang('Prizing'),
'lang_unit' => lang('Unit'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'sort_total_cost' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'total_cost',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
'cat_id'
=>$this->cat_id)
))
);
$dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$sep = '/';
$dlarr[strpos($dateformat,'y')] =
'yyyy';
$dlarr[strpos($dateformat,'m')] = 'MM';
$dlarr[strpos($dateformat,'d')] = 'DD';
ksort($dlarr);
$table_update[] = array
(
'lang_new_index' =>
lang('New index'),
'lang_new_index_statustext' => lang('Enter
a new index'),
'dateformat' =>
(implode($sep,$dlarr)),
'link_calendar_date' =>
'setDateField(document.form.date);top.newWin=window.open('."'.".'/'.$this->currentapp.'/inc/calendar.html'."'".','."'".'cal'."'".','."'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes'".')',
'calendar_gif' =>
'./'.$this->currentapp.'/templates/default/images/calendar.gif',
'calendar_source' =>
'./'.$this->currentapp.'/inc/calendar.js',
'lang_popup_calendar' => lang('Popup
Calendar'),
'lang_date_statustext' => lang('Select
the date for the update'),
'lang_update' =>
lang('Update'),
'lang_update_statustext' => lang('update
selected investments')
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a
building'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uipricebook.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;
}
$data = array
(
'error'
=> $receipt['error'],
'message'
=> $receipt['message'],
'links'
=> $links,
'allrows'
=> $this->allrows,
'allow_allrows'
=> true,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($pricebook_list),
'all_records'
=> $this->bo->total_records,
'lang_select_all'
=> lang('Select All'),
'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
'check_source'
=> './'.$this->currentapp.'/inc/check.js',
'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 pricebook'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the pricebook belongs to. To do not use a category
select NO CATEGORY'),
'select_name'
=> 'cat_id',
'cat_list'
=> $this->bo->get_vendor_list('filter',$this->cat_id),
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_submit'
=> lang('submit'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_update'
=> $table_update,
'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.index'),
'table_add'
=> $table_add
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
}
function edit()
{
$property_id =
get_var('property_id',array('GET'));
$building_id =
get_var('building_id',array('POST','GET'));
$values =
get_var('values',array('POST','GET'));
$values['property_id'] =
get_var('property_id',array('POST'));
$values['property_name'] =
get_var('property_name',array('POST'));
$values_attribute =
get_var('values_attribute',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('building',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
if ($values['save'])
{
if(!$values['property_id'] && !$property_id)
{
$receipt['error'][]=array('msg'=>lang('Please select a Property ID !'));
$error_property_id=true;
$error_id=true;
}
if(!$values['building_id'] && !$building_id)
{
$receipt['error'][]=array('msg'=>lang('Please enter a Building ID !'));
$error_building_id=true;
$error_id=true;
}
if($values['property_id'] &&
$values['building_id'])
{
if($this->socommon->check_building($values['property_id'],$values['building_id']))
{
$receipt['error'][]=array('msg'=>lang('This building is already registered!') .
'[ '.$values['property_id'].'-'.$values['building_id'].' ]');
$error_building_id=true;
$error_id=true;
}
}
if($building_id)
{
$values['property_id']=$property_id;
$values['building_id']=$building_id;
$action='edit';
}
else
{
$property_id = $values['property_id'];
$building_id = $values['building_id'];
}
//_debug_array($values);
if(!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
if($values_attribute)
{
$this->bocommon->save_attributes($values_attribute,'location');
}
}
}
else
{
$values['property_id']= $property_id;
$values['building_id']= $building_id;
$values =
$this->bo->read_single($property_id,$building_id);
}
if ($building_id)
{
$function_msg = lang('edit building');
}
else
{
$function_msg = lang('add building');
}
if ($values['cat_id'] > 0)
{
$this->cat_id = $values['cat_id'];
}
if($error_property_id)
{
unset($values['property_id']);
}
if($error_building_id)
{
unset($values['building_id']);
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uibuilding.edit',
'property_id' => $property_id,
'building_id' => $building_id
);
if($values['building_id'])
{
$attributes_values =
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>2,'id'=>$property_id
. '-' . $building_id));
$attributes_header[] = array
(
'lang_name' => lang('Name'),
'lang_descr' => lang('Description'),
'lang_datatype' => lang('Datatype'),
'lang_value' => lang('Value')
);
$location_type='view';
}
else
{
$location_type='form';
}
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' =>
$location_type,
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name']));
$data = array
(
'location_type'
=> $location_type,
'location_data'
=> $location_data,
'lang_attributes'
=> lang('Attributes'),
'attributes_header'
=> $attributes_header,
'attributes_values'
=> $attributes_values,
'appname'
=> lang('building'),
'function_msg'
=> $function_msg,
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.index'),
'lang_building_id'
=> lang('Building ID'),
'lang_name'
=> lang('name'),
'lang_general_address' =>
lang('General Address'),
'lang_category'
=> lang('category'),
'lang_access'
=> lang('private'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_remark'
=> lang('remark'),
'value_building_id'
=> $values['building_id'],
'value_name'
=> $values['name'],
'value_general_address' =>
$values['general_address'],
'value_access'
=> $values['access'],
'value_remark'
=> $values['remark'],
'error'
=> $receipt['error'],
'error_flag'
=> $error_id,
'message'
=> $receipt['message'],
'lang_name_statustext' =>
lang('Enter the name of the building'),
'lang_building_id_statustext' => lang('Enter
Building ID'),
'lang_general_address_statustext'=> lang('Enter
the general address'),
'lang_done_statustext' =>
lang('Back to the list'),
'lang_save_statustext' =>
lang('Save the building'),
'lang_access_off_statustext' => lang('The
building is public. If the building should be private, check this box'),
'lang_access_on_statustext' =>
lang('The building is private. If the building should be public, uncheck this
box'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
'select_name'
=> 'values[cat_id]',
'lang_remark_statustext' =>
lang('Enter any remarks regarding this building'),
'cat_list'
=>
$this->bocommon->select_category_building_list('select',$values['cat_id'])
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$property_id = get_var('property_id',array('GET'));
$building_id =
get_var('building_id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uibuilding.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($property_id,$building_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('building'),
'function_msg' => lang('delete
building'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.delete&property_id='
. $property_id.'&building_id=' . $building_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));
}
function view()
{
$property_id = get_var('property_id',array('GET'));
$building_id = get_var('building_id',array('GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('building',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
$values =
$this->bo->read_single($property_id,$building_id);
$attributes_values =
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>2,'id'=>$property_id
. '-' . $building_id));
$attributes_header[] = array
(
'lang_name' => lang('Name'),
'lang_descr' => lang('Description'),
'lang_datatype' => lang('Datatype'),
'lang_value' => lang('Value')
);
$location_type='view';
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' =>
$location_type,
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name']));
$data = array
(
'location_type'
=> $location_type,
'location_data'
=> $location_data,
'lang_attributes'
=> lang('Attributes'),
'attributes_header'
=> $attributes_header,
'attributes_values'
=> $attributes_values,
'appname'
=> lang('building'),
'function_msg'
=> lang('view building'),
'value_building_id'
=> $values['building_id'],
'value_name'
=> $values['name'],
'value_general_address' =>
$values['general_address'],
'value_access'
=> $values['access'],
'value_remark'
=> $values['remark'],
'lang_remark'
=> lang('remark'),
'value_category'
=> $this->bo->read_category_name($values['cat_id']),
'lang_building_id'
=> lang('Building ID'),
'lang_name'
=> lang('name'),
'lang_general_address' =>
lang('General Address'),
'lang_category'
=> lang('category'),
'lang_done'
=> lang('done'),
'lang_edit'
=> lang('Edit'),
'edit_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.edit&property_id='
. $property_id . '&building_id=' . $building_id),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.index'),
'lang_done_statustext' => lang('Back
to the list'),
'lang_edit_statustext' => lang('Edit
this entry equipment'),
);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
}
}
?>
Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** class.bocommon.inc.php 27 Feb 2003 19:40:01 -0000 1.20
--- class.bocommon.inc.php 28 Feb 2003 19:39:00 -0000 1.21
***************
*** 118,122 ****
$this->admin_equipment=$admins[$module_order['equipment']]['equipment']['admin'];
$this->admin_workorder=$admins[$module_order['workorder']]['workorder']['admin'];
!
$this->admin_activity=$admins[$module_order['activity']]['activity']['admin'];
$this->admin_invoice=$admins[$module_order['invoice']]['invoice']['admin'];
}
--- 118,122 ----
$this->admin_equipment=$admins[$module_order['equipment']]['equipment']['admin'];
$this->admin_workorder=$admins[$module_order['workorder']]['workorder']['admin'];
!
$this->admin_pricebook=$admins[$module_order['pricebook']]['pricebook']['admin'];
$this->admin_invoice=$admins[$module_order['invoice']]['invoice']['admin'];
}
***************
*** 474,479 ****
'link_invoice' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index'),
'lang_invoice' => lang('Invoice'),
! 'link_activities' =>
$GLOBALS['phpgw']->link('/property/list_vendors_activities.php'),
! 'lang_activities' =>
lang('Activities'),
'link_documentation'=>
$GLOBALS['phpgw']->link('/property/list_documentation.php'),
'lang_documentation'=> lang('Documentation')
--- 474,479 ----
'link_invoice' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index'),
'lang_invoice' => lang('Invoice'),
! 'link_pricebook' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index'),
! 'lang_pricebook' =>
lang('Pricebook'),
'link_documentation'=>
$GLOBALS['phpgw']->link('/property/list_documentation.php'),
'lang_documentation'=> lang('Documentation')
***************
*** 579,589 ****
$menu['sublang_invoice_export']='';
}
! if ($sub == activity && $admin_activity)
{
-
$menu['sub_activities_list']=$GLOBALS['phpgw']->link('/property/list_activity.php');
-
$menu['sub_vendor_activities']=$GLOBALS['phpgw']->link('/property/list_vendors_activities.php');
-
$menu['sub_list_agreement']=$GLOBALS['phpgw']->link('/property/list_agreement.php');
-
$menu['sublang_activities_list']=lang('Activities');
$menu['sublang_vendor_activities']=lang('Vendors');
$menu['sublang_agreement']=lang('Agreement');
}
--- 579,590 ----
$menu['sublang_invoice_export']='';
}
! if ($sub == pricebook && $this->admin_pricebook)
{
$menu['sublang_vendor_activities']=lang('Vendors');
+
$menu['sub_vendor_activities']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
+
+
$menu['sub_activities_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
+
$menu['sub_list_agreement']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
+
$menu['sublang_activities_list']=lang('Activities');
$menu['sublang_agreement']=lang('Agreement');
}
Index: class.boinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boinvestment.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.boinvestment.inc.php 27 Jan 2003 10:40:30 -0000 1.5
--- class.boinvestment.inc.php 28 Feb 2003 19:39:00 -0000 1.6
***************
*** 253,257 ****
if ($values['value'][$n])
{
-
if ((abs($values['value'][$n])-
abs(($values['initial_value'][$n]*$new_index)))<0)
{
--- 253,256 ----
***************
*** 265,272 ****
$this->so->update_investment($values['entity_id'][$n],$values['investment_id'][$n],$new_index,$new_value,$values['initial_value'][$n],$date);
-
}
-
-
}
}
--- 264,268 ----
Index: class.boinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boinvoice.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.boinvoice.inc.php 15 Feb 2003 19:51:39 -0000 1.10
--- class.boinvoice.inc.php 28 Feb 2003 19:39:00 -0000 1.11
***************
*** 48,53 ****
$cat_id =
get_var('cat_id',array('POST','GET'));
$user_lid =
get_var('user_lid',array('POST','GET'));
! $sub =
get_var('sub',array('POST','GET'));
! $allrows =
get_var('allrows',array('POST','GET'));
if ($start)
--- 48,52 ----
$cat_id =
get_var('cat_id',array('POST','GET'));
$user_lid =
get_var('user_lid',array('POST','GET'));
! $allrows =
get_var('allrows',array('POST','GET'));
if ($start)
Index: class.uiinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiinvestment.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uiinvestment.inc.php 21 Feb 2003 10:28:59 -0000 1.9
--- class.uiinvestment.inc.php 28 Feb 2003 19:39:00 -0000 1.10
***************
*** 76,80 ****
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP .
'app_header'));
- $sub = get_var('sub',array('POST','GET'));
$links = $this->bocommon->menu($sub);
$values = get_var('values',array('POST'));
--- 76,79 ----
Index: class.uiinvoice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiinvoice.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.uiinvoice.inc.php 15 Feb 2003 19:51:39 -0000 1.12
--- class.uiinvoice.inc.php 28 Feb 2003 19:39:00 -0000 1.13
***************
*** 48,52 ****
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
- $this->sub =
$this->bo->sub;
$this->user_lid =
$this->bo->user_lid;
$this->allrows =
$this->bo->allrows;
--- 48,51 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.bopricebook.inc.php,NONE,1.1 class.sopricebook.inc.php,NONE,1.1 class.uipricebook.inc.php,NONE,1.1 class.bocommon.inc.php,1.20,1.21 class.boinvestment.inc.php,1.5,1.6class.boinvoice.inc.php,1.10,1.11 class.uiinvestment.inc.php,1.9,1.10class.uiinvoice.inc.php,1.12,1.13,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property index.php,1.8,1.9
- Next by Date:
[Phpgroupware-cvs] CVS: property/templates/default pricebook.xsl,NONE,1.1 menu.xsl,1.3,1.4
- Previous by thread:
[Phpgroupware-cvs] CVS: property index.php,1.8,1.9
- Next by thread:
[Phpgroupware-cvs] CVS: property/templates/default pricebook.xsl,NONE,1.1 menu.xsl,1.3,1.4
- Index(es):