webform_handler_field_submission_link makes an assumption that webform_submissions is the base table of the view. If the submission was reached through a view relationship, this is not the case and the submission link field cannot be added to the view.
The message reported is that node_uid field is not reachable (not the exact wording). It results from an exception during the query (inside the call to ensure_table, as I recall) in class webform_handler_field_submission_link in webform_handler_field_submission_link.inc. Alas, I don't currently know enough about how relationships are implemented in views to help more, but I'm guessing that the join is not right in query:
function query() {
$this->ensure_my_table();
// Join to the node table to retrieve the node UID.
$join = new views_join();
$join->construct('node', $this->table_alias, 'nid', 'nid');
$this->query->ensure_table('node', $this->relationship, $join);
$this->add_additional_fields();
}
To reproduce the problem, you will need a table with a relationship that gets you (presumably via an sid) to the submission table. Create a view using this base table. Add the relationship to the submissions. Try to add a link field, such as view or edit. Ajax error results.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | node-1435846-broken-relationship.view_.txt | 2.55 KB | kscheirer |
| #1 | webform_views_link_relationship.patch | 555 bytes | quicksketch |
Comments
Comment #1
quicksketchThanks, I ran across this exact same problem two days ago. Looks like the existing Webform views implementation sadly misnamed one of its views tables. It should have specified "webform_submissions" (plural) but instead it specified "webform_submission" (singular). Since we can't change this without breaking all existing views that use Webform, we'll have to compensate by manually specifying the JOIN relationship between the node table and the webform_submissions table. This patch corrects the problem. Committed to both 3.x branches.
Comment #3
kscheirerI don't think the patch fixed the issue unfortunately, sorry to reopen this ticket.
I'm using the relationship Node: Webform submissions, which is what the patch above was trying to correct.
The SQL join ends up as:
where
node.webform_submissionis obviously not a valid field, that should benode.nid = webform_submissions_node.nid.Here's the entire final query:
and attached the export of the View I'm working on (simplified to just show this problem). This is with Commons 6.x-2.6, which uses Views 6.x-2.16 and Webform 6.x-3.17. I've tried different things in
webform_views_data_alter()but I'm just not getting the right syntax to have Views make the join properly.Comment #4
danchadwick commented@kscheirer - Your bug in unrelated. I finally got to the bottom of it:
#2208931: Using views, submission table unreachable from node or user table