Tried to use ViewsOR with arguments
In the argument "Views Or: Next alternative" setting "Share arguments" does not work. In the query user/%/support i got an SQL errors:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') count_alias' at line 8 query: SELECT COUNT(*) FROM (SELECT node.nid AS nid FROM issue_node node INNER JOIN issue_node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid INNER JOIN issue_users users ON node.uid = users.uid LEFT JOIN issue_users ncs_users ON node_comment_statistics.last_comment_uid = ncs_users.uid AND ncs_users.uid != '0' LEFT JOIN issue_content_type_test_case node_data_field_in_charge ON node.vid = node_data_field_in_charge.vid WHERE ) count_alias in Y:\home\drupal6\www\sites\all\modules\views\includes\view.inc on line 739.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY node_comment_statistics_last_updated DESC LIMIT 0, 25' at line 21 query: SELECT node.nid AS nid, node.title AS node_title, GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated, users.name AS users_name, users.uid AS users_uid, COALESCE(ncs_users.name, node_comment_statistics.last_comment_name) AS node_comment_statistics_last_comment_name, ncs_users.name AS ncs_users_name, node_comment_statistics.last_comment_uid AS node_comment_statistics_last_comment_uid, node_data_field_in_charge.field_in_charge_uid AS node_data_field_in_charge_field_in_charge_uid, node.type AS node_type, node.vid AS node_vid, node_data_field_in_charge.field_priority_value AS node_data_field_in_charge_field_priority_value, node_data_field_in_charge.field_category_value AS node_data_field_in_charge_field_category_value, node_data_field_in_charge.field_status_value AS node_data_field_in_charge_field_status_value FROM issue_node node INNER JOIN issue_node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid INNER JOIN issue_users users ON node.uid = users.uid LEFT JOIN issue_users ncs_users ON node_comment_statistics.last_comment_uid = ncs_users.uid AND ncs_users.uid != '0' LEFT JOIN issue_content_type_test_case node_data_field_in_charge ON node.vid = node_data_field_in_charge.vid WHERE ORDER BY node_comment_statistics_last_updated DESC LIMIT 0, 25 in Y:\home\drupal6\www\sites\all\modules\views\includes\view.inc on line 765.
I see this with zero or one argument. Views OR works only if both arguments are set trgardless of "share argument" option set.
Arguments used:
Node: user is author or commented - default settings
Content: userreferrence field - default settings
other arguments settings work as AND or won't work at all
Comment | File | Size | Author |
---|---|---|---|
#20 | views_or-6.x-1.x-644174-19.patch | 1.08 KB | seandunaway |
#12 | views_or_644174_shared_arguments_fix.patch | 907 bytes | WorldFallz |
Comments
Comment #1
that0n3guy CreditAttribution: that0n3guy commentedI can second this bug....
Comment #2
benone CreditAttribution: benone commentedthe same here.
need to give both arguments, even if they are the same..
subscribe.
Comment #3
inforeto CreditAttribution: inforeto commentedGot the same errors when setting shared arguments.
Be it with or without shared arguments the second argument is expected.
The whole where clause seems missing if either argument is not set.
The sql error points to the "WHERE ORDER BY " where theres no where clause added.
Comment #4
pontus_nilssonI get the same error.
I have
Views Or: Begin alternatives (share argument)
Nid
Views Or: Next alternative (share argument)
Nid
Views Or: Next alternative (share argument)
Nid
Views Or: Next alternative (share argument)
Nid
Views Or: End alternatives
When I enter argument 11 the SQL clause ends with only WHERE
When I enter 11/11/11/11 as argument the WHERE clause is written correctly in views UI preview.
When I remove the setting share argument in the next alternative setting, the same problem occurs.
Comment #5
Josh Benner CreditAttribution: Josh Benner commentedI am seeing the same error.
Comment #6
Josh Benner CreditAttribution: Josh Benner commentedPreliminarily, I'm having luck with a one-character edit on line 215 of views_or_handler_argument.inc, changing the != to a ==
I've not done much testing on this change, yet, and I don't have a full understanding of how the module operates to know for sure if this is an appropriate fix.
Comment #7
jsenich CreditAttribution: jsenich commentedThe fix in 6 works for me, thanks!
Comment #8
not_Dries_Buytaert CreditAttribution: not_Dries_Buytaert commentedSo, I guess that line 215 (as mentioned in post #6) is
if ($this->view->args[$this->position] != '') {
, quoted fromComment #9
liquidcms CreditAttribution: liquidcms commentedfix works for me as well.. any chance of getting this committed?
Comment #10
thadwheeler CreditAttribution: thadwheeler commentedI tried the fix in #6 and it was not working for me. I get no query run when I enter a single argument or all 4 that I need
Comment #11
liquidcms CreditAttribution: liquidcms commentednot sure if it helps.. but this is a screen of my View setup http://screencast.com/t/BbZSzOuFMu0B
and i only pass a single arg
Comment #12
WorldFallz CreditAttribution: WorldFallz commentedyep, I can confirm this fixes the problem. Here's a patch in the hopes of getting it committed. If someone could try it and then RTBC this issue it might help move things along.
Comment #13
elliotttf CreditAttribution: elliotttf commentedConfirmed the patch in #12 works.
Comment #14
ZechariahStover CreditAttribution: ZechariahStover commentedConfirmed the patch in #12 works for me.
Comment #15
stevehuk CreditAttribution: stevehuk commentedConfirmed the patch in #12 works for me.
Comment #16
alienatix CreditAttribution: alienatix commentedConfirmed the patch in #12 works for me.
Comment #17
allain CreditAttribution: allain commentedConfirmed patch in #12 works for me too.
Comment #18
skylord CreditAttribution: skylord commentedHm. With this patch view fails when "Share arguments" is set and there are two arguments. So, this solution is not correct... I.e. view can have more arguments not used in OR block....
Comment #19
skylord CreditAttribution: skylord commentedAs i think removing the whole condition is the best choice. Test on misc configs - works as expected - uses first arg for all alternatives when "share" is set no matter of args number. Please, test and confirm...
Comment #20
seandunaway CreditAttribution: seandunaway commentedI've tested both of these and they both work well. I am running into some issues when not passing any arguments at all but that can be restructured in the view. Can we get this in dev before it gets lost forever in issueland? You wouldn't believe the hacks I was doing before for similar functionality.
Here is a git re-roll of #19 for easy commit.
Comment #21
Jim Kirkpatrick CreditAttribution: Jim Kirkpatrick commented#20 works for me, please commit!
Comment #22
Darren OhFixed in commit c3294b8. Thanks to rump and Jim Kirkpatrick for reviewing skylord’s patch!
Comment #24
Darren OhThis patch broke functionality when arguments are not shared: #1340590: Default arguments not respected (and query broken?) when "Share arguments" is NOT indicated. It has been reversed until a safe patch is provided.