[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7891] property: tweaking request
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7891] property: tweaking request |
Date: |
Tue, 18 Oct 2011 13:34:26 +0000 |
Revision: 7891
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7891
Author: sigurdne
Date: 2011-10-18 13:34:26 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
property: tweaking request
Modified Paths:
--------------
trunk/property/inc/class.borequest.inc.php
trunk/property/inc/class.sorequest.inc.php
trunk/property/inc/class.uirequest.inc.php
trunk/property/inc/hook_config.inc.php
trunk/property/js/yahoo/request.index.js
trunk/property/templates/base/config.tpl
trunk/property/templates/base/request.xsl
Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/inc/class.borequest.inc.php 2011-10-18 13:34:26 UTC (rev
7891)
@@ -83,6 +83,7 @@
$start_date = phpgw::get_var('start_date');
$end_date = phpgw::get_var('end_date');
+ $building_part = phpgw::get_var('building_part');
if(isset($_POST['start']) || isset($_GET['start']))
{
@@ -125,6 +126,11 @@
{
$this->criteria_id = $criteria_id;
}
+ if(isset($_POST['building_part']) ||
isset($_GET['building_part']))
+ {
+ $this->building_part = $building_part;
+ }
+
if($allrows)
{
$this->allrows = $allrows;
@@ -162,9 +168,9 @@
$this->cat_id = $data['cat_id'];
$this->property_cat_id = $data['property_cat_id'];
$this->status_id = $data['status_id'];
+ $this->building_part = $data['building_part'];
$this->start_date =
isset($data['start_date']) ? $data['start_date']: '';
$this->end_date =
isset($data['end_date']) ? $data['end_date']: '';
-
}
@@ -404,7 +410,7 @@
'filter' => $this->filter,'district_id' =>
$this->district_id,'cat_id' => $this->cat_id,'status_id' => $this->status_id,
'project_id' =>
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' =>
$data['list_descr'],
'dry_run'=>$data['dry_run'], 'p_num' =>
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date,
- 'property_cat_id' => $this->property_cat_id));
+ 'property_cat_id' => $this->property_cat_id,
'building_part' => $this->building_part));
$this->total_records = $this->so->total_records;
$this->sum_budget = $this->so->sum_budget;
Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/inc/class.sorequest.inc.php 2011-10-18 13:34:26 UTC (rev
7891)
@@ -211,6 +211,7 @@
$p_num = isset($data['p_num']) ?
$data['p_num'] : '';
$start_date = isset($data['start_date']) &&
$data['start_date'] ? phpgwapi_datetime::date_to_timestamp($data['start_date'])
: 0;
$end_date = isset($data['end_date']) &&
$data['end_date'] ? phpgwapi_datetime::date_to_timestamp($data['end_date']) : 0;
+ $building_part = isset($data['building_part']) &&
$data['building_part'] ? (int)$data['building_part'] : 0;
$location_id =
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
$attribute_table = 'phpgw_cust_attribute';
@@ -398,10 +399,12 @@
$paranthesis .= '(';
$joinmethod .= "{$this->left_join} fm_request_consume
ON {$entity_table}.id = fm_request_consume.request_id)";
-
+ $GLOBALS['phpgw']->config->read();
+ $_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;
$sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
'uicols'=>array(),'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,
- 'query'=>$query,'force_location'=>true));
+ 'query'=>$query,'force_location'=>true,
'location_level' => $_location_level));
+ unset($_location_level);
$cols_group[] = "{$entity_table}.id";
$cols_group[] = 'fm_request_status.descr';
@@ -421,7 +424,6 @@
$where = 'WHERE';
$filtermethod = '';
- $GLOBALS['phpgw']->config->read();
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) &&
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
{
$access_location =
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -429,9 +431,6 @@
$where= 'AND';
}
-
-
-
if ($property_cat_id > 0)
{
$filtermethod .= " $where
fm_location1.category='{$property_cat_id}' ";
@@ -440,16 +439,22 @@
if ($cat_id > 0)
{
- $filtermethod .= " $where
fm_request.category='{$cat_id}' ";
+ $filtermethod .= " $where
fm_request.category='{$cat_id}'";
$where = 'AND';
}
if ($status_id)
{
- $filtermethod .= " $where
fm_request.status='{$status_id}' ";
+ $filtermethod .= " $where
fm_request.status='{$status_id}'";
$where = 'AND';
}
+ if ($building_part)
+ {
+ $filtermethod .= " $where
fm_request.building_part='{$building_part}'";
+ $where = 'AND';
+ }
+
if ($start_date)
{
$end_date = $end_date + 3600 * 16 +
phpgwapi_datetime::user_timezone();
Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/inc/class.uirequest.inc.php 2011-10-18 13:34:26 UTC (rev
7891)
@@ -90,7 +90,7 @@
$this->district_id =
$this->bo->district_id;
$this->start_date =
$this->bo->start_date;
$this->end_date =
$this->bo->end_date;
-
+ $this->building_part =
$this->bo->building_part;
$this->allrows =
$this->bo->allrows;
$this->p_num =
$this->bo->p_num;
}
@@ -111,6 +111,7 @@
'start_date' => $this->start_date,
'end_date' =>
$this->end_date,
'property_cat_id' =>
$this->property_cat_id,
+ 'building_part' => $this->building_part
);
$this->bo->save_sessiondata($data);
}
@@ -241,7 +242,8 @@
."district_id: '{$this->district_id}',"
."start_date:'{$this->start_date}',"
."end_date: '{$this->end_date}',"
- ."cat_id:'{$this->cat_id}'";
+ ."cat_id:'{$this->cat_id}',"
+
."building_part:'{$this->building_part}'";
$values_combo_box[0] =
$this->bocommon->select_category_list(array
(
@@ -272,11 +274,22 @@
$default_value = array
('user_id'=>'','name'=>lang('no user'));
array_unshift
($values_combo_box[4],$default_value);
+ $_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('.project.request', $filter_buildingpart))
+ {
+ $_filter_buildingpart =
array("filter_{$filter_key}" => 1);
+ }
+
+ $building_part_list =
$this->bocommon->select_category_list(array('type'=> 'building_part','selected'
=>$this->building_part, 'order' => 'id', 'id_in_name' => 'num', 'filter' =>
$_filter_buildingpart));
+ array_unshift ($building_part_list, array
('id'=>'','name'=> lang('building part')));
+
$datatable['actions']['form'] = array
+ (
+ array
(
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',
array
(
'menuaction'
=> 'property.uirequest.index',
@@ -289,7 +302,8 @@
'district_id'
=> $this->district_id,
'query'
=> $this->query,
'start_date'
=> $this->start_date,
- 'end_date'
=> $this->end_date
+ 'end_date'
=> $this->end_date,
+ 'building_part'
=> $this->building_part
)
),
@@ -313,7 +327,7 @@
'value'
=> lang('district'),
'type'
=> 'button',
'style'
=> 'filter',
-
'tab_index' => 1
+
'tab_index' => 2
),
array
( //boton
CATEGORY
@@ -323,7 +337,7 @@
'value'
=> lang('Category'),
'type'
=> 'button',
'style'
=> 'filter',
-
'tab_index' => 2
+
'tab_index' => 3
),
array
( //boton
STATUS
@@ -332,30 +346,41 @@
'value'
=> lang('Status'),
'type'
=> 'button',
'style'
=> 'filter',
-
'tab_index' => 3
+
'tab_index' => 4
),
array
+ (
+ 'id' =>
'sel_building_part', // traditional listbox for long list
+ 'name'
=> 'building_part',
+ 'value'
=> lang('building part'),
+ 'type'
=> 'select',
+ 'style'
=> 'filter',
+
'values' => $building_part_list,
+
'onchange'=> 'onChangeSelect("building_part");',
+
'tab_index' => 5
+ ),
+ array
( //boton
FILTER
'id' =>
'btn_user_id',
'name'
=> 'filter',
'value'
=> lang('User'),
'type'
=> 'button',
'style'
=> 'filter',
-
'tab_index' => 4
+
'tab_index' => 6
),
array
(
'type'
=> 'button',
'id'
=> 'btn_update',
'value'
=> lang('Update project'),
-
'tab_index' => 9
+
'tab_index' => 14
),
array
(
'type'
=> 'button',
'id'
=> 'btn_export',
'value'
=> lang('download'),
-
'tab_index' => 8
+
'tab_index' => 13
),
array
@@ -363,7 +388,7 @@
'type'
=> 'button',
'id'
=> 'btn_new',
'value'
=> lang('add'),
-
'tab_index' => 7
+
'tab_index' => 12
),
array
(
@@ -391,7 +416,7 @@
'menuaction' => 'property.uiproject.date_search')
)."','','width=350,height=250')",
'value'
=> lang('Date search'),
-
'tab_index' => 9
+
'tab_index' => 11
),
array
@@ -401,7 +426,7 @@
'value'
=> lang('search'),
'onkeypress' => 'return pulsar(event)',
'type'
=> 'button',
-
'tab_index' => 6
+
'tab_index' => 10
),
array
( //hidden
request
@@ -418,7 +443,7 @@
'type'
=> 'text',
'size'
=> 28,
'onkeypress' => 'return pulsar(event)',
-
'tab_index' => 5
+
'tab_index' => 9
),
array
(
@@ -429,7 +454,7 @@
(
'menuaction' =>
'property.uirequest.priority_key'))."','','left=50,top=100,width=350,height=350,scrollbars=1')",
'value' => lang('Priority key'),
-
'tab_index' => 4
+
'tab_index' => 8
),
array
(
@@ -440,54 +465,54 @@
(
'menuaction' =>
'property.uirequest.columns'))."','','width=300,height=600,scrollbars=1')",
'value' => lang('columns'),
-
'tab_index' => 10
+
'tab_index' => 7
),
),
- 'hidden_value'
=> array
- (
- array
- ( //div
values combo_box_0
-
'id' => 'values_combo_box_0',
-
'value' => $this->bocommon->select2String($values_combo_box[0])
- ),
- array
- ( //div
values combo_box_1
-
'id' => 'values_combo_box_1',
-
'value' => $this->bocommon->select2String($values_combo_box[1])
- ),
- array
- ( //div
values combo_box_2
-
'id' => 'values_combo_box_2',
-
'value' => $this->bocommon->select2String($values_combo_box[2]['cat_list'],
'cat_id') //i.e. id,value/id,vale/
- ),
- array
- ( //div
values combo_box_3
-
'id' => 'values_combo_box_3',
-
'value' => $this->bocommon->select2String($values_combo_box[3])
- ),
- array
- ( //div
values combo_box_4
-
'id' => 'values_combo_box_4',
-
'value' => $this->bocommon->select2String($values_combo_box[4], 'user_id')
- )
+ 'hidden_value' => array
+ (
+ array
+ ( //div values
combo_box_0
+ 'id' =>
'values_combo_box_0',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[0])
+ ),
+ array
+ ( //div values
combo_box_1
+ 'id' =>
'values_combo_box_1',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[1])
+ ),
+ array
+ ( //div values
combo_box_2
+ 'id' =>
'values_combo_box_2',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[2]['cat_list'], 'cat_id')
//i.e. id,value/id,vale/
+ ),
+ array
+ ( //div values
combo_box_3
+ 'id' =>
'values_combo_box_3',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[3])
+ ),
+ array
+ ( //div values
combo_box_4
+ 'id' =>
'values_combo_box_4',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[4], 'user_id')
)
)
)
- );
+ )
+ );
- if(!$this->acl_manage)
+ if(!$this->acl_manage)//priority_key
{
-
unset($datatable['actions']['form'][0]['fields']['field'][9]);
+
unset($datatable['actions']['form'][0]['fields']['field'][16]);
}
- if(!$this->acl_add)
+ if(!$this->acl_add) //add
{
-
unset($datatable['actions']['form'][0]['fields']['field'][5]);
+
unset($datatable['actions']['form'][0]['fields']['field'][8]);
}
- if(!$project_id)
+ if(!$project_id) // update project
{
-
unset($datatable['actions']['form'][0]['fields']['field'][4]);
+
unset($datatable['actions']['form'][0]['fields']['field'][6]);
}
$dry_run = true;
}
@@ -1213,12 +1238,11 @@
$lookup_type = $mode == 'edit' ? 'form' : 'view';
-
$location_data=$this->bolocation->initiate_ui_location(array
- (
- 'values' =>
$values['location_data'],
- 'type_id' => -1, // calculated
from location_types
- 'no_link' => false, // disable
lookup links for location type less than type_id
- 'tenant' => true,
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
isset($this->config->config_data['request_location_level']) &&
$this->config->config_data['request_location_level'] ?
$this->config->config_data['request_location_level'] : -1,
+ 'no_link' => false, //
disable lookup links for location type less than type_id
+ 'tenant' => true,
'lookup_type' => $lookup_type,
'lookup_entity' =>
$this->bocommon->get_lookup_entity('request'),
'entity_data' => $values['p']
@@ -1277,8 +1301,8 @@
$jscal->add_listener('values_consume_date');
$jscal->add_listener('values_planning_date');
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
$link_file_data = array
(
'menuaction' =>
'property.uirequest.view_file',
@@ -1365,7 +1389,17 @@
}
}
-
+
+ $value_diff = (int)$values['budget'] -
($_consume_amount + $_planning_amount);
+ $value_diff2 = (int)$values['budget'] -
$_consume_amount;
+
+ if ($value_diff < 0 || $value_diff2 < 0)
+ {
+ $receipt['error'][]=array('msg'=>lang('negative
value for budget'));
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
$datavalues[2] = array
(
'name'
=> "2",
@@ -1515,8 +1549,8 @@
'lang_budget'
=> lang('Budget'),
'value_budget'
=> number_format($values['budget'], 0, ',', ' '),
'lang_budget_statustext'
=> lang('Enter the budget'),
- 'value_diff'
=> number_format(((int)$values['budget'] - ($_consume_amount +
$_planning_amount)), 0, ',', ' '),
- 'value_diff2'
=> number_format(((int)$values['budget'] - $_consume_amount),
0, ',', ' '),
+ 'value_diff'
=> number_format($value_diff, 0, ',', ' '),
+ 'value_diff2'
=> number_format($value_diff2, 0, ',', ' '),
'location_data'
=> $location_data,
'location_type'
=> 'form',
Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/inc/hook_config.inc.php 2011-10-18 13:34:26 UTC (rev
7891)
@@ -199,7 +199,35 @@
return $out;
}
+
/**
+ * Get HTML options with location levels that should be listed in a
listbox
+ *
+ * @param $config
+ * @return string HTML options to be placed in a select
+ */
+
+ function list_location_level_otions($config)
+ {
+ $location_types =
execMethod('property.soadmin_location.select_location_type');
+
+ $level_assigned = isset($config['request_location_level']) ?
$config['request_location_level'] : 0;
+ $out = '';
+ foreach ( $location_types as $dummy => $level)
+ {
+ $selected = '';
+ if ( ($level['id'] == $level_assigned))
+ {
+ $selected = ' selected';
+ }
+ $out .= <<<HTML
+ <option value="{$level['id']}"
{$selected}><label>{$level['name']}</label></option>
+HTML;
+ }
+ return $out;
+ }
+
+ /**
* Get HTML checkbox with filter buildingpart
*
* @param $config
Modified: trunk/property/js/yahoo/request.index.js
===================================================================
--- trunk/property/js/yahoo/request.index.js 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/js/yahoo/request.index.js 2011-10-18 13:34:26 UTC (rev
7891)
@@ -48,6 +48,21 @@
elCell.innerHTML = "<div
align=\"right\">"+YAHOO.util.Number.format(oData, {thousandsSeparator:"
"})+"</div>";
}
+
+ this.onChangeSelect = function(type)
+ {
+ var myselect=document.getElementById("sel_"+ type);
+ for (var i=0; i<myselect.options.length; i++)
+ {
+ if (myselect.options[i].selected==true)
+ {
+ break;
+ }
+ }
+ eval("path_values." +type +"='"+myselect.options[i].value+"'");
+ execute_ds();
+ }
+
var tableYUI;
this.particular_setting = function()
Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/templates/base/config.tpl 2011-10-18 13:34:26 UTC (rev
7891)
@@ -405,6 +405,16 @@
</td>
</tr>
+ <tr class="row_off">
+ <td>{lang_request_location_level}.</td>
+ <td>
+ <select
name="newsettings[request_location_level]">
+ {hook_list_location_level_otions}
+ </select>
+ </td>
+ </tr>
+
+
<tr class="row_on">
<td>{lang_meter_table}:</td>
<td><input name="newsettings[meter_table]"
value="{value_meter_table}"></td>
Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl 2011-10-18 08:15:57 UTC (rev
7890)
+++ trunk/property/templates/base/request.xsl 2011-10-18 13:34:26 UTC (rev
7891)
@@ -331,38 +331,7 @@
</xsl:choose>
<tr>
- <td
valign="top">
-
<xsl:value-of select="php:function('lang', 'total cost estimate')" />
- </td>
<td>
- <input
type="text" name="values[budget]" value="{value_budget}">
-
<xsl:attribute name="title">
-
<xsl:value-of select="lang_budget_statustext"/>
-
</xsl:attribute>
- </input>
-
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="php:function('lang', 'not allocated')" />
- </td>
- <td>
-
<xsl:value-of select="value_diff"/>
-
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="php:function('lang', 'residual demand')" />
- </td>
- <td>
-
<xsl:value-of select="value_diff2"/>
-
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td>
<xsl:value-of select="php:function('lang', 'building part')" />
</td>
<td>
@@ -433,6 +402,38 @@
<tr>
<td
valign="top">
+
<xsl:value-of select="php:function('lang', 'total cost estimate')" />
+ </td>
+ <td>
+ <input
type="text" name="values[budget]" value="{value_budget}">
+
<xsl:attribute name="title">
+
<xsl:value-of select="lang_budget_statustext"/>
+
</xsl:attribute>
+ </input>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </td>
+ </tr>
+ <tr>
+ <td
valign="top">
+
<xsl:value-of select="php:function('lang', 'not allocated')" />
+ </td>
+ <td>
+
<xsl:value-of select="value_diff"/>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </td>
+ </tr>
+ <tr>
+ <td
valign="top">
+
<xsl:value-of select="php:function('lang', 'residual demand')" />
+ </td>
+ <td>
+
<xsl:value-of select="value_diff2"/>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </td>
+ </tr>
+
+ <tr>
+ <td
valign="top">
<xsl:value-of select="php:function('lang', 'planning date')" />
</td>
<td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7891] property: tweaking request,
Sigurd Nes <=