[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17011] Property: more on location exceptions
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17011] Property: more on location exceptions |
Date: |
Wed, 30 Aug 2017 13:35:21 -0400 (EDT) |
Revision: 17011
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17011
Author: sigurdne
Date: 2017-08-30 13:35:21 -0400 (Wed, 30 Aug 2017)
Log Message:
-----------
Property: more on location exceptions
Modified Paths:
--------------
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/class.sogeneric_.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.uigeneric.inc.php
trunk/property/setup/setup.inc.php
trunk/property/templates/base/generic.xsl
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2017-08-30 11:42:49 UTC (rev
17010)
+++ trunk/property/inc/class.sogeneric.inc.php 2017-08-30 17:35:21 UTC (rev
17011)
@@ -2622,28 +2622,30 @@
'method_input' => array('role' => 'parent', 'type' =>
'location_exception_category', 'selected' => '##category_id##')
)
),
-// array
-// (
-// 'name' =>
'category_text_id',
-// 'descr' =>
lang('category content'),
-// 'type' =>
'select',
-// 'nullable' =>
true,
-// 'filter' =>
false,
-// 'sortable' =>
true,
-// 'values_def' =>
array
-// (
-//
'valueset' => false,
-//
'method' => 'property.bogeneric.get_list',
-//
'get_single_value' => 'property.sogeneric.get_name',
-//
'method_input' => array(
-//
'type' => 'location_exception_category_text',
-//
'selected' => '##category_text_id##',
-//// //
'filter' => array('category_id' => '##category_id##')
-//
)
-// )
-// ),
array
+ (
+ 'name' =>
'category_text_id',
+ 'descr' =>
lang('category content'),
+ 'type' =>
'select',
+ 'nullable' =>
true,
+ 'filter' =>
false,
+ 'sortable' =>
true,
+ 'js_file'
=> 'location_exception_category_text.edit.js',
+ 'values_def' =>
array
(
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
+
'method_input' => array(
+
'type' => 'location_exception_category_text',
+
'selected' => '##category_text_id##',
+
'mapping' => array('name' => 'content'),
+
'filter' => array('category_id' => '##category_id##'),
+
)
+ )
+ ),
+ array
+ (
'name' =>
'alert_vendor',
'descr' =>
lang('alert vendor'),
'type' =>
'checkbox'
Modified: trunk/property/inc/class.sogeneric_.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric_.inc.php 2017-08-30 11:42:49 UTC (rev
17010)
+++ trunk/property/inc/class.sogeneric_.inc.php 2017-08-30 17:35:21 UTC (rev
17011)
@@ -273,7 +273,7 @@
foreach ($this->location_info['fields'] as
$field)
{
- if ($field['type'] == 'varchar')
+ if ($field['type'] == 'varchar' ||
$field['type'] == 'text' || $field['type'] == 'location')
{
$querymethod .= " OR
{$table}.{$field['name']} $this->_like '%$query%'";
}
@@ -359,12 +359,22 @@
public function get_name( $data )
{
+ $mapping = array();
+ if (isset($data['mapping']) && $data['mapping'])
+ {
+ $mapping = $data['mapping'];
+ }
+ else
+ {
+ $mapping = array('name' => 'name');
+ }
+
if (isset($data['type']) && $data['type'])
{
$this->get_location_info($data['type']);
}
$values = $this->read_single($data);
- return isset($values['name']) ? $values['name'] :
$values['descr'];
+ return isset($values[$mapping['name']]) ?
$values[$mapping['name']] : $values['descr'];
}
function read_single( $data, $values = array() )
@@ -478,12 +488,23 @@
$return_fields = isset($data['fields']) &&
$data['fields'] && is_array($data['fields']) ? $data['fields'] : array();
+
+ $mapping = array();
+ if (isset($data['mapping']) && $data['mapping'])
+ {
+ $mapping = $data['mapping'];
+ }
+ else
+ {
+ $mapping = array('name' => 'name');
+ }
+
$i = 0;
while ($this->_db->next_record())
{
$_extra = $this->_db->f($id_in_name, true);
$id = $this->_db->f('id');
- if (!$name = $this->_db->f('name', true))
+ if (!$name = $this->_db->f($mapping['name'],
true))
{
$name = $this->_db->f('descr', true);
}
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-08-30 11:42:49 UTC (rev
17010)
+++ trunk/property/inc/class.solocation.inc.php 2017-08-30 17:35:21 UTC (rev
17011)
@@ -2223,7 +2223,7 @@
. " FROM fm_location_exception"
. " {$this->join}
fm_location_exception_severity ON fm_location_exception.severity_id =
fm_location_exception_severity.id"
. " {$this->join}
fm_location_exception_category ON fm_location_exception.category_id =
fm_location_exception_category.id"
- . " {$this->left_join}
fm_location_exception_category_text ON fm_location_exception_category.id =
fm_location_exception_category_text.category_id"
+ . " {$this->left_join}
fm_location_exception_category_text ON fm_location_exception.category_text_id =
fm_location_exception_category_text.id"
. " WHERE location_code =
'{$_location_code}'"
. " AND start_date < $now AND (end_date
IS NULL OR end_date = 0 OR end_date > $now)";
Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php 2017-08-30 11:42:49 UTC (rev
17010)
+++ trunk/property/inc/class.uigeneric.inc.php 2017-08-30 17:35:21 UTC (rev
17011)
@@ -57,7 +57,8 @@
'download' => true,
'columns' => true,
'attrib_history' => true,
- 'edit_field' => true
+ 'edit_field' => true,
+ 'get_list' => true
);
function __construct()
@@ -107,6 +108,18 @@
$GLOBALS['phpgw_info']['flags']['menu_selection'] = $_menu_selection;
}
}
+
+ function get_list( )
+ {
+ $params = array(
+ 'type' => phpgw::get_var('type'),
+ 'selected' => phpgw::get_var('selected'),
+ 'mapping' => phpgw::get_var('mapping'),
+ 'filter' => phpgw::get_var('filter'),
+ );
+
+ return $this->bo->get_list($params);
+ }
/*
* Overrides with incoming data from POST
*/
@@ -251,6 +264,7 @@
}
else if
(isset($field['values_def']['method']))
{
+ $method_input = array();
foreach
($field['values_def']['method_input'] as $_argument => $_argument_value)
{
if (preg_match('/^##/',
$_argument_value))
@@ -707,6 +721,11 @@
$field['value'] =
$GLOBALS['phpgw']->common->show_date($field['value'], $dateformat);
}
+ if(!empty($field['js_file']))
+ {
+ self::add_javascript($this->appname,
'portico', $field['js_file']);
+ }
+
if (isset($field['values_def']))
{
if ($field['values_def']['valueset'] &&
is_array($field['values_def']['valueset']))
@@ -719,7 +738,7 @@
}
else if
(isset($field['values_def']['method']))
{
-
+ $method_input = array();
foreach
($field['values_def']['method_input'] as $_argument => $_argument_value)
{
if (preg_match('/^##/',
$_argument_value))
@@ -727,6 +746,20 @@
$_argument_value_name = trim($_argument_value, '#');
$_argument_value = $values[$_argument_value_name];
}
+
+ if($_argument ==
'filter' && is_array($_argument_value))
+ {
+ foreach
($_argument_value as $key => &$value)
+ {
+ if
(preg_match('/^##/', $value))
+ {
+
$_argument_value_name = trim($value, '#');
+
$value = $values[$_argument_value_name] ? $values[$_argument_value_name] : -1;
+ }
+ }
+
+ }
+
if
(preg_match('/^\$this->/', $_argument_value))
{
$_argument_value_name = ltrim($_argument_value, '$this->');
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2017-08-30 11:42:49 UTC (rev 17010)
+++ trunk/property/setup/setup.inc.php 2017-08-30 17:35:21 UTC (rev 17011)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.716';
+ $setup_info['property']['version'] = '0.9.17.717';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/templates/base/generic.xsl
===================================================================
--- trunk/property/templates/base/generic.xsl 2017-08-30 11:42:49 UTC (rev
17010)
+++ trunk/property/templates/base/generic.xsl 2017-08-30 17:35:21 UTC (rev
17011)
@@ -165,7 +165,7 @@
<xsl:when test="type='integer' or type='int'">
-
<input data-validation="number" type="text" name="values[{name}]"
value="{value}" size="{size}">
+
<input data-validation="number" type="text" id="{name}" name="values[{name}]"
value="{value}" size="{size}">
<xsl:attribute name="title">
<xsl:value-of select="$descr"/>
</xsl:attribute>
@@ -179,7 +179,7 @@
</input>
</xsl:when>
<xsl:when test="type='numeric'">
-
<input data-validation="number" data-validation-allowing="float"
data-validation-decimal-separator="." type="text" name="values[{name}]"
value="{value}" size="{size}">
+
<input data-validation="number" data-validation-allowing="float"
data-validation-decimal-separator="." type="text" id="{name}"
name="values[{name}]" value="{value}" size="{size}">
<xsl:attribute name="title">
<xsl:value-of select="$descr"/>
</xsl:attribute>
@@ -195,7 +195,7 @@
<xsl:when test="type='checkbox'">
<xsl:choose>
<xsl:when test="value = 1">
-
<input type="checkbox" name="values[{name}]" value="1"
checked="checked">
+
<input type="checkbox" id="{name}" name="values[{name}]"
value="1" checked="checked">
<xsl:attribute name="title">
<xsl:value-of select="$descr"/>
</xsl:attribute>
@@ -202,7 +202,7 @@
</input>
</xsl:when>
<xsl:otherwise>
-
<input type="checkbox" name="values[{name}]" value="1">
+
<input type="checkbox" id="{name}" name="values[{name}]"
value="1">
<xsl:attribute name="title">
<xsl:value-of select="$descr"/>
</xsl:attribute>
@@ -211,7 +211,7 @@
</xsl:choose>
</xsl:when>
<xsl:when test="type='select'">
-
<select name="values[{name}]" class="pure-input-1-2" >
+
<select id="{name}" name="values[{name}]" class="pure-input-1-2" >
<xsl:choose>
<xsl:when test="nullable!='1'">
<xsl:attribute name="data-validation">
@@ -233,7 +233,7 @@
</select>
</xsl:when>
<xsl:when test="type='multiple_select'">
-
<select name="values[{name}][]" multiple="multiple" class="pure-input-1-2" >
+
<select id="{name}" name="values[{name}][]" multiple="multiple"
class="pure-input-1-2" >
<xsl:choose>
<xsl:when test="nullable!='1'">
<xsl:attribute name="data-validation">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17011] Property: more on location exceptions,
sigurdne <=