When adding a submission count field i get this error :

warning: array_fill() [function.array-fill]: Number of elements must be positive in /home/devitii/public_html/includes/database.inc on line 253.
warning: implode() [function.implode]: Invalid arguments passed in /home/devitii/public_html/includes/database.inc on line 253.
warning: array_keys() [function.array-keys]: The first argument should be an array in /home/devitii/public_html/modules/user/user.module on line 502.
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 ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/devitii/public_html/modules/user/user.module on line 502.

Currently under Views 6.x-2.6

Comments

okokokok’s picture

I had the same error after upgrading to 3.0-beta5.
Clearing cache fixed it for me. Also make sure you ran the updates.

drush up; drush cc all should be enough to fix it.

Note: I tried clearing cache after I got "Fatal error: Cannot redeclare webform_components_form".
I guess it would be good if Drupal or drush clears cache right after upgrading.

quicksketch’s picture

Thanks for the info guaka. I should note that there have been no changes to the Views integration between beta 4 and 5, my guess is that a change to Views may have caused the problem if you updated that at the same time.

okokokok’s picture

@quicksketch, I upgraded from the stable 2.7, to see if the upgrade would resolve #529718: Components not showing on form - I hadn't changed my submission from the default (unlimited) before this upgrade.

quicksketch’s picture

Perhaps it's a theme issue then? Try switching to Garland and see if the form shows up then.

Isostar’s picture

Version: 6.x-3.0-beta5 » 6.x-3.0-beta6

I have an Identical error with the views submission count.
- views 2.11
- webform 3.0-beta6

    * warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/jdbi/includes/database.inc on line 253.
    * warning: implode() [function.implode]: Invalid arguments passed in /var/www/jdbi/includes/database.inc on line 253.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/jdbi/modules/user/user.module on line 513.
    * 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 ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/jdbi/modules/user/user.module on line 513.

Clearing cache didn't help, changing theme either.

Isostar’s picture

I suspect this error being caused by the possibility that anonymous users can submit submissions.
The submission count in views also only counts the submissions from registered users.

quicksketch’s picture

Yikes, I took a look at this problem this evening and it looks to me like our submission count handler is rather poorly constructed. I would think that the submission count would be the number of submissions that the user has made, taking into account all the filters on the view. Instead it just returns all the submissions they've made ever, not restricted even to a single node.

      $sql = "SELECT COUNT(sid) FROM {webform_submissions} WHERE uid = %d";
      $output = db_result(db_query($sql, $values->{$this->aliases['uid']}));

That said, I couldn't actually reproduce the problem described here, but regardless the submission count handler is quite broken and won't return anything particularly useful anyway.

Isostar’s picture

To me it would be handy to create an overview using views that shows all webforms made by user x (author) and the total number of submissions (by whatever user or anonymous) for each of those webforms.

thus:
- webform a | total submission count webform a
- webfrom b | total submission count webform b

quicksketch’s picture

Isostar: I think that functionality already exists, though I wouldn't say it's written properly either.

brightbold’s picture

Same error here. Clearing the cache does not solve the problem. This occurs both on a Webform Submissons-type view and a Node-type view if you try to use the submission count field.

spikeerob’s picture

Version: 6.x-3.0-beta6 » 6.x-3.4

The issue with the submissions per node implementation seems to be on line 42 of views/webform_handler_field_submission_count.inc.

      if (webform_results_access($node, 'access all webform results')) {

The correct use of the function should be this:

      if (webform_results_access($node, $user)) {
snufkin’s picture

Version: 6.x-3.4 » 6.x-3.x-dev
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new1.01 KB

Confirmed just ran into this bug myself today. The patch is implementing #11.

quicksketch’s picture

Priority: Major » Normal
Status: Needs review » Active

Thanks snufkin, looks good. The views handler needs to be rewritten entirely, but this is a good bug fix for the time being. Committed to #12 to CVS. I'm leaving this issue open since we still need to rewrite the handler entirely as mentioned in #7.

anybody’s picture

[Push... this bug still exists. Would be nice if you could fix it and push it into the next version.]

Sorry, I have to correct myself. The bug has been resolved in code but anyway no value is shown in my case. I'll try to find out myself why this happens and tell you about my result, if I can figure it out.

anybody’s picture

Status: Active » Needs work

Okay, I found out where's the BUG:

if ($this->count_type == 'node' && in_array($node->type, webform_variable_get('webform_node_types'))) {
      module_load_include('inc', 'webform', 'includes/webform.submissions');
      $node = node_load($values->{$this->aliases['nid']});

-------------------------------
The $node variable doesn't exist in the if condition, so that it always returns false.

The line

$node = node_load($values->{$this->aliases['nid']});

Must be placed before the if!!
Can anyone fix it please?

Thanks!

snufkin’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
StatusFileSize
new869 bytes

Rolled a patchety patch!

snufkin’s picture

Status: Needs work » Needs review
derhasi’s picture

Status: Needs review » Fixed
Issue tags: +dvcs11

This is fixed in the current 7.x-3.x-dev, as the $values->{$this->aliases['type']} is used instead of $node->type.

Status: Fixed » Closed (fixed)
Issue tags: -dvcs11

Automatically closed -- issue fixed for 2 weeks with no activity.