I have a listing by date range that works fine when no range is input. The complete set of records is displayed and pagination works as expected.
When inputting a date range it also works fine if there is no limit to the page.
If a page limit is set the first page is displayed correctly but on picking a different page from the paginator the date range check is lost and the full listing appears.
The code for the date range is in the Header:
The code to select the records is in the Conditions box for the model:
Is this a bug or am I missing some code? Help much appreciated.
Wallyhowe
When inputting a date range it also works fine if there is no limit to the page.
If a page limit is set the first page is displayed correctly but on picking a different page from the paginator the date range check is lost and the full listing appears.
The code for the date range is in the Header:
<p>To select range of dates enter the dates in the format: yyyy-mm-dd. End date can be left empty for today's date.</p>
<p>
<b> Search: </b><input type="text" name="srch" />
<b> Start Date: </b><input type="text" name="datemin" />
<b> End Date: </b><input type="text" name="datemax" /> <br />
</p>
<p>
<input type="submit" name="submit" value="Go" />
<br />
</p>
The code to select the records is in the Conditions box for the model:
<?php
$start=\GCore\Libs\Request::data("datemin");
$b=strtotime("$start");
$end= \GCore\Libs\Request::data("datemax");
$c=strtotime("$end");
$t=time();
if(empty($end)){$c=$t;}
if(\GCore\Libs\Request::data("datemin")){
return array("txn.date >=" => "$b", "txn.date <=" => "$c");
}
?>
Is this a bug or am I missing some code? Help much appreciated.
Wallyhowe
Hi Wallyhowe,
There is IMHO something odd about the way that CC preserves - or not - the values of filters and searches. Though usually I've seen it the other way round where the values are kept when they are not wanted.
I'll try to run some experiments to duplicate this and see if I can work out what is happening.
Bob
There is IMHO something odd about the way that CC preserves - or not - the values of filters and searches. Though usually I've seen it the other way round where the values are kept when they are not wanted.
I'll try to run some experiments to duplicate this and see if I can work out what is happening.
Bob
Hi Bob,
I have a similar problem.
In my page I have a filter on range data (dataFrom and dataTo), for the particular purpose the default range is dataFrom="today" and dataTo="tomorrow" to show only record included in these two date.
Then I inserted the following condition
The date filter runs correctly, if I change the range (dataFrom and/or dataTo) it runs correctly but when I select another page (by pagination functionality) the filter is set again to the default range.
How can I to avoid the override of customer date filter?
I have a similar problem.
In my page I have a filter on range data (dataFrom and dataTo), for the particular purpose the default range is dataFrom="today" and dataTo="tomorrow" to show only record included in these two date.
Then I inserted the following condition
<?php
$today = date('d-m-Y', time());
$tomorrow = date('d-m-Y', time()+86400);
$dataFrom= JRequest::getVar('dataFrom',$today, 'post');
$dataTo= JRequest::getVar('dataTo',$tomorrow, 'post');
if ($dataFrom != null && $dataFrom != '') {
$query = "spedizione.data_ritiro_convert>=STR_TO_DATE('$dataFrom','%d-%m-%Y')";
if ($dataTo != null && $dataTo != '') {
$query = $query . " AND spedizione.data_ritiro_convert<=STR_TO_DATE('$dataTo','%d-%m-%Y')";
}
return array (":$query");
}
?>
The date filter runs correctly, if I change the range (dataFrom and/or dataTo) it runs correctly but when I select another page (by pagination functionality) the filter is set again to the default range.
How can I to avoid the override of customer date filter?
Hi cenzomita,
Just to help me understand, when you click the pagination - do you see any values for these dates in the URL?
Bob
Just to help me understand, when you click the pagination - do you see any values for these dates in the URL?
Bob
This topic is locked and no more replies can be posted.