[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.16,1.17 cl
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.16,1.17 class.boequipment.inc.php,1.5,1.6class.bostandard_entity.inc.php,1.5,1.6 class.socommon.inc.php,1.8,1.9 class.soequipment.inc.php,1.5,1.6 class.uiequipment.inc.php,1.4,1.5 |
Date: |
Tue, 18 Feb 2003 04:14:00 -0500 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv16738/inc
Modified Files:
class.bocommon.inc.php class.boequipment.inc.php
class.bostandard_entity.inc.php class.socommon.inc.php
class.soequipment.inc.php class.uiequipment.inc.php
Log Message:
no message
Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.bocommon.inc.php 16 Feb 2003 22:27:00 -0000 1.16
--- class.bocommon.inc.php 18 Feb 2003 09:13:57 -0000 1.17
***************
*** 290,293 ****
--- 290,336 ----
}
+ function read_attibutes($data)
+ {
+ if($data['form'])
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('attributes_form'));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('attributes_view'));
+ }
+
+ $attributes_values =
$this->socommon->read_attibutes($data);
+
+ for ($i=0;$i<count($attributes_values);$i++)
+ {
+
$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'];
+ }
+
+ return $attributes_values;
+ }
+
+ function translate_datatype_attributes($datatype)
+ {
+ $datatype_text = array(
+ 'I' => 'Integer',
+ 'C' => 'Text',
+ 'N' => 'Float',
+ 'T' => 'Datetime'
+ );
+
+ $datatype = lang($datatype_text[$datatype]);
+
+ return $datatype;
+ }
+
+ function save_attributes($values_attribute,$type)
+ {
+
$this->socommon->save_attributes($values_attribute,$type);
+ }
+
function list_methods($_type='xmlrpc')
{
Index: class.boequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boequipment.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.boequipment.inc.php 16 Feb 2003 22:27:01 -0000 1.5
--- class.boequipment.inc.php 18 Feb 2003 09:13:57 -0000 1.6
***************
*** 228,232 ****
}
-
function read_single_equipment_type($equipment_type_id)
{
--- 228,231 ----
Index: class.bostandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bostandard_entity.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.bostandard_entity.inc.php 12 Feb 2003 19:33:37 -0000 1.5
--- class.bostandard_entity.inc.php 18 Feb 2003 09:13:57 -0000 1.6
***************
*** 49,52 ****
--- 49,53 ----
$this->so =
CreateObject($this->currentapp.'.sostandard_entity');
$this->socommon =
CreateObject($this->currentapp.'.socommon');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$start = get_var('start',array('POST','GET'));
***************
*** 135,148 ****
$this->total_records = $this->so->total_records;
- $datatype_text = array(
- 'I' => 'Integer',
- 'C' => 'Character',
- 'N' => 'Float',
- 'T' => 'Datetime'
- );
-
for ($i=0; $i<count($attrib); $i++)
{
! $attrib[$i]['datatype'] =
lang($datatype_text[$attrib[$i]['datatype']]);
}
--- 136,142 ----
$this->total_records = $this->so->total_records;
for ($i=0; $i<count($attrib); $i++)
{
! $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype_attributes($attrib[$i]['datatype']);
}
Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.socommon.inc.php 12 Feb 2003 19:33:37 -0000 1.8
--- class.socommon.inc.php 18 Feb 2003 09:13:57 -0000 1.9
***************
*** 30,33 ****
--- 30,105 ----
}
+ function read_attibutes($data)
+ {
+
+ //_debug_array($data);
+ switch($data['type'])
+ {
+ case 'equipment':
+ $type_table='fm_equipment_type_attrib';
+ $attrib_table='fm_equipment_attrib';
+ break;
+ case 'location':
+ $type_table='fm_location_type_attrib';
+ $attrib_table='fm_location_attrib';
+ break;
+ }
+
+ $this->db->query("SELECT * FROM $type_table WHERE
type_id ='" . $data['type_id'] . "'");
+
+ while ($this->db->next_record())
+ {
+ $attributes_values[] = array
+ (
+ 'attrib_id' =>
$this->db->f('id'),
+ 'name' =>
$this->db->f('name'),
+ 'type_id' =>
$this->db->f('type_id'),
+ 'descr' =>
$this->db->f('descr'),
+ 'datatype' =>
$this->db->f('datatype')
+ );
+ }
+
+ for ($i=0;$i<count($attributes_values);$i++)
+ {
+ $this->db->query("SELECT " .
strtolower($attributes_values[$i]['datatype']) . " as value FROM $attrib_table
WHERE entity_id ='" . $data['id'] . "' and attrib_id='" .
$attributes_values[$i]['attrib_id'] . "'");
+
+ $this->db->next_record();
+ $attributes_values[$i]['value'] =
$this->db->f('value');
+ $attributes_values[$i]['entity_id'] =
$data['id'];
+
+ }
+
+ //_debug_array($attributes_values);
+ return $attributes_values;
+ }
+
+ function save_attributes($values_attribute,$type)
+ {
+ switch($type)
+ {
+ case 'equipment':
+ $table='fm_equipment_attrib';
+ break;
+ case 'location':
+ $table='fm_location_attrib';
+ break;
+ }
+
+ $this->db->query("DELETE FROM $table WHERE entity_id='"
. $values_attribute[0]['entity_id'] . "'",__LINE__,__FILE__);
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['value'])
+ {
+ $this->db->query("INSERT INTO $table
(entity_id,type_id,attrib_id," .strtolower($values_attribute[$i]['datatype']).
") "
+ . "VALUES ('"
+ .
$values_attribute[$i]['entity_id']. "','"
+ .
$values_attribute[$i]['type_id']. "','"
+ .
$values_attribute[$i]['attrib_id']. "','"
+ .
$values_attribute[$i]['value'] . "')",__LINE__,__FILE__);
+ }
+ }
+ }
+
function check_property($property_id='')
{
Index: class.soequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soequipment.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.soequipment.inc.php 16 Feb 2003 22:27:01 -0000 1.5
--- class.soequipment.inc.php 18 Feb 2003 09:13:57 -0000 1.6
***************
*** 222,225 ****
--- 222,226 ----
$equipment['floor']
= $this->db->f('floor');
$equipment['descr']
= $this->db->f('descr');
+ $equipment['status'] =
$this->db->f('status');
$equipment['cost']
= $this->db->f('cost');
$equipment['vendor_id'] =
$this->db->f('vendor_id');
***************
*** 233,237 ****
$equipment['cat_id'] =
$this->db->f('equipment_type_id');
! _debug_array($equipment);
return $equipment;
}
--- 234,238 ----
$equipment['cat_id'] =
$this->db->f('equipment_type_id');
! //_debug_array($equipment);
return $equipment;
}
***************
*** 336,340 ****
{
$this->db->query("DELETE FROM fm_equipment WHERE
equipment_id='" . $equipment_id . "'",__LINE__,__FILE__);
! $this->db->query("DELETE FROM fm_equipment_attrib WHERE
equipment_id='" . $equipment_id . "'",__LINE__,__FILE__);
}
}
--- 337,341 ----
{
$this->db->query("DELETE FROM fm_equipment WHERE
equipment_id='" . $equipment_id . "'",__LINE__,__FILE__);
! $this->db->query("DELETE FROM fm_equipment_attrib WHERE
entity_id='" . $equipment_id . "'",__LINE__,__FILE__);
}
}
Index: class.uiequipment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiequipment.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.uiequipment.inc.php 16 Feb 2003 22:27:01 -0000 1.4
--- class.uiequipment.inc.php 18 Feb 2003 09:13:57 -0000 1.5
***************
*** 99,111 ****
'date'
=> $equipment['date'],
'owner'
=> $equipment['owner'],
! 'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.attribute&equipment_id='
. $equipment['equipment_id']),
! 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.view&equipment_id='
. $equipment['equipment_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit&id='
. $equipment['equipment_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.delete&equipment_id='
. $equipment['equipment_id']),
- 'lang_attribute_statustext' =>
lang('view the attributes for this selection'),
'lang_view_statustext' =>
lang('view the equipment'),
'lang_edit_statustext' =>
lang('edit the equipment'),
! 'lang_delete_statustext' =>
lang('delete the equipment'),
! 'text_attribute'
=> $text_attribute,
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
--- 99,108 ----
'date'
=> $equipment['date'],
'owner'
=> $equipment['owner'],
! 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.view&id='
. $equipment['equipment_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit&id='
. $equipment['equipment_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.delete&equipment_id='
. $equipment['equipment_id']),
'lang_view_statustext' =>
lang('view the equipment'),
'lang_edit_statustext' =>
lang('edit the equipment'),
! 'lang_delete_statustext' =>
lang('delete this equipment'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
***************
*** 160,164 ****
'lang_street_num' => lang('Num'),
'lang_category' => lang('Category'),
- 'lang_attribute' => lang('Attribute'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
--- 157,160 ----
***************
*** 221,226 ****
);
- //_debug_array($data).'<br>';
- //print_($menu);
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
--- 217,220 ----
***************
*** 229,235 ****
function edit()
{
! $id = get_var('id',array('POST','GET'));
! $err = get_var('err',array('POST','GET'));
! $values = get_var('values',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
--- 223,229 ----
function edit()
{
! $id =
get_var('id',array('POST','GET'));
! $values =
get_var('values',array('POST','GET'));
! $values_attribute =
get_var('values_attribute',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
***************
*** 250,256 ****
--- 244,257 ----
if ($values['save'])
{
+ if(!$values['generate_id'] &&
!$values['equipment_id'] && !$id)
+ {
+
$receipt['error'][]=array('msg'=>lang('Please either select GENERATE ID or type
a Equipment ID !'));
+ $error_id=true;
+ }
+
if(!$values['cat_id'])
{
$receipt['error'][]=array('msg'=>lang('Please select equipment type !'));
+ $error_id=true;
}
***************
*** 260,268 ****
}
- if(!$values['generate_id'] &&
!$values['equipment_id'] && !$id)
- {
-
$receipt['error'][]=array('msg'=>lang('Please either select GENERATE ID or type
a Equipment ID !'));
- }
-
if($id)
{
--- 261,264 ----
***************
*** 280,287 ****
if(!$receipt['error'])
{
! _debug_array($values);
! $receipt =
$this->bo->save($values,$action,$err);
$id = $values['equipment_id'];
$function_msg = lang('edit equipment');
}
}
--- 276,286 ----
if(!$receipt['error'])
{
! $receipt =
$this->bo->save($values,$action);
$id = $values['equipment_id'];
$function_msg = lang('edit equipment');
+ if($values_attribute)
+ {
+
$this->bocommon->save_attributes($values_attribute,'equipment');
+ }
}
}
***************
*** 291,302 ****
{
$values =
$this->bo->read_single($id);
- $function_msg = lang('edit
equipment');
- }
- else
- {
- $function_msg = lang('add equipment');
}
}
! if ($values['cat_id'] > 0)
{
$this->cat_id = $values['cat_id'];
--- 290,306 ----
{
$values =
$this->bo->read_single($id);
}
}
!
! if ($id)
! {
! $function_msg = lang('edit equipment');
! }
! else
! {
! $function_msg = lang('add equipment');
! }
!
! if ($values['cat_id'])
{
$this->cat_id = $values['cat_id'];
***************
*** 322,332 ****
if($values['equipment_id'])
{
! $cat_text =
$this->bo->read_single_equipment_type($values['cat_id']);
}
!
! if($receipt['error'])
{
- $err=true;
unset($values['equipment_id']);
unset($id);
--- 326,342 ----
if($values['equipment_id'])
{
! $cat_text =
$this->bo->read_single_equipment_type($values['cat_id']);
! $attributes_values =
$this->bocommon->read_attibutes(array('form'=>true,'type'=>equipment,'type_id'=>$values['cat_id'],'id'=>$values['equipment_id']));
! $attributes_header[] = array
! (
! 'lang_name' => lang('Name'),
! 'lang_descr' => lang('Description'),
! 'lang_datatype' => lang('Datatype'),
! 'lang_value' => lang('Value')
! );
}
! if($error_id)
{
unset($values['equipment_id']);
unset($id);
***************
*** 337,344 ****
(
'menuaction' =>
$this->currentapp.'.uiequipment.edit',
! 'id' => $id,
! 'err' => $err
);
- //_debug_array($link_data);
$dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
--- 347,352 ----
(
'menuaction' =>
$this->currentapp.'.uiequipment.edit',
! 'id' => $id
);
$dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
***************
*** 351,357 ****
$dateformat= (implode($sep,$dlarr));
-
$data = array
(
'generate_id'
=> $values['generate_id'],
'link_calendar_date' =>
'setDateField(document.form.date);top.newWin=window.open('."'.".'/'.$this->currentapp.'/inc/calendar.html'."'".','."'".'cal'."'".','."'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes'".')',
--- 359,367 ----
$dateformat= (implode($sep,$dlarr));
$data = array
(
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $attributes_values,
'generate_id'
=> $values['generate_id'],
'link_calendar_date' =>
'setDateField(document.form.date);top.newWin=window.open('."'.".'/'.$this->currentapp.'/inc/calendar.html'."'".','."'".'cal'."'".','."'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes'".')',
***************
*** 386,390 ****
'cat_text'
=> $cat_text,
'error'
=> $receipt['error'],
! 'error_flag'
=> $err,
'message'
=> $receipt['message'],
'lang_descr_statustext' =>
lang('Enter a description of the equipment'),
--- 396,400 ----
'cat_text'
=> $cat_text,
'error'
=> $receipt['error'],
! 'error_flag'
=> $error_id,
'message'
=> $receipt['message'],
'lang_descr_statustext' =>
lang('Enter a description of the equipment'),
***************
*** 406,410 ****
'value_cost'
=> $values['cost'],
'lang_cost_statustext' =>
lang('Enter the purchase cost'),
- 'equipment_type_id'
=> $equipment['equipment_type_id'],
'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
);
--- 416,419 ----
***************
*** 450,474 ****
function view()
{
! $property_id = get_var('property_id',array('GET'));
! $equipment_id = get_var('equipment_id',array('GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
! $equipment =
$this->bo->read_single($property_id,$equipment_id);
$data = array
(
! 'appname' =>
lang('equipment'),
! 'function_msg' => lang('view
equipment'),
! 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index'),
! 'lang_name' => lang('name'),
! 'lang_category' => lang('category'),
! 'lang_access' => lang('access'),
! 'lang_time_created' => lang('time created'),
! 'lang_done' => lang('done'),
! 'value_name' => $equipment['name'],
! 'value_access' =>
lang(ucfirst($equipment['access'])),
! 'value_cat' =>
'',//$this->cats->id2name($equipment['cat']),
! 'value_date' =>
$GLOBALS['phpgw']->common->show_date($equipment['date'])
);
--- 459,522 ----
function view()
{
! $id = get_var('id',array('POST','GET'));
! $values = $this->bo->read_single($id);
$GLOBALS['phpgw']->xslttpl->add_file(array('equipment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
. SEP . 'app_header'));
!
$location_data=$this->bocommon->initiate_ui_location(array(
! 'form' =>
false,
! 'equipment' =>
false,
! 'tenant' =>
false,
! '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_equipment_type($values['cat_id']);
! $attributes_values =
$this->bocommon->read_attibutes(array('form'=>false,'type'=>equipment,'type_id'=>$values['cat_id'],'id'=>$id));
! $attributes_header[] = array(
! 'lang_name' => lang('Name'),
! 'lang_descr' => lang('Description'),
! 'lang_datatype' => lang('Datatype'),
! 'lang_value' => lang('Value')
! );
$data = array
(
! 'lang_attributes' =>
lang('Attributes'),
! 'attributes_header' =>
$attributes_header,
! 'attributes_values' =>
$attributes_values,
! 'lang_date'
=> lang('Acquisition date'),
! 'value_date' =>
$values['date'],
! 'location_data' =>
$location_data,
! 'lang_year'
=> lang('Year'),
! 'lang_category' =>
lang('category'),
! 'lang_equipment_id' =>
lang('equipment ID'),
! 'value_equipment_id' =>
$values['equipment_id'],
! 'lang_lifetime' =>
lang('Longevity'),
! 'value_lifetime' =>
$values['lifetime'],
! 'cat_text'
=> $cat_text,
! 'lang_descr' =>
lang('Description'),
! 'value_descr' =>
$values['descr'],
! 'lang_status' =>
lang('Status'),
! 'value_status' =>
$values['status'],
! 'lang_cost'
=> lang('Purchase cost'),
! 'value_cost' =>
$values['cost'],
! 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
! 'appname'
=> lang('equipment'),
! 'function_msg' =>
lang('view equipment'),
! 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.index'),
! 'edit_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiequipment.edit&id='
. $id),
! 'lang_vendor' =>
lang('Vendor'),
! 'value_vendor_id' =>
$values['vendor_id'],
! 'value_vendor_name' =>
$values['vendor_name'],
! 'lang_done_statustext' => lang('Back
to the list'),
! 'lang_edit_statustext' => lang('Edit
this entry equipment'),
! 'lang_done'
=> lang('done'),
! 'lang_edit'
=> lang('Edit')
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.16,1.17 class.boequipment.inc.php,1.5,1.6class.bostandard_entity.inc.php,1.5,1.6 class.socommon.inc.php,1.8,1.9 class.soequipment.inc.php,1.5,1.6 class.uiequipment.inc.php,1.4,1.5,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php,1.33,1.34
- Next by Date:
[Phpgroupware-cvs] CVS: property/inc class.boproperty.inc.php,1.2,1.3 class.soproperty.inc.php,1.3,1.4 class.uibuilding.inc.php,1.6,1.7 class.uiequipment.inc.php,1.5,1.6 class.uiproperty.inc.php,1.7,1.8
- Previous by thread:
[Phpgroupware-cvs] CVS: property/setup tables_current.inc.php,1.33,1.34
- Next by thread:
[Phpgroupware-cvs] CVS: property/inc class.boproperty.inc.php,1.2,1.3 class.soproperty.inc.php,1.3,1.4 class.uibuilding.inc.php,1.6,1.7 class.uiequipment.inc.php,1.5,1.6 class.uiproperty.inc.php,1.7,1.8
- Index(es):