[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15895] property: refine search
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15895] property: refine search |
Date: |
Tue, 25 Oct 2016 16:34:17 +0000 (UTC) |
Revision: 15895
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15895
Author: sigurdne
Date: 2016-10-25 16:34:17 +0000 (Tue, 25 Oct 2016)
Log Message:
-----------
property: refine search
Modified Paths:
--------------
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2016-10-25 16:33:45 UTC (rev
15894)
+++ trunk/property/inc/class.soentity.inc.php 2016-10-25 16:34:17 UTC (rev
15895)
@@ -668,19 +668,35 @@
if ($query)
{
- $query = $this->db->db_addslashes($query);
+ $query =
html_entity_decode($this->db->db_addslashes($query));
$query = str_replace(",", '.', $query);
- $_int_query = (int)$query;
+ $_int_query = 0;
+ $query_parts = array();
+ if(ctype_digit($query))
+ {
+ $_int_query = (int)$query;
+ }
if (stristr($query, '.'))
{
- $query = explode(".", $query);
- $_querymethod[] =
"($entity_table.location_code $this->like '" . $query[0] . "%' AND
$entity_table.location_code $this->like '%" . $query[1] . "')";
+ $query_parts = explode(".", $query);
}
+
+ if(ctype_digit( $query_parts[0]) &&
!empty($query_parts[1]) && ctype_digit( $query_parts[1]))
+ {
+ $_querymethod[] =
"($entity_table.location_code $this->like '" . $query_parts[0] . "%' AND
$entity_table.location_code $this->like '%" . $query_parts[1] . "')";
+ }
else
{
if (!$criteria_id)
{
- $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
+ if($_int_query)
+ {
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
+ }
+ else
+ {
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR address
{$this->like} '%{$query}%')";
+ }
// $where= 'OR';
}
else
@@ -795,7 +811,7 @@
}
}
}
-
+//_debug_array($_querymethod);
$sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)"
. " {$this->join} phpgw_accounts ON
$entity_table.user_id = phpgw_accounts.account_id"
. " {$acl_group_join}";
@@ -837,8 +853,7 @@
{
if(!empty($attibute['choice']))
{
- $_querymethod[] =
"(json_representation->>'status' IS NULL OR CAST(
json_representation->>'status' AS integer) < 90)";
- $__querymethod =
array(); // remove block
+ $_querymethod_status =
"(json_representation->>'status' IS NULL OR CAST(
json_representation->>'status' AS integer) < 90)";
}
}
}
@@ -898,10 +913,16 @@
$querymethod = '';
$_querymethod = array_merge($__querymethod,
$_querymethod);
+// _debug_array($_querymethod);
if ($_querymethod)
{
$querymethod = " $where (" . implode(' OR ',
$_querymethod) . ')';
unset($_querymethod);
+
+ if($_querymethod_status)
+ {
+ $querymethod .= " AND
{$_querymethod_status}";
+ }
}
// $filtermethod .= "AND xmlexists('//location_code[text()
= ''5002-02'']' PASSING BY REF xml_representation)";
@@ -1723,17 +1744,34 @@
if ($query)
{
$query = $this->db->db_addslashes($query);
+ $_int_query = 0;
+ $query_parts = array();
+ if(ctype_digit($query))
+ {
+ $_int_query = (int)$query;
+ }
$query = str_replace(",", '.', $query);
if (stristr($query, '.'))
{
- $query = explode(".", $query);
- $_querymethod[] =
"($entity_table.location_code $this->like '" . $query[0] . "%' AND
$entity_table.location_code $this->like '%" . $query[1] . "')";
+ $query_parts = explode(".", $query);
}
+
+ if(ctype_digit( $query_parts[0]) &&
!empty($query_parts[1]) && ctype_digit( $query_parts[1]))
+ {
+ $_querymethod[] =
"($entity_table.location_code $this->like '" . $query_parts[0] . "%' AND
$entity_table.location_code $this->like '%" . $query_parts[1] . "')";
+ }
else
{
if (!$criteria_id)
{
- $_querymethod[] .= "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.num
{$this->like} '%{$query}%' OR address {$this->like} '%{$query}%')";
+ if($_int_query)
+ {
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id
= {$_int_query} OR address {$this->like} '%{$query}%')";
+ }
+ else
+ {
+ $_querymethod[] = "(
{$entity_table}.location_code {$this->like} '%{$query}%' OR address
{$this->like} '%{$query}%')";
+ }
// $where= 'OR';
}
else
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2016-10-25 16:33:45 UTC (rev
15894)
+++ trunk/property/inc/class.uientity.inc.php 2016-10-25 16:34:17 UTC (rev
15895)
@@ -121,7 +121,17 @@
{
$this->acl_location .= ".{$this->cat_id}";
}
- $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ,
$this->type_app[$this->type]);
+ $config = CreateObject('phpgwapi.config',
'property')->read();
+
+ if(!empty($config['bypass_acl_at_entity']) &&
is_array($config['bypass_acl_at_entity']) && in_array($this->entity_id,
$config['bypass_acl_at_entity']))
+ {
+ $this->acl_read = true;
+ }
+ else
+ {
+ $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ,
$this->type_app[$this->type]);
+ }
+
$this->acl_add = $this->acl->check($this->acl_location,
PHPGW_ACL_ADD, $this->type_app[$this->type]);
$this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT,
$this->type_app[$this->type]);
$this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE,
$this->type_app[$this->type]);
@@ -1247,8 +1257,9 @@
//redirect if no rights
if (!$this->acl_read && $this->cat_id)
{
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop',
- 'perm' => 1, 'acl_location' =>
$this->acl_location));
+ phpgw::no_access('property', lang('No access')
.' :: '. $this->acl_location);
+// $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop',
+// 'perm' => 1, 'acl_location' =>
$this->acl_location));
}
$default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])
?
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'] :
'');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15895] property: refine search,
sigurdne <=