Hey there! we have this use case where we want to add some info to nodes using cck and vbo. The thing is that for some fields, even if they are setup as multiple values, using the vbo action for fields only replaces the current value with the new one. Could there be an option where the user can select if new terms are added, or if they should replace the previous content.

I think the taxonomy action already does this, so maybe it's not so hard to add? Anyone else would find this useful?

Thanks,
Patchak

Comments

infojunkie’s picture

Good idea. Thanks for the request.

patchak’s picture

Infojunkie, glad you like it! You think this is something that could be happening soon? Could you give me some directions on where to look to get inspiration for this? Any examples or special ways to do this?

Thanks

infojunkie’s picture

I'm currently working on it.

infojunkie’s picture

Version: 6.x-1.9 » 6.x-1.x-dev
Status: Active » Fixed

Fixed in the latest dev. Please try it (12 hours form now or get from CVS branch DRUPAL-6--1) and let me know!

Status: Fixed » Closed (fixed)

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

aron novak’s picture

Category: feature » bug
Status: Closed (fixed) » Needs review

I tried out this feature and it seemed to fail in that case if the multivalue field has value. It simply discarded the new value instead of adding it to the next 'row'.
Here is a code what worked perfectly for me:

if ($context[$field_name . '_add']) {
        if (!is_array($node->$field_name) || empty($node->$field_name)) {
          $node->$field_name = array();
        }
        else {
          $function = $field['module'] .'_content_is_empty';
          foreach ($node->$field_name as $delta => $item) {
            if (call_user_func($function, $item, $field)) {
              unset($node->$field_name[$delta]);
            }
          }
          $node->$field_name = array_values($node->$field_name);
        }
        foreach ($value as $v_delta => $v_item) {
          if (is_string($v_delta)) {
            $node->$field_name[$v_delta] = $v_item;
          }
          else {
            $node->{$field_name}[] = $v_item;
          }
        }
      }
      else {
        $node->$field_name = $value;
      }

Sorry for not providing a patch.

infojunkie’s picture

Status: Needs review » Fixed

@Aron Novak: Thanks for the fix. Seems to run fine. Committed to the latest dev.

Status: Fixed » Closed (fixed)

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

zio’s picture

Version: 6.x-1.x-dev » 6.x-3.x-dev
Status: Closed (fixed) » Active

hi,
I'm using 6.x-3.x-dev from April 18. This patch is missing in that version.

nruest’s picture

Version: 6.x-3.x-dev » 6.x-1.x-dev

The 6.x-1.x-dev version is working great. However, I am only able to bulk modify (add new values) one cck field at a time. When I selected more than one field to perform operations on, the entire process proceeds smoothly - confirmation screen, processing screen, results. However, when I check a node which should have had the bulk operation performed on it, it does not reflect the operations performed.

infojunkie’s picture

@nruest: I was able to add values to many fields at once. Can you confirm that this is still an issue with the latest dev release?

nally’s picture

Thanks for the fix and this thread.

I'm also using the 6.x-3.x version of the module. Should I attempt to fold the above fix into that module? Are there gotchas involved in that effort?

infojunkie’s picture

Version: 6.x-1.x-dev » 6.x-1.10-beta2

@nally: please note that the 6.x-1.10-beta2 is now Views 3-compatible. Can you please try it?

nally’s picture

Thanks for the fix. I have tested it, and ran into a problem.

The path for my bulk_ops view is not directly off the root.

i.e. my views path is

[specific-text-value]/bulk_ops

When I execute a bulk "modify fields" action, to submits to

[specific-text-value]/[specific-text-value]/bulk_ops

The URL that the form is submitting to includes (erroneously) the first part of the path, twice.

This happens straight away, before I get to enter the values to be used for modifying field values.

Does that sound like a bug in the beta version?

UPDATE: making the path a single value with no slashes permitted me to get to the value-setting page.

infojunkie’s picture

Version: 6.x-1.10-beta2 » 6.x-1.10

Is this also happening on the stock VBO at admin/content/node2? This one too has a non-root path.

infojunkie’s picture

Status: Active » Fixed

@nally: Your URL issue is not related to adding new values in "Modify node fields". Might it be related to this one: #939446: Still not working with dirty URLs? If so please subscribe there. Otherwise, please open a new issue.

Status: Fixed » Closed (fixed)

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