[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14813] filter, validation and fix endless loop
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14813] filter, validation and fix endless loop |
Date: |
Mon, 07 Mar 2016 14:40:32 +0000 |
Revision: 14813
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14813
Author: sigurdne
Date: 2016-03-07 14:40:32 +0000 (Mon, 07 Mar 2016)
Log Message:
-----------
filter, validation and fix endless loop
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.sorequest.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/inc/class.uirequest.inc.php
trunk/property/templates/base/generic.xsl
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2016-03-06 14:38:37 UTC
(rev 14812)
+++ trunk/controller/inc/class.socheck_list.inc.php 2016-03-07 14:40:32 UTC
(rev 14813)
@@ -497,12 +497,23 @@
$this->db->query($sql);
$this->db->next_record();
-
- return array(
- 'start_timestamp' =>
$this->db->f('start_timestamp'),
- 'end_timestamp' =>
$this->db->f('end_timestamp'),
- );
+ $start_timestamp = $this->db->f('start_timestamp');
+ $end_timestamp = $this->db->f('end_timestamp');
+ if($start_timestamp)
+ {
+ return array(
+ 'start_timestamp' => $start_timestamp,
+ 'end_timestamp' => $end_timestamp
+ );
+ }
+ else
+ {
+ return array(
+ 'start_timestamp' => time(),
+ 'end_timestamp' => time()
+ );
+ }
}
/**
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2016-03-06 14:38:37 UTC (rev
14812)
+++ trunk/property/inc/class.solocation.inc.php 2016-03-07 14:40:32 UTC (rev
14813)
@@ -153,7 +153,7 @@
$entity['related'][] = array
(
'entity_link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uirequest.index',
- 'query' => $location_code)),
+ 'query' => $location_code,
'status_id' => 'all')),
'name' => lang('request') . "
[{$hits}]",
'descr' => lang('request')
);
Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php 2016-03-06 14:38:37 UTC (rev
14812)
+++ trunk/property/inc/class.sorequest.inc.php 2016-03-07 14:40:32 UTC (rev
14813)
@@ -479,8 +479,7 @@
$uicols['classname'][] = 'rightClasss';
$uicols['sortable'][] = true;
-// $cols.= ",sum(amount) as consume";
-// $cols_return[] = 'consume';
+/*
$uicols['input_type'][] = 'text';
$uicols['name'][] = 'consume';
$uicols['descr'][] = lang('consume');
@@ -491,8 +490,8 @@
$uicols['formatter'][] = 'FormatterRight';
$uicols['classname'][] = '';
$uicols['sortable'][] = true;
+*/
-
$cols.= ",$entity_table.score";
$cols_return[] = 'score';
$cols_group[] = 'score';
@@ -580,9 +579,9 @@
$paranthesis .= '(';
$joinmethod .= "{$this->_left_join} fm_request_planning
ON {$entity_table}.id = fm_request_planning.request_id)";
+// $paranthesis .= '(';
+// $joinmethod .= "{$this->_left_join} fm_request_consume
ON {$entity_table}.id = fm_request_consume.request_id)";
$paranthesis .= '(';
- $joinmethod .= "{$this->_left_join} fm_request_consume
ON {$entity_table}.id = fm_request_consume.request_id)";
- $paranthesis .= '(';
$joinmethod .= "{$this->_left_join}
fm_request_condition ON {$entity_table}.id = fm_request_condition.request_id)";
$_location_level =
isset($GLOBALS['phpgw']->config->config_data['request_location_level']) &&
$GLOBALS['phpgw']->config->config_data['request_location_level'] ?
$GLOBALS['phpgw']->config->config_data['request_location_level'] : 0;
@@ -743,8 +742,12 @@
}
else
{
+ if(ctype_digit($query))
+ {
+ $_filter_id = "OR fm_request.id
=" . (int)$query;
+ }
$query =
$this->_db->db_addslashes($query);
- $querymethod = " $where
(fm_request.title {$this->_like} '%$query%' OR fm_request.address
{$this->_like} '%$query%' OR fm_request.location_code {$this->_like} '%$query%'
OR fm_request.id =" . (int)$query;
+ $querymethod = " $where
(fm_request.title {$this->_like} '%$query%' OR fm_request.address
{$this->_like} '%$query%' OR fm_request.location_code {$this->_like} '%$query%'
{$_filter_id}";
for ($i = 1; $i <= ($_location_level);
$i++)
{
$querymethod .= " OR
fm_location{$i}.loc{$i}_name {$this->_like} '%$query%'";
@@ -795,12 +798,12 @@
$this->sum_investment = $this->_db->f('sum_investment');
$this->sum_operation = $this->_db->f('sum_operation');
$this->sum_potential_grants =
$this->_db->f('sum_potential_grants');
-
+/*
$sql3 = "SELECT sum(fm_request_consume.amount) as
sum_consume FROM {$sql_arr[1]}";
$this->_db->query($sql3, __LINE__, __FILE__);
$this->_db->next_record();
$this->sum_consume = $this->_db->f('sum_consume');
-
+*/
// _debug_array($sql_arr);
//address@hidden 23/10/08 avoid retrieve data in first
time, only render definition for headers (var myColumnDefs)
if ($dry_run)
@@ -838,7 +841,7 @@
}
$j++;
}
-
+/*
foreach ($dataset as &$entry)
{
$sql = "SELECT sum(amount) as consume FROM
fm_request_consume WHERE request_id={$entry['request_id']['value']}";
@@ -852,7 +855,7 @@
'attrib_id' => false,
);
}
-
+*/
$values = $this->custom->translate_value($dataset,
$location_id);
return $values;
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2016-03-06 14:38:37 UTC (rev
14812)
+++ trunk/property/inc/class.uientity.inc.php 2016-03-07 14:40:32 UTC (rev
14813)
@@ -2082,7 +2082,7 @@
)
);
}
- if
(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
+ if ($_enable_controller)
{
$location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
$_controls =
$this->get_controls_at_component($location_id, $id);
Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php 2016-03-06 14:38:37 UTC (rev
14812)
+++ trunk/property/inc/class.uirequest.inc.php 2016-03-07 14:40:32 UTC (rev
14813)
@@ -262,9 +262,14 @@
);
$count = count($values_combo_box);
- $values_combo_box[$count] =
$this->bo->select_status_list('filter', $this->status_id);
+ $values_combo_box[$count] =
$this->bo->select_status_list('filter');
array_unshift($values_combo_box[$count], array('id' =>
'all', 'name' => lang('all')));
array_unshift($values_combo_box[$count], array('id' =>
'open', 'name' => lang('open')));
+ foreach ($values_combo_box[$count] as &$_entry)
+ {
+ $_entry['selected'] = $_entry['id'] ==
$this->status_id ? 1 : 0;
+ }
+ unset($_entry);
$combos[] = array
(
'type' => 'filter',
@@ -281,6 +286,11 @@
$_degree['id'] ++;
}
array_unshift($values_combo_box[$count], array('id' =>
'', 'name' => lang('condition degree')));
+ foreach ($values_combo_box[$count] as &$_entry)
+ {
+ $_entry['selected'] = $_entry['id'] ==
$this->degree_id ? 1 : 0;
+ }
+ unset($_entry);
$combos[] = array
(
'type' => 'filter',
@@ -684,7 +694,8 @@
'allrows' => true,
'select_all' => !!$project_id,
'editor_action' => array(),
- 'field' => array()
+ 'field' => array(),
+ 'query' => phpgw::get_var('query')
)
);
Modified: trunk/property/templates/base/generic.xsl
===================================================================
--- trunk/property/templates/base/generic.xsl 2016-03-06 14:38:37 UTC (rev
14812)
+++ trunk/property/templates/base/generic.xsl 2016-03-07 14:40:32 UTC (rev
14813)
@@ -63,10 +63,18 @@
<xsl:value-of select="value_id"/>
</xsl:when>
<xsl:otherwise>
-
<input data-validation="number" type="text" name="values[{id_name}]"
value="{value_id}">
+
<input type="text" name="values[{id_name}]" value="{value_id}">
<xsl:attribute name="title">
<xsl:value-of select="php:function('lang', 'Enter the
ID')"/>
</xsl:attribute>
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:if test="id_type != 'varchar'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>number</xsl:text>
+
</xsl:attribute>
+
</xsl:if>
</input>
</xsl:otherwise>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14813] filter, validation and fix endless loop,
Sigurd Nes <=