mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 01:34:31 +02:00
Fix "OR-condition not allowed" error introduced from a change related to processwire/processwire-issues#1428
This commit is contained in:
@@ -456,15 +456,27 @@ class PageFinder extends Wire {
|
||||
$checkAccessSpecified = false;
|
||||
$hasParents = array(); // requests for parent(s) in the selector
|
||||
$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) {
|
||||
|
||||
/** @var Selector $selector */
|
||||
$fieldName = $selector->field;
|
||||
$fieldName = $selector->field();
|
||||
|
||||
if(is_array($fieldName) || is_array($selector->value)) {
|
||||
if(isset($noArrayFields[$fieldName])) {
|
||||
if(is_array($selector->field) || is_array($selector->value)) {
|
||||
throw new PageFinderException("OR-condition not supported in '$selector'");
|
||||
}
|
||||
}
|
||||
|
||||
if($fieldName === 'status') {
|
||||
// @todo add support for array value,i.e. `status=hidden|unpublished`
|
||||
@@ -507,6 +519,7 @@ class PageFinder extends Wire {
|
||||
// for getTotal auto detect
|
||||
$limit = (int) $selector->value;
|
||||
$limitSelector = $selector;
|
||||
// @todo allow for array value that specifies start and limit, i.e. '10|25'
|
||||
|
||||
} else if($fieldName == 'start') {
|
||||
// for getTotal auto detect
|
||||
|
@@ -397,7 +397,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
'page' => array('@=', '@!='),
|
||||
'checkbox' => array('=', '!='),
|
||||
'sort' => array('.=', '.=-'),
|
||||
'status' => array('@=', '@!='),
|
||||
'status' => array('@=', '@!=', '<', '<=', '>', '>='),
|
||||
//'selector' => array('#=', '#!='),
|
||||
'selector' => array('=', '!=', '<', '>', '<=', '>='),
|
||||
);
|
||||
@@ -523,7 +523,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
'temp' => $this->_('Temp'),
|
||||
),
|
||||
'sanitizer' => 'integer',
|
||||
'operators' => array('@=', '@!='),
|
||||
'operators' => $this->operatorsByType['status'],
|
||||
),
|
||||
'template' => array(
|
||||
'input' => 'select',
|
||||
|
Reference in New Issue
Block a user