Assigning a value to a filter is broken in new version
I've experienced several issues with filters. My Data Processor is attached. There are two custom fields in the field list but it should be fine to remove those.
This Data Processor has a filter that is pre-set in the configuration, which seems to no longer work:
When I try to set the filter value, I get a fatal error (backtrace below). Removing and re-adding the filter allows me to access the filter once, but not again.
More importantly, the filter is ignored, for at least three reasons.
-
CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass()
doesn't assign thefilterHandler
to the$dataProcessorClass
. There's$filterHandler->setDataProcessor($dataProcessorClass);
but that's not the same. -
Civi\DataProcessor\Output\AbstractApi::runDataProcessor()
only processes exposed filters. - Even after adding
$dataProcessorClass->addFilterHandler($filterHandler);
todataProcessorToClass()
it still is ignored -if (isset($params[$filterSpec->alias])) {
evaluates toFALSE
because the filter isn't in$params
.
The workaround was to add a filter in "Data Sources".
Error: Call to a member function addWhere() on null in Civi\DataProcessor\FilterHandler\SimpleSqlFilter->setFilter() (line 36 of
/home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/dataprocessor/Civi/DataProcessor/FilterHandler/SimpleSqlFilter.php) #0
/home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/dataprocessor/Civi/DataProcessor/FilterHandler/AbstractFilterHandler.php(290):
Civi\DataProcessor\FilterHandler\SimpleSqlFilter->setFilter()
#1 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/dataprocessor/Civi/DataProcessor/FilterHandler/AbstractFilterHandler.php(138):
Civi\DataProcessor\FilterHandler\AbstractFilterHandler->applyFilterFromSubmittedFilterParams()
#2 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/dataprocessor/Civi/DataProcessor/FilterHandler/AbstractFilterHandler.php(127):
Civi\DataProcessor\FilterHandler\AbstractFilterHandler->setDefaultFilterValues()
#3 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/dataprocessor/CRM/Dataprocessor/Form/FilterValue.php(61):
Civi\DataProcessor\FilterHandler\AbstractFilterHandler->initialize()
#4 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/Form.php(668): CRM_Dataprocessor_Form_FilterValue->preProcess()
#5 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Display.php(76): CRM_Core_Form->buildForm()
#6 /home/jon/local/mysite/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform()
#7 /home/jon/local/mysite/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle()
#8 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle()
#9 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run()
#10 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(292): CRM_Utils_Wrapper->run()
#11 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#12 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#13 /home/jon/local/mysite/web/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke()
#14 /home/jon/local/mysite/web/modules/contrib/civicrm/src/Controller/CivicrmController.php(80): Drupal\civicrm\Civicrm->invoke()
#15 [internal function]: Drupal\civicrm\Controller\CivicrmController->main()
#16 /home/jon/local/mysite/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /home/jon/local/mysite/web/core/lib/Drupal/Core/Render/Renderer.php(580):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /home/jon/local/mysite/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /home/jon/local/mysite/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /home/jon/local/mysite/vendor/symfony/http-kernel/HttpKernel.php(169):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /home/jon/local/mysite/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /home/jon/local/mysite/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /home/jon/local/mysite/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /home/jon/local/mysite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /home/jon/local/mysite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#26 /home/jon/local/mysite/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#27 /home/jon/local/mysite/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#28 /home/jon/local/mysite/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#29 /home/jon/local/mysite/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#30 /home/jon/local/mysite/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}.