[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12730] rental: add district filter on composites
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12730] rental: add district filter on composites |
Date: |
Wed, 11 Feb 2015 18:05:42 +0000 |
Revision: 12730
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12730
Author: sigurdne
Date: 2015-02-11 18:05:41 +0000 (Wed, 11 Feb 2015)
Log Message:
-----------
rental: add district filter on composites
Modified Paths:
--------------
trunk/rental/inc/class.socomposite.inc.php
trunk/rental/inc/class.uicomposite.inc.php
trunk/rental/setup/phpgw_no.lang
trunk/rental/templates/base/composite_list_partial.php
Modified: trunk/rental/inc/class.socomposite.inc.php
===================================================================
--- trunk/rental/inc/class.socomposite.inc.php 2015-02-10 23:28:40 UTC (rev
12729)
+++ trunk/rental/inc/class.socomposite.inc.php 2015-02-11 18:05:41 UTC (rev
12730)
@@ -145,6 +145,20 @@
$filter_clauses[] = "rental_composite.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
}
+
+ $tables = "rental_composite";
+ $joins = " {$this->left_join} rental_unit ON
(rental_composite.id = rental_unit.composite_id)";
+ $joins .= " {$this->left_join} rental_contract_composite ON
(rental_contract_composite.composite_id = rental_composite.id)";
+ $joins .= " {$this->left_join} rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)";
+
+ if(isset($filters['district_id']) && $filters['district_id'])
+ {
+ $joins .= " {$this->join} fm_locations ON
(rental_unit.location_code = fm_locations.location_code)";
+ $joins .= " {$this->join} fm_location1 ON
(fm_location1.loc1 = fm_locations.loc1)";
+ $joins .= " {$this->join} fm_part_of_town ON
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)";
+
+ $filter_clauses[] = "fm_part_of_town.district_id =" .
(int) $filters['district_id'];
+ }
if(count($filter_clauses))
{
$clauses[] = join(' AND ', $filter_clauses);
@@ -152,11 +166,6 @@
$condition = join(' AND ', $clauses);
- $tables = "rental_composite";
- $joins = " {$this->left_join} rental_unit ON
(rental_composite.id = rental_unit.composite_id)";
- $joins .= " {$this->left_join} rental_contract_composite ON
(rental_contract_composite.composite_id = rental_composite.id)";
- $joins .= " {$this->left_join} rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)";
-
if($return_count) // We should only return a count
{
$cols = 'COUNT(DISTINCT(rental_composite.id)) AS count';
@@ -188,7 +197,7 @@
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY {$this->marshal($sort_field,
'field')} $dir ": '';
- //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
+// _debug_array("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
}
Modified: trunk/rental/inc/class.uicomposite.inc.php
===================================================================
--- trunk/rental/inc/class.uicomposite.inc.php 2015-02-10 23:28:40 UTC (rev
12729)
+++ trunk/rental/inc/class.uicomposite.inc.php 2015-02-11 18:05:41 UTC (rev
12730)
@@ -36,7 +36,8 @@
{
$user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
- else {
+ else
+ {
$user_rows_per_page = 10;
}
// YUI variables for paging and sorting
@@ -50,6 +51,7 @@
// Create an empty result set
$result_objects = array();
$result_count = 0;
+ $district_id = phpgw::get_var('district_id', 'int');
//Retrieve a contract identifier and load corresponding
contract
$contract_id = phpgw::get_var('contract_id');
@@ -88,7 +90,7 @@
phpgwapi_cache::session_set('rental',
'composite_furnished_status', phpgw::get_var('furnished_status'));
$filters = array('furnished_status' =>
phpgw::get_var('furnished_status'),'is_active' => phpgw::get_var('is_active'),
'is_vacant' => phpgw::get_var('occupancy'),
'has_contract' => phpgw::get_var('has_contract'), 'availability_date_from' =>
phpgw::get_var('availability_date_from_hidden'),
-
'availability_date_to' => phpgw::get_var('availability_date_to_hidden'));
+
'availability_date_to' => phpgw::get_var('availability_date_to_hidden'),
'district_id' => $district_id);
$result_objects =
rental_socomposite::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
$object_count =
rental_socomposite::get_instance()->get_count($search_for, $search_type,
$filters);
break;
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2015-02-10 23:28:40 UTC (rev 12729)
+++ trunk/rental/setup/phpgw_no.lang 2015-02-11 18:05:41 UTC (rev 12730)
@@ -601,3 +601,5 @@
free_of_charge rental no Vederlagsfritt
extra_adjustment rental no Ekstra regulering
free_of_charge rental no Vederlagsfritt
+select rental no Velg
+district rental no Område
Modified: trunk/rental/templates/base/composite_list_partial.php
===================================================================
--- trunk/rental/templates/base/composite_list_partial.php 2015-02-10
23:28:40 UTC (rev 12729)
+++ trunk/rental/templates/base/composite_list_partial.php 2015-02-11
18:05:41 UTC (rev 12730)
@@ -99,7 +99,7 @@
'index.php?menuaction=rental.uicomposite.query&phpgw_return_as=json<?php
echo $url_add_on; ?>&editable=<?php echo isset($editable) && $editable ?
"true" : "false"; ?>',
columnDefs,
'<?php echo $list_id ?>_form',
- ['<?php echo $list_id
?>_ctrl_toggle_furnished_status_rental_composites','<?php echo $list_id
?>_ctrl_toggle_active_rental_composites','<?php echo $list_id
?>_ctrl_toggle_occupancy_of_rental_composites','<?php echo $list_id
?>_ctrl_toggle_has_contract_rental_composites','<?php echo $list_id
?>_ctrl_search_query'],
+ ['<?php echo $list_id
?>_ctrl_toggle_furnished_status_rental_composites','<?php echo $list_id
?>_ctrl_toggle_active_rental_composites','<?php echo $list_id
?>_district_id','<?php echo $list_id
?>_ctrl_toggle_occupancy_of_rental_composites','<?php echo $list_id
?>_ctrl_toggle_has_contract_rental_composites','<?php echo $list_id
?>_ctrl_search_query'],
'<?php echo $list_id ?>_container',
'<?php echo $list_id ?>_paginator',
'<?php echo $list_id ?>',
@@ -122,6 +122,8 @@
function composite_export(compType) {
var availabilityselect = document.getElementById('<?php echo $list_id
?>_ctrl_toggle_active_rental_composites');
var availabilityoption =
availabilityselect.options[availabilityselect.selectedIndex].value;
+ var districtselect = document.getElementById('<?php echo $list_id
?>_district_id');
+ var districtoption =
districtselect.options[districtselect.selectedIndex].value;
<?php
if(isset($config->config_data['contract_future_info']) &&
$config->config_data['contract_future_info'])
{
@@ -143,6 +145,7 @@
'&type='+compType+
'&query='+query+
'&search_option='+sOption+
+ '&district_id='+districtoption+
'&export=true';
}
</script>
@@ -187,8 +190,8 @@
<!-- Filters -->
<h3><?php echo lang('filters') ?></h3>
<?php
-
if(isset($config->config_data['contract_furnished_status']) &&
$config->config_data['contract_furnished_status'])
- {
+ if(isset($config->config_data['contract_furnished_status'])
&& $config->config_data['contract_furnished_status'])
+ {
?>
<!-- Møbleringsstatus -->
@@ -205,6 +208,18 @@
</select>
<?php }
?>
+ <label for="district_id"><?php echo lang('district')
?></label>
+ <select name="district_id" id="<?php echo $list_id
?>_district_id">
+ <?php
+ $districts =
execMethod('property.sogeneric.get_list',array('type' => 'district'));
+
+ echo "<option
value=''>" . lang('select') . "</option>";
+ foreach($districts as
$district)
+ {
+ echo "<option
value='{$district['id']}'>{$district['name']}</option>";
+ }
+ ?>
+ </select>
<label for="ctrl_toggle_active_rental_composites"><?php echo
lang('availability') ?></label>
<select name="is_active" id="<?php echo $list_id
?>_ctrl_toggle_active_rental_composites">
<option value="both" <?php echo ($status == 'both') ?
'selected' : ''?>><?php echo lang('all') ?></option>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12730] rental: add district filter on composites,
Sigurd Nes <=