[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7528] property: configurable filter on buildingparts
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7528] property: configurable filter on buildingparts |
Date: |
Wed, 24 Aug 2011 14:19:38 +0000 |
Revision: 7528
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7528
Author: sigurdne
Date: 2011-08-24 14:19:37 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
property: configurable filter on buildingparts
Modified Paths:
--------------
trunk/property/inc/class.borequest.inc.php
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/class.uirequest.inc.php
trunk/property/inc/class.uitemplate.inc.php
trunk/property/inc/class.uitts.inc.php
trunk/property/inc/class.uiwo_hour.inc.php
trunk/property/inc/hook_config.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/config.tpl
trunk/property/templates/base/template.xsl
trunk/property/templates/base/wo_hour.xsl
Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.borequest.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -312,6 +312,8 @@
'risk'
=> $risk,
'score'
=> $risk * (int)$condition_type_list[$i]['weight'] *
(int)$conditions[$i]['degree']
);
+
+
array_unshift($values[0]['condition_type_list']['options'], array
('id'=>'','name'=> lang('consequence type')));
}
//_debug_array($values);die();
return $values;
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.sogeneric.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -1160,6 +1160,12 @@
);
break;
case 'building_part':
+
+ $config =
CreateObject('phpgwapi.config','property');
+ $config->read();
+
+ $filter_buildingpart =
isset($config->config_data['filter_buildingpart']) ?
$config->config_data['filter_buildingpart'] : array();
+
$info = array
(
'table'
=> 'fm_building_part',
@@ -1171,7 +1177,56 @@
'name' =>
'descr',
'descr' =>
lang('descr'),
'type' =>
'varchar'
- )
+ ),
+ array
+ (
+ 'name' =>
'filter_1',
+ 'descr' =>
isset($filter_buildingpart[1]) && $filter_buildingpart[1] ?
$filter_buildingpart[1] : 'Filter 1',
+ 'type' =>
'checkbox',
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+ )
+
+ ),
+ array
+ (
+ 'name' =>
'filter_2',
+ 'descr' =>
isset($filter_buildingpart[2]) && $filter_buildingpart[2] ?
$filter_buildingpart[2] : 'Filter 2',
+ 'type' =>
'checkbox',
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+ )
+ ),
+ array
+ (
+ 'name' =>
'filter_3',
+ 'descr' =>
isset($filter_buildingpart[3]) && $filter_buildingpart[3] ?
$filter_buildingpart[3] : 'Filter 3',
+ 'type' =>
'checkbox',
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+ )
+ ),
+ array
+ (
+ 'name' =>
'filter_4',
+ 'descr' =>
isset($filter_buildingpart[4]) && $filter_buildingpart[4] ?
$filter_buildingpart[4] : 'Filter 4',
+ 'type' =>
'checkbox',
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+ )
+ ),
),
'edit_msg'
=> lang('edit'),
'add_msg'
=> lang('add'),
Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.uirequest.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -1337,6 +1337,15 @@
}
}
+ $_filter_buildingpart = array();
+ $filter_buildingpart =
isset($this->config->config_data['filter_buildingpart']) ?
$this->config->config_data['filter_buildingpart'] : array();
+
+ if($filter_key = array_search('.project.request',
$filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+
+
$data = array
(
'mode'
=> $mode,
@@ -1469,7 +1478,7 @@
'regulations'
=> execMethod('property.bogeneric.get_list',array('type' =>
'regulations', 'selected' => $values['regulations'], 'fields' => array('descr',
'external_ref'))),
'condition_list'
=> $this->bo->select_conditions($id),
- 'building_part_list'
=> array('options' =>
$this->bocommon->select_category_list(array('type'=> 'building_part','selected'
=>$values['building_part'], 'order' => 'id', 'id_in_name' => 'num' ))),
+ 'building_part_list'
=> array('options' =>
$this->bocommon->select_category_list(array('type'=> 'building_part','selected'
=>$values['building_part'], 'order' => 'id', 'id_in_name' => 'num', 'filter' =>
$_filter_buildingpart))),
'value_consume'
=> isset($receipt['error']) ? $values['consume_value'] : ''
);
//_debug_array($data);die();
Modified: trunk/property/inc/class.uitemplate.inc.php
===================================================================
--- trunk/property/inc/class.uitemplate.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.uitemplate.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -972,6 +972,17 @@
'hour_id' => $hour_id
);
+ $config =
CreateObject('phpgwapi.config','property');
+ $config->read();
+
+ $_filter_buildingpart = array();
+ $filter_buildingpart =
isset($config->config_data['filter_buildingpart']) ?
$config->config_data['filter_buildingpart'] : array();
+
+ if($filter_key = array_search('.project',
$filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
@@ -1051,13 +1062,8 @@
'lang_new_grouping'
=> lang('New grouping'),
'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
- 'lang_building_part' =>
lang('building_part'),
- 'building_part_list' =>
$this->bowo_hour->get_building_part_list(isset($values['building_part_id']) ?
$values['building_part_id'] : ''),
- 'select_building_part' =>
'values[building_part_id]',
- 'lang_no_building_part' =>
lang('Select building part'),
- 'lang_building_part_statustext'
=> lang('Select the building part for this activity.'),
+ 'building_part_list'
=> array('options' => $this->bocommon->select_category_list(array('type'=>
'building_part','selected' =>$values['building_part_id'], 'order' => 'id',
'id_in_name' => 'num', 'filter' => $_filter_buildingpart))),
-
'ns3420_link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilookup.ns3420')),
'lang_ns3420'
=> lang('NS3420'),
'value_ns3420_id'
=> $values['ns3420_id'],
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.uitts.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -2992,7 +2992,14 @@
'footer'
=> 0
);
-
+ $_filter_buildingpart = array();
+ $filter_buildingpart =
isset($this->bo->config->config_data['filter_buildingpart']) ?
$this->bo->config->config_data['filter_buildingpart'] : array();
+
+ if($filter_key = array_search('.b_account',
$filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+
//----------------------------------------------datatable settings--------
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$cat_select =
$this->cats->formatted_xslt_list(array('select_name' =>
'values[cat_id]','selected' => $this->cat_id,'use_acl' =>
$this->_category_acl));
@@ -3104,7 +3111,7 @@
'textareacols'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
'textarearows'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
'order_cat_list'
=> $order_catetory,
- 'building_part_list'
=> array('options' => $this->bocommon->select_category_list(array('type'=>
'building_part','selected' =>$ticket['building_part'], 'order' => 'id',
'id_in_name' => 'num' ))),
+ 'building_part_list'
=> array('options' => $this->bocommon->select_category_list(array('type'=>
'building_part','selected' =>$ticket['building_part'], 'order' => 'id',
'id_in_name' => 'num', 'filter' => $_filter_buildingpart))),
'order_dim1_list'
=> array('options' =>
$this->bocommon->select_category_list(array('type'=> 'order_dim1','selected'
=>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' => 'num' ))),
'branch_list'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
&&
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list']==1
? array('options' => execMethod('property.boproject.select_branch_list',
$values['branch_id'])) :'',
);
Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/class.uiwo_hour.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -3149,6 +3149,14 @@
'from' => $from
);
+ $_filter_buildingpart = array();
+ $filter_buildingpart =
isset($this->config->config_data['filter_buildingpart']) ?
$this->config->config_data['filter_buildingpart'] : array();
+
+ if($filter_key = array_search('.project',
$filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
@@ -3232,13 +3240,8 @@
'lang_new_grouping'
=> lang('New grouping'),
'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
- 'lang_building_part'
=> lang('building_part'),
- 'building_part_list'
=> $this->bo->get_building_part_list($values['building_part_id']),
- 'select_building_part'
=> 'values[building_part_id]',
- 'lang_no_building_part'
=> lang('Select building part'),
- 'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
+ 'building_part_list'
=> array('options' => $this->bocommon->select_category_list(array('type'=>
'building_part','selected' =>$values['building_part_id'], 'order' => 'id',
'id_in_name' => 'num', 'filter' => $_filter_buildingpart))),
-
'ns3420_link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilookup.ns3420')),
'lang_ns3420'
=> lang('NS3420'),
'value_ns3420_id'
=> $values['ns3420_id'],
Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/inc/hook_config.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -198,3 +198,55 @@
}
return $out;
}
+
+ /**
+ * Get HTML checkbox with filter buildingpart
+ *
+ * @param $config
+ * @return string HTML listbox to be placed in a table
+ */
+ function filter_buildingpart($config)
+ {
+ $filters = array
+ (
+ 1 => 'Filter 1',
+ 2 => 'Filter 2',
+ 3 => 'Filter 3',
+// 4 => 'Filter 4'
+ );
+
+ $locations = array
+ (
+ '.project' =>
$GLOBALS['phpgw']->translation->translate('project', array(), false,
'property'),
+ '.b_account' =>
$GLOBALS['phpgw']->translation->translate('accounting', array(), false,
'property'),
+ '.project.request' =>
$GLOBALS['phpgw']->translation->translate('request', array(), false,
'property'),
+ );
+
+ $filter_assigned = isset($config['filter_buildingpart']) ?
$config['filter_buildingpart'] : array();
+
+ $out = '';
+ foreach ( $filters as $filter_key => $filter_name)
+ {
+ $out .= <<<HTML
+ <tr><td><label>{$filter_name}</label></td><td><select
name="newsettings[filter_buildingpart][{$filter_key}]">
+HTML;
+ $out .= '<option value="">' . lang('none selected') .
'</option>' . "\n";
+ foreach ( $locations as $key => $name)
+ {
+ $selected = '';
+ if ( isset($filter_assigned[$filter_key]) &&
$filter_assigned[$filter_key] == $key)
+ {
+ $selected = 'selected = "selected"';
+ }
+
+ $out .= <<<HTML
+ <option
value='{$key}'{$selected}>{$name}</option>
+HTML;
+ }
+
+ $out .= <<<HTML
+ </select></td></tr>
+HTML;
+ }
+ return $out;
+ }
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2011-08-24 14:15:25 UTC (rev 7527)
+++ trunk/property/setup/setup.inc.php 2011-08-24 14:19:37 UTC (rev 7528)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.622';
+ $setup_info['property']['version'] = '0.9.17.623';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/setup/tables_current.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -441,8 +441,12 @@
'fm_building_part' => array(
'fd' => array(
- 'id' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
- 'descr' => array('type' =>
'varchar','precision' => '50','nullable' => True)
+ 'id' => array('type' => 'varchar','precision'
=> '5','nullable' => False),
+ 'descr' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'filter_1' => array('type' => 'int','precision'
=> '2','nullable' => True),
+ 'filter_2' => array('type' => 'int','precision'
=> '2','nullable' => True),
+ 'filter_3' => array('type' => 'int','precision'
=> '2','nullable' => True),
+ 'filter_4' => array('type' => 'int','precision'
=> '2','nullable' => True),
),
'pk' => array('id'),
'fk' => array(),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/setup/tables_update.inc.php 2011-08-24 14:19:37 UTC (rev
7528)
@@ -5407,6 +5407,30 @@
/**
+ * Update property version from 0.9.17.622 to 0.9.17.623
+ * Allow filtering of buildingparts depending of type of use
+ *
+ */
+
+ $test[] = '0.9.17.622';
+ function property_upgrade0_9_17_622()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_building_part','id',array('type'
=> 'varchar','precision' => '5','nullable' => False));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_building_part','filter_1',
array('type' => 'int','precision' => '2','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_building_part','filter_2',
array('type' => 'int','precision' => '2','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_building_part','filter_3',
array('type' => 'int','precision' => '2','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_building_part','filter_4',
array('type' => 'int','precision' => '2','nullable' => True));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.623';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
+
+ /**
* Update property version from 0.9.17.607 to 0.9.17.608
* Add more room for address at tickets
*
Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/templates/base/config.tpl 2011-08-24 14:19:37 UTC (rev
7528)
@@ -486,6 +486,18 @@
<td><input name="newsettings[uploader_filetypes]"
value="{value_uploader_filetypes}"></td>
</tr>
+ <tr class="row_off">
+ <td>{lang_filter_buildingpart}:</td>
+ <td>
+ <!--to be able to blank the setting - need an
empty value
+ <input type = 'hidden'
name="newsettings[list_location_level][]" value="">-->
+ <table>
+ {hook_filter_buildingpart}
+ </table>
+ </td>
+ </tr>
+
+
<!--
groupnotification
-->
Modified: trunk/property/templates/base/template.xsl
===================================================================
--- trunk/property/templates/base/template.xsl 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/templates/base/template.xsl 2011-08-24 14:19:37 UTC (rev
7528)
@@ -464,7 +464,7 @@
- <xsl:template match="edit_hour">
+ <xsl:template match="edit_hour" xmlns:php="http://php.net/xsl">
<script type="text/javascript">
self.name="first_Window";
function ns3420_lookup()
@@ -576,14 +576,21 @@
</xsl:when>
</xsl:choose>
<tr>
- <td valign="top">
- <xsl:value-of
select="lang_building_part"/>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'building part')" />
</td>
- <td class="th_text" >
- <xsl:call-template
name="building_part_select"/>
+ <td>
+ <select
name="values[building_part_id]" >
+ <xsl:attribute
name="title">
+
<xsl:value-of select="php:function('lang', 'select building part')" />
+ </xsl:attribute>
+ <option
value="0">
+
<xsl:value-of select="php:function('lang', 'select building part')" />
+ </option>
+
<xsl:apply-templates select="building_part_list/options"/>
+ </select>
</td>
</tr>
-
<xsl:choose>
<xsl:when
test="value_activity_num !=''">
<tr>
@@ -753,3 +760,12 @@
</table>
</div>
</xsl:template>
+
+ <xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"
/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes"
select="name"/>
+ </option>
+ </xsl:template>
Modified: trunk/property/templates/base/wo_hour.xsl
===================================================================
--- trunk/property/templates/base/wo_hour.xsl 2011-08-24 14:15:25 UTC (rev
7527)
+++ trunk/property/templates/base/wo_hour.xsl 2011-08-24 14:19:37 UTC (rev
7528)
@@ -1964,7 +1964,7 @@
<!-- add / edit -->
- <xsl:template match="edit_hour">
+ <xsl:template match="edit_hour" xmlns:php="http://php.net/xsl">
<script type="text/javascript">
self.name="first_Window";
function ns3420_lookup()
@@ -2087,14 +2087,21 @@
</xsl:when>
</xsl:choose>
<tr>
- <td valign="top">
- <xsl:value-of
select="lang_building_part"/>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'building part')" />
</td>
- <td class="th_text" >
- <xsl:call-template
name="building_part_select"/>
+ <td>
+ <select
name="values[building_part_id]" >
+ <xsl:attribute
name="title">
+
<xsl:value-of select="php:function('lang', 'select building part')" />
+ </xsl:attribute>
+ <option
value="0">
+
<xsl:value-of select="php:function('lang', 'select building part')" />
+ </option>
+
<xsl:apply-templates select="building_part_list/options"/>
+ </select>
</td>
</tr>
-
<xsl:choose>
<xsl:when
test="value_activity_num !=''">
<tr>
@@ -2448,4 +2455,11 @@
</xsl:template>
-
+ <xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"
/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes"
select="name"/>
+ </option>
+ </xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7528] property: configurable filter on buildingparts,
Sigurd Nes <=