When using Views Bulk Operations to bulk modify a HS Node Reference field, I get an error. I choose my highest-level item, and the AJAX response causes my browser (Chrome) to popup an error: "Received an invalid response from the server."

Comments

jrao’s picture

The error is:

PHP Fatal error: views_bulk_operations_form() [function.views-bulk-operations-form]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "views_bulk_operations_plugin_style" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in modules\views_bulk_operations\views_bulk_operations.module on line 219

Probably related to how VBO handles the HS field, will try to look into this sometime next week.

bricef’s picture

+1 i have the same issue.

bricef’s picture

Status: Active » Needs work

I add thie piece of code in views_bulk_operations_init() :

  include_once (drupal_get_path ('module', 'views') .'/views.module');
  include_once (drupal_get_path ('module', 'views') .'/includes/base.inc');
  include_once (drupal_get_path ('module', 'views') .'/includes/view.inc');
  include_once (drupal_get_path ('module', 'views') .'/includes/plugins.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin_style.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin_style_table.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin_display.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin_display_default.inc');
  include_once (drupal_get_path ('module', 'views') .'/plugins/views_plugin_display_page.inc');
  $files = file_scan_directory(drupal_get_path('module', 'views_bulk_operations'), '(.*).inc$');
  if ($files) foreach ($files as $file) {
    require_once($file->filename);
  }

And it works but that's not very clean i guess :)

I think we must open a bug in VBO.

gunzip’s picture

same here, subscribing and filed a bug vs vbo here
#979766: Does not work with Hierarchical Select

gunzip’s picture

bricef code works. as a workaround you can put this code in your own module init function
without hacking vbo sources till a patch will come


function MYMODULE_init()
{
  if (arg(0) == 'hierarchical_select_json') {
    views_include_handlers();
    views_include('view');

    foreach (array(
        'views_plugin_style',
        'views_plugin_style_table',
        'views_plugin_display',
        'views_plugin_display_default',
        'views_plugin_display_page') as $module)
    {
      module_load_include('inc', 'views', 'plugins/'. $module);
    }

    $files = file_scan_directory(drupal_get_path('module', 'views_bulk_operations'), '(.*).inc$');
    foreach ((array) $files as $file) {
      require_once($file->filename);
    }
  }
}
janusman’s picture

The above worked for me; however there is the additional problem that, for an HS widget that uses the dropbox (e.g. has multiple values), no values at all get sent from that widget.

For this I did some testing with a XXXX_nodeapi() function, when $op = 'presave', checking what the sent $node was; that field's value was empty when the dropbox was enabled, but did contain something when the field only allowed one value.