[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15448] Property: refine search
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15448] Property: refine search |
Date: |
Thu, 11 Aug 2016 09:32:05 +0000 (UTC) |
Revision: 15448
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15448
Author: sigurdne
Date: 2016-08-11 09:32:05 +0000 (Thu, 11 Aug 2016)
Log Message:
-----------
Property: refine search
Modified Paths:
--------------
trunk/property/inc/class.soagreement.inc.php
Modified: trunk/property/inc/class.soagreement.inc.php
===================================================================
--- trunk/property/inc/class.soagreement.inc.php 2016-08-11 01:18:10 UTC
(rev 15447)
+++ trunk/property/inc/class.soagreement.inc.php 2016-08-11 09:32:05 UTC
(rev 15448)
@@ -39,6 +39,7 @@
function __construct()
{
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->custom = createObject('property.custom_fields');
$this->bocommon = CreateObject('property.bocommon');
$this->db = clone($GLOBALS['phpgw']->db);
$this->db2 = clone($this->db);
@@ -192,6 +193,7 @@
$this->db->query("SELECT * FROM $attribute_table WHERE
list=1 AND $attribute_filter $user_column_filter ");
+ $cols_return_extra = array();
while ($this->db->next_record())
{
$uicols['input_type'][] = 'text';
@@ -248,6 +250,7 @@
{
$query = $this->db->db_addslashes($query);
+ $querymethod[] = "fm_vendor.org_name
{$this->like} '%{$query}%'";
$querymethod[] = "fm_branch.descr {$this->like}
'%{$query}%'";
$querymethod[] = "{$entity_table}.name
{$this->like} '%{$query}%'";
@@ -255,14 +258,18 @@
while ($this->db->next_record())
{
- if ($this->db->f('datatype') == 'V' ||
$this->db->f('datatype') == 'email' || $this->db->f('datatype') == 'CH')
+ switch ($this->db->f('datatype'))
{
- $querymethod[] =
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
+ case 'V':
+ case 'T':
+ case 'email':
+ case 'CH':
+ $querymethod[] =
"$entity_table." . $this->db->f('column_name') . " {$this->like} '%$query%'";
+ break;
+ default:
+ $querymethod[] =
"$entity_table." . $this->db->f('column_name') . " = '$query'";
+ break;
}
- else
- {
- $querymethod[] =
"$entity_table." . $this->db->f('column_name') . " = '$query'";
- }
}
if (isset($querymethod) AND
is_array($querymethod))
@@ -299,70 +306,16 @@
$agreement_list[$j][$cols_return[$i]] =
$this->db->f($cols_return[$i]);
}
- if (isset($cols_return_extra) &&
is_array($cols_return_extra))
+ foreach ($cols_return_extra as $custom_col)
{
- for ($i = 0; $i <
count($cols_return_extra); $i++)
+ if ($custom_value =
$this->db->f($custom_col['name'], true))
{
- $value = '';
- $value =
$this->db->f($cols_return_extra[$i]['name']);
-
- if
(($cols_return_extra[$i]['datatype'] == 'R' ||
$cols_return_extra[$i]['datatype'] == 'LB') && $value)
- {
- $sql = "SELECT value
FROM $choice_table WHERE $attribute_filter AND attrib_id=" .
$cols_return_extra[$i]['attrib_id'] . " AND id=" . $value;
- $this->db2->query($sql);
-
$this->db2->next_record();
-
$agreement_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
- }
- else if
($cols_return_extra[$i]['datatype'] == 'AB' && $value)
- {
- $contact_data =
$contacts->read_single_entry($value, array('n_given' => 'n_given',
- 'n_family' =>
'n_family', 'email' => 'email'));
-
$agreement_list[$j][$cols_return_extra[$i]['name']] =
$contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
- }
- else if
($cols_return_extra[$i]['datatype'] == 'VENDOR' && $value)
- {
- $sql = "SELECT org_name
FROM fm_vendor where id=$value";
- $this->db2->query($sql);
-
$this->db2->next_record();
-
$agreement_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
- }
- else if
($cols_return_extra[$i]['datatype'] == 'CH' && $value)
- {
-// $ch=
unserialize($value);
- $ch = explode(',',
trim($data['value'], ','));
- if (isset($ch) AND
is_array($ch))
- {
- for ($k = 0; $k
< count($ch); $k++)
- {
- $sql =
"SELECT value FROM $choice_table WHERE $attribute_filter AND attrib_id=" .
$cols_return_extra[$i]['attrib_id'] . " AND id=" . $ch[$k];
-
$this->db2->query($sql);
- while
($this->db2->next_record())
- {
-
$ch_value[] = $this->db2->f('value');
- }
- }
-
$agreement_list[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
-
unset($ch_value);
- }
- }
- else if
($cols_return_extra[$i]['datatype'] == 'D' && $value)
- {
-
$agreement_list[$j][$cols_return_extra[$i]['name']] =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
strtotime($value));
- }
- else if
($cols_return_extra[$i]['datatype'] == 'timestamp' && $value)
- {
-
$agreement_list[$j][$cols_return_extra[$i]['name']] =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$value);
- }
- else if
($cols_return_extra[$i]['datatype'] == 'link' && $value)
- {
-
$agreement_list[$j][$cols_return_extra[$i]['name']] =
phpgw::safe_redirect($value);
- }
- else
- {
-
$agreement_list[$j][$cols_return_extra[$i]['name']] = $value;
- }
+ $custom_value =
$this->custom->get_translated_value(array('value' => $custom_value,
+ 'attrib_id' =>
$custom_col['attrib_id'], 'datatype' => $custom_col['datatype']), $location_id);
}
+
$agreement_list[$j][$custom_col['name']] = $custom_value;
}
+
$j++;
}
//_debug_array($agreement_list);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15448] Property: refine search,
sigurdne <=