Steps to reproduce:
1) Create a new view against the user table. Continue and Edit.
2) The default user view contains a filter on "User: Active".
3) Get error message as the query contains "(users.status NOT IN ())"
I tried debugging this, but the user status references a boolean handler, and the boolean handler in turn doesn't appear to be able to generate IN-wheres at all, so I don't know how to debug further.
Assigning to dereine as it's a D7 issue.
Happens in -rc1 and -dev.
@dereine If you want, ping me on IRC and give me a hint where I should look, and maybe I can work it out myself :)
Comments
Comment #1
Letharion commentedBah. Third party module running query alters.
Comment #2
Letharion commentedThe above error in Views is caused by a slightly too enthusiastic query alter.
Comment #3
Letharion commentedIf the condition['value'] == 0, this
in_array($condition['value'], $replacements)appears to be true, and the replacement happens.Comment #4
miax commentedI came across this issue also, as Letharion found, but in a different context.
When using views to filter on unpublished nodes the condition['value'] is set to 0 and the replacements happens.
Resulting in that I can not filter a view on unpublished nodes (node.status == 0).
I have created a patch with emattias that seem to fix this issue.
Comment #5
Letharion commentedComment #6
Letharion commentedThat wasn't very clever of me. Will revert the patch, as it generally broke vms.
Comment #7
cbeier commentedThe included patch from #4 was included in the 7.x-1.0-beta1. But the patch broke the vms functionality completely, if the (node) field was not named "vms_field_promo_mlid_direct" or "vms_field_promo_mlid_sub".
I have attached a "patch" that will remove the problematically patch from #4.
Comment #8
Letharion commentedYes, my apologies, as I noted in #6, that wasn't my most clever move.
Anyway, I rewrote the relevant logic completely, which should solve both the original problem in a robust way, as well as solve the problem I introduced.
Please try and report back.
Comment #9
Letharion commentedComment #10
Letharion commented#9 Introduces better "IS NOT" handling.
Misspelled variable in #9 fixed with this patch.
Comment #11
Letharion commentedMarking critical as the module currently does not properly perform it's main purpose.
Comment #12
knalstaaf commentedJust for the sake of clarity: is this fixed in the dev-version? Or does the dev-version require the patch as well?
(I'm using the Submenu tree module for the time being, but I'd like to follow the VMS project because it looks like it provides more flexible solutions.)
Comment #13
Letharion commentedI've been waiting with committing it as I haven't had any feedback. Since it's critical though, and it works for me, I will commit it very soon unless I hear otherwise.
Please give some feedback in case you test it. :)
Comment #14
knalstaaf commentedDespite some error notices while patching the dev version it seems to work ok for me.
First I applied the latest patch in the main folder of the module, but it said it couldn't find a certain file (something about line 17 as far as I can remember). Then applied it again on the "handlers" folder, which had a similar notice.
But after that it seems to work...
Comment #15
Letharion commentedGlad the module work well for you :)
With that said: I just tried it, the patch applies cleanly against the latest code. You should get no errors. Maybe you want to read Applying patches for future patch applying.
Comment #16
knalstaaf commentedOk, I patched it using this line:
patch -b < 1277518_10_Move-query-logic.patchI'm using it for all patches, and it seems to work fine usually. Don't know what the
-bstands for though. I should read the "Applying pages" page through.Edit: (...) and the -b option creates a backup copy of the file before modifying it.
Comment #17
Letharion commentedMost patches are done in -p1 style, and if you don't specify the proper -p level, a lot of patches will fail.
Comment #18
Letharion commentedCommited