Index: components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php =================================================================== --- components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php (revision 865) +++ components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php (working copy) @@ -1564,13 +1564,13 @@ list( $y, $c, $d ) = sscanf( date( 'Y-m-d' ), '%d-%d-%d' ); $minValIn = (int) cbGetParam( $postdata, $minNam, 0 ); $maxValIn = (int) cbGetParam( $postdata, $maxNam, 0 ); - if ( $minValIn && ( $minValIn > $yMinMin ) ) { + if ( $maxValIn && ( $maxValIn < $yMaxMax ) ) { $yMin = $y - $maxValIn -1; // yes, crossed: the more years back, the smaller the date... add 1 year for searches from 24 to 24 (INCLUDED) $minVal = sprintf( '%04d-%02d-%02d', $yMin, $c, $d ); } else { $minVal = null; } - if ( $maxValIn && ( $maxValIn < $yMaxMax ) ) { + if ( $minValIn && ( $minValIn > $yMinMin ) ) { $yMax = $y - $minValIn; $maxVal = sprintf( '%04d-%02d-%02d', $yMax, $c, $d ); } else { @@ -1584,16 +1584,17 @@ } if ( $minVal && ( $minVal !== '0000-00-00' ) ) { - $searchVals->$minNam = $minValIn; $query[] = $this->_dateToSql( $field, $col, $minVal, '>=', $searchMode ); } if ( $maxVal && ( $maxVal !== '0000-00-00' ) ) { - $searchVals->$maxNam = $maxValIn; $query[] = $this->_dateToSql( $field, $col, $maxVal, '<=', $searchMode ); if ( ( ! ( $minVal && ( $minVal !== '0000-00-00' ) ) ) && ( ! in_array( $field->name, array( 'lastupdatedate', 'lastvisitDate' ) ) ) ) { $query[] = $this->_dateToSql( $field, $col, '0000-00-00', '>', $searchMode ); } } + // Finally store the selected drop-down values so they can be pre-selected on display: + $searchVals->$minNam = $minValIn; + $searchVals->$maxNam = $maxValIn; } } return $query;