Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As follow up to #1421382: "Compounded Filter" - create filter for filtering several concatenated fields which.
If any of the field of the compound filter has no value (NULL), the filter does not work. This is because CONCAT() returns NULL if at least a single argument is NULL.
Comment | File | Size | Author |
---|---|---|---|
#8 | views-1494226-8-test-only.patch | 3.29 KB | tim.plunkett |
#8 | views-1494226-8.patch | 3.85 KB | tim.plunkett |
#6 | views-1494226-6-test-only.patch | 3.14 KB | tim.plunkett |
#6 | views-1494226-6.patch | 3.71 KB | tim.plunkett |
#4 | views-1494226-4-test-only.patch | 2.97 KB | tim.plunkett |
Comments
Comment #1
derhasi CreditAttribution: derhasi commentedOne solution could be to use
$fields[] = " IFNULL($field->table_alias.$field->real_field, '')";
, but i guess this is restricted to MySQL.Another would be to use OR clauses for checking each field separately, instead of using CONCAT.
Comment #2
dawehnerWhen we developed this filter we said: Let's make sure it works for most cases, because for example certain handlers will work a bit different internally.
So what we actually want on this issue is contact_ws, see http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_co...
It would be cool if there would be simpletests for this handler type.
Comment #3
derhasi CreditAttribution: derhasi commentedoh, yes, sure CONCAT_WS is a solution. I attached a patch with the additional
' '
as a separator.Within that patch there's also a test (my first one ever).
Comment #4
tim.plunkettUploading the test separately to see that it fails, and adding it to the .info file.
Comment #6
tim.plunkettOkay, rewrote a chunk of the test.
Comment #8
tim.plunkettOkay, I hate override_option.
Comment #10
tim.plunkett#8: views-1494226-8-test-only.patch queued for re-testing.
Comment #11
tim.plunkett#8: views-1494226-8.patch queued for re-testing.
Comment #12
tim.plunkettgit.d.o went down, hence the retests.
The test was very close, glad to have more coverage (even though we'll now have more than 1337 tests)
Comment #13
tim.plunkettThis part is the only reason I didn't RTBC. There seems to be no better way to do it, but I wanted to check.
Comment #14
dawehnerFrom my experience you can use
$view->display['default']->display_options['fields']['foo'] = array(id' => 'job'...) but if it works things like that doesn't matter that much. Just changed it and committed it.
Thanks for the work!!
If the compound filter will be backported this fix should be considered as well.
Comment #15
tim.plunkettI KNEW there was a way to do it. I kept trying to add to
$view->display['default']->handler->options['fields']
and$view->display['default']->options['fields']
, which made it show up, but not get added to$this->view->fields
. Thanks!Comment #16
derhasi CreditAttribution: derhasi commentedtim and daniel, thanks for making the test work ;)
Comment #17
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue