Problem/motivation

Example situation:
There are entity bundles which have similar name:

  • message
  • status_message

(both ends with 'message', it's important).

If we enable some fields from status_message for modifying by action, the bulk action form will fieldsets for both bundles, but should have only for status_message. The fieldset for message is empty though.

When submitting the bulk action form it raises an error
Warning: Invalid argument supplied for foreach() in views_bulk_operations_modify_action_validate() (line 371 of /Users/username/Sites/projectname/sites/all/modules/contrib/views_bulk_operations/actions/modify.action.inc).

Proposed resolution

Change the way how the action check whether bundle is affected by current action config. In _views_bulk_operations_modify_action_get_bundles() function, in this piece of code:

    $has_enabled_fields = FALSE;
    foreach ($display_values as $key) {
      if (strpos($key, $bundle_name . '::') !== FALSE) {
        $has_enabled_fields = TRUE;
      }
    }

Change:

if (strpos($key, $bundle_name . '::') !== FALSE) {

to

if (strpos($key, $bundle_name . '::') === 0) {

.

CommentFileSizeAuthor
#2 views_bulk_operations-2973282-2.patch504 bytesmpolishchuck

Comments

mpolishchuck created an issue. See original summary.

mpolishchuck’s picture

Status: Active » Needs review
StatusFileSize
new504 bytes

Here is a patch, which implements my proposed resolution.

joelpittet’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Status: Needs review » Fixed

I've committed this fix to the latest dev branch. Thank you for patching this.

Status: Fixed » Closed (fixed)

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

chris matthews’s picture