mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 09:44:38 +02:00
Fix "OR-condition not allowed" error introduced from a change related to processwire/processwire-issues#1428
This commit is contained in:
@@ -456,14 +456,26 @@ class PageFinder extends Wire {
|
|||||||
$checkAccessSpecified = false;
|
$checkAccessSpecified = false;
|
||||||
$hasParents = array(); // requests for parent(s) in the selector
|
$hasParents = array(); // requests for parent(s) in the selector
|
||||||
$hasSort = false; // whether or not a sort is requested
|
$hasSort = false; // whether or not a sort is requested
|
||||||
|
$noArrayFields = array_flip(array( // field names that do not accept array values
|
||||||
|
'status',
|
||||||
|
'include',
|
||||||
|
'check_access',
|
||||||
|
'checkAccess',
|
||||||
|
'limit',
|
||||||
|
'start',
|
||||||
|
'getTotal',
|
||||||
|
'get_total',
|
||||||
|
));
|
||||||
|
|
||||||
foreach($selectors as $key => $selector) {
|
foreach($selectors as $key => $selector) {
|
||||||
|
|
||||||
/** @var Selector $selector */
|
/** @var Selector $selector */
|
||||||
$fieldName = $selector->field;
|
$fieldName = $selector->field();
|
||||||
|
|
||||||
if(is_array($fieldName) || is_array($selector->value)) {
|
if(isset($noArrayFields[$fieldName])) {
|
||||||
throw new PageFinderException("OR-condition not supported in '$selector'");
|
if(is_array($selector->field) || is_array($selector->value)) {
|
||||||
|
throw new PageFinderException("OR-condition not supported in '$selector'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fieldName === 'status') {
|
if($fieldName === 'status') {
|
||||||
@@ -507,6 +519,7 @@ class PageFinder extends Wire {
|
|||||||
// for getTotal auto detect
|
// for getTotal auto detect
|
||||||
$limit = (int) $selector->value;
|
$limit = (int) $selector->value;
|
||||||
$limitSelector = $selector;
|
$limitSelector = $selector;
|
||||||
|
// @todo allow for array value that specifies start and limit, i.e. '10|25'
|
||||||
|
|
||||||
} else if($fieldName == 'start') {
|
} else if($fieldName == 'start') {
|
||||||
// for getTotal auto detect
|
// for getTotal auto detect
|
||||||
|
@@ -397,7 +397,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
|||||||
'page' => array('@=', '@!='),
|
'page' => array('@=', '@!='),
|
||||||
'checkbox' => array('=', '!='),
|
'checkbox' => array('=', '!='),
|
||||||
'sort' => array('.=', '.=-'),
|
'sort' => array('.=', '.=-'),
|
||||||
'status' => array('@=', '@!='),
|
'status' => array('@=', '@!=', '<', '<=', '>', '>='),
|
||||||
//'selector' => array('#=', '#!='),
|
//'selector' => array('#=', '#!='),
|
||||||
'selector' => array('=', '!=', '<', '>', '<=', '>='),
|
'selector' => array('=', '!=', '<', '>', '<=', '>='),
|
||||||
);
|
);
|
||||||
@@ -523,7 +523,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
|||||||
'temp' => $this->_('Temp'),
|
'temp' => $this->_('Temp'),
|
||||||
),
|
),
|
||||||
'sanitizer' => 'integer',
|
'sanitizer' => 'integer',
|
||||||
'operators' => array('@=', '@!='),
|
'operators' => $this->operatorsByType['status'],
|
||||||
),
|
),
|
||||||
'template' => array(
|
'template' => array(
|
||||||
'input' => 'select',
|
'input' => 'select',
|
||||||
|
Reference in New Issue
Block a user