[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc class.boadmin_entity.inc.php, NONE, 1.1
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] property/inc class.boadmin_entity.inc.php, NONE, 1.1 class.soadmin_entity.inc.php, NONE, 1.1 class.uiadmin_entity.inc.php, NONE, 1.1 class.uiworkorder.inc.php, 1.45, 1.46 class.uiproject.inc.php, 1.51, 1.52 class.bocommon.inc.php, 1.83, 1.84 hook_settings.inc.php, 1.14, 1.15 class.uilocation.inc.php, 1.31, 1.32 class.bostandard_entity.inc.php, 1.12, 1.13 class.soreport.inc.php, 1.12, 1.13 class.soproject.inc.php, 1.40, 1.41 class.soworkorder.inc.php, 1.29, 1.30 class.boworkorder.inc.php, 1.17, 1.18 class.boproject.inc.php, 1.17, 1.18 class.uitts.inc.php, 1.38, 1.39 class.botts.inc.php, 1.20, 1.21 class.sotts.inc.php, 1.27, 1.28 hook_admin.inc.php, 1.42, 1.43 class.boadmin_location.inc.php, 1.5, 1.6 class.soadmin_location.inc.php, 1.18, 1.19 class.bowo_hour.inc.php, 1.10, 1.11 |
Date: |
Fri, 10 Oct 2003 21:57:17 +0000 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv13693/inc
Modified Files:
class.uiworkorder.inc.php class.uiproject.inc.php
class.bocommon.inc.php hook_settings.inc.php
class.uilocation.inc.php class.bostandard_entity.inc.php
class.soreport.inc.php class.soproject.inc.php
class.soworkorder.inc.php class.boworkorder.inc.php
class.boproject.inc.php class.uitts.inc.php
class.botts.inc.php class.sotts.inc.php hook_admin.inc.php
class.boadmin_location.inc.php class.soadmin_location.inc.php
class.bowo_hour.inc.php
Added Files:
class.boadmin_entity.inc.php class.soadmin_entity.inc.php
class.uiadmin_entity.inc.php
Log Message:
no message
Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/hook_admin.inc.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** hook_admin.inc.php 8 Sep 2003 17:36:37 -0000 1.42
--- hook_admin.inc.php 10 Oct 2003 21:57:15 -0000 1.43
***************
*** 20,24 ****
'District'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=district'),
'Part of town'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uip_of_town.index'),
! 'Location type'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_location.index'),
'Update the not active category for
locations'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uilocation.update_cat'),
// 'Request Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=request'),
--- 20,25 ----
'District'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=district'),
'Part of town'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uip_of_town.index'),
! 'Admin entity'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_entity.index'),
! 'Admin Location'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_location.index'),
'Update the not active category for
locations'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uilocation.update_cat'),
// 'Request Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=request'),
Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** class.uilocation.inc.php 3 Oct 2003 16:01:26 -0000 1.31
--- class.uilocation.inc.php 10 Oct 2003 21:57:14 -0000 1.32
***************
*** 85,89 ****
$lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
- $location_list = $this->bo->read($allrows=true);
$location_list =
$this->bo->read($type_id,$lookup_tenant,$allrows=true);
--- 85,88 ----
Index: class.sotts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sotts.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** class.sotts.inc.php 15 Sep 2003 18:28:43 -0000 1.27
--- class.sotts.inc.php 10 Oct 2003 21:57:15 -0000 1.28
***************
*** 84,88 ****
else
{
! $ordermethod = ' order by id DESC';
}
--- 84,88 ----
else
{
! $ordermethod = ' order by .fm_tts_tickets.id
DESC';
}
***************
*** 123,133 ****
if($query)
{
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
!
! $querymethod = " $where (subject LIKE
'%$query%' or address LIKE '%$query%' or location_code LIKE '%$query%')";
}
! $sql = "SELECT * FROM fm_tts_tickets $filtermethod
$querymethod";
//echo $sql;
--- 123,140 ----
if($query)
{
! if($query=explode(".",$query))
! {
! $querymethod = " $where
(fm_tts_tickets.loc1='" . $query[0] . "' AND fm_tts_tickets.loc4='" . $query[1]
. "')";
! }
! else
! {
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
! $querymethod = " $where (subject LIKE
'%$query%' or address LIKE '%$query%' or location_code LIKE '%$query%')";
! }
}
! $sql = "SELECT fm_tts_tickets.*, fm_tts_category.descr
as category,phpgw_accounts.account_lid as user_lid FROM fm_tts_tickets
$this->join fm_tts_category on fm_tts_tickets.cat_id=fm_tts_category.id "
! . " $this->join phpgw_accounts on
fm_tts_tickets.user_id=phpgw_accounts.account_id $filtermethod $querymethod";
//echo $sql;
***************
*** 144,152 ****
$tickets[$i]['subject'] =
$this->db->f('subject');
$tickets[$i]['location_code'] =
$this->db->f('location_code');
! $tickets[$i]['user_id'] =
$this->db->f('user_id');
$tickets[$i]['address'] =
$this->db->f('address');
$tickets[$i]['assignedto'] =
$this->db->f('assignedto');
$tickets[$i]['status'] =
$this->db->f('status');
$tickets[$i]['priority'] =
$this->db->f('priority');
$this->db2->query("select count(*) from
fm_tts_views where id='" . $this->db->f('id')
--- 151,161 ----
$tickets[$i]['subject'] =
$this->db->f('subject');
$tickets[$i]['location_code'] =
$this->db->f('location_code');
! $tickets[$i]['user'] =
$this->db->f('user_lid');
$tickets[$i]['address'] =
$this->db->f('address');
$tickets[$i]['assignedto'] =
$this->db->f('assignedto');
$tickets[$i]['status'] =
$this->db->f('status');
$tickets[$i]['priority'] =
$this->db->f('priority');
+ $tickets[$i]['category'] =
$this->db->f('category');
+ $tickets[$i]['group_id'] =
$this->db->f('group_id');
$this->db2->query("select count(*) from
fm_tts_views where id='" . $this->db->f('id')
***************
*** 244,247 ****
--- 253,266 ----
function add($ticket)
{
+ while (is_array($ticket['location']) &&
list($input_name,$value) = each($ticket['location']))
+ {
+ if($value)
+ {
+ $cols[] = $input_name;
+ $vals[] = $value;
+ }
+ }
+
+
while (is_array($ticket['extra']) &&
list($input_name,$value) = each($ticket['extra']))
{
Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** class.uiproject.inc.php 4 Oct 2003 20:47:08 -0000 1.51
--- class.uiproject.inc.php 10 Oct 2003 21:57:13 -0000 1.52
***************
*** 22,25 ****
--- 22,26 ----
var $public_functions = array
(
+ 'excel' => True,
'index' => True,
'view' => True,
***************
*** 75,78 ****
--- 76,133 ----
}
+ function excel()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ require('PEAR.php');
+ $xls =
CreateObject($this->currentapp.'.excel');
+
+ $start_date =
urldecode(get_var('start_date',array('POST','GET')));
+ $end_date =
urldecode(get_var('end_date',array('POST','GET')));
+ $list =
$this->bo->read($start_date,$end_date,$allrows=True);
+
+ $uicols = $this->bo->uicols;
+ $count_uicols_name=count($uicols['name']);
+
+ $j=0;
+ if (isset($list) AND is_array($list))
+ {
+ $str=$xls->Begin();
+ foreach($list as $entry)
+ {
+ $m=0;
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+
if($uicols['input_type'][$k]!='hidden')
+ {
+ $content[$j][$m]
= $entry[$uicols['name'][$k]];
+
$str.=$xls->WriteLabel(0,$m,$uicols['descr'][$k]);
+ $m++;
+ }
+ }
+
+ $j++;
+ }
+
+ foreach($content as $row)
+ {
+ $line++;
+ for ($i=0; $i<count($row); $i++)
+ {
+
$str.=$xls->WriteLabel($line,$i,$row[$i]);
+ }
+ }
+
+ $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
+
+ $str.=$xls->EOF();
+ $size=strlen($str);
+
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,'application/vnd.ms-excel',$size);
+
+ echo $str;
+ }
+ }
+
function index()
{
***************
*** 288,299 ****
'lookup'
=>$lookup,
'query'
=>$this->query,
! 'start_date'=>$start_date,
! 'end_date'=>$end_date
);
$link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
$data = array
(
'start_date'
=>$start_date,
'end_date'
=>$end_date,
--- 343,373 ----
'lookup'
=>$lookup,
'query'
=>$this->query,
! 'start_date' =>$start_date,
! 'end_date'
=>$end_date
);
$link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'lookup'
=>$lookup,
+ 'query'
=>$this->query,
+ 'start_date' =>$start_date,
+ 'end_date'
=>$end_date
+ );
+
$data = array
(
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
'start_date'
=>$start_date,
'end_date'
=>$end_date,
Index: class.boproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boproject.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** class.boproject.inc.php 26 Sep 2003 18:04:34 -0000 1.17
--- class.boproject.inc.php 10 Oct 2003 21:57:14 -0000 1.18
***************
*** 285,289 ****
! function read($start_date='',$end_date='')
{
$start_date =
$this->bocommon->date_to_timestamp($start_date);
--- 285,289 ----
! function read($start_date='',$end_date='',$allrows='')
{
$start_date =
$this->bocommon->date_to_timestamp($start_date);
***************
*** 292,296 ****
$project = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,
!
'start_date'=>$start_date,'end_date'=>$end_date));
$this->total_records = $this->so->total_records;
--- 292,296 ----
$project = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,
!
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
$this->total_records = $this->so->total_records;
Index: class.soworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soworkorder.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** class.soworkorder.inc.php 26 Sep 2003 18:04:34 -0000 1.29
--- class.soworkorder.inc.php 10 Oct 2003 21:57:14 -0000 1.30
***************
*** 133,136 ****
--- 133,137 ----
$start_date =
(isset($data['start_date'])?$data['start_date']:'');
$end_date =
(isset($data['end_date'])?$data['end_date']:'');
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
***************
*** 180,187 ****
$uicols['statustext'][] =
lang('Workorder entry date');
! $cols .= ",fm_workorder.user_id as user_id";
! $cols_return[] =
'user_id';
$uicols['input_type'][] = 'text';
! $uicols['name'][] =
'user';
$uicols['descr'][] =
lang('User');
$uicols['statustext'][] =
lang('Workorder User');
--- 181,188 ----
$uicols['statustext'][] =
lang('Workorder entry date');
! $cols .= ",phpgw_accounts.account_lid as
user_lid";
! $cols_return[] =
'user_lid';
$uicols['input_type'][] = 'text';
! $uicols['name'][] =
'user_lid';
$uicols['descr'][] =
lang('User');
$uicols['statustext'][] =
lang('Workorder User');
***************
*** 193,201 ****
$uicols['descr'][] =
lang('Vendor ID');
-
$cols .= ",fm_project.user_id as project_owner";
!
! $joinmethod .= " $this->join fm_workorder ON
($entity_table.id = fm_workorder.project_id))";
$paranthesis .='(';
--- 194,200 ----
$uicols['descr'][] =
lang('Vendor ID');
$cols .= ",fm_project.user_id as project_owner";
! $joinmethod .= " $this->join fm_workorder ON
($entity_table.id = fm_workorder.project_id) $this->join phpgw_accounts ON
(fm_workorder.user_id = phpgw_accounts.account_id))";
$paranthesis .='(';
***************
*** 221,230 ****
$cols_return =
$this->bocommon->cols_return;
$type_id =
$this->bocommon->type_id;
! $this->cols_extra =
$this->bocommon->cols_extra;
$this->bocommon->fm_cache('uicols_workorder'.!!$search_vendor,$this->uicols);
$this->bocommon->fm_cache('cols_return_workorder'.!!$search_vendor,$cols_return);
$this->bocommon->fm_cache('type_id_workorder'.!!$search_vendor,$type_id);
!
$this->bocommon->fm_cache('cols_extra_workorder'.!!$search_vendor,$this->cols_extra);
}
--- 220,229 ----
$cols_return =
$this->bocommon->cols_return;
$type_id =
$this->bocommon->type_id;
! // $this->cols_extra =
$this->bocommon->cols_extra;
$this->bocommon->fm_cache('uicols_workorder'.!!$search_vendor,$this->uicols);
$this->bocommon->fm_cache('cols_return_workorder'.!!$search_vendor,$cols_return);
$this->bocommon->fm_cache('type_id_workorder'.!!$search_vendor,$type_id);
! //
$this->bocommon->fm_cache('cols_extra_workorder'.!!$search_vendor,$this->cols_extra);
}
***************
*** 234,238 ****
$cols_return =
$this->bocommon->fm_cache('cols_return_workorder'.!!$search_vendor);
$type_id =
$this->bocommon->fm_cache('type_id_workorder'.!!$search_vendor);
! $this->cols_extra =
$this->bocommon->fm_cache('cols_extra_workorder'.!!$search_vendor);
}
--- 233,237 ----
$cols_return =
$this->bocommon->fm_cache('cols_return_workorder'.!!$search_vendor);
$type_id =
$this->bocommon->fm_cache('type_id_workorder'.!!$search_vendor);
! // $this->cols_extra =
$this->bocommon->fm_cache('cols_extra_workorder'.!!$search_vendor);
}
***************
*** 293,300 ****
if($query)
{
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
! $querymethod = " $where (fm_workorder.title
LIKE '%$query%' or fm_workorder.descr LIKE '%$query%' or fm_project.address
LIKE '%$query%' or fm_project.location_code LIKE '%$query%')";
$where= 'AND';
--- 292,306 ----
if($query)
{
! if($query=explode(".",$query))
! {
! $querymethod = " $where
(fm_project.loc1='" . $query[0] . "' AND fm_project.loc".$type_id."='" .
$query[1] . "')";
! }
! else
! {
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
! $querymethod = " $where
(fm_workorder.title LIKE '%$query%' or fm_workorder.descr LIKE '%$query%' or
fm_project.address LIKE '%$query%' or fm_project.location_code LIKE '%$query%'
or fm_workorder.id LIKE '%$query%')";
! }
$where= 'AND';
***************
*** 317,321 ****
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
! $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
$count_cols_return=count($cols_return);
--- 323,334 ----
$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__);
! }
$count_cols_return=count($cols_return);
Index: hook_settings.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/hook_settings.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** hook_settings.inc.php 3 Oct 2003 16:01:26 -0000 1.14
--- hook_settings.inc.php 10 Oct 2003 21:57:13 -0000 1.15
***************
*** 52,55 ****
--- 52,69 ----
create_select_box('Default Priority
TTS','prioritydefault',$priority,'The default priority for tickets in the
Helpdesk-submodule');
+
+ $sotts= CreateObject($this->currentapp.'.sotts');
+ $category_tts= $sotts->select_category_list();
+ if ($category_tts)
+ {
+ while (list($key,$entry) = each($category_tts))
+ {
+ $_categories_tts[$entry['id']] = $entry['name'];
+ }
+ }
+
+ unset($sotts);
+ create_select_box('Default TTS
categories','tts_category',$_categories_tts,'The default category for TTS');
+
create_select_box('Default Degree Request
safety','default_safety',$degree,'The degree of seriousness');
create_select_box('Default Degree Request
aesthetics','default_aesthetics',$degree);
Index: class.bowo_hour.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bowo_hour.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** class.bowo_hour.inc.php 14 Jul 2003 10:36:43 -0000 1.10
--- class.bowo_hour.inc.php 10 Oct 2003 21:57:15 -0000 1.11
***************
*** 270,273 ****
--- 270,281 ----
foreach($values['select'] as $n)
{
+
+ if(!$values['quantity'][$n])
+ {
+ $values['quantity'][$n]=1;
+ }
+
+ $values['quantity'][$n] =
str_replace(",",".",$values['quantity'][$n]);
+
$cost=($values['total_cost'][$n]*$values['quantity'][$n]);
--- NEW FILE: class.uiadmin_entity.inc.php ---
<?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 uiadmin_entity
{
var $grants;
var $start;
var $query;
var $sort;
var $order;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'category' => True,
'edit' => True,
'edit_category' => True,
'view' => True,
'delete' => True,
'list_attribute' => True,
'edit_attrib' => True,
);
function uiadmin_entity()
{
$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.'.boadmin_entity',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->allrows =
$this->bo->allrows;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'admin_entity');
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
);
$this->bo->save_sessiondata($data);
}
function index()
{
$this->bo->reset_fm_cache();
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_entity',
'nextmatchs',
'menu',
'search_field'));
$links = $this->bocommon->menu();
$entity_list = $this->bo->read();
if (isSet($entity_list) AND is_array($entity_list))
{
foreach($entity_list as $entry)
{
$content[] = array
(
'id'
=> $entry['id'],
'name'
=> $entry['name'],
'descr'
=> $entry['descr'],
'link_categories'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.category&entity_id='
. $entry['id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit&id='
. $entry['id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.delete&entity_id='
. $entry['id']),
'lang_view_standardtext'
=> lang('view the standard'),
'lang_category_text'
=> lang('categories for the entity type'),
'lang_edit_standardtext'
=> lang('edit the entity'),
'lang_delete_standardtext'
=> lang('delete the entity'),
'text_categories'
=> lang('Categories'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
}
//_debug_array($content);
$table_header[] = array
(
'lang_descr' => lang('Descr'),
'lang_categories' => lang('Categories'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_entity.index')
)),
'lang_id' => lang('entity id'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_entity.index')
)),
'lang_name' => lang('Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_standardtext' => lang('add a
standard'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit'),
'lang_done' =>
lang('done'),
'lang_done_standardtext' => lang('back
to admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'query'
=>$this->query
);
$data = array
(
'links'
=> $links,
'allow_allrows'
=> True,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($entity_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'),
'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('entity');
$function_msg =
lang('list entity type');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
}
function category()
{
$entity_id =
get_var('entity_id',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_entity',
'nextmatchs',
'menu',
'search_field'));
$links = $this->bocommon->menu();
$category_list = $this->bo->read_category($entity_id);
if (isSet($category_list) AND is_array($category_list))
{
foreach($category_list as $entry)
{
$content[] = array
(
'id'
=> $entry['id'],
'name'
=> $entry['name'],
'prefix'
=> $entry['prefix'],
'descr'
=> $entry['descr'],
'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.list_attribute&cat_id='
. $entry['id'] . '&entity_id=' . $entity_id),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_category&id='
. $entry['id'] . '&entity_id=' . $entity_id),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.delete&cat_id='
. $entry['id'] . '&entity_id=' . $entity_id),
'lang_view_standardtext'
=> lang('view the category'),
'lang_attribute_standardtext'
=> lang('attributes for the entity type'),
'lang_edit_standardtext'
=> lang('edit the standard'),
'lang_delete_standardtext'
=> lang('delete the standard'),
'text_attribute'
=> lang('Attributes'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
}
//_debug_array($content);
$table_header[] = array
(
'lang_descr' => lang('Descr'),
'lang_prefix' => lang('prefix'),
'lang_attribute' => lang('Attributes'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_entity.category',
'entity_id' =>$entity_id)
)),
'lang_id' => lang('category id'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_entity.category',
'entity_id' =>$entity_id)
)),
'lang_name' => lang('Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_standardtext' => lang('add a
category'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_category&entity_id='
. $entity_id),
'lang_done' =>
lang('done'),
'lang_done_standardtext' => lang('back
to entity'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.index')
);
$entity = $this->bo->read_single($entity_id,false);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.category',
'sort'
=>$this->sort,
'order'
=>$this->order,
'query'
=>$this->query,
'entity_id'
=>$entity_id
);
$data = array
(
'lang_entity'
=> lang('entity'),
'entity_name'
=> $entity['name'],
'links'
=> $links,
'allow_allrows'
=> True,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($category_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'),
'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header_category' =>
$table_header,
'values_category'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('entity');
$function_msg =
lang('list entity type');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_category' => $data));
$this->save_sessiondata();
}
function edit()
{
$id = get_var('id',array('POST','GET'));
$values =
get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
if ($values['save'])
{
if (!$values['name'])
{
$receipt['error'][] =
array('msg'=>lang('Name not entered!'));
}
if($id)
{
$values['id']=$id;
$action='edit';
}
if (!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
if(!$id)
{
$id=$receipt['id'];
}
}
else
{
$receipt['error'][] = array('msg'=>
lang('Entity has NOT been saved'));
}
}
if ($id)
{
$values = $this->bo->read_single($id);
$function_msg = lang('edit standard');
$action='edit';
}
else
{
$function_msg = lang('add entity');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.edit',
'id' => $id
);
//_debug_array($link_data);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'lang_name_standardtext' =>
lang('Enter a name of the standard'),
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.index'),
'lang_id'
=> lang('standard ID'),
'lang_name'
=> lang('Name'),
'lang_descr'
=> lang('Descr'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'value_name'
=> $values['name'],
'lang_id_standardtext' =>
lang('Enter the standard ID'),
'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
'lang_done_standardtext' =>
lang('Back to the list'),
'lang_save_standardtext' =>
lang('Save the standard'),
'type_id'
=> $values['type_id'],
'value_descr'
=> $values['descr']
);
$appname
= lang('entity');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function edit_category()
{
$entity_id =
get_var('entity_id',array('POST','GET'));
$id = get_var('id',array('POST','GET'));
$values =
get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
if ($values['save'])
{
$values['entity_id'] = $entity_id;
if (!$values['name'])
{
$receipt['error'][] =
array('msg'=>lang('Name not entered!'));
}
if (!$values['entity_id'])
{
$receipt['error'][] =
array('msg'=>lang('Entity not choosen'));
}
if($id)
{
$values['id']=$id;
$action='edit';
}
if (!$receipt['error'])
{
$receipt =
$this->bo->save_category($values,$action);
if(!$id)
{
$id=$receipt['id'];
}
}
else
{
$receipt['error'][] = array('msg'=>
lang('Category has NOT been saved'));
}
}
if ($id)
{
$values =
$this->bo->read_single_category($id,$entity_id);
$function_msg = lang('edit category');
$action='edit';
}
else
{
$function_msg = lang('add category');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.edit_category',
'entity_id' =>$entity_id,
'id' => $id
);
//_debug_array($link_data);
$entity = $this->bo->read_single($entity_id,false);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'lang_entity'
=> lang('entity'),
'entity_name'
=> $entity['name'],
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id of the equipments'),
'lang_name_standardtext' =>
lang('Enter a name of the standard'),
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.category&entity_id='
. $entity_id),
'lang_id'
=> lang('Category'),
'lang_name'
=> lang('Name'),
'lang_descr'
=> lang('Descr'),
'lang_prefix'
=> lang('Prefix'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'value_name'
=> $values['name'],
'value_prefix'
=> $values['prefix'],
'lang_id_standardtext' =>
lang('Enter the standard ID'),
'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
'lang_done_standardtext' =>
lang('Back to the list'),
'lang_save_standardtext' =>
lang('Save the standard'),
'type_id'
=> $values['type_id'],
'value_descr'
=> $values['descr']
);
$appname
= lang('entity');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$entity_id =
get_var('entity_id',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$attrib_id =
get_var('attrib_id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
if($attrib_id)
{
$function='list_attribute';
}
else
{
if($cat_id)
{
$function='category';
}
else
{
$function='index';
}
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.'.$function,
'cat_id' => $cat_id,
'entity_id' => $entity_id
);
$delete_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.delete',
'cat_id' => $cat_id,
'entity_id' => $entity_id,
'attrib_id' => $attrib_id
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($cat_id,$entity_id,$attrib_id);
Header('Location: ' .
$GLOBALS['phpgw']->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',$delete_data),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_standardtext' => lang('Delete the
entry'),
'lang_no_standardtext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname
= lang('entity');
$function_msg =
lang('delete entity type');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function list_attribute()
{
$entity_id =
get_var('entity_id',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_entity',
'nextmatchs',
'search_field'));
$attrib_list =
$this->bo->read_attrib($entity_id,$cat_id);
if (isset($attrib_list) AND is_array($attrib_list))
{
foreach($attrib_list as $entry)
{
$content[] = array
(
'name'
=> $entry['name'],
'datatype'
=> $entry['datatype'],
'column_name'
=> $entry['column_name'],
'input_text'
=> $entry['input_text'],
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_attrib&entity_id='
. $entity_id . '&cat_id=' . $cat_id . '&id=' . $entry['id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.delete&entity_id='
. $entity_id . '&cat_id=' . $cat_id . '&attrib_id=' . $entry['id']),
'lang_view_attribtext'
=> lang('view the attrib'),
'lang_attribute_attribtext'
=> lang('attributes for the attrib'). ' ' . lang('entity'),
'lang_edit_attribtext'
=> lang('edit the attrib'),
'lang_delete_attribtext'
=> lang('delete the attrib'),
'text_attribute'
=> lang('Attributes'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
}
//_debug_array($content);
$table_header[] = array
(
'lang_descr' => lang('Descr'),
'lang_datatype' => lang('Datatype'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'column_name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_entity.list_attribute',
'entity_id'
=>$entity_id,
'cat_id'
=>$cat_id)
)),
'lang_name' => lang('Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_attribtext' => lang('add a attrib'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_attrib&entity_id='.$entity_id
. '&cat_id=' . $cat_id),
'lang_done' =>
lang('done'),
'lang_done_attribtext' => lang('back to
admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.category&entity_id='.$entity_id),
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.list_attribute',
'sort'
=>$this->sort,
'order'
=>$this->order,
'query'
=>$this->query,
'entity_id'
=>$entity_id,
'cat_id'
=>$cat_id
);
$entity = $this->bo->read_single($entity_id,false);
$category =
$this->bo->read_single_category($cat_id,$entity_id);
$data = array
(
'lang_entity'
=> lang('entity'),
'entity_name'
=> $entity['name'],
'lang_category'
=> lang('category'),
'category_name'
=> $category['name'],
'allow_allrows'
=> True,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'start_record'
=> $this->start,
'num_records'
=> count($attrib_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'),
'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_attribtext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header_attrib' =>
$table_header,
'values_attrib'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('attribute');
$function_msg =
lang('list entity attribute');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
$this->save_sessiondata();
}
function edit_attrib()
{
$entity_id =
get_var('entity_id',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$id =
get_var('id',array('POST','GET'));
$values = get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
if ($values['save'])
{
if($id)
{
$values['id']=$id;
$action='edit';
}
$values['entity_id']=$entity_id;
$values['cat_id']=$cat_id;
if (!$values['column_name'])
{
$receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
}
if (!$values['input_text'])
{
$receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
}
if (!$values['statustext'])
{
$receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
}
if (!$values['entity_id'])
{
$receipt['error'][] =
array('msg'=>lang('entity type not choosen!'));
}
if (!$values['column_info']['type'])
{
$receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
}
if(!ctype_digit($values['column_info']['precision']))
{
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
unset($values['column_info']['precision']);
}
if(!ctype_digit($values['column_info']['scale']))
{
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
unset($values['column_info']['scale']);
}
if (!$values['column_info']['nullable'])
{
$receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
}
if (!$receipt['error'])
{
$receipt =
$this->bo->save_attrib($values,$action);
if(!$id)
{
$id=$receipt['id'];
}
}
else
{
$receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
}
}
if ($id)
{
$values =
$this->bo->read_single_attrib($entity_id,$cat_id,$id);
$type_name=$values['type_name'];
$function_msg = lang('edit attribute'). ' ' .
lang($type_name);
$action='edit';
}
else
{
$function_msg = lang('add attribute');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_entity.edit_attrib',
'entity_id' => $entity_id,
'cat_id' => $cat_id,
'id' => $id
);
if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH')
{
$multiple_choice= True;
}
//_debug_array($values);
$entity = $this->bo->read_single($entity_id,false);
$category =
$this->bo->read_single_category($cat_id,$entity_id);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'lang_entity'
=> lang('entity'),
'entity_name'
=> $entity['name'],
'lang_category'
=> lang('category'),
'category_name'
=> $category['name'],
'lang_choice' =>
lang('Choice'),
'lang_new_value' =>
lang('New value'),
'lang_new_value_statustext' => lang('New
value for mulitple choice'),
'multiple_choice' =>
$multiple_choice,
'value_choice' =>
$values['choice'],
'lang_delete_value' =>
lang('Delete value'),
'lang_value' =>
lang('value'),
'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.list_attribute&entity_id='.$entity_id
. '&cat_id='.$cat_id),
'lang_id'
=> lang('Attribute ID'),
'lang_entity_type' =>
lang('Entity type'),
'lang_no_entity_type' => lang('No
entity type'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'lang_column_name'
=> lang('Column name'),
'value_column_name'
=> $values['column_name'],
'lang_column_name_statustext' => lang('enter
the name for the column'),
'lang_input_text'
=> lang('input text'),
'value_input_text'
=> $values['input_text'],
'lang_input_name_statustext' => lang('enter
the input text for records'),
'lang_id_attribtext' => lang('Enter
the attribute ID'),
'lang_entity_statustext' => lang('Select
a entity type'),
'lang_statustext' =>
lang('Statustext'),
'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
'value_statustext' =>
$values['statustext'],
'lang_done_attribtext' => lang('Back
to the list'),
'lang_save_attribtext' => lang('Save
the attribute'),
'lang_datatype' =>
lang('Datatype'),
'lang_datatype_statustext' => lang('Select
a datatype'),
'lang_no_datatype' =>
lang('No datatype'),
'datatype_list' =>
$this->bo->select_datatype($values['column_info']['type']),
'lang_precision' =>
lang('Precision'),
'lang_precision_statustext' => lang('enter
the record length'),
'value_precision' =>
$values['column_info']['precision'],
'lang_scale' =>
lang('scale'),
'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
'value_scale' =>
$values['column_info']['scale'],
'lang_default' =>
lang('default'),
'lang_default_statustext' => lang('enter
the default value'),
'value_default' =>
$values['column_info']['default'],
'lang_nullable' =>
lang('Nullable'),
'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
'lang_select_nullable' => lang('Select
nullable'),
'nullable_list' =>
$this->bo->select_nullable($values['column_info']['nullable']),
'value_lookup_form' =>
$values['lookup_form'],
'lang_lookup_form'
=> lang('show in lookup forms'),
'lang_lookup_form_statustext'
=> lang('check to show this attribue in lookup forms'),
'value_list' =>
$values['list'],
'lang_list' =>
lang('show in list'),
'lang_list_statustext' =>
lang('check to show this attribute in entity list')
);
//_debug_array($data);
$appname
= lang('entity');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
}
}
?>
Index: class.uiworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiworkorder.inc.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** class.uiworkorder.inc.php 4 Oct 2003 20:47:08 -0000 1.45
--- class.uiworkorder.inc.php 10 Oct 2003 21:57:13 -0000 1.46
***************
*** 22,25 ****
--- 22,26 ----
var $public_functions = array
(
+ 'excel' => True,
'index' => True,
'view' => True,
***************
*** 76,79 ****
--- 77,135 ----
}
+ function excel()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ require('PEAR.php');
+ $xls =
CreateObject($this->currentapp.'.excel');
+
+ $start_date =
urldecode(get_var('start_date',array('POST','GET')));
+ $end_date =
urldecode(get_var('end_date',array('POST','GET')));
+ $list =
$this->bo->read($start_date,$end_date,$allrows=True);
+
+ $uicols = $this->bo->uicols;
+ $count_uicols_name=count($uicols['name']);
+
+ $j=0;
+ if (isset($list) AND is_array($list))
+ {
+ $str=$xls->Begin();
+ foreach($list as $entry)
+ {
+ $m=0;
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+
if($uicols['input_type'][$k]!='hidden')
+ {
+ $content[$j][$m]
= $entry[$uicols['name'][$k]];
+
$str.=$xls->WriteLabel(0,$m,$uicols['descr'][$k]);
+ $m++;
+ }
+ }
+
+ $j++;
+ }
+
+ foreach($content as $row)
+ {
+ $line++;
+ for ($i=0; $i<count($row); $i++)
+ {
+
$str.=$xls->WriteLabel($line,$i,$row[$i]);
+ }
+ }
+
+ $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
+
+ $str.=$xls->EOF();
+ $size=strlen($str);
+
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,'application/vnd.ms-excel',$size);
+
+ echo $str;
+ }
+ }
+
+
function index()
{
***************
*** 320,331 ****
'query'
=>$this->query,
'search_vendor'
=>$this->search_vendor,
! 'start_date'=>$start_date,
! 'end_date'=>$end_date
);
$link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
$data = array
(
'start_date'
=>$start_date,
'end_date'
=>$end_date,
--- 376,406 ----
'query'
=>$this->query,
'search_vendor'
=>$this->search_vendor,
! 'start_date' =>$start_date,
! 'end_date'
=>$end_date
);
$link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'status_id'
=>$this->status_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'search_vendor'
=>$this->search_vendor,
+ 'start_date' =>$start_date,
+ 'end_date'
=>$end_date
+ );
+
$data = array
(
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
'start_date'
=>$start_date,
'end_date'
=>$end_date,
Index: class.soadmin_location.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soadmin_location.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** class.soadmin_location.inc.php 27 Aug 2003 16:35:12 -0000 1.18
--- class.soadmin_location.inc.php 10 Oct 2003 21:57:15 -0000 1.19
***************
*** 446,494 ****
$attrib['id'] =
$this->next_id('fm_location_type_column');
! if($attrib['column_info']['scale'])
! {
! $scale="'".$attrib['column_info']['scale']."'";
! }
! else
! {
! $scale='NULL';
! }
! if($attrib['column_info']['default'])
! {
!
$default="'".$attrib['column_info']['default']."'";
! }
! else
! {
! $default='NULL';
! }
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_location_type_column
(id,column_name, input_text, statustext, type_id,lookup_form,list,
datatype,precision_,scale,default_value,nullable) "
! . "VALUES ('" .
! $attrib['id'] . "','" .
! $attrib['column_name'] . "','" .
! $attrib['input_text'] . "','" .
! $attrib['statustext'] . "','" .
! $attrib['type_id'] . "','" .
! $attrib['lookup_form'] . "','" .
! $attrib['list'] . "','" .
! $attrib['column_info']['type'] . "'," .
! $attrib['column_info']['precision'] . "," .
! $scale . "," .
! $default . ",'" .
! $attrib['column_info']['nullable'].
"')",__LINE__,__FILE__);
$receipt['id']= $attrib['id'];
! $this->init_process();
! if($attrib['column_info']['type']=='date')
{
- $attrib['column_info']['type']='int';
$attrib['column_info']['precision']=4;
}
if($this->oProc->AddColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],
$attrib['column_info']))
{
--- 446,483 ----
$attrib['id'] =
$this->next_id('fm_location_type_column');
! $values= array(
! $attrib['id'],
! $attrib['column_name'],
! $attrib['input_text'],
! $attrib['statustext'],
! $attrib['type_id'],
! $attrib['lookup_form'],
! $attrib['list'],
! $attrib['column_info']['type'],
! $attrib['column_info']['precision'],
! $attrib['column_info']['scale'],
! $attrib['column_info']['default'],
! $attrib['column_info']['nullable']
! );
!
! $values = $this->bocommon->validate_db_insert($values);
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_location_type_column
(id,column_name, input_text, statustext, type_id,lookup_form,list,
datatype,precision_,scale,default_value,nullable) "
! . "VALUES ($values)",__LINE__,__FILE__);
$receipt['id']= $attrib['id'];
! $attrib['column_info']['type'] =
$this->bocommon->translate_datatype_insert($attrib['column_info']['type']);
! if($attrib['column_info']['type']=='int' &&
!$attrib['column_info']['precision'])
{
$attrib['column_info']['precision']=4;
}
+ $this->init_process();
+
if($this->oProc->AddColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],
$attrib['column_info']))
{
***************
*** 601,618 ****
}
! $this->db->query("UPDATE fm_location_type_column set
! column_name = '".
$attrib['column_name'] . "',
! input_text = '".
$attrib['input_text'] . "',
! statustext = '".
$attrib['statustext'] . "',
! type_id = '".
$attrib['type_id'] . "',
! lookup_form = '".
$attrib['lookup_form'] . "',
! list = '". $attrib['list'] .
"',
! datatype = '".
$attrib['column_info']['type'] . "',
! precision_ = '".
$attrib['column_info']['precision'] . "',
! scale = " . $scale . ",
! default_value = " . $default . ",
! nullable = '".
$attrib['column_info']['nullable']
! . "' WHERE id='" . $attrib['id'].
"'",__LINE__,__FILE__);
$this->init_process();
--- 590,612 ----
}
+ $value_set=array(
+ 'column_name' =>
$attrib['column_name'],
+ 'input_text' =>
$attrib['input_text'],
+ 'statustext' =>
$attrib['statustext'],
+ 'type_id' =>
$attrib['type_id'],
+ 'lookup_form' =>
$attrib['lookup_form'],
+ 'list' => $attrib['list'],
+ 'datatype' =>
$attrib['column_info']['type'],
+ 'precision_' =>
$attrib['column_info']['precision'],
+ 'scale' =>
$attrib['column_info']['scale'],
+ 'default_value' =>
$attrib['column_info']['default'],
+ 'nullable' =>
$attrib['column_info']['nullable']
+ );
+
+ $value_set =
$this->bocommon->validate_db_update($value_set);
!
!
! $this->db->query("UPDATE fm_location_type_column set
$value_set WHERE id=" . $attrib['id'],__LINE__,__FILE__);
$this->init_process();
Index: class.boworkorder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boworkorder.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** class.boworkorder.inc.php 26 Sep 2003 18:04:34 -0000 1.17
--- class.boworkorder.inc.php 10 Oct 2003 21:57:14 -0000 1.18
***************
*** 296,300 ****
! function read($start_date='',$end_date='')
{
$start_date =
$this->bocommon->date_to_timestamp($start_date);
--- 296,300 ----
! function read($start_date='',$end_date='',$allrows='')
{
$start_date =
$this->bocommon->date_to_timestamp($start_date);
***************
*** 303,307 ****
$workorder = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'search_vendor' => $this->search_vendor,
!
'start_date'=>$start_date,'end_date'=>$end_date));
$this->total_records = $this->so->total_records;
--- 303,307 ----
$workorder = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'search_vendor' => $this->search_vendor,
!
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
$this->total_records = $this->so->total_records;
***************
*** 309,324 ****
$this->uicols = $this->so->uicols;
! $cols_extra = $this->so->cols_extra;
for ($i=0; $i<count($workorder); $i++)
{
- $workorder[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($workorder[$i]['user_id']);
$workorder[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($workorder[$i]['entry_date'],$dateformat);
-
$location_data=$this->solocation->read_single($workorder[$i]['location_code']);
for ($j=0;$j<count($cols_extra);$j++)
{
$workorder[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
}
}
--- 309,324 ----
$this->uicols = $this->so->uicols;
! // $cols_extra = $this->so->cols_extra;
for ($i=0; $i<count($workorder); $i++)
{
$workorder[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($workorder[$i]['entry_date'],$dateformat);
+ /*
$location_data=$this->solocation->read_single($workorder[$i]['location_code']);
for ($j=0;$j<count($cols_extra);$j++)
{
$workorder[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
}
+ */
}
Index: class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uitts.inc.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** class.uitts.inc.php 24 Sep 2003 15:40:50 -0000 1.38
--- class.uitts.inc.php 10 Oct 2003 21:57:14 -0000 1.39
***************
*** 92,100 ****
while (is_array($ticket_list) && list(,$ticket) =
each($ticket_list))
{
- $words = split(' ',$ticket['subject']);
- $first = "$words[0] $words[1] $words[2]
$words[3] .....";
-
$priostr = '';
-
while ($ticket['priority'] > 0)
{
--- 92,96 ----
***************
*** 102,107 ****
$ticket['priority']--;
}
- //_debug_array($ticket);
-
$content[] = array
(
--- 98,101 ----
***************
*** 109,115 ****
'new_ticket'
=> $ticket['new_ticket'],
'priostr'
=> $priostr,
! 'first'
=> $first,
'location_code'
=> $ticket['location_code'],
! 'address'
=> $ticket['location_data']['street_name'] . ' ' .
$ticket['location_data']['street_number'],
'date'
=> $ticket['timestampopened'],
'user'
=> $ticket['user'],
--- 103,109 ----
'new_ticket'
=> $ticket['new_ticket'],
'priostr'
=> $priostr,
! 'first'
=> $ticket['category'],
'location_code'
=> $ticket['location_code'],
! 'address'
=> $ticket['address'],
'date'
=> $ticket['timestampopened'],
'user'
=> $ticket['user'],
***************
*** 140,144 ****
(
'sort' => $this->sort,
!
'var' => 'id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
--- 134,138 ----
(
'sort' => $this->sort,
!
'var' => 'fm_tts_tickets.id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
***************
*** 148,158 ****
)),
! 'lang_id' => lang('Ticket ID'),
'lang_id_statustext' => lang('Sort
the tickets by their ID'),
! 'lang_subject' =>
lang('Subject'),
'lang_time_created' => lang('Started'),
'lang_view' => lang('view'),
! 'lang_location_code' => lang('Location
code'),
'lang_address' => lang('Address'),
'lang_user' => lang('user'),
--- 142,152 ----
)),
! 'lang_id' => lang('ID'),
'lang_id_statustext' => lang('Sort
the tickets by their ID'),
! 'lang_subject' =>
lang('Category'),
'lang_time_created' => lang('Started'),
'lang_view' => lang('view'),
! 'lang_location_code' => lang('Location'),
'lang_address' => lang('Address'),
'lang_user' => lang('user'),
***************
*** 171,175 ****
(
'sort' => $this->sort,
!
'var' => 'user_id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
--- 165,169 ----
(
'sort' => $this->sort,
!
'var' => 'user',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
***************
*** 283,294 ****
$values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
! if(!$values['subject'])
{
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
}
! if(!$values['assignedto'])
{
!
$receipt['error'][]=array('msg'=>lang('Please select a person to handle the
ticket !'));
}
--- 277,288 ----
$values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
! /* if(!$values['subject'])
{
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
}
! */ if(!$values['assignedto'] &&
!$values['group_id'])
{
!
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to
handle the ticket !'));
}
***************
*** 346,349 ****
--- 340,348 ----
{
$values['group_id']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['groupdefault'];
+ }
+
+ if(!$values['cat_id'])
+ {
+ $this->cat_id =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_category'];
}
--- NEW FILE: class.boadmin_entity.inc.php ---
<?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 boadmin_entity
{
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 boadmin_entity($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.soadmin_entity');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
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))
{
$this->cat_id = $cat_id;
}
if(isset($allrows))
{
$this->allrows = $allrows;
}
}
function save_sessiondata($data)
{
if ($this->use_session)
{
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
$this->start = $data['start'];
$this->query = $data['query'];
$this->filter = $data['filter'];
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
$this->allrows = $data['allrows'];
}
function reset_fm_cache()
{
$this->so->reset_fm_cache();
}
function read()
{
$entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,'allrows'=>$this->allrows));
$this->total_records = $this->so->total_records;
return $entity;
}
function read_category($entity_id)
{
$category = $this->so->read_category(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,
'order' =>
$this->order,'allrows'=>$this->allrows,'entity_id'=>$entity_id));
$this->total_records = $this->so->total_records;
return $category;
}
function read_config()
{
$standard = $this->so->read_config(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
$this->total_records = $this->so->total_records;
return $standard;
}
function read_config_single($column_name)
{
return $this->so->read_config_single($column_name);
}
function read_single($id)
{
return $this->so->read_single($id);
}
function read_single_category($id,$entity_id)
{
return $this->so->read_single_category($id,$entity_id);
}
function save($values,$action='')
{
if ($action=='edit')
{
if ($values['id'] != '')
{
$receipt =
$this->so->edit_entity($values);
}
}
else
{
$receipt = $this->so->add_entity($values);
}
return $receipt;
}
function save_category($values,$action='')
{
if ($action=='edit')
{
if ($values['id'] != '')
{
$receipt =
$this->so->edit_category($values);
}
}
else
{
$receipt = $this->so->add_category($values);
}
return $receipt;
}
function delete($cat_id='',$entity_id='',$attrib_id='')
{
if(!$attrib_id && !$cat_id && $entity_id):
{
$this->so->delete_entity($entity_id);
}
elseif(!$attrib_id && $cat_id && $entity_id):
{
$this->so->delete_category($cat_id,$entity_id);
}
elseif($attrib_id && $cat_id && $entity_id):
{
$this->so->delete_attrib($cat_id,$entity_id,$attrib_id);
}
endif;
}
function read_attrib($entity_id='',$cat_id='')
{
$attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'cat_id' => $cat_id,'entity_id' =>
$entity_id,'allrows'=>$this->allrows));
for ($i=0; $i<count($attrib); $i++)
{
$attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
}
$this->total_records = $this->so->total_records;
return $attrib;
}
function read_single_attrib($entity_id,$cat_id,$id)
{
return
$this->so->read_single_attrib($entity_id,$cat_id,$id);
}
function save_attrib($attrib,$action='')
{
if ($action=='edit')
{
if ($attrib['id'] != '')
{
$receipt =
$this->so->edit_attrib($attrib);
}
}
else
{
$receipt = $this->so->add_attrib($attrib);
}
return $receipt;
}
function save_config($values='',$column_name='')
{
return
$this->so->save_config($values,$column_name);
}
function select_datatype($selected='')
{
$datatypes[0]['id']= 'V';
$datatypes[0]['name']= lang('varchar');
$datatypes[1]['id']= 'C';
$datatypes[1]['name']= lang('Character');
$datatypes[2]['id']= 'I';
$datatypes[2]['name']= lang('Integer');
$datatypes[3]['id']= 'N';
$datatypes[3]['name']= lang('Decimal');
$datatypes[4]['id']= 'D';
$datatypes[4]['name']= lang('Date');
$datatypes[5]['id']= 'T';
$datatypes[5]['name']= lang('Memo');
$datatypes[6]['id']= 'R';
$datatypes[6]['name']= lang('Multiple radio');
$datatypes[7]['id']= 'CH';
$datatypes[7]['name']= lang('Multiple Checkbox');
while (is_array($datatypes) && list(,$type) =
each($datatypes))
{
$sel_type = '';
if ($type['id']==$selected)
{
$sel_type = 'selected';
}
$datatype_list[] = array
(
'id' => $type['id'],
'name' => $type['name'],
'selected' => $sel_type
);
}
for ($i=0;$i<count($datatype_list);$i++)
{
if ($datatype_list[$i]['selected'] !=
'selected')
{
unset($datatype_list[$i]['selected']);
}
}
return $datatype_list;
}
function select_nullable($selected='')
{
$nullable[0]['id']= 'True';
$nullable[0]['name']= lang('True');
$nullable[1]['id']= 'False';
$nullable[1]['name']= lang('False');
while (is_array($nullable) && list(,$type) =
each($nullable))
{
$sel_type = '';
if ($type['id']==$selected)
{
$sel_type = 'selected';
}
$nullable_list[] = array
(
'id' => $type['id'],
'name' => $type['name'],
'selected' => $sel_type
);
}
for ($i=0;$i<count($nullable_list);$i++)
{
if ($nullable_list[$i]['selected'] !=
'selected')
{
unset($nullable_list[$i]['selected']);
}
}
return $nullable_list;
}
}
?>
Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** class.soproject.inc.php 26 Sep 2003 18:04:34 -0000 1.40
--- class.soproject.inc.php 10 Oct 2003 21:57:14 -0000 1.41
***************
*** 117,120 ****
--- 117,121 ----
$start_date =
(isset($data['start_date'])?$data['start_date']:'');
$end_date =
(isset($data['end_date'])?$data['end_date']:'');
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
***************
*** 243,250 ****
if($query)
{
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
!
! $querymethod = " $where (fm_project.name LIKE
'%$query%' or fm_project.address LIKE '%$query%' or fm_project.location_code
LIKE '%$query%')";
}
--- 244,257 ----
if($query)
{
! if($query=explode(".",$query))
! {
! $querymethod = " $where
(fm_project.loc1='" . $query[0] . "' AND fm_project.loc".$type_id."='" .
$query[1] . "')";
! }
! else
! {
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
! $querymethod = " $where
(fm_project.name LIKE '%$query%' or fm_project.address LIKE '%$query%' or
fm_project.location_code LIKE '%$query%' or fm_project.id LIKE '%$query%')";
! }
}
***************
*** 253,257 ****
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
! $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
--- 260,271 ----
$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__);
! }
Index: class.soreport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soreport.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** class.soreport.inc.php 29 Sep 2003 21:29:18 -0000 1.12
--- class.soreport.inc.php 10 Oct 2003 21:57:14 -0000 1.13
***************
*** 148,151 ****
--- 148,153 ----
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+ $type_id = $this->bocommon->type_id;
+
if ($order)
{
***************
*** 209,216 ****
if($query)
{
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
!
! $querymethod = " $where fm_report.location_code
LIKE '%$query%' or fm_report.title LIKE '%$query%' or fm_report.address LIKE
'%$query%'";
}
--- 211,224 ----
if($query)
{
! if($query=explode(".",$query))
! {
! $querymethod = " $where
(fm_report.loc1='" . $query[0] . "' AND fm_report.loc".$type_id."='" .
$query[1] . "')";
! }
! else
! {
! $query = ereg_replace("'",'',$query);
! $query = ereg_replace('"','',$query);
! $querymethod = " $where
fm_report.location_code LIKE '%$query%' or fm_report.title LIKE '%$query%' or
fm_report.address LIKE '%$query%'";
! }
}
***************
*** 219,223 ****
$this->uicols = $this->bocommon->uicols;
$cols_return = $this->bocommon->cols_return;
- $type_id =
$this->bocommon->type_id;
$this->cols_extra = $this->bocommon->cols_extra;
--- 227,230 ----
Index: class.bostandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bostandard_entity.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** class.bostandard_entity.inc.php 1 Oct 2003 19:26:45 -0000 1.12
--- class.bostandard_entity.inc.php 10 Oct 2003 21:57:14 -0000 1.13
***************
*** 166,170 ****
for ($i=0; $i<count($attrib); $i++)
{
! $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype_attributes($attrib[$i]['datatype']);
}
--- 166,170 ----
for ($i=0; $i<count($attrib); $i++)
{
! $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
}
Index: class.boadmin_location.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boadmin_location.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** class.boadmin_location.inc.php 27 Aug 2003 16:35:12 -0000 1.5
--- class.boadmin_location.inc.php 10 Oct 2003 21:57:15 -0000 1.6
***************
*** 180,183 ****
--- 180,188 ----
'type_id' => $type_id));
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
$this->total_records = $this->so->total_records;
***************
*** 246,261 ****
function select_datatype($selected='')
{
! $datatypes[0]['id']= 'varchar';
$datatypes[0]['name']= lang('varchar');
! $datatypes[1]['id']= 'char';
! $datatypes[1]['name']= lang('char');
! $datatypes[2]['id']= 'int';
! $datatypes[2]['name']= lang('integer');
! $datatypes[3]['id']= 'text';
! $datatypes[3]['name']= lang('text');
! $datatypes[4]['id']= 'decimal';
! $datatypes[4]['name']= lang('decimal');
! $datatypes[5]['id']= 'date';
! $datatypes[5]['name']= lang('date');
while (is_array($datatypes) && list(,$type) =
each($datatypes))
--- 251,272 ----
function select_datatype($selected='')
{
! $datatypes[0]['id']= 'V';
$datatypes[0]['name']= lang('varchar');
! $datatypes[1]['id']= 'C';
! $datatypes[1]['name']= lang('Character');
! $datatypes[2]['id']= 'I';
! $datatypes[2]['name']= lang('Integer');
! $datatypes[3]['id']= 'N';
! $datatypes[3]['name']= lang('Decimal');
! $datatypes[4]['id']= 'D';
! $datatypes[4]['name']= lang('Date');
! $datatypes[5]['id']= 'T';
! $datatypes[5]['name']= lang('Memo');
! $datatypes[6]['id']= 'R';
! $datatypes[6]['name']= lang('Multiple radio');
! $datatypes[7]['id']= 'CH';
! $datatypes[7]['name']= lang('Multiple Checkbox');
!
!
while (is_array($datatypes) && list(,$type) =
each($datatypes))
Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** class.bocommon.inc.php 3 Oct 2003 16:01:26 -0000 1.83
--- class.bocommon.inc.php 10 Oct 2003 21:57:13 -0000 1.84
***************
*** 541,545 ****
$attributes_values[$i]['lang_attribute_statustext'] = lang('Enter the attribute
value for this entity');
! $attributes_values[$i]['datatype_text'] =
$this->translate_datatype_attributes($attributes_values[$i]['datatype']);
$attributes_values[$i]['counter'] = $i;
$attributes_values[$i]['type_id'] =
$data['type_id'];
--- 541,545 ----
$attributes_values[$i]['lang_attribute_statustext'] = lang('Enter the attribute
value for this entity');
! $attributes_values[$i]['datatype_text'] =
$this->translate_datatype($attributes_values[$i]['datatype']);
$attributes_values[$i]['counter'] = $i;
$attributes_values[$i]['type_id'] =
$data['type_id'];
***************
*** 583,589 ****
}
! function translate_datatype_attributes($datatype)
{
$datatype_text = array(
'I' => 'Integer',
'C' => 'char',
--- 583,590 ----
}
! function translate_datatype($datatype)
{
$datatype_text = array(
+ 'V' => 'Varchar',
'I' => 'Integer',
'C' => 'char',
***************
*** 599,602 ****
--- 600,620 ----
return $datatype;
}
+
+ function translate_datatype_insert($datatype)
+ {
+ $datatype_text = array(
+ 'V' => 'varchar',
+ 'I' => 'int',
+ 'C' => 'char',
+ 'N' => 'decimal',
+ 'D' => 'timestamp',
+ 'T' => 'text',
+ 'R' => 'int',
+ 'CH' => 'text',
+ );
+
+ return $datatype_text[$datatype];
+ }
+
function save_attributes($values_attribute,$type)
--- NEW FILE: class.soadmin_entity.inc.php ---
<?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 soadmin_entity
{
var $grants;
function soadmin_entity()
{
$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 reset_fm_cache()
{
$this->db->query("DELETE FROM fm_cache
",__LINE__,__FILE__);
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id asc';
}
$table = 'fm_entity';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " where name LIKE '%$query%' or
descr LIKE '%$query%'";
}
$sql = "SELECT * FROM $table $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())
{
$standard[] = array
(
'id' => $this->db->f('id'),
'name' => $this->db->f('name'),
'prefix'=> $this->db->f('prefix'),
'descr' => $this->db->f('descr')
);
}
return $standard;
}
function read_category($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
$entity_id =
(isset($data['entity_id'])?$data['entity_id']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id asc';
}
$table = 'fm_entity_category';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND name LIKE '%$query%' or
descr LIKE '%$query%'";
}
$sql = "SELECT * FROM $table WHERE entity_id=$entity_id
$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())
{
$standard[] = array
(
'id' => $this->db->f('id'),
'name' => $this->db->f('name'),
'prefix'=> $this->db->f('prefix'),
'descr' => $this->db->f('descr')
);
}
return $standard;
}
function read_single($id)
{
$sql = "SELECT * FROM fm_entity where id='$id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$entity['id'] = $this->db->f('id');
$entity['name'] = $this->db->f('name');
$entity['descr'] = $this->db->f('descr');
return $entity;
}
}
function read_single_category($id,$entity_id)
{
$sql = "SELECT * FROM fm_entity_category where id=$id
AND entity_id=$entity_id";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$category['id'] =
$this->db->f('id');
$category['name'] =
$this->db->f('name');
$category['descr'] =
$this->db->f('descr');
$category['prefix'] =
$this->db->f('prefix');
return $category;
}
}
function next_id($table='',$key='')
{
if(is_array($key))
{
while (is_array($key) && list($column,$value) =
each($key))
{
if($value)
{
$condition[] = $column . '=' .
$value;
}
}
$where=' WHERE ' . implode(" AND ", $condition);
}
$this->db->query("SELECT max(id) as maximum FROM $table
$where",__LINE__,__FILE__);
$this->db->next_record();
$next_id = $this->db->f('maximum')+1;
return "$next_id";
}
function add_entity($values)
{
$values['name'] =
$this->db->db_addslashes($values['name']);
$values['descr'] =
$this->db->db_addslashes($values['descr']);
$values['id'] = $this->next_id('fm_entity');
$this->db->query("INSERT INTO fm_entity (id,name,
descr) "
. "VALUES ('" . $values['id'] . "','" .
$values['name'] . "','" . $values['descr']. "')",__LINE__,__FILE__);
$receipt['id']= $values['id'];
$receipt['message'][] = array('msg'=> lang('entity has
been added'));
return $receipt;
}
function add_category($values)
{
$values['name'] =
$this->db->db_addslashes($values['name']);
$values['descr'] =
$this->db->db_addslashes($values['descr']);
$values['id'] =
$this->next_id('fm_entity_category',array('entity_id'=>$values['entity_id']));
$location_type = $this->next_id('fm_location_type');
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_entity_category
(entity_id,id,name, descr,prefix) "
. "VALUES ('" . $values['entity_id'] . "','" .
$values['id'] . "','" . $values['name'] . "','" . $values['descr'] . "','" .
$values['prefix']. "')",__LINE__,__FILE__);
$receipt['id']= $values['id'];
$this->init_process();
$fd=array();
$fd['id'] = array('type' => 'int', 'precision' => 4,
'nullable' => False);
$fd['num'] = array('type' => 'varchar', 'precision' =>
16, 'nullable' => False);
$fd['location_code'] = array('type' => 'varchar',
'precision' => 25, 'nullable' => True);
for ($i=1; $i<$location_type; $i++)
{
$fd['loc' . $i] = array('type' => 'varchar',
'precision' => 4, 'nullable' => True);
}
$fd['address'] = array('type' => 'varchar', 'precision'
=> 100, 'nullable' => True);
$fd['entry_date'] = array('type' => 'int', 'precision'
=> 4, 'nullable' => True);
$fd['user_id'] = array('type' => 'int', 'precision' =>
4, 'nullable' => True);
$fd['remark'] = array('type' => 'text', 'nullable' =>
True);
$pk[]= 'id';
if($this->oProc->CreateTable('fm_entity_'.
$values['entity_id'] .'_'.$values['id'],array('fd' => $fd,'pk' => $pk,'fk' =>
$fk,'ix' => array('location_code'),'uc' => array())))
{
$receipt['message'][] = array('msg' =>
lang('table %1 has been saved','fm_entity_'. $values['entity_id']
.'_'.$values['id']) );
$this->db->transaction_commit();
}
else
{
$receipt['error'][] = array('msg' =>
lang('table could not be added') );
if($this->db->Transaction)
{
$this->db->transaction_abort();
}
else
{
$this->db->query("DELETE FROM
fm_entity_category WHERE id=" . $values['id'] . " AND entity_id=" .
$values['entity_id'],__LINE__,__FILE__);
unset($receipt['id']);
}
}
return $receipt;
}
function edit_entity($entity)
{
if (!$entity['name'])
{
$receipt['error'][] = array('msg'=>lang('Name
not entered!'));
}
if (!$receipt['error'])
{
$table = 'fm_entity';
$entity['name'] =
$this->db->db_addslashes($entity['name']);
$entity['descr'] =
$this->db->db_addslashes($entity['descr']);
$this->db->query("UPDATE $table set descr='" .
$entity['descr'] . "', name='". $entity['name']
. "' WHERE id='" . $entity['id'].
"'",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>
lang('entity has been edited'));
}
else
{
$receipt['error'][] = array('msg' =>
lang('entity has NOT been edited'));
}
return $receipt;
}
function edit_category($entity)
{
if (!$entity['name'])
{
$receipt['error'][] = array('msg'=>lang('Name
not entered!'));
}
if (!$receipt['error'])
{
$table = 'fm_entity_category';
$entity['name'] =
$this->db->db_addslashes($entity['name']);
$entity['descr'] =
$this->db->db_addslashes($entity['descr']);
$this->db->query("UPDATE $table set descr='" .
$entity['descr'] . "', name='". $entity['name'] . "', prefix='".
$entity['prefix']
. "' WHERE entity_id=" .
$entity['entity_id']. " AND id=" . $entity['id'],__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>
lang('entity has been edited'));
}
else
{
$receipt['error'][] = array('msg' =>
lang('entity has NOT been edited'));
}
return $receipt;
}
function delete_entity($id)
{
$category_list=$this->read_category(array('entity_id'=>$id));
$this->db->query("DELETE FROM fm_entity WHERE
id=$id",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_entity_category WHERE
entity_id=$id",__LINE__,__FILE__);
if (isset($category_list) AND is_array($category_list))
{
$this->init_process();
foreach($category_list as $entry)
{
$this->oProc->DropTable('fm_entity_' .
$id . '_' . $entry['id']);
}
}
}
function delete_category($id,$entity_id)
{
$this->init_process();
$this->oProc->DropTable('fm_entity_' . $entity_id . '_'
. $id);
$this->db->query("DELETE FROM fm_entity_category WHERE
entity_id= $entity_id AND id= $id",__LINE__,__FILE__);
}
function delete_attrib($cat_id,$entity_id,$attrib_id)
{
$this->init_process();
$sql = "SELECT * FROM fm_entity_attribute WHERE
entity_id=$entity_id AND cat_id=$cat_id AND id=$attrib_id";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$ColumnName = $this->db->f('column_name');
$this->oProc->DropColumn('fm_entity_' .$entity_id.'_'.
$cat_id,'', $ColumnName);
$this->db->query("DELETE FROM fm_entity_attribute WHERE
entity_id=$entity_id AND cat_id=$cat_id AND id=$attrib_id",__LINE__,__FILE__);
}
function read_attrib($data)
{
//_debug_array($data);
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
$entity_id =
(isset($data['entity_id'])?$data['entity_id']:0);
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by attrib_sort asc';
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND (fm_entity_attribute.name
LIKE '%$query%' or fm_entity_attribute.descr LIKE '%$query%')";
}
$sql = "SELECT * FROM fm_entity_attribute WHERE
entity_id=$entity_id AND cat_id = $cat_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())
{
$attrib[] = array
(
'id' =>
$this->db->f('id'),
'entity_type' =>
$this->db->f('type_id'),
'list' =>
$this->db->f('list'),
'lookup_form' =>
$this->db->f('lookup_form'),
'entity_form' =>
$this->db->f('entity_form'),
'column_name' =>
$this->db->f('column_name'),
'size' =>
$this->db->f('size'),
'statustext' =>
$this->db->f('statustext'),
'input_text' =>
$this->db->f('input_text'),
'type_name' =>
$this->db->f('type'),
'datatype' =>
$this->db->f('datatype')
);
}
return $attrib;
}
function read_single_attrib($entity_id,$cat_id,$id)
{
$sql = "SELECT * FROM fm_entity_attribute where
entity_id=$entity_id AND cat_id=$cat_id AND id=$id";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$attrib['id']
= $this->db->f('id');
$attrib['column_name']
= $this->db->f('column_name');
$attrib['input_text']
= $this->db->f('input_text');
$attrib['statustext']
= $this->db->f('statustext');
$attrib['column_info']['precision'] =
$this->db->f('precision_');
$attrib['column_info']['scale'] =
$this->db->f('scale');
$attrib['column_info']['default'] =
$this->db->f('default_value');
$attrib['column_info']['nullable'] =
$this->db->f('nullable');
$attrib['column_info']['type'] =
$this->db->f('datatype');
$attrib['type_id']
= $this->db->f('type_id');
$attrib['type_name']
= $this->db->f('type_name');
$attrib['lookup_form']
= $this->db->f('lookup_form');
$attrib['list']
= $this->db->f('list');
if($this->db->f('datatype')=='R' ||
$this->db->f('datatype')=='CH')
{
$attrib['choice'] =
$this->read_attrib_choice($entity_id,$cat_id,$id);
}
return $attrib;
}
}
function read_attrib_choice($entity_id,$cat_id,$attrib_id)
{
$choice_table = 'fm_entity_choice';
$sql = "SELECT * FROM $choice_table WHERE
entity_id=$entity_id AND cat_id=$cat_id AND attrib_id=$attrib_id";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
$choice[] = array
(
'id' => $this->db->f('id'),
'value' => $this->db->f('value')
);
}
return $choice;
}
function add_attrib($attrib)
{
$attrib['column_name'] =
$this->db->db_addslashes($attrib['column_name']);
$attrib['input_text'] =
$this->db->db_addslashes($attrib['input_text']);
$attrib['statustext'] =
$this->db->db_addslashes($attrib['statustext']);
$attrib['default'] =
$this->db->db_addslashes($attrib['default']);
$attrib['id'] =
$this->next_id('fm_entity_attribute',array('entity_id'=>$attrib['entity_id'],'cat_id'=>$attrib['cat_id']));
$values= array(
$attrib['entity_id'],
$attrib['cat_id'],
$attrib['id'],
$attrib['column_name'],
$attrib['input_text'],
$attrib['statustext'],
$attrib['list'],
$attrib['column_info']['type'],
$attrib['column_info']['precision'],
$attrib['column_info']['scale'],
$attrib['column_info']['default'],
$attrib['column_info']['nullable']
);
$values = $this->bocommon->validate_db_insert($values);
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_entity_attribute
(entity_id,cat_id,id,column_name, input_text, statustext,list,
datatype,precision_,scale,default_value,nullable) "
. "VALUES ($values)",__LINE__,__FILE__);
$receipt['id']= $attrib['id'];
$attrib['column_info']['type'] =
$this->bocommon->translate_datatype_insert($attrib['column_info']['type']);
if($attrib['column_info']['type']=='int' &&
!$attrib['column_info']['precision'])
{
$attrib['column_info']['precision']=4;
}
$this->init_process();
if($this->oProc->AddColumn('fm_entity_'.$attrib['entity_id'] . '_' .
$attrib['cat_id'],$attrib['column_name'], $attrib['column_info']))
{
$receipt['message'][] = array('msg' =>
lang('Attribute has been saved') );
$this->db->transaction_commit();
}
else
{
$receipt['error'][] = array('msg' =>
lang('column could not be added') );
if($this->db->Transaction)
{
$this->db->transaction_abort();
}
else
{
$this->db->query("DELETE FROM
fm_entity_attribute WHERE entity_id=" . $attrib['entity_id']. " AND cat_id=" .
$attrib['id']. " AND id='" . $receipt['id'] . "'",__LINE__,__FILE__);
unset($receipt['id']);
}
}
return $receipt;
}
function init_process()
{
$this->oProc
=
CreateObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
$this->oProc->m_odb
= $this->db;
$this->oProc->m_odb->Halt_On_Error = 'report';
}
function edit_attrib($attrib)
{
$attrib['column_name'] =
$this->db->db_addslashes($attrib['column_name']);
$attrib['input_text'] =
$this->db->db_addslashes($attrib['input_text']);
$attrib['statustext'] =
$this->db->db_addslashes($attrib['statustext']);
$attrib['default'] =
$this->db->db_addslashes($attrib['default']);
$this->db->query("SELECT column_name FROM
fm_entity_attribute WHERE entity_id=" . $attrib['entity_id']. " AND cat_id=" .
$attrib['cat_id']. " AND id='" . $attrib['id']. "'",__LINE__,__FILE__);
$this->db->next_record();
$OldColumnName = $this->db->f('column_name');
$value_set=array(
'column_name' => $attrib['column_name'],
'input_text' => $attrib['input_text'],
'statustext' => $attrib['statustext'],
'list' => $attrib['list'],
'datatype' =>
$attrib['column_info']['type'],
'precision_' =>
$attrib['column_info']['precision'],
'scale' =>
$attrib['column_info']['scale'],
'default_value' =>
$attrib['column_info']['default'],
'nullable' =>
$attrib['column_info']['nullable']
);
$value_set =
$this->bocommon->validate_db_update($value_set);
$this->db->query("UPDATE fm_entity_attribute set
$value_set WHERE entity_id=" . $attrib['entity_id']. " AND cat_id=" .
$attrib['cat_id']. " AND id=" . $attrib['id'],__LINE__,__FILE__);
$choice_table ='fm_entity_choice';
if($attrib['new_choice'])
{
$choice_id = $this->next_id($choice_table
,array('entity_id'=>$attrib['entity_id'],'cat_id'=>$attrib['cat_id'],'attrib_id'=>$attrib['id']));
$values= array(
$attrib['entity_id'],
$attrib['cat_id'],
$attrib['id'],
$choice_id,
$attrib['new_choice']
);
$values =
$this->bocommon->validate_db_insert($values);
$this->db->query("INSERT INTO $choice_table
(entity_id,cat_id,attrib_id,id,value) "
. "VALUES ($values)",__LINE__,__FILE__);
}
if($attrib['delete_choice'])
{
for
($i=0;$i<count($attrib['delete_choice']);$i++)
{
$this->db->query("DELETE FROM
$choice_table WHERE entity_id=" . $attrib['entity_id']. " AND cat_id=" .
$attrib['cat_id']. " AND attrib_id=" . $attrib['id'] ." AND id=" .
$attrib['delete_choice'][$i],__LINE__,__FILE__);
}
}
if($attrib['column_info']['type']!='R' &&
$attrib['column_info']['type']!='CH')
{
$this->db->query("DELETE FROM $choice_table
WHERE entity_id=" . $attrib['entity_id']. " AND cat_id=" . $attrib['cat_id']. "
AND attrib_id=" . $attrib['id'],__LINE__,__FILE__);
}
$attrib['column_info']['type'] =
$this->bocommon->translate_datatype_insert($attrib['column_info']['type']);
if($attrib['column_info']['type']=='int' &&
!$attrib['column_info']['precision'])
{
$attrib['column_info']['precision']=4;
}
$this->init_process();
$this->oProc->RenameColumn('fm_entity'.$attrib['type_id'], $OldColumnName,
$attrib['column_name']);
$this->oProc->AlterColumn('fm_entity'.$attrib['type_id'],$attrib['column_name'],$attrib['column_info']);
$receipt['message'][] = array('msg' =>
lang('Attribute has been edited'));
return $receipt;
}
}
?>
Index: class.botts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.botts.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** class.botts.inc.php 15 Sep 2003 18:28:43 -0000 1.20
--- class.botts.inc.php 10 Oct 2003 21:57:15 -0000 1.21
***************
*** 250,253 ****
--- 250,254 ----
function select_category_list($format='',$selected='')
{
+
switch($format)
{
***************
*** 300,311 ****
for ($i=0; $i<count($tickets); $i++)
{
!
! if($tickets[$i]['location_code'])
{
! $tickets[$i]['location_data'] =
$this->solocation->read_single($tickets[$i]['location_code']);
}
-
- $tickets[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['user_id']);
- $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
$history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$tickets[$i]['id']);
--- 301,312 ----
for ($i=0; $i<count($tickets); $i++)
{
! if($tickets[$i]['assignedto'])
{
! $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
! }
! else
! {
! $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['group_id']);
}
$history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$tickets[$i]['id']);
***************
*** 585,589 ****
$body .= lang('Date Opened').': '.$timestampopened."\n";
$body .= lang('Category').': '.
$this->get_category_name($ticket['cat_id']) ."\n";
! $body .= lang('Subject').': '. $ticket['subject'] ."\n";
$body .= lang('Location').': '.
$ticket['location_code'] ."\n";
$body .= lang('Address').': '. $ticket['address'] ."\n";
--- 586,590 ----
$body .= lang('Date Opened').': '.$timestampopened."\n";
$body .= lang('Category').': '.
$this->get_category_name($ticket['cat_id']) ."\n";
! // $body .= lang('Subject').': '. $ticket['subject'] ."\n";
$body .= lang('Location').': '.
$ticket['location_code'] ."\n";
$body .= lang('Address').': '. $ticket['address'] ."\n";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc class.boadmin_entity.inc.php, NONE, 1.1 class.soadmin_entity.inc.php, NONE, 1.1 class.uiadmin_entity.inc.php, NONE, 1.1 class.uiworkorder.inc.php, 1.45, 1.46 class.uiproject.inc.php, 1.51, 1.52 class.bocommon.inc.php, 1.83, 1.84 hook_settings.inc.php, 1.14, 1.15 class.uilocation.inc.php, 1.31, 1.32 class.bostandard_entity.inc.php, 1.12, 1.13 class.soreport.inc.php, 1.12, 1.13 class.soproject.inc.php, 1.40, 1.41 class.soworkorder.inc.php, 1.29, 1.30 class.boworkorder.inc.php, 1.17, 1.18 class.boproject.inc.php, 1.17, 1.18 class.uitts.inc.php, 1.38, 1.39 class.botts.inc.php, 1.20, 1.21 class.sotts.inc.php, 1.27, 1.28 hook_admin.inc.php, 1.42, 1.43 class.boadmin_location.inc.php, 1.5, 1.6 class.soadmin_location.inc.php, 1.18, 1.19 class.bowo_hour.inc.php, 1.10, 1.11,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] property/templates/default admin_entity.xsl, NONE, 1.1 project.xsl, 1.19, 1.20 workorder.xsl, 1.18, 1.19 tts.xsl, 1.13, 1.14
- Next by Date:
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.19, 1.17.2.2.2.20
- Previous by thread:
[Phpgroupware-cvs] property/templates/default admin_entity.xsl, NONE, 1.1 project.xsl, 1.19, 1.20 workorder.xsl, 1.18, 1.19 tts.xsl, 1.13, 1.14
- Next by thread:
[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.19, 1.17.2.2.2.20
- Index(es):