Reporting mixes up fields from two webforms
mgenovese - April 28, 2008 - 05:41
| Project: | webform report |
| Version: | 5.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
Hi there,
First off, I'm using 5.x-1.4 of Webform report, and the latest (5.x-2.0-beta3) of webforms. My site is Drupal 5.7.
I have two nodes, each with a different webform (say webform A and webform B). I created a webform report node for webform B to report on its fields. When editing the webform, it works just fine - allows me to select the appropriate fields from B's fields.
However, when I view that webform report, it's pulling in data from webform A and webform B. The columns have fields from both webforms. All screwed up.
Ideas? Thanks!

#1
Hello?
#2
Hey, sorry for the long delay in replying. I haven't seen this happen before, and the report pulls its data from webform's tables using the node ID of the webform, so I don't see how it would mix results from two webforms. Could be something with the latest version of webform. I'll check it out.
#3
Great - thanks very much!
#4
#5
I am now having this happen with Webform 2.1.3 and webform report 2.0.
All of my reports seem to have the data from every webform in them.
#6
#7
Hi presleyd, did you run update.php? There are some db changes in this version.
#8
Yes, I did but this was the only version of Webform report I've ever installed.
#9
Okay, thanks for the info. I'm not sure what's up since I can't reproduce this. What other modules are you running, presleyd, and what database backend?
#10
MySQL 5.0.27 for win32 with PHP 5.2.5
CCK
Webform
Date
Calendar
TAC
Views
LDAP Authentication
Image
TinyMCE
Feedapi
Taxonomy Image
Usernode
LoginToboggan
Pathauto
XML Sitemap
#11
I believe this is fixed by 5.x-2.1. Please give it a boot and let me know. Thanks.
#12
In my case, the column titles are still wrong, but the data is correct. Very strange! Column titles are taken from a different form than chosen for the report, but the data in the column is from the report chosen. Sometimes the column titles are wrong and taken from the same form as chosen from the report. Hope it can be fixed. Good luck! :)
#13
Ditto. I get the data correct but the column titles are from different form.
#14
I upgraded to webform_report 5.x-2.2 and now I have double entries in every column! HELP!!! Also, the wrong column title problem persists.
#15
I'm going to look into it this week. I'm backporting the newly-rewritten 6.x version to 5.x and that should fix most problems like this.
#16
This is fixed in 6.x-1.3 for me.
#17
No follow up original issue poster in some time, considering this closed.
#18
This is caused because webform reuses component id's. So to be unique, the pair of node id and component id must be checked.
See the big SELECT around line 529 of webform_report.module.
Make the JOIN consider nids:
<?phpLEFT JOIN {webform_component} c ON ( d.cid = c.cid AND d.nid = c.nid )
?>
That should get rid of the duplicating field content.
For grins, my SELECT right now looks like:
<?php$result = db_query("SELECT w.nid, c.name, c.cid, c.type, d.nid, d.sid, d.data, s.uid, u.name as user, s.submitted, s.remote_addr, d.no, c.type
FROM {webform} w
LEFT JOIN {webform_submitted_data} d ON w.nid = d.nid
LEFT JOIN {webform_component} c ON ( d.cid = c.cid AND d.nid = c.nid )
LEFT JOIN {webform_submissions} s ON d.sid = s.sid
LEFT JOIN {users} u ON s.uid = u.uid
WHERE w.nid = '" . $node->wnid . "'
AND (" . $query . ")
ORDER BY d.sid, c.cid, d.no, c.name, d.data");
?>
I added d.no so that date fields would be useful. of course, they are still bizarre on the display, but that is some other bug somewhere or should be.
(No idea why this is closed, it is clearly unfixed on 5.x-2.x)
#19
Applied the above patch on webforms report 5.X-2.2 and got rid of multiple values for a field (as many as different forms). However have still a warning:
warning: Invalid argument supplied for foreach() in /var/www/vhosts/oxaco-tennis.be/httpdocs/sites/all/modules/cck/fieldgroup.module on line 394.
Also, when creating a new report and choosing a form, at first i get a warning on not finding the right form but it finds the fields and one can continue creating the report!
Also when using phpadmin and inspecting the wedform-submissions and webform submissions-datafile i get warnings on misuse of indexes!
#20
Any update on this? I would like to use this for my website, but it sounds like the 5.X-2.2 version is unstable until this is fixed. Changing this issue to critical (you can correct me if I'm wrong, but these issues sound truly problematic).
#21
Subscribing. Don't make me write my own!!