Fix bug handling multiple prop-filter clauses.

This commit is contained in:
Andrew McMillan 2011-06-03 13:43:25 -07:00
parent 06dcb0b166
commit 5e3ed8dedc

View File

@ -206,7 +206,7 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
$propertyname = $v->GetAttribute("name"); $propertyname = $v->GetAttribute("name");
switch( $propertyname ) { switch( $propertyname ) {
case 'PERCENT-COMPLETE': case 'PERCENT-COMPLETE':
$property = 'percent_complete'; $subproperty = 'percent_complete';
break; break;
case 'UID': case 'UID':
@ -224,7 +224,7 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
case 'DTEND': case 'DTEND':
case 'DUE': case 'DUE':
case 'PRIORITY': case 'PRIORITY':
$property = strtolower($propertyname); $subproperty = strtolower($propertyname);
break; break;
case 'COMPLETED': /** @todo this should be moved into the properties supported in SQL. */ case 'COMPLETED': /** @todo this should be moved into the properties supported in SQL. */
@ -233,11 +233,13 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
dbg_error_log("calquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname ); dbg_error_log("calquery", "Could not handle 'prop-filter' on %s in SQL", $propertyname );
continue; continue;
} }
$subfilter = $v->GetContent(); if ( isset($subproperty) ) {
$success = SqlFilterFragment( $subfilter, $components, $property, $parameter ); $subfilter = $v->GetContent();
if ( $success === false ) continue; else { $success = SqlFilterFragment( $subfilter, $components, $subproperty, $parameter );
$sql .= $success['sql']; if ( $success === false ) continue; else {
$params = array_merge( $params, $success['params'] ); $sql .= $success['sql'];
$params = array_merge( $params, $success['params'] );
}
} }
break; break;