Bug #2337 ยป 2337.patch
components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php | ||
---|---|---|
$maxValIn = cbFormatDate( $maxVal );
|
||
}
|
||
|
||
if ( $minVal && ( $minVal !== '0000-00-00' ) ) {
|
||
$query[] = $this->_dateToSql( $field, $col, $minVal, '>=', $searchMode );
|
||
// Finally store the selected drop-down values so they can be pre-selected on display:
|
||
$searchVals->$minNam = $minValIn;
|
||
$min_search = ( $minVal && ( $minVal !== '0000-00-00' ) );
|
||
$max_search = ( $maxVal && ( $maxVal !== '0000-00-00' ) );
|
||
$force_min = ( ( ! $min_search ) && $max_search && ( ! in_array( $field->name, array( 'lastupdatedate', 'lastvisitDate' ) ) ) );
|
||
|
||
if ( ( ! $maxVal ) && $maxValIn ) {
|
||
$searchVals->$maxNam = $maxValIn;
|
||
if ( $min_search || $force_min ) {
|
||
$min = new cbSqlQueryPart();
|
||
$min->tag = 'column';
|
||
$min->name = $col;
|
||
$min->table = $field->table;
|
||
$min->type = 'sql:field';
|
||
$min->operator = ( ! $force_min ? ( $searchMode == 'isnot' ? '<=' : '>=' ) : '>' );
|
||
$min->value = ( ! $force_min ? $minVal : '0000-00-00' );
|
||
$min->valuetype = 'const:date';
|
||
$min->searchmode = $searchMode;
|
||
|
||
if ( ! $force_min ) {
|
||
if ( ( ! $maxVal ) && $maxValIn ) {
|
||
$searchVals->$maxNam= $maxValIn;
|
||
}
|
||
|
||
$searchVals->$minNam = $minValIn;
|
||
}
|
||
}
|
||
|
||
if ( $maxVal && ( $maxVal !== '0000-00-00' ) ) {
|
||
$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:
|
||
if ( $max_search ) {
|
||
$max = new cbSqlQueryPart();
|
||
$max->tag = 'column';
|
||
$max->name = $col;
|
||
$max->table = $field->table;
|
||
$max->type = 'sql:field';
|
||
$max->operator = ( $searchMode == 'isnot' ? '>=' : '<=' );
|
||
$max->value = $maxVal;
|
||
$max->valuetype = 'const:date';
|
||
$max->searchmode = $searchMode;
|
||
|
||
if ( ( ! $minVal ) && $minValIn ) {
|
||
$searchVals->$minNam = $minValIn;
|
||
}
|
||
|
||
$searchVals->$maxNam = $maxValIn;
|
||
}
|
||
|
||
if ( isset( $min ) && isset( $max ) ) {
|
||
$sql = new cbSqlQueryPart();
|
||
$sql->tag = 'column';
|
||
$sql->name = $col;
|
||
$sql->table = $field->table;
|
||
$sql->type = 'sql:operator';
|
||
$sql->operator = ( $searchMode == 'isnot' ? 'OR' : 'AND' );
|
||
$sql->searchmode = $searchMode;
|
||
|
||
$sql->addChildren( array( $min, $max ) );
|
||
|
||
$query[] = $sql;
|
||
} elseif ( isset( $min ) ) {
|
||
$query[] = $min;
|
||
} elseif ( isset( $max ) ) {
|
||
$query[] = $max;
|
||
}
|
||
}
|
||
}
|
||
return $query;
|
||
}
|
||
function _dateToSql( &$field, $col, $value, $operator, $searchMode ) {
|
||
$value = stripslashes( $value );
|
||
// $this->validate( $field, $user, $col, $value, $postdata, $reason );
|
||
$sql = new cbSqlQueryPart();
|
||
$sql->tag = 'column';
|
||
$sql->name = $col;
|
||
$sql->table = $field->table;
|
||
$sql->type = 'sql:field';
|
||
$sql->operator = $operator;
|
||
$sql->value = $value;
|
||
$sql->valuetype = 'const:date';
|
||
$sql->searchmode = $searchMode;
|
||
return $sql;
|
||
}
|
||
}
|
||
class CBfield_editorta extends cbFieldHandler {
|
||
/**
|