[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.uireport.inc.php,1.7,1.8 clas
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.uireport.inc.php,1.7,1.8 class.soreport.inc.php,1.3,1.4 class.someter.inc.php,1.5,1.6 class.boreport.inc.php,1.4,1.5 class.bometer.inc.php,1.5,1.6 |
Date: |
Wed, 25 Jun 2003 14:27:52 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv25983/inc
Modified Files:
class.uireport.inc.php class.soreport.inc.php
class.someter.inc.php class.boreport.inc.php
class.bometer.inc.php
Log Message:
no message
Index: class.uireport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uireport.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.uireport.inc.php 19 Jun 2003 20:03:09 -0000 1.7
--- class.uireport.inc.php 25 Jun 2003 18:27:48 -0000 1.8
***************
*** 36,44 ****
$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.'.boreport',True);
- $this->so =
CreateObject($this->currentapp.'.soreport');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->fakebase =
$this->bo->fakebase;
--- 36,48 ----
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bo =
CreateObject($this->currentapp.'.boreport',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl_read =
$this->acl2->check('.report',1);
+ $this->acl_add =
$this->acl2->check('.report',2);
+ $this->acl_edit =
$this->acl2->check('.report',4);
+ $this->acl_delete =
$this->acl2->check('.report',8);
$this->fakebase =
$this->bo->fakebase;
***************
*** 74,78 ****
{
! $GLOBALS['phpgw']->xslttpl->add_file(array('report',
'menu',
'nextmatchs',
--- 78,82 ----
{
!
$GLOBALS['phpgw']->xslttpl->add_file(array('report','values','table_header',
'menu',
'nextmatchs',
***************
*** 85,177 ****
//_debug_array($report_list);
! while (is_array($report_list) && list(,$report) =
each($report_list))
{
! $value_attribute =
(isset($report['attribute'])?$report['attribute']:'');
! $location = split("-",
$report['location_code']);
! $content[] = array
! (
! 'report_id'
=> $report['report_id'],
! 'title'
=> $report['title'],
! 'property_id'
=> $location[0],
! 'building_id'
=> $location[1],
! 'entrance_id'
=> $location[2],
! 'floor'
=> $report['floor'],
! 'apartment_id'
=> $location[3],
! 'address'
=> $report['address'],
! 'category'
=> $report['category'],
! 'date'
=> $report['date'],
! 'owner'
=> $report['owner'],
! 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view&id='
. $report['report_id']),
! 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit&id='
. $report['report_id']),
! 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&report_id='
. $report['report_id']),
! 'lang_view_statustext' =>
lang('view the report'),
! 'lang_edit_statustext' =>
lang('edit the report'),
! 'lang_delete_statustext' =>
lang('delete this report'),
! 'text_view'
=> lang('view'),
! 'value_attribute'
=> $value_attribute,
! 'text_edit'
=> lang('edit'),
! 'text_delete'
=> lang('delete')
! );
}
! $table_header[] = array
! (
! 'sort_report' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
!
'var' => 'report_id',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
!
'filter'
=>$this->filter,
!
'query'
=>$this->query)
!
)),
! 'lang_report' => lang('report'),
! 'lang_title' => lang('Title'),
! 'sort_property' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
!
'var' => 'property_id',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
!
'filter'
=>$this->filter,
!
'query'
=>$this->query)
!
)),
! 'lang_property' => lang('Property'),
! 'lang_building' => lang('Building'),
! 'lang_entrance' => lang('Entrance'),
! 'lang_floor' => lang('Floor'),
! 'lang_apartment' => lang('Apartment'),
! 'sort_address' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'address',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
!
'filter'
=>$this->filter,
!
'query'
=>$this->query)
!
)),
! 'lang_address' => lang('Address'),
! 'lang_category' => lang('Category'),
! 'attribute' =>
$value_attribute,
! 'lang_attribute' => lang('Attribute'),
! 'lang_view' => lang('view'),
! 'lang_edit' => lang('edit'),
! 'lang_delete' => lang('delete')
! );
! $table_add[] = array
! (
! 'lang_add' =>
lang('add'),
! 'lang_add_statustext' => lang('add a report'),
! 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit')
! );
$link_data = array
--- 89,248 ----
//_debug_array($report_list);
! $uicols = $this->bo->uicols;
! //_debug_array($uicols);
!
! $j=0;
! while (is_array($report_list) && list(,$report_entry) =
each($report_list))
{
! for ($k=0;$k<count($uicols['name']);$k++)
! {
! if($uicols['input_type'][$k]!='hidden')
! {
!
if($report_entry['query_location'][$uicols['name'][$k]])
! {
!
$content[$j]['row'][$k]['statustext'] = lang('search');
!
$content[$j]['row'][$k]['text'] =
$report_entry[$uicols['name'][$k]];
!
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.index&query='
. $report_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup);
! }
! else
! {
!
$content[$j]['row'][$k]['value'] =
$report_entry[$uicols['name'][$k]];
!
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
! }
! }
! }
!
! if(!$lookup)
! {
! if($this->acl_read)
! {
!
$content[$j]['row'][$k]['statustext'] = lang('view the
report');
! $content[$j]['row'][$k]['text']
= lang('view');
! $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view&id='
. $report_entry['report_id']);
! $k++;
! }
!
! if($this->acl_edit)
! {
!
$content[$j]['row'][$k]['statustext'] = lang('edit the
report');
! $content[$j]['row'][$k]['text']
= lang('edit');
! $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit&id='
. $report_entry['report_id']);
! $k++;
! }
!
! if($this->acl_delete)
! {
!
$content[$j]['row'][$k]['statustext'] = lang('delete the
report');
! $content[$j]['row'][$k]['text']
= lang('delete');
! $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&id='
. $report_entry['report_id']);
! $k++;
! }
! }
!
! $j++;
}
! for ($i=0;$i<count($uicols['descr']);$i++)
! {
! if($uicols['input_type'][$i]!='hidden')
! {
! $table_header[$i]['header'] =
$uicols['descr'][$i];
! $table_header[$i]['width']
= '5%';
! $table_header[$i]['align']
= 'center';
! if($uicols['name'][$i]=='loc1')
! {
! $table_header[$i]['sort_link']
=true;
! $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
!
'var' => 'location_code',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'type_id'
=>$type_id,
!
'query'
=>$this->query,
!
'lookup'
=>$lookup,
'district_id' =>
$this->district_id,
!
'cat_id'
=>$this->cat_id)
!
));
! }
! if($uicols['name'][$i]=='num')
! {
! $table_header[$i]['sort_link']
=true;
! $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
!
'var' => 'num',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'type_id'
=>$type_id,
!
'query'
=>$this->query,
!
'lookup'
=>$lookup,
'district_id' =>
$this->district_id,
!
'cat_id'
=>$this->cat_id)
!
));
! }
! if($uicols['name'][$i]=='address')
! {
! $table_header[$i]['sort_link']
=true;
! $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'address',
'order' => $this->order,
!
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
!
'type_id'
=>$type_id,
!
'query'
=>$this->query,
!
'lookup'
=>$lookup,
'district_id' =>
$this->district_id,
!
'cat_id'
=>$this->cat_id)
!
));
! }
! }
! }
! if(!$lookup)
! {
! if($this->acl_read)
! {
! $table_header[$i]['width']
= '5%';
! $table_header[$i]['align']
= 'center';
! $table_header[$i]['header']
= lang('view');
! $i++;
! }
! if($this->acl_edit)
! {
! $table_header[$i]['width']
= '5%';
! $table_header[$i]['align']
= 'center';
! $table_header[$i]['header']
= lang('edit');
! $i++;
! }
! if($this->acl_delete)
! {
! $table_header[$i]['width']
= '5%';
! $table_header[$i]['align']
= 'center';
! $table_header[$i]['header']
= lang('delete');
! $i++;
! }
! }
! else
! {
! $table_header[$i]['width']
= '5%';
! $table_header[$i]['align']
= 'center';
! $table_header[$i]['header'] =
lang('select');
! }
!
! //_debug_array($content);
! if($this->acl_add)
! {
! $table_add[] = array
! (
! 'lang_add'
=> lang('add'),
! 'lang_add_statustext' => lang('add a
report'),
! 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit')
!
! );
! }
$link_data = array
***************
*** 234,241 ****
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
$file_name =
get_var('file_name',array('POST','GET'));
! $property_id =
get_var('property_id',array('POST','GET'));
$report_id =
get_var('report_id',array('POST','GET'));
! $file = $this->fakebase. SEP . 'report' . SEP .
$property_id . SEP . $report_id . SEP . $file_name;
//echo 'file: ' . $file . '<br>';
--- 305,312 ----
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
$file_name =
get_var('file_name',array('POST','GET'));
! $loc1 = get_var('loc1',array('POST','GET'));
$report_id =
get_var('report_id',array('POST','GET'));
! $file = $this->fakebase. SEP . 'report' . SEP . $loc1 .
SEP . $report_id . SEP . $file_name;
//echo 'file: ' . $file . '<br>';
***************
*** 272,275 ****
--- 343,351 ----
function edit()
{
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uireport.index');
+ }
+
$id =
get_var('id',array('POST','GET'));
$values =
get_var('values',array('POST','GET'));
***************
*** 278,292 ****
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
$bypass =
get_var('bypass',array('POST','GET'));
! if($values && !$bypass)
{
! $values = $values +
$this->bocommon->get_location();
}
else
{
$location_code =
get_var('location_code',array('POST','GET'));
! $values['tenant_id'] =
get_var('tenant_id',array('POST','GET'));
! $values['equipment_id'] =
get_var('equipment_id',array('POST','GET'));
$ticket_id
= get_var('ticket_id',array('POST','GET'));
--- 354,389 ----
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+
$bypass =
get_var('bypass',array('POST','GET'));
! if($_POST && !$bypass)
{
! for ($i=0;
$i<count($insert_record['location']); $i++)
! {
!
if($_POST[$insert_record['location'][$i]])
! {
!
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
! }
! }
!
! while (is_array($insert_record['extra']) &&
list($key,) = each($insert_record['extra']))
! {
! if($_POST[$key])
! {
! $values['extra'][$key] =
$_POST[$key];
! }
! }
!
! $values['street_name'] =
$_POST['street_name'];
! $values['street_number'] =
$_POST['street_number'];
! $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
!
}
else
{
$location_code =
get_var('location_code',array('POST','GET'));
! $tenant_id
= get_var('tenant_id',array('POST','GET'));
! $equipment_id =
get_var('equipment_id',array('POST','GET'));
$ticket_id
= get_var('ticket_id',array('POST','GET'));
***************
*** 297,312 ****
}
- if($values['tenant_id'])
- {
-
$tenant_data=$this->bocommon->read_single_tenant($values['tenant_id']);
- $values['contact_phone']=
$tenant_data['contact_phone'];
- $values['tenant_name']=
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
- }
-
if($location_code)
{
!
$location_data=$this->bocommon->read_location_data($location_code);
!
! $values=$values + $location_data;
}
}
--- 394,400 ----
}
if($location_code)
{
! $values['location_data'] =
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'equipment_id'=>$equipment_id));
}
}
***************
*** 320,324 ****
{
$values['file_name']=$_FILES['file']['name'];
! $to_file = $this->fakebase. SEP .
'report' . SEP . $values['property_id'] . SEP . $id . SEP .
$values['file_name'];
if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
--- 408,412 ----
{
$values['file_name']=$_FILES['file']['name'];
! $to_file = $this->fakebase. SEP .
'report' . SEP . $values['location']['loc1'] . SEP . $id . SEP .
$values['file_name'];
if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
***************
*** 352,356 ****
if (!$receipt['error'])
{
!
$values['report_id']=$this->so->generate_id($values['cat_id']);
}
}
--- 440,444 ----
if (!$receipt['error'])
{
!
$values['report_id']=$this->bo->generate_id($values['cat_id']);
}
}
***************
*** 368,372 ****
if($values['file_name'])
{
!
$this->bo->create_document_dir($values['property_id'], $values['report_id']);
$this->bo->vfs->cp (array (
'from' =>
$_FILES['file']['tmp_name'],
--- 456,460 ----
if($values['file_name'])
{
!
$this->bo->create_document_dir($values['location']['loc1'],
$values['report_id']);
$this->bo->vfs->cp (array (
'from' =>
$_FILES['file']['tmp_name'],
***************
*** 375,381 ****
}
}
}
! if (!$receipt['error'])
{
$values = $this->bo->read_single($id);
--- 463,478 ----
}
}
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
+ }
+ }
+
}
! if (!$receipt['error'] && $id)
{
$values = $this->bo->read_single($id);
***************
*** 399,415 ****
!
$location_data=$this->bocommon->initiate_ui_location(array(
! 'location_type' =>
$location_type,
! 'report' =>
false,
! 'apartment' => true,
! 'address' => true,
! 'property_id' =>
$values['property_id'],
! 'property_name' =>
$values['property_name'],
! 'building_id' =>
$values['building_id'],
! 'entrance_id' =>
$values['entrance_id'],
! 'floor' =>
$values['floor'],
! 'street_name' =>
$values['street_name'],
! 'street_number' =>
$values['street_number'],
! 'apartment_id' =>
$values['apartment_id']));
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
--- 496,507 ----
!
$location_data=$this->bolocation->initiate_ui_location(array(
! 'values' =>
$values['location_data'],
! 'type_id' => -1,
// calculated from location_types
! 'no_link' =>
False, // disable lookup links for location type less than type_id
! 'tenant' =>
False,
! 'equipment' =>
False,
! 'lookup_type' => 'form'
! ));
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
***************
*** 485,490 ****
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
! 'property_id'
=> $values['property_id'],
! 'link_view_file'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view_file&property_id='
. $values['property_id'] . '&report_id=' . $id),
'files'
=> $values['files'],
'lang_files'
=> lang('files'),
--- 577,582 ----
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
! 'property_id'
=> $values['location']['loc1'],
! 'link_view_file'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view_file&loc1='
. $values['location_data']['loc1'] . '&report_id=' . $id),
'files'
=> $values['files'],
'lang_files'
=> lang('files'),
***************
*** 557,561 ****
function delete()
{
! $report_id = get_var('report_id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
--- 649,658 ----
function delete()
{
! if(!$this->acl_delete)
! {
!
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uireport.index');
! }
!
! $id = get_var('id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
***************
*** 567,571 ****
if (get_var('confirm',array('POST')))
{
! $this->bo->delete($report_id);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
--- 664,668 ----
if (get_var('confirm',array('POST')))
{
! $this->bo->delete($id);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
***************
*** 576,580 ****
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
! 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&report_id='
. $report_id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
--- 673,677 ----
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
! 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&id='
. $id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
***************
*** 593,613 ****
function view()
{
$id = get_var('id',array('POST','GET'));
$values = $this->bo->read_single($id);
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
!
$location_data=$this->bocommon->initiate_ui_location(array(
! 'location_type' => 'view',
! 'apartment' => true,
! 'address' => true,
! 'property_id' =>
$values['property_id'],
! 'property_name' =>
$values['property_name'],
! 'building_id' =>
$values['building_id'],
! 'entrance_id' =>
$values['entrance_id'],
! 'floor' =>
$values['floor'],
! 'street_name' =>
$values['street_name'],
! 'street_number' =>
$values['street_number'],
! 'apartment_id' =>
$values['apartment_id']));
$cat_text =
$this->bo->read_single_report_type($values['cat_id']);
--- 690,712 ----
function view()
{
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uireport.index');
+ }
+
$id = get_var('id',array('POST','GET'));
$values = $this->bo->read_single($id);
+ //_debug_array($values);
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
!
$location_data=$this->bolocation->initiate_ui_location(array(
! 'values' =>
$values['location_data'],
! 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
! 'no_link' =>
False, // disable lookup links for location type less than type_id
! 'tenant' =>
False,
! 'equipment' =>
False,
! 'lookup_type' => 'view'
! ));
$cat_text =
$this->bo->read_single_report_type($values['cat_id']);
Index: class.soreport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soreport.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.soreport.inc.php 21 Jun 2003 19:27:35 -0000 1.3
--- class.soreport.inc.php 25 Jun 2003 18:27:48 -0000 1.4
***************
*** 73,76 ****
--- 73,117 ----
}
+ $entity_table = 'fm_report';
+
+ $cols .= $entity_table . '.location_code';
+ $cols_return[] = 'location_code';
+
+ $cols .= ",$entity_table.report_id as report_id";
+ $cols_return[] = 'report_id';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'report_id';
+ $uicols['descr'][] = lang('report
id');
+ $uicols['statustext'][] = lang('report id');
+
+ $cols .= ",$entity_table.title as title";
+ $cols_return[] = 'title';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'title';
+ $uicols['descr'][] = lang('title');
+ $uicols['statustext'][] = lang('title');
+
+ $cols .= ",fm_report_type.name as category";
+ $cols_return[] = 'category';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'category';
+ $uicols['descr'][] =
lang('category');
+ $uicols['statustext'][] = lang('category');
+
+ $cols.= ",$entity_table.entry_date";
+ $cols_return[] = 'entry_date';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'entry_date';
+ $uicols['descr'][] = lang('entry
date');
+ $uicols['statustext'][] = lang('Report entry
date');
+
+
+ $joinmethod .= " $this->join fm_report_type ON
($entity_table.report_type_id = fm_report_type.id))";
+ $paranthesis .='(';
+
+
+ $sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
+
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+
if ($order)
{
***************
*** 82,114 ****
}
! $filtermethod = ' ( fm_report.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_report.access='public' OR fm_report.owner IN(" .
implode(',',$public_user_list) . ")))";
! }
! else
! {
! $filtermethod .= ' )';
! }
if ($cat_id > 0)
{
! $filtermethod .= " AND
fm_report.report_type_id='$cat_id' ";
}
if ($district_id > 0)
{
! $filtermethod .= " AND
district_id='$district_id' ";
}
if ($filter > 0)
{
! $filtermethod .= " AND
fm_report.owner='$filter' ";
}
--- 123,145 ----
}
!
! $where = 'WHERE';
if ($cat_id > 0)
{
! $filtermethod .= " $where
fm_report.report_type_id='$cat_id' ";
! $where = 'AND';
}
if ($district_id > 0)
{
! $filtermethod .= " $where
district_id='$district_id' ";
! $where = 'AND';
}
if ($filter > 0)
{
! $filtermethod .= " $where
fm_report.owner='$filter' ";
! $where = 'AND';
}
***************
*** 118,130 ****
$query = ereg_replace('"','',$query);
! $querymethod = " AND fm_report.property_id LIKE
'%$query%' or fm_report.title LIKE '%$query%' or fm_report.address LIKE
'%$query%'";
}
! $sql = "SELECT
report_id,fm_report.location_code,fm_report.title,fm_report.address as address,
fm_report_type.name as category"
! . " FROM fm_report $this->join"
! . " fm_property ON fm_report.property_id =
fm_property.property_id $this->join"
! . " fm_part_of_town ON fm_property.part_of_town_id =
fm_part_of_town.part_of_town_id $this->join"
! . " fm_report_type ON fm_report.report_type_id =
fm_report_type.id "
! . " WHERE $filtermethod $querymethod ";
$this->db2->query($sql,__LINE__,__FILE__);
--- 149,161 ----
$query = ereg_replace('"','',$query);
! $querymethod = " $where fm_report.property_id
LIKE '%$query%' or fm_report.title LIKE '%$query%' or fm_report.address LIKE
'%$query%'";
}
! $sql .= " $filtermethod $querymethod";
! //echo $sql;
! $this->uicols = $this->bocommon->uicols;
! $cols_return = $this->bocommon->cols_return;
! $type_id =
$this->bocommon->type_id;
! $this->cols_extra = $this->bocommon->cols_extra;
$this->db2->query($sql,__LINE__,__FILE__);
***************
*** 132,149 ****
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
while ($this->db->next_record())
{
! $ngrants =
(int)$this->grants[$this->db->f('fm_report.owner')];
! $report_list[] = array
! (
! 'report_id' =>
$this->db->f('report_id'),
! 'location_code' =>
$this->db->f('location_code'),
! 'address' =>
$this->db->f('address'),
! 'category' =>
$this->db->f('category'),
! 'title' =>
$this->db->f('title'),
! 'grants' => $ngrants
! );
}
- //_debug_array($report_list);
return $report_list;
--- 163,184 ----
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ $j=0;
while ($this->db->next_record())
{
! for ($i=0;$i<count($cols_return);$i++)
! {
! $report_list[$j][$cols_return[$i]] =
$this->db->f($cols_return[$i]);
! }
!
! $location_code= $this->db->f('location_code');
! $location = split('-',$location_code);
! for ($m=0;$m<count($location);$m++)
! {
! $report_list[$j]['loc' . ($m+1)] =
$location[$m];
!
$report_list[$j]['query_location']['loc' . ($m+1)]=implode("-",
array_slice($location, 0, ($m+1)));
! }
!
! $j++;
}
return $report_list;
***************
*** 164,168 ****
$report['abstract'] =
$this->db->f('abstract');
$report['status'] =
$this->db->f('status');
! $report['owner'] =
$this->db->f('owner');
$report['access'] =
$this->db->f('access');
$report['date'] =
$this->db->f('date');
--- 199,203 ----
$report['abstract'] =
$this->db->f('abstract');
$report['status'] =
$this->db->f('status');
! $report['user_id'] =
$this->db->f('user_id');
$report['access'] =
$this->db->f('access');
$report['date'] =
$this->db->f('date');
***************
*** 226,241 ****
{
! if($report['street_number'])
{
! $address= $report['street_name'] . ' ' .
$report['street_number'];
}
! else
{
! $address= $report['street_name'];
}
$report['descr'] =
$this->db->db_addslashes($report['descr']);
//_debug_array($report);
! $this->db->query("INSERT INTO fm_report
(report_id,abstract,status,report_type_id,entry_date,title,location_code,property_id,address,owner)
"
. "VALUES ('"
. $report['report_id']. "','"
--- 261,295 ----
{
! while (is_array($report['location']) &&
list($input_name,$value) = each($report['location']))
{
! if($value)
! {
! $cols[] = $input_name;
! $vals[] = $value;
! }
}
!
! if($cols)
! {
! $cols = "," . implode(",", $cols);
! $vals = ",'" . implode("','", $vals) . "'";
! }
!
! if($report['street_name'])
{
! $address[]= $report['street_name'];
! $address[]= $report['street_number'];
! $address = implode(" ", $address);
}
+ if(!$address)
+ {
+ $address = $report['location_name'];
+ }
+
+
$report['descr'] =
$this->db->db_addslashes($report['descr']);
//_debug_array($report);
! $this->db->query("INSERT INTO fm_report
(report_id,abstract,status,report_type_id,entry_date,title,location_code,address,user_id
$cols) "
. "VALUES ('"
. $report['report_id']. "','"
***************
*** 246,252 ****
. $report['title']. "','"
. $report['location_code']. "','"
- . $report['property_id']. "','"
. $address . "','"
! . $this->account. "')",__LINE__,__FILE__);
if($report['origin'] && $report['origin_id'])
--- 300,305 ----
. $report['title']. "','"
. $report['location_code']. "','"
. $address . "','"
! . $this->account. "' $vals
)",__LINE__,__FILE__);
if($report['origin'] && $report['origin_id'])
***************
*** 265,278 ****
function edit($report)
{
! //_debug_array($report);
! if($report['street_number'])
{
! $address= $report['street_name'] . ' ' .
$report['street_number'];
}
! else
{
! $address= $report['street_name'];
}
$report['descr'] =
$this->db->db_addslashes($report['descr']);
--- 318,345 ----
function edit($report)
{
!
! while (is_array($report['location']) &&
list($input_name,$value) = each($report['location']))
{
! $vals[] = "$input_name = '$value'";
}
!
! if($vals)
! {
! $vals = "," . implode(",",$vals);
! }
!
! if($report['street_name'])
{
! $address[]= $report['street_name'];
! $address[]= $report['street_number'];
! $address = implode(" ", $address);
}
+ if(!$address)
+ {
+ $address = $report['location_name'];
+ }
+
+
$report['descr'] =
$this->db->db_addslashes($report['descr']);
***************
*** 283,289 ****
title='" . $report['title'] . "',
location_code='" . $report['location_code'] .
"',
- property_id='" . $report['property_id'] . "',
address='" . $address
! . "' WHERE report_id= '" . $report['report_id']
."'",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>lang('report %1
has been edited',$report['report_id']));
--- 350,355 ----
title='" . $report['title'] . "',
location_code='" . $report['location_code'] .
"',
address='" . $address
! . "' $vals WHERE report_id= '" .
$report['report_id'] ."'",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>lang('report %1
has been edited',$report['report_id']));
Index: class.someter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.someter.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.someter.inc.php 25 Jun 2003 09:47:28 -0000 1.5
--- class.someter.inc.php 25 Jun 2003 18:27:48 -0000 1.6
***************
*** 74,79 ****
$entity_table = 'fm_meter';
-
-
$cols .= $entity_table . '.location_code';
$cols_return[] = 'location_code';
--- 74,77 ----
Index: class.boreport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boreport.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.boreport.inc.php 23 May 2003 08:40:19 -0000 1.4
--- class.boreport.inc.php 25 Jun 2003 18:27:49 -0000 1.5
***************
*** 53,56 ****
--- 53,57 ----
$this->rootdir = $this->vfs->basedir;
$this->fakebase = $this->vfs->fakebase;
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
if ($session)
***************
*** 81,85 ****
$this->query = $query;
}
! if(!empty($filter))
{
$this->filter = $filter;
--- 82,86 ----
$this->query = $query;
}
! if(isset($filter))
{
$this->filter = $filter;
***************
*** 215,218 ****
--- 216,235 ----
$this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ for ($i=0; $i<count($report); $i++)
+ {
+ $report[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($report[$i]['user_id']);
+ $report[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($report[$i]['entry_date'],$dateformat);
+
$location_data=$this->solocation->read_single($report[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $report[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+ }
+
return $report;
}
***************
*** 224,235 ****
$report['date'] =
$GLOBALS['phpgw']->common->show_date($report['date'],$dateformat);
!
$location_data=$this->socommon->read_location_data($report['location_code']);
- $report=$report + $location_data;
$report['files'] = $this->vfs->ls (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $report['property_id'] . SEP . $report_id,
'relatives' => array(RELATIVE_NONE)));
! //_debug_array($report['files']);
return $report;
}
--- 241,254 ----
$report['date'] =
$GLOBALS['phpgw']->common->show_date($report['date'],$dateformat);
! if($report['location_code'])
! {
! $report['location_data']
=$this->solocation->read_single($report['location_code']);
! }
$report['files'] = $this->vfs->ls (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $report['location_data']['loc1'] . SEP . $report_id,
'relatives' => array(RELATIVE_NONE)));
! //_debug_array($report);
return $report;
}
***************
*** 268,275 ****
}
! function create_document_dir($property_id='',$report_id='')
{
if(!$this->vfs->file_exists(array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $property_id,
'relatives' => Array(RELATIVE_NONE)
)))
--- 287,294 ----
}
! function create_document_dir($loc1='',$report_id='')
{
if(!$this->vfs->file_exists(array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $loc1,
'relatives' => Array(RELATIVE_NONE)
)))
***************
*** 277,281 ****
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $property_id,
'relatives' => array(
RELATIVE_NONE
--- 296,300 ----
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $loc1,
'relatives' => array(
RELATIVE_NONE
***************
*** 283,291 ****
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id);
}
$this->vfs->override_acl = 0;
--- 302,310 ----
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $loc1);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $loc1);
}
$this->vfs->override_acl = 0;
***************
*** 294,298 ****
if(!$this->vfs->file_exists(array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $property_id . SEP . $report_id,
'relatives' => Array(RELATIVE_NONE)
)))
--- 313,317 ----
if(!$this->vfs->file_exists(array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $loc1 . SEP . $report_id,
'relatives' => Array(RELATIVE_NONE)
)))
***************
*** 300,304 ****
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $property_id . SEP . $report_id,
'relatives' => array(
RELATIVE_NONE
--- 319,323 ----
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
! 'string' => $this->fakebase. SEP .
'report' . SEP . $loc1 . SEP . $report_id,
'relatives' => array(
RELATIVE_NONE
***************
*** 306,314 ****
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id . SEP . $report_id);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id . SEP . $report_id);
}
$this->vfs->override_acl = 0;
--- 325,333 ----
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $loc1 . SEP . $report_id);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $loc1 . SEP . $report_id);
}
$this->vfs->override_acl = 0;
***************
*** 319,329 ****
}
function save($report,$action='')
{
-
$report['location_code']=$this->bocommon->location_code($report['property_id'],$report['building_id'],$report['entrance_id'],$report['apartment_id']);
- // $date = $this->bocommon->date_array($report['date']);
! // $report['date'] = mktime
(2,0,0,$date['month'],$date['day'],$date['year']);
if ($action=='edit')
--- 338,358 ----
}
+ function generate_id($report_type)
+ {
+ return $this->so->generate_id($report_type);
+ }
function save($report,$action='')
{
! while (is_array($report['location']) && list(,$value) =
each($report['location']))
! {
! if($value)
! {
! $location[] = $value;
! }
! }
!
! $report['location_code']=implode("-", $location);
if ($action=='edit')
***************
*** 342,346 ****
for
($i=0;$i<count($report['delete_file']);$i++)
{
! $file = $this->fakebase. SEP .
'report' . SEP . $report['property_id'] . SEP . $report['report_id'] . SEP .
$report['delete_file'][$i];
if($this->vfs->file_exists(array(
--- 371,375 ----
for
($i=0;$i<count($report['delete_file']);$i++)
{
! $file = $this->fakebase. SEP .
'report' . SEP . $location[0] . SEP . $report['report_id'] . SEP .
$report['delete_file'][$i];
if($this->vfs->file_exists(array(
***************
*** 358,366 ****
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'report'. SEP . $report['property_id']. SEP .
$report['delete_file'][$i]);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'report'. SEP . $report['property_id']. SEP .
$report['delete_file'][$i]);
}
$this->vfs->override_acl = 0;
--- 387,395 ----
)))
{
!
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'report'. SEP . $location[0]. SEP .
$report['delete_file'][$i]);
}
else
{
!
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'report'. SEP . $location[0]. SEP .
$report['delete_file'][$i]);
}
$this->vfs->override_acl = 0;
Index: class.bometer.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bometer.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.bometer.inc.php 25 Jun 2003 09:47:28 -0000 1.5
--- class.bometer.inc.php 25 Jun 2003 18:27:49 -0000 1.6
***************
*** 186,196 ****
$meter= $this->so->read_single($meter_id);
-
if($meter['location_code'])
{
$meter['location_data']
=$this->solocation->read_single($meter['location_code']);
}
-
- //_debug_array($meter);
return $meter;
--- 186,193 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.uireport.inc.php,1.7,1.8 class.soreport.inc.php,1.3,1.4 class.someter.inc.php,1.5,1.6 class.boreport.inc.php,1.4,1.5 class.bometer.inc.php,1.5,1.6,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/templates/default report.xsl,1.3,1.4
- Next by Date:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php,1.98,1.99 default_records.inc.php,1.21,1.22
- Previous by thread:
[Phpgroupware-cvs] CVS: property/templates/default report.xsl,1.3,1.4
- Next by thread:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php,1.98,1.99 default_records.inc.php,1.21,1.22
- Index(es):