[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc class.bocommon.inc.php class.soact...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] property/inc class.bocommon.inc.php class.soact... |
Date: |
Tue, 07 Feb 2006 19:22:01 +0000 |
CVSROOT: /sources/phpgroupware
Module name: property
Branch:
Changes by: Sigurd Nes <address@hidden> 06/02/07 19:22:01
Modified files:
inc : class.bocommon.inc.php class.soactor.inc.php
class.soadmin_entity.inc.php
class.soadmin_location.inc.php
class.uiactor.inc.php
class.uiadmin_entity.inc.php
class.uiadmin_location.inc.php
Log message:
no message
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bocommon.inc.php.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.soactor.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.soadmin_entity.inc.php.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.soadmin_location.inc.php.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiactor.inc.php.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiadmin_entity.inc.php.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiadmin_location.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
Patches:
Index: property/inc/class.bocommon.inc.php
diff -u property/inc/class.bocommon.inc.php:1.21
property/inc/class.bocommon.inc.php:1.22
--- property/inc/class.bocommon.inc.php:1.21 Fri Feb 3 12:05:49 2006
+++ property/inc/class.bocommon.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage core
- * @version $Id: class.bocommon.inc.php,v 1.21 2006/02/03 12:05:49
sigurdne Exp $
+ * @version $Id: class.bocommon.inc.php,v 1.22 2006/02/07 19:22:01
sigurdne Exp $
*/
/**
@@ -759,6 +759,7 @@
function translate_datatype_precision($datatype)
{
$datatype_precision = array(
+ 'I' => 4,
'R' => 4,
'LB' => 4,
'AB' => 4,
Index: property/inc/class.soactor.inc.php
diff -u property/inc/class.soactor.inc.php:1.12
property/inc/class.soactor.inc.php:1.13
--- property/inc/class.soactor.inc.php:1.12 Tue Feb 7 14:44:28 2006
+++ property/inc/class.soactor.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.soactor.inc.php,v 1.12 2006/02/07 14:44:28
sigurdne Exp $
+ * @version $Id: class.soactor.inc.php,v 1.13 2006/02/07 19:22:01
sigurdne Exp $
*/
/**
@@ -719,6 +719,93 @@
$this->oProc->m_odb->Halt_On_Error = 'report';
}
+
+ function get_table_def()
+ {
+ $table = 'fm_' . $this->role;
+ $attribute_table = 'fm_' . $this->role . '_attribute';
+
+ $metadata = $this->db->metadata($table);
+
+ $fd = $this->get_default_column_def();
+
+ for ($i=0; $i<count($metadata); $i++)
+ {
+ $sql = "SELECT * FROM $attribute_table WHERE
column_name = '" . $metadata[$i]['name'] . "'";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ while($this->db->next_record())
+ {
+ if(!$precision =
$this->db->f('precision_'))
+ {
+ $precision =
$this->bocommon->translate_datatype_precision($this->db->f('datatype'));
+ }
+
+ $fd[$metadata[$i]['name']] = array(
+ 'type' =>
$this->bocommon->translate_datatype_insert(stripslashes($this->db->f('datatype'))),
+ 'precision' =>
$precision,
+ 'nullable' =>
stripslashes($this->db->f('nullable')),
+ 'default' =>
stripslashes($this->db->f('default_value')),
+ 'scale' =>
$this->db->f('scale')
+ );
+ unset($precision);
+ }
+ }
+
+ $table_def = array(
+ $table => array(
+ 'fd' => $fd
+ )
+ );
+
+ $table_def[$table]['pk'] = array('id');
+ $table_def[$table]['fk'] = array();
+ $table_def[$table]['ix'] = array();
+ $table_def[$table]['uc'] = array();
+
+ return $table_def;
+ }
+
+
+ function get_default_column_def()
+ {
+ $fd=array();
+ $fd['id'] = array('type' => 'int','precision' =>
'4','nullable' => False);
+ $fd['entry_date'] = array('type' => 'int','precision'
=> '4','nullable' => True);
+ $fd['category'] =array('type' => 'int','precision' =>
'4','nullable' => False);
+
+ switch($this->role)
+ {
+ case 'owner':
+ $fd['abid'] =array('type' =>
'int','precision' => '4','nullable' => False);
+ $fd['org_name'] =array('type' =>
'varchar','precision' => '50','nullable' => True);
+ $fd['contact_name'] =array('type' =>
'varchar','precision' => '50','nullable' => True);
+ $fd['member_of'] =array('type' =>
'varchar','precision' => '255','nullable' => True);
+ $fd['remark'] =array('type' =>
'varchar','precision' => '255','nullable' => True);
+ break;
+ case 'tenant':
+ $fd['member_of'] = array('type' =>
'varchar','precision' => '255','nullable' => True);
+ $fd['first_name'] = array('type' =>
'varchar','precision' => '30','nullable' => True);
+ $fd['last_name'] = array('type' =>
'varchar','precision' => '30','nullable' => True);
+ $fd['contact_phone'] = array('type' =>
'varchar','precision' => '20','nullable' => True);
+
+ break;
+ case 'vendor':
+ $fd['org_name'] = array('type' =>
'varchar','precision' => '100','nullable' => True);
+ $fd['email'] = array('type' =>
'varchar','precision' => '64','nullable' => True);
+ $fd['contact_phone'] = array('type' =>
'varchar','precision' => '20','nullable' => True);
+ $fd['klasse'] = array('type' =>
'varchar','precision' => '10','nullable' => True);
+ $fd['member_of'] = array('type' =>
'varchar','precision' => '255','nullable' => True);
+ $fd['mva'] = array('type' =>
'int','precision' => '4','nullable' => True);
+
+ break;
+ default:
+ return;
+ break;
+ }
+ return $fd;
+ }
+
function edit_attrib($attrib)
{
$attribute_table = 'fm_' . $this->role . '_attribute';
@@ -737,6 +824,8 @@
$OldDataType = $this->db->f('datatype');
$OldPrecision = $this->db->f('precision_');
+ $table_def =
$this->get_table_def($attrib['entity_id'],$attrib['cat_id']);
+
$this->init_process();
$this->oProc->m_odb->transaction_begin();
$this->db->transaction_begin();
@@ -755,31 +844,30 @@
$attrib_type=$attrib['column_info']['type'];
- if(($OldColumnName !=$attrib['column_name']) ||
($attrib['column_info']['type'] != $this->db->f('datatype')))
- {
- $value_set=array(
- 'column_name' =>
$attrib['column_name'],
- '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']
- );
+ $this->oProc->m_aTables = $table_def;
+ if($OldColumnName !=$attrib['column_name'])
+ {
+ $value_set=array('column_name' =>
$attrib['column_name']);
$value_set =
$this->bocommon->validate_db_update($value_set);
+ $this->db->query("UPDATE $attribute_table set
$value_set WHERE id=" . $attrib['id'],__LINE__,__FILE__);
- $this->db->query("UPDATE $attribute_table set
$value_set WHERE id=" . $attrib['id']);
-
- if($attrib['column_info']['type']=='email' &&
!$attrib['column_info']['precision'])
+ $this->oProc->RenameColumn($table,
$OldColumnName, $attrib['column_name']);
+ }
+
+ if (($OldDataType != $attrib['column_info']['type']) ||
($OldPrecision != $attrib['column_info']['precision']) )
+ {
+ if($attrib_type!='R' && $attrib_type!='CH' &&
$attrib_type!='LB')
{
- $attrib['column_info']['precision']=64;
+ $this->db->query("DELETE FROM
$choice_table WHERE attrib_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'])
+ if(!$attrib['column_info']['precision'])
{
- $attrib['column_info']['precision']=4;
+ if($precision =
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']))
+ {
+
$attrib['column_info']['precision']=$precision;
+ }
}
if(!$attrib['column_info']['default'])
@@ -787,11 +875,21 @@
unset($attrib['column_info']['default']);
}
-
-
$this->oProc->AlterColumn($table,$OldColumnName,$attrib['column_name'],$attrib['column_info']);
+ $value_set=array(
+ '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 $attribute_table set
$value_set WHERE id=" . $attrib['id']);
+
+ $attrib['column_info']['type'] =
$this->bocommon->translate_datatype_insert($attrib['column_info']['type']);
+
$this->oProc->AlterColumn($table,$attrib['column_name'],$attrib['column_info']);
+ }
if($attrib['new_choice'])
{
@@ -809,7 +907,6 @@
. "VALUES ($values)");
}
-
if($attrib['delete_choice'])
{
for
($i=0;$i<count($attrib['delete_choice']);$i++)
@@ -818,25 +915,16 @@
}
}
-//html_print_r($attrib_type);
- if($attrib_type!='R' && $attrib_type!='CH' &&
$attrib_type!='LB')
- {
- $this->db->query("DELETE FROM $choice_table
WHERE attrib_id=" . $attrib['id']);
- }
-
-
$this->db->transaction_commit();
$this->oProc->m_odb->transaction_commit();
$receipt['message'][] = array('msg' =>
lang('Attribute has been edited'));
-
return $receipt;
-
}
+
function resort_attrib($data)
{
-//html_print_r($data);
$attribute_table = 'fm_' . $this->role . '_attribute';
if(is_array($data))
{
Index: property/inc/class.soadmin_entity.inc.php
diff -u property/inc/class.soadmin_entity.inc.php:1.14
property/inc/class.soadmin_entity.inc.php:1.15
--- property/inc/class.soadmin_entity.inc.php:1.14 Tue Feb 7 14:17:28 2006
+++ property/inc/class.soadmin_entity.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.soadmin_entity.inc.php,v 1.14 2006/02/07 14:17:28
sigurdne Exp $
+ * @version $Id: class.soadmin_entity.inc.php,v 1.15 2006/02/07 19:22:01
sigurdne Exp $
*/
/**
@@ -1063,14 +1063,12 @@
$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__);
}
- if($attrib['column_info']['type']=='email' &&
!$attrib['column_info']['precision'])
+ if(!$attrib['column_info']['precision'])
{
- $attrib['column_info']['precision']=64;
- }
-
- if($precision =
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']))
- {
-
$attrib['column_info']['precision']=$precision;
+ if($precision =
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']))
+ {
+
$attrib['column_info']['precision']=$precision;
+ }
}
if(!$attrib['column_info']['default'])
@@ -1095,8 +1093,6 @@
$this->oProc->AlterColumn('fm_entity_'.$attrib['entity_id'] . '_' .
$attrib['cat_id'],$attrib['column_name'],$attrib['column_info']);
}
- $choice_table ='fm_entity_choice';
-
if($attrib['new_choice'])
{
$choice_id =
$this->bocommon->next_id($choice_table
,array('entity_id'=>$attrib['entity_id'],'cat_id'=>$attrib['cat_id'],'attrib_id'=>$attrib['id']));
Index: property/inc/class.soadmin_location.inc.php
diff -u property/inc/class.soadmin_location.inc.php:1.15
property/inc/class.soadmin_location.inc.php:1.16
--- property/inc/class.soadmin_location.inc.php:1.15 Mon Jan 30 22:14:19 2006
+++ property/inc/class.soadmin_location.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.soadmin_location.inc.php,v 1.15 2006/01/30
22:14:19 sigurdne Exp $
+ * @version $Id: class.soadmin_location.inc.php,v 1.16 2006/02/07
19:22:01 sigurdne Exp $
*/
/**
@@ -722,9 +722,10 @@
return $receipt;
}
-
function edit_attrib($attrib)
{
+ $choice_table ='fm_location_choice';
+
$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']);
@@ -740,11 +741,11 @@
$history_table_def['fm_location'.$attrib['type_id'] .
'_history'] = $table_def['fm_location'.$attrib['type_id']];
$history_table_def['fm_location'.$attrib['type_id']]['fd']['exp_date']=array('type'
=> 'timestamp','nullable' => False,'default' => 'current_timestamp');
//
$history_table_def['fm_location'.$attrib['type_id']]['fd']['change_type'] =
array('type' => 'int','precision' => '4','nullable' => True);
-
-
unset($history_table_def['fm_location'.$attrib['type_id']]['pk']);
-
unset($history_table_def['fm_location'.$attrib['type_id']]['fk']);
-
unset($history_table_def['fm_location'.$attrib['type_id']]['ix']);
-
unset($history_table_def['fm_location'.$attrib['type_id']]['uc']);
+
+
$history_table_def['fm_location'.$attrib['type_id']]['pk'] = array();
+
$history_table_def['fm_location'.$attrib['type_id']]['fk'] = array();
+
$history_table_def['fm_location'.$attrib['type_id']]['ix'] = array();
+
$history_table_def['fm_location'.$attrib['type_id']]['uc'] = array();
if($this->receipt['error'])
{
@@ -766,11 +767,11 @@
$this->init_process();
+ $this->oProc->m_odb->transaction_begin();
+
if($OldColumnName !=$attrib['column_name'])
{
- $value_set=array(
- 'column_name' =>
$attrib['column_name']
- );
+ $value_set=array('column_name' =>
$attrib['column_name']);
$value_set =
$this->bocommon->validate_db_update($value_set);
@@ -782,11 +783,19 @@
$this->oProc->RenameColumn('fm_location'.$attrib['type_id'] . '_history',
$OldColumnName, $attrib['column_name']);
}
- if($OldColumnType !=$attrib['column_info']['type'])
+ if (($OldDataType != $attrib['column_info']['type']) ||
($OldPrecision != $attrib['column_info']['precision']) )
{
- if($precision =
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']))
+ if($attrib['column_info']['type']!='R' &&
$attrib['column_info']['type']!='CH' && $attrib['column_info']['type']!='LB')
{
-
$attrib['column_info']['precision']=$precision;
+ $this->db->query("DELETE FROM
$choice_table WHERE type_id=" . $attrib['type_id']. " AND attrib_id=" .
$attrib['id'],__LINE__,__FILE__);
+ }
+
+ if(!$attrib['column_info']['precision'])
+ {
+ if($precision =
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']))
+ {
+
$attrib['column_info']['precision']=$precision;
+ }
}
if(!$attrib['column_info']['default'])
@@ -794,14 +803,13 @@
unset($attrib['column_info']['default']);
}
-
$value_set=array(
- 'type_id' =>
$attrib['type_id'],
- 'datatype' =>
$attrib['column_info']['type'],
+ 'type_id' =>
$attrib['type_id'],
+ 'datatype' =>
$attrib['column_info']['type'],
'precision_' =>
$attrib['column_info']['precision'],
- 'scale' =>
$attrib['column_info']['scale'],
+ 'scale' =>
$attrib['column_info']['scale'],
'default_value' =>
$attrib['column_info']['default'],
- 'nullable' =>
$attrib['column_info']['nullable']
+ 'nullable' =>
$attrib['column_info']['nullable']
);
$value_set =
$this->bocommon->validate_db_update($value_set);
@@ -816,8 +824,6 @@
$this->oProc->AlterColumn('fm_location'.$attrib['type_id'] .
'_history',$attrib['column_name'],$attrib['column_info']);
}
- $choice_table ='fm_location_choice';
-
if($attrib['new_choice'])
{
$choice_id =
$this->bocommon->next_id($choice_table
,array('type_id'=>$attrib['type_id'],'attrib_id'=>$attrib['id']));
@@ -843,12 +849,9 @@
}
}
- if($attrib['column_info']['type']!='R' &&
$attrib['column_info']['type']!='CH' && $attrib['column_info']['type']!='LB')
- {
- $this->db->query("DELETE FROM $choice_table
WHERE type_id=" . $attrib['type_id']. " AND attrib_id=" .
$attrib['id'],__LINE__,__FILE__);
- }
$this->db->transaction_commit();
+ $this->oProc->m_odb->transaction_commit();
$receipt['message'][] = array('msg' =>
lang('Attribute has been edited'));
@@ -914,20 +917,37 @@
{
$table_def['fm_location'.$id]['pk'] =
explode(',',$this->db->f('pk'));
}
+ else
+ {
+ $table_def['fm_location'.$id]['pk'] = array();
+ }
+
if($fk)
{
$table_def['fm_location'.$id]['fk'] = $fk;
}
+ else
+ {
+ $table_def['fm_location'.$id]['fk'] = array();
+ }
+
if($this->db->f('ix'))
{
$table_def['fm_location'.$id]['ix'] =
explode(',',$this->db->f('ix'));
}
+ else
+ {
+ $table_def['fm_location'.$id]['ix'] = array();
+ }
+
if($this->db->f('uc'))
{
$table_def['fm_location'.$id]['uc'] =
explode(',',$this->db->f('uc'));
}
-
-
+ else
+ {
+ $table_def['fm_location'.$id]['uc'] = array();
+ }
return $table_def;
}
Index: property/inc/class.uiactor.inc.php
diff -u property/inc/class.uiactor.inc.php:1.14
property/inc/class.uiactor.inc.php:1.15
--- property/inc/class.uiactor.inc.php:1.14 Tue Feb 7 14:44:28 2006
+++ property/inc/class.uiactor.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.uiactor.inc.php,v 1.14 2006/02/07 14:44:28
sigurdne Exp $
+ * @version $Id: class.uiactor.inc.php,v 1.15 2006/02/07 19:22:01
sigurdne Exp $
*/
@@ -778,7 +778,7 @@
$receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
}
-
if(!ctype_digit($values['column_info']['precision']))
+
if(!ctype_digit($values['column_info']['precision']) &&
$values['column_info']['precision'])
{
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
unset($values['column_info']['precision']);
Index: property/inc/class.uiadmin_entity.inc.php
diff -u property/inc/class.uiadmin_entity.inc.php:1.16
property/inc/class.uiadmin_entity.inc.php:1.17
--- property/inc/class.uiadmin_entity.inc.php:1.16 Tue Feb 7 08:31:07 2006
+++ property/inc/class.uiadmin_entity.inc.php Tue Feb 7 19:22:01 2006
@@ -10,7 +10,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.uiadmin_entity.inc.php,v 1.16 2006/02/07 08:31:07
sigurdne Exp $
+ * @version $Id: class.uiadmin_entity.inc.php,v 1.17 2006/02/07 19:22:01
sigurdne Exp $
*/
/**
@@ -1081,7 +1081,7 @@
$receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
}
-
if(!ctype_digit($values['column_info']['precision']))
+
if(!ctype_digit($values['column_info']['precision']) &&
$values['column_info']['precision'])
{
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
unset($values['column_info']['precision']);
Index: property/inc/class.uiadmin_location.inc.php
diff -u property/inc/class.uiadmin_location.inc.php:1.11
property/inc/class.uiadmin_location.inc.php:1.12
--- property/inc/class.uiadmin_location.inc.php:1.11 Fri Feb 3 12:05:49 2006
+++ property/inc/class.uiadmin_location.inc.php Tue Feb 7 19:22:01 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.uiadmin_location.inc.php,v 1.11 2006/02/03
12:05:49 sigurdne Exp $
+ * @version $Id: class.uiadmin_location.inc.php,v 1.12 2006/02/07
19:22:01 sigurdne Exp $
*/
/**
@@ -494,7 +494,7 @@
$receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
}
-
if(!ctype_digit($values['column_info']['precision']))
+
if(!ctype_digit($values['column_info']['precision']) &&
$values['column_info']['precision'])
{
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
unset($values['column_info']['precision']);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc class.bocommon.inc.php class.soact...,
Sigurd Nes <=