I am getting a notice when adding a checkbox field to a report when running the latest version of Webform (7.x-4.0-rc4):
Notice: Undefined index: nid in _webform_select_options() (line 887 of /var/www/contracts/sites/all/modules/contrib/webform/components/select.inc).
The stacktrace points to the following line:
sites/all/modules/contrib/webform_report/webform_report.inc:376
372 if (function_exists('_webform_select_options_callback')) {
373 // make a webform "component"
374 $wfcomp['extra'] = $extra;
375 // get select options
376 $columns[$index]['pairs'] = _webform_select_options($wfcomp);
377 }
Here is the declaration for _webform_select_options():
function _webform_select_options($component, $flat = FALSE, $filter = TRUE)
As long as $filter is TRUE, _webform_select_options() expects 'nid' as an array key for '$wfcomp', a.k.a. '$component'. '$wfcomp' is created in line 374 above, and as you can see, the key 'nid' is never created.
It seems to me that there are three possible solutions:
A. call _webform_select_options() with the $filter set to FALSE
B. add the 'nid' key to '$wfcomp'
C. file a bug report with webform
They're all really simple fixes, but I'll leave the solution to someone who understand the intent of this function better than I.
Comment | File | Size | Author |
---|---|---|---|
#3 | webform_report-2307639.patch | 542 bytes | pgsengstock |
Comments
Comment #1
jbulcher CreditAttribution: jbulcher commentedadd a third solution
Comment #2
waluyo.umam CreditAttribution: waluyo.umam commentedI have the same problem.
Can you explain clearly how to solve this.
Comment #3
pgsengstock CreditAttribution: pgsengstock commentedComment #4
pgsengstock CreditAttribution: pgsengstock commentedMy patch took the path of least resistance (option A: call _webform_select_options() with the $filter set to FALSE). Works well enough for our implementation, but others should probably test on their own. Also, this patch was made against the 7.x-1.x dev version. Haven't submitted a drupal patch before, so apologies if I did it wrong.
Comment #5
waluyo.umam CreditAttribution: waluyo.umam commentedThank you pgsengstock, your patch #3 works for me.
Now I don't have any notice warning again.
Comment #6
srutland CreditAttribution: srutland commentedThanks. Worked for our app too though don't know the full ramifications of passing FALSE and FALSE. No more warning notices "Notice: Undefined index: nid in _webform_select_options() (line 888 of /apps/drupal/html/sites/all/modules/webform/components/select.inc)"
Comment #7
varenius CreditAttribution: varenius commentedThanks. I also changed the function args to FALSE, FALSE as described above and it works to avoid the notice.
Comment #8
Temmest CreditAttribution: Temmest commentedThanks @pgsengstock your patch #3 works for me.
Comment #9
aubjr_drupal CreditAttribution: aubjr_drupal commentedAnother vote for patch in #3. Can someone review this?
Comment #10
rjt1224Seems to be working well once patch #3 is applied.