Hello, I'm trying to figure out if I'm doing something wrong or if it's VBO, and then figure out what to do next.

I'm using VBO to select a number of entities, create PDFs based on each one, concatenate that into one PDF, and download the multi-page PDF. I'm using the FPDF library to create the PDFs as local files in /tmp & the FPDI library to concatenate them. I'm using an action to run the PDF creation, concatenation, and output.

All of that works except for the last step, downloading the multi-page PDF. It just silently doesn't happen. No download dialog, no error message. I can save the multi-page PDF as a local file in /tmp, so I know that works. If I change the FPDI flag to download the output instead, nothing happens.

All of my experience so far suggests that VBO's behavior is masking or interfering with the download step, as if the action was trying to present the download but no longer has the stage. However, #1222844: Provide an action for creating an archive of selected files suggests that all of this is possible.

What am I doing wrong? Should I somehow be presenting the download from the View and not from the action?

Comments

bojanz’s picture

Status: Active » Fixed

The download action is in actions/archive.action.inc so you can start your debugging from there.
The download is never initiated, you are supposed to get a message with a link to the download file.

    $archive_file = new stdClass();
    $archive_file->uri      = $destination;
    $archive_file->filename = basename($destination);
    $archive_file->filemime = file_get_mimetype($destination);
    $archive_file->uid      = $user->uid;
    $archive_file->status   = $context['settings']['temporary'] ? FALSE : FILE_STATUS_PERMANENT;
    file_save($archive_file);

    $url = file_create_url($archive_file->uri);
    $url = l($url, $url, array('absolute' => TRUE));
    _views_bulk_operations_log(t('An archive has been created and can be downloaded from: !url', array('!url' => $url)));

maybe that's not happening?

Also, if you're using VBO 3.1, try going back to 3.0 to confirm if maybe there was a recent regression.

bojanz’s picture

Status: Fixed » Active

Let's keep this open for now.

bojanz’s picture

Issue summary: View changes
Status: Active » Closed (fixed)
pdesai’s picture

I am using VBO 3.2 and it is not giving me the download link. It goes right back to the view page again. Any ideas?

bojanz’s picture

In the VBO settings enable the "Skip batching" option and retry. That should help us narrow down the potential problem.

pdesai’s picture

Thanks for the quick response. However, even with that option checked - it still goes back to the views page. Here is the views export:

$view = new view();
$view->name = 'files_test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'file_managed';
$view->human_name = 'Files Test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Files Test';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'views_bulk_operations' => 'views_bulk_operations',
  'filename' => 'filename',
  'extension' => 'extension',
  'filesize' => 'filesize',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'views_bulk_operations' => array(
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'filename' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'extension' => array(
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'filesize' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
/* Relationship: File: Content using Image */
$handler->display->display_options['relationships']['reverse_field_image_node']['id'] = 'reverse_field_image_node';
$handler->display->display_options['relationships']['reverse_field_image_node']['table'] = 'file_managed';
$handler->display->display_options['relationships']['reverse_field_image_node']['field'] = 'reverse_field_image_node';
$handler->display->display_options['relationships']['reverse_field_image_node']['required'] = TRUE;
/* Field: Bulk operations: File */
$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'file_managed';
$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['skip_batching'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array(
  'action::views_bulk_operations_archive_action' => array(
    'selected' => 1,
    'postpone_processing' => 0,
    'skip_confirmation' => 1,
    'override_label' => 0,
    'label' => '',
    'settings' => array(
      'scheme' => 'public',
      'temporary' => 1,
    ),
  ),
  'action::views_bulk_operations_delete_item' => array(
    'selected' => 0,
    'postpone_processing' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
  ),
  'action::views_bulk_operations_delete_revision' => array(
    'selected' => 0,
    'postpone_processing' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
  ),
  'action::views_bulk_operations_script_action' => array(
    'selected' => 0,
    'postpone_processing' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
  ),
  'action::views_bulk_operations_modify_action' => array(
    'selected' => 0,
    'postpone_processing' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
    'settings' => array(
      'show_all_tokens' => 1,
      'display_values' => array(
        '_all_' => '_all_',
      ),
    ),
  ),
  'action::views_bulk_operations_argument_selector_action' => array(
    'selected' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
    'settings' => array(
      'url' => '',
    ),
  ),
  'action::system_send_email_action' => array(
    'selected' => 0,
    'postpone_processing' => 0,
    'skip_confirmation' => 0,
    'override_label' => 0,
    'label' => '',
  ),
);
/* Field: File: Name */
$handler->display->display_options['fields']['filename']['id'] = 'filename';
$handler->display->display_options['fields']['filename']['table'] = 'file_managed';
$handler->display->display_options['fields']['filename']['field'] = 'filename';
$handler->display->display_options['fields']['filename']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['filename']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['filename']['link_to_file'] = TRUE;
/* Field: File: Extension */
$handler->display->display_options['fields']['extension']['id'] = 'extension';
$handler->display->display_options['fields']['extension']['table'] = 'file_managed';
$handler->display->display_options['fields']['extension']['field'] = 'extension';
/* Field: File: Size */
$handler->display->display_options['fields']['filesize']['id'] = 'filesize';
$handler->display->display_options['fields']['filesize']['table'] = 'file_managed';
$handler->display->display_options['fields']['filesize']['field'] = 'filesize';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'files-test';
$translatables['files_test'] = array(
  t('Master'),
  t('Files Test'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('« first'),
  t('‹ previous'),
  t('next ›'),
  t('last »'),
  t('field_image'),
  t('File'),
  t('- Choose an operation -'),
  t('Name'),
  t('Extension'),
  t('Size'),
  t('Page'),
);