[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8118] Property: more on EAV
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8118] Property: more on EAV |
Date: |
Wed, 16 Nov 2011 15:11:56 +0000 |
Revision: 8118
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8118
Author: sigurdne
Date: 2011-11-16 15:11:55 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Property: more on EAV
Modified Paths:
--------------
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.soadmin_entity.inc.php
trunk/property/inc/class.soentity.inc.php
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2011-11-16 13:10:14 UTC (rev
8117)
+++ trunk/property/inc/class.boentity.inc.php 2011-11-16 15:11:55 UTC (rev
8118)
@@ -305,6 +305,8 @@
$custom = createObject('phpgwapi.custom_fields');
$attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+ $category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+
$attrib_filter = array();
if($attrib_data)
{
@@ -314,14 +316,28 @@
{
if($_attrib_filter_value =
phpgw::get_var($attrib['column_name'], 'int'))
{
- $attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} =
'{$_attrib_filter_value}'";
+ if($category['is_eav'])
+ {
+
$attrib_filter[] = "xmlexists('//{$attrib['column_name']}[text() =
''$_attrib_filter_value'']' PASSING BY REF xml_representation)";
+ }
+ else
+ {
+
$attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} =
'{$_attrib_filter_value}'";
+ }
}
}
else if($attrib['datatype'] == 'CH')
{
if($_attrib_filter_value =
phpgw::get_var($attrib['column_name'], 'int'))
{
- $attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']}
{$GLOBALS['phpgw']->db->like} '%,{$_attrib_filter_value},%'";
+ if($category['is_eav'])
+ {
+
$attrib_filter[] =
"xmlexists('//{$attrib['column_name']}[contains(.,'',$_attrib_filter_value,'')]'
PASSING BY REF xml_representation)";
+ }
+ else
+ {
+
$attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']}
{$GLOBALS['phpgw']->db->like} '%,{$_attrib_filter_value},%'";
+ }
}
}
}
Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php 2011-11-16 13:10:14 UTC
(rev 8117)
+++ trunk/property/inc/class.soadmin_entity.inc.php 2011-11-16 15:11:55 UTC
(rev 8118)
@@ -956,6 +956,10 @@
$category = $this->read_single_category($entity_id,
$id);
if($category['is_eav'])
{
+ $this->db->query("SELECT id as type FROM
fm_bim_type WHERE location_id= {$location_id}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $type = (int)$this->db->f('type');
+ $this->db->query("DELETE FROM fm_bim_item WHERE
type = {$type}",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_bim_type WHERE
location_id= {$location_id}",__LINE__,__FILE__);
}
else
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2011-11-16 13:10:14 UTC (rev
8117)
+++ trunk/property/inc/class.soentity.inc.php 2011-11-16 15:11:55 UTC (rev
8118)
@@ -374,7 +374,8 @@
}
}
$user_column_filter = '';
- if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
+
+ if ($_user_columns)
{
$user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$_user_columns) .'))';
}
@@ -459,7 +460,7 @@
{
$ordermethod = " ORDER BY $entity_table.id
DESC";
}
-
+_debug_array($ordermethod);
$filtermethod = "WHERE fm_bim_type.location_id =
{$location_id}";
$where= 'AND';
@@ -470,7 +471,7 @@
&& $category['location_level'] > 0)
{
$access_location =
$this->bocommon->get_location_list(PHPGW_ACL_READ);
- $filtermethod = " $where {$entity_table}.loc1
in ('" . implode("','", $access_location) . "')";
+ $filtermethod = " $where {$entity_table}.loc1
IN ('" . implode("','", $access_location) . "')";
$where= 'AND';
}
@@ -498,8 +499,8 @@
if ($status)
{
- $filtermethod .= " $where
$entity_table.status='$status' ";
- $where= 'AND';
+ // $filtermethod .= " $where
$entity_table.status='$status' ";
+ // $where= 'AND';
}
if ($district_id > 0 && $category['location_level'])
@@ -546,6 +547,7 @@
{
$query = $this->db->db_addslashes($query);
$query = str_replace(",",'.',$query);
+ $_int_query = (int) $query;
if(stristr($query, '.'))
{
$query=explode(".",$query);
@@ -555,7 +557,7 @@
{
if(!$criteria_id)
{
- $_querymethod[] .= "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.num
{$this->like} '%{$query}%' OR address {$this->like} '%{$query}%')";
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
// $where= 'OR';
}
else
@@ -637,7 +639,7 @@
default:
if(!$criteria_id)
{
-
$_querymethod[]= "$entity_table." . $this->db->f('column_name') . " =
'{$query}'";
+
//$_querymethod[]= "$entity_table." . $this->db->f('column_name') . " =
'{$query}'";
$_querymethod[]= "xmlexists('//" . $this->db->f('column_name') . "[text() =
''$query'']' PASSING BY REF xml_representation)";
$__querymethod = array(); // remove block
}
@@ -675,7 +677,7 @@
$cache_info = array();
}
- if(!$cache_info)
+// if(!$cache_info)
{
$sql_cnt = "SELECT DISTINCT fm_bim_item.id " .
substr($sql,strripos($sql,'FROM'));
$sql2 = "SELECT count(*) as cnt FROM
({$sql_cnt}) as t";
@@ -935,7 +937,7 @@
}
}
$user_column_filter = '';
- if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
+ if ($_user_columns)
{
$user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$_user_columns) .'))';
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8118] Property: more on EAV,
Sigurd Nes <=