Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
DateRangeFilter overwrites other filter
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanvierkant authored Dec 7, 2018
2 parents 6a19724 + d5563b0 commit 13d208f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 1.1.1

* Bugfix: DateRangeFilter overwrites other filter (#803)

# Version 1.1.0

* Dropped support for PHP 5 and PHP 7.0. (#850)
Expand Down
8 changes: 5 additions & 3 deletions Datatable/Filter/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ protected function getExpression(Composite $expr, QueryBuilder $qb, $searchType,
case 'decimal':
case 'float':
if (is_numeric($searchValue)) {
$searchValue = floatval($searchValue);
$searchValue = (float) $searchValue;
} else {
$incompatibleTypeOfField = true;
}
Expand All @@ -382,8 +382,8 @@ protected function getExpression(Composite $expr, QueryBuilder $qb, $searchType,
case 'bigint':
case 'smallint':
case 'boolean':
if ($searchValue == strval(intval($searchValue))) {
$searchValue = intval($searchValue);
if ( $searchValue == (string) (int) $searchValue ) {
$searchValue = (int) $searchValue;
} else {
$incompatibleTypeOfField = true;
}
Expand Down Expand Up @@ -465,6 +465,8 @@ protected function getExpression(Composite $expr, QueryBuilder $qb, $searchType,
*/
protected function getBetweenAndExpression(Andx $andExpr, QueryBuilder $qb, $searchField, $from, $to, $parameterCounter)
{
$parameterCounter++;

$k = $parameterCounter + 1;
$andExpr->add($qb->expr()->between($searchField, '?'.$parameterCounter, '?'.$k));
$qb->setParameter($parameterCounter, $from);
Expand Down

0 comments on commit 13d208f

Please sign in to comment.