[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6554] Added possibility to filter composites on avai
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [6554] Added possibility to filter composites on availability date |
Date: |
Tue, 09 Nov 2010 08:43:34 +0000 |
Revision: 6554
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6554
Author: erikhl
Date: 2010-11-09 08:43:34 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
Added possibility to filter composites on availability date
Modified Paths:
--------------
trunk/rental/inc/class.socomposite.inc.php
trunk/rental/inc/class.uicomposite.inc.php
trunk/rental/templates/base/composite_list_partial.php
Modified: trunk/rental/inc/class.socomposite.inc.php
===================================================================
--- trunk/rental/inc/class.socomposite.inc.php 2010-11-09 07:41:48 UTC (rev
6553)
+++ trunk/rental/inc/class.socomposite.inc.php 2010-11-09 08:43:34 UTC (rev
6554)
@@ -68,13 +68,19 @@
}
$special_query = false; //specify if the query should use
distinct on rental_composite.id (used for selecting composites that has an
active or inactive contract)
$ts_query = strtotime(date('Y-m-d')); // timestamp for query
(today)
+ if(isset($filters['availability_date']) &&
$filters['availability_date'] != ''){
+ $availability_date =
strtotime($filters['availability_date']);
+ }
+ else{
+ $availability_date = $ts_query;
+ }
switch($filters['has_contract']){
case "has_contract":
- $filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start < $ts_query
AND (rental_contract.date_end IS NULL OR (NOT rental_contract.date_end IS NULL
AND rental_contract.date_end > $ts_query))))";
+ $filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date))))";
$special_query=true;
break;
case "has_no_contract":
- $filter_clauses[] =
"(rental_contract_composite.contract_id IS NULL OR NOT rental_composite.id IN
(SELECT rental_composite.id FROM rental_composite LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id) LEFT JOIN rental_contract ON (rental_contract.id =
rental_contract_composite.contract_id) WHERE 1=1 AND rental_composite.is_active
= TRUE AND (NOT rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start < $ts_query
AND (rental_contract.date_end IS NULL OR (NOT rental_contract.date_end IS NULL
AND rental_contract.date_end > $ts_query))))))";
+ $filter_clauses[] =
"(rental_contract_composite.contract_id IS NULL OR NOT rental_composite.id IN
(SELECT rental_composite.id FROM rental_composite LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id) LEFT JOIN rental_contract ON (rental_contract.id =
rental_contract_composite.contract_id) WHERE 1=1 AND rental_composite.is_active
= TRUE AND (NOT rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date))))))";
$special_query=true;
break;
case "both":
Modified: trunk/rental/inc/class.uicomposite.inc.php
===================================================================
--- trunk/rental/inc/class.uicomposite.inc.php 2010-11-09 07:41:48 UTC (rev
6553)
+++ trunk/rental/inc/class.uicomposite.inc.php 2010-11-09 08:43:34 UTC (rev
6554)
@@ -85,7 +85,7 @@
phpgwapi_cache::session_set('rental',
'composite_search_type', $search_type);
phpgwapi_cache::session_set('rental',
'composite_status', phpgw::get_var('is_active'));
phpgwapi_cache::session_set('rental',
'composite_status_contract', phpgw::get_var('has_contract'));
- $filters = array('is_active' =>
phpgw::get_var('is_active'), 'is_vacant' => phpgw::get_var('occupancy'),
'has_contract' => phpgw::get_var('has_contract'));
+ $filters = array('is_active' =>
phpgw::get_var('is_active'), 'is_vacant' => phpgw::get_var('occupancy'),
'has_contract' => phpgw::get_var('has_contract'), 'availability_date' =>
phpgw::get_var('availability_date_hidden'));
$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/templates/base/composite_list_partial.php
===================================================================
--- trunk/rental/templates/base/composite_list_partial.php 2010-11-09
07:41:48 UTC (rev 6553)
+++ trunk/rental/templates/base/composite_list_partial.php 2010-11-09
08:43:34 UTC (rev 6554)
@@ -144,6 +144,8 @@
<option value="has_contract" <?php echo
($status_contract == 'has_contract') ? 'selected' : ''?>><?php echo
lang('composite_has_contract') ?></option>
<option value="has_no_contract" <?php echo
($status_contract == 'has_no_contract') ? 'selected' : ''?>><?php echo
lang('composite_has_no_contract') ?></option>
</select>
+ <label for="availability_period"><?php echo
lang('availability_date')?></label>
+ <?php echo
$GLOBALS['phpgw']->yuical->add_listener('availability_date',
$availability_date); ?>
</fieldset>
</form>
<?php
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6554] Added possibility to filter composites on availability date,
Erik Holm-Larsen <=