Closed (won't fix)
Project:
Views Bulk Operations (VBO)
Version:
7.x-3.0-beta3
Component:
Actions
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
29 Apr 2011 at 06:35 UTC
Updated:
29 May 2013 at 13:14 UTC
Jump to comment: Most recent file
Comments
Comment #1
paulgemini commentedForgive me (I'm a novice), but is this the patch that makes the taxonomy bulk operations work? I added it and I still received the error described here:
http://drupal.org/node/1015164
Comment #2
aangel commentedIt doesn't appear to be...looking at the code it doesn't make changes where the error is occurring. I applied it anyway to be sure and the error persists.
I think this part just hasn't been ported yet, per the discussion at http://drupal.org/node/1108578
Comment #3
sunThis is already going to be changed via #1123364: Implement hook_views_bulk_operations_object_info() for entities and can be removed from this patch.
Powered by Dreditor.
Comment #4
Taxoman commentedSubscribing
Comment #5
paulgemini commentedsubscribing
Comment #6
bojanz commentedMarking this as fixed.
The first chunk (fixing delete) just went into the reloaded branch, soon to be merged into 7.x-3.x
The second chunk was already there.
Modifying terms on nodes will be possible once #1057158: Provide an action for modifying entity values gets done.
The separate taxonomy.action.inc was removed because in D7 terms work through ordinary reference fields.
Comment #8
kclarkson commentedSo fields Actions needs to be done before we get bulk taxonomy update?
Comment #9
bojanz commentedYes. But getting that to work generically (VBO supports all entity types) is a huge & hard effort that nobody's contributing to, so it will take a while.
If someone wants to port over / write just the taxonomy actions themselves, even as a stop gap measure, I wouldn't complain. It's just not my priority with the general field updating still unresolved.
Comment #10
erik2e commentedbojanz does not lie when he writes about a huge & hard effort :)
i came up with quick and basic taxonomy actions, and i'll share the code after a bit of cleaning. this is used in 2 d7 production sites for mass taxonomy operations, so i guess it should be usable for someone else.
you can add/update/delete the terms of selected nodes. i may add support for other entities if needed, but the code is really a quick answer to a client need for mass taxonomy operations on nodes.
@bojanz, should I just upload the .inc files here ?
Comment #11
bojanz commentedYes, please do, and then reopen the issue.
Comment #12
erik2e commentedPlease find attached the 2 actions mentionned above. 2 files in the zip/tgz :
Just copy the files to the actions/ subdirectory of the VBO module directory.
As I said, this is quick and basic code. Comments/feedback are welcome. The action only works on nodes, and is provided without any warranty, use it at your own risks.
Comment #13
erik2e commentedBetter with the files attached ...
Comment #14
erik2e commentedForgot to mention that you need to setup and activate the Entity API module
Comment #15
bojanz commentedEntity API is a VBO dependency, it's always there.
Thanks, I'll take a look.
Comment #16
erik2e commentedOops, I forgot that VBO requires Entity API :) The module_exists() checks might be removed.
Let me know if you find this useful, and if I can help with the generic Fields Actions.
Comment #17
erik2e commentedRe-oops. I screwed the actions, this cannot work (name changes on the callback, and name mismatch on one of the files).
Please find attached a working version.
Comment #18
philipz commentedThe actions do not show up on the vbo field's action list. I cleared the cache just to be sure.
Comment #19
bojanz commentedYes, you need to add the filename to views_bulk_operations_load_action_includes().
Thanks for the code, erik2e, I'm on DrupalCon London right now, but when that ends I will review this.
Comment #20
erik2e commentedThe code does not work with -beta2. Even if you add the filenames to function views_bulk_operations_load_action_includes() it won't work.
I'll double check the changes done in beta2 and update the code.
The code works with beta1 if you want to try it before the fix is sent.
Things are moving fast on the VBO planet :-)
Comment #21
bojanz commentedThere's shouldn't be anything else other than the line in views_bulk_operations_load_action_includes(), but do double check :)
Comment #22
erik2e commentedI've double check :-)
It seems the context parameter of function views_bulk_operations_taxonomy_action_form have changed, the $nid of selected node was the key of the array, and it is now the value. The code is updated, but I'd like to find a way to make a patch that includes the addition of the 2 actions files in the actions/ directory.
In the meantime, please find attached a new zip with the 2 updated .inc files, to be copied in the actions/ subfolder of the VBO module directory. And also find a patch for the .module file to include the 2 new actions in the list.
Basically, at line 50 of the views_bulk_operations.module, you have to add the 2 new actions as follow :
'delete.action.inc',
'script.action.inc',
'user_roles.action.inc',
+ 'terms_fields.action.inc',
+ 'terms_fields_bundles.action.inc'
);
Comment #23
epoitras commentedVery much appreciated erik2e, thank you.
Comment #24
infojunkieFYI, the latest 6.x dev release has a better mechanism for detecting actions, without sacrificing too much resources. Check function
_views_bulk_operations_load_actions.Comment #25
bojanz commentedI'm fine with the current approach to detecting. Discussed it with catch, we saw the benefit to doing what 6.x-1.x does, despite the variable_set ugliness, but simplicity won out in the end.
Comment #26
grossmann commentedI tested the patch and files of #22 and they seem to work so far.
Thanks for this cause it is a most needed feature for me. It would be a nice feature to see in the selection view which terms are already selected.
grossmann-mcs
Comment #27
sachbearbeiter commentedsub
Comment #28
erik2e commented@grossmann-mcs, I thought about this feature, but you can either display terms common to all nodes, or terms that are used by some of the node, so I did not implemented anything :)
What I've done is have the terms reference fields displayed in the view that uses VBO, and added a filter so one can quickly select nodes depending on their terms. That made everyone happy in my context.
Adding this is not very hard, but this code is a quick hack to get things running for mass taxonomy operations in a particular context, so unless the module maintainers are planning on integrating it, I won't work further on it.
Support for other entities (supports only nodes for now), and an extra form page asking a few options (display fields only or each combination of fields/bundles, pre-selection of terms common to all node or all terms used, use of field native widget or generic select list) would indeed make a more usable vbo taxonomy solution.
@bojanz, did you had any time to review the code ? How would a dedicated vbo taxonomy action fit in the plans ?
Comment #29
grossmann commented@erik2e, yes I see the problem with showing terms when I select multible nodes. I will be easier to filter them beforehand and then execute the action.
I would love to see the taxonomy handling added to the module because this makes life so much easier. Good work on that.
grossmann-mcs
Comment #30
bojanz commentedAnd both would be wrong. When bulk editing there's no point in showing any values.
I like these actions. The code has a bad way of getting bundles, but once I get a faster & generic way of doing that into VBO (as a part of #1057158: Provide an action for modifying entity values) that can easily be fixed here as well.
I'm just not sure how useful this action will be once #1057158: Provide an action for modifying entity values is done (I'm working on it this week). I already have there support for fields on all entities (per bundle), including taxonomy references.
I'll just let the users decide once both solutions are in the queue and awaiting review.
Once again, thank you for your work, erik2e.
Comment #31
erik2e commented@bojanz, Glad to hear you're working on #1057158: Rewrite fields.action.inc :-)
We'll see if there's the need for specific taxonomy actions. In the meantime, let me know if you need any help on #1057158, even for testing (any Git place to be cloned ? :-)
Comment #32
mike27 commented@erik2e
Hello,
I applied the patch and enabled Entity. However when i try to modify taxonomy terms i have the following error:
Notice: Trying to get property of non-object in views_bulk_operations_terms_fields_action_form() (line 105 of ..\views_bulk_operations\actions\terms_fields.action.inc).
Can you tell me what am i doing wrong because i think that the patch and files should have worked.
Thank
Comment #33
erik2e commentedHello mike27,
Latest patch (#22) is designed for 3.0-beta2. It is not compatible with previous version and the error you have is probably due to an older version.
Previous version of the actions files (#17) are working with pre 3.0-beta2 version.
You should either upgrade VBO to -beta2 and use #22, or use the files in #17.
If you upgrade to 3.0-beta2, don't forget to patch or manually add the actions in the .module file or they won't appear in the list.
Comment #34
mike27 commentedHello erik2e,
I did what is mentioned in this thread an d i have no errors.
The action is present but when i try to add a term, the action deletes any existing terms and leaves the field blank.
It is like it has no write permissions. However the processed post seems to be updated (the date is changing)
I also tried to perform the same action with rules but it is too complicated.
If you could provide any further help is much appreciated.
Thanks
Mike
Comment #35
webchickTagging. According to bojanz in #1276986: Blockers to a 7.x-3.0 release?, #1057158: Provide an action for modifying entity values is a prerequisite to this.
Comment #36
mike27 commentedCan anybody write step by step how modifing terms can be performed with vbo and rules? Component - Condition - Action.
Unfortunately patch and actions do not update terms correctly (or I miss something)
What i have managed to figure out is creating a component
Variables
1)Entity - Node
2) List of taxonomy terms
Condition
Entity has field --> Set Node and preffered term field
Action
Set data value
(replace "preffered term field" with variable "List of taxonomy terms" )
However this component works with term ids and not term names and only replace modification can be performed (not e.g. add extra terms)
Any help is much appreciated.
Thank you in advance,
Mike
Comment #37
bojanz commentedYou have an exported rule available in http://drupal.org/node/1057158#comment-4792118 ready to be used with VBO (just change the field name).
As you'll see there, you add items instead of replacing through a different action (called something like "Add item to list").
Comment #38
mike27 commentedThank you bojanz,
It works indeed. I suppose there is no way to add new terms since it works with term ids.
I hope there is an improvement soon.
Thank you again,
Mike
Comment #39
erik2e commented@mike27, sorry for the lack of feedback. I don't have the problem on sites where these actions are used, so we may need to enter a full debug cycle to track the problem down :-)
Can you let me know the modules and versions you're using ?
Glad to see that you have it working by using rules, however. VBO definitely rocks :)
Concerning the add new terms features, if what you want is to be able to add new terms in the vocabulary directly from the VBO UI, while adding these to the taxonomy fields, I may add it in the next few days. I'll add a basic text field where you can add comma separated new terms. These will be added in the vocabulary, and assigned to the taxonomy field. Quick hack but that will save time to the current users.
@bojanz, any help needed for #1057158: Rewrite fields.action.inc ? Can we test and help debug ?
Comment #40
gidgetk commentedI applied erik2e's fix/path in #22 and it works perfectly so far.
Comment #41
mike27 commentederik2e,
sorry for the delay, i use the following modules
Entity API 7.x-1.0-beta10
Views Bulk Operations 7.x-3.0-beta2
Views 7.x-3.0-beta2
Rules 7.x-2.0-rc1
Comment #42
Refineo commentedAfter applying the patch (#22), when a node selected has no taxonomy term reference fields at all, system displays a warning message:
"Warning: Invalid argument supplied for foreach() in views_bulk_operations_terms_fields_action_submit() (line 184 of /***/sites/all/modules/contrib/views_bulk_operations/actions/terms_fields.action.inc)."
Comment #43
Refineo commentedpatch (#22) error: The node multiple taxonomy terms are not updated.
Test scenario:
ERROR: The node multiple taxonomy terms are not updated.
Drupal 7.8
Comment #44
prodigeek commentedWhen I try running the tag update, I get all the way to the confirmation screen when I get an ajax error (see attached screenshot).
I've tried it in both Firefox and Chrome.
Comment #45
itamair commentedprolems for me too ...
It was working somehow then I added a new term_reference_field to more than one content types, (shown in the same view) and the VBO is not able to update terms on some content types (actually works just on one of them).
When lunched the command these error messages appears:
Notice: Undefined index: node in views_bulk_operations_terms_fields_action_form() (line 117 of ...
Warning: Invalid argument supplied for foreach() in views_bulk_operations_terms_fields_action_form() (line 117 ...
Comment #46
anouHello,
I wanted to mention three things :
Thanks for the code. Very useful for me.
David
Comment #47
robloachMay be running into this pretty soon.
Comment #48
erik2e commentedSorry for the lack of feedback. After some quick checks, I was not able to reproduce the problems mentionned by mike27, refineo and itamair. I'll try to find time to fix the issues later on, but as I said, this really is some quick hack work, so you may be more lucky walking the VBO/Rules path, or help bojanz finish #1057158: Rewrite fields.action.inc.
I'll of course get back here if I fix something in the current patch.
@Rob Loach, what do you mean by "may be running into this" ? Are you planning to work on taxonomy actions ?
Comment #49
Nick Lewis commentedIf your view has exposed filters that are set, this patch will result in the following error.
PDOException: You cannot serialize or unserialize PDO instances in dmemcache_set() (line 41 of /sites/all/modules/memcache/dmemcache.inc).Error is same regardless of cache backend.
Comment #50
Nick Lewis commentedNevermind. The problem is unique to views 3.x/7.x "search terms" exposed widget. I wrote a patch for views that resolves the problem:
#1372376: Search Terms Exposed Filter Breaks Views Bulk Operations
Comment #51
jeffschuler#22 is working for me. I rerolled all changes in #22 as a single patch and removed improper whitespace and tabs.
Comment #52
jeffschulerActually, this patch (#51, was #22,) is working in 7.x-3.0-beta3 for me, but not in 7.x-3.x-dev.
In 7.x-3.x-dev I get the following error when I attempt to execute one of the taxonomy-related VBO actions:
Notice: Undefined index: selection in views_bulk_operations_terms_fields_action_form() (line 101 of /sites/all/modules/views_bulk_operations/actions/terms_fields.action.inc).
Warning: Invalid argument supplied for foreach() in views_bulk_operations_terms_fields_action_form() (line 101 of /sites/all/modules/views_bulk_operations/actions/terms_fields.action.inc).
Comment #53
SammMoney commented@ #22 Just wanted to pop in and say thanks for posting this, its really helping me out.
Comment #54
daniel wentsch commentedThanks for your work in #22, erik2e.
Still don't get it to work. Applied the patch against VBO 3.0-beta3 and put the action files into their directory.
Now, I am able to configure term actions in my view and when I actually run them I get a success messages that tells me: "Performed Modify node terms per fields on 1 entry." But the given node still hasn't got a term applied.
Any idea?
Comment #55
goodeit commentedThanks for the patch, erik2e and jeffschueler.
The patch in #51 applied fine to 7.x-3.0-beta3, and I can go through the form and select terms to add/delete/etc. However, when I submit on the confirmation page, the
views_bulk_operations_terms_fields_action()function fails silently. I did some debugging and it stops onentity_save('node',$entity);at line 64.I compared $entity from the beginning of the method to right before entity_save(), and they are identical except for the new term in my taxonomy field.
Comment #56
bojanz commentedThere's now a final patch at #1057158: Provide an action for modifying entity values that I plan to commit in the next day or two (depending on user testing).
It allows you (among other things) to edit term reference fields, with both add or replace (append values, or replace values)
The only thing missing is the "Delete selected terms" option.
How important is this option? Is it something we need in VBO? If yes, do we want it in the "Modify entity fields" action, or do we want
to have a separate action that allows deleting terms?
I haven't reviewed the patch here because I'm hoping that the "Modify entity fields" action is enough.
If it's not, let's discuss it.
Comment #57
summit commented+1 for deleting selected terms, because then all term manipulation can be done through VBO.
Greetings, Martijn
Comment #58
goodeit commented@bojanz: I also think that deleting selected terms is an important option to have in VBO. As far as how it's implemented, it would probably be better off in the "modify entity fields" action to go with the add and replace functions.
(update to #55, I tracked the problem down to an Ubercart bug, fixed it, and now all actions work fine using the patch in #51.)
Comment #59
grossmann commented+1 for bulk deleting terms. This is a must have. If you can bulk add then you have to be able to bulk remove or we end up on manually removing accidently wrong added terms on 10k nodes by hand ;-).
grossmann-mcs
Comment #60
erik2e commentedThanks bojanz, I won't miss to test this in the next few days/hours :-)
Deleting terms is needed on the few sites I have running these taxonomy actions, and grossmann-mcs is right : people adding wrong terms on 10k nodes could be hurt :-)
If there's a single action for add/modify, then I think adding the delete feature to it would be a good idea. If they are distinct actions, then a distinct delete action is fine.
I guess someone, including me of course, could add this and save your time for something more important. I'll try to work on it while testing the new actions.
Thanks again for your work on VBO, and thanks jeffschueler for the patch cleanup !
Comment #61
commercebythegraceofgod commentedFirst off, thanks for working on this patch/issue.
One small issue you might want to be aware of: It doesn't allow you to modify values on items sorted by a contextual filter, or at least those using search terms. It throws a reference to the cache...however, I cleared and disabled cache, then tried again. I received the same results.
If you know a better way to go about sorting these, please let me know. I have 750+ products that I must tag. If there isn't a solution, it's back to Commerce BPC to figure out how to replace only the taxonomy fields.
Error follows:
Comment #62
bojanz commentedOkay, you've convinced me.
I'll add the "delete" functionality to #1057158: Provide an action for modifying entity values.
Of course, not all multiple fields can support that, only the ones with property_info types: list<$entity_type> (this includes entityreference, taxonomy term, product reference fields...) and perhaps list / list, needs to be checked.
@erik2e
You could help me by reviewing the existing patch at #1057158: Provide an action for modifying entity values and commenting. Read your patch in this issue, very sound approach and code, so I would like to know if you find my current code understandable and maintainable.
While you do that, I'll try to do a reroll with delete functionality.
Comment #63
erik2e commented@bojanz, I will review the patch asap and provide the requested feedback. Glad to finally help on the "official" solution :-)
For problems with the patch in #51, I'll try to test this further against -beta3 and find some answers.
Comment #64
OnkelTem commentedI confirm both #54 and #55.
On -dev, I'm getting this:
On -beta3 - no terms are applied.
Comment #65
bojanz commentedJust committed #1057158: Provide an action for modifying entity values.
This provides the "add" and "replace" taxonomy functionality.
Opened a followup issue for adding "delete": #1421656: Extend the "modify entity values" action to add a delete mode for multiple-value properties and fields.
Closing this issue, since the code found here won't be committed.
Big thanks to erik2e for keeping this alive and providing a temporary solution. I appreciate it.
Comment #66
erik2e commentedI'm glad to see this closed :)
This code was not made to be committed, and it's nice to see the official code available. I'm currently testing this, and will try to find time to work on #1421656.
Thanks for all the work on VBO bojanz.
Comment #67
slefevre1 commentedSorry for being dense, but is this working now, or just not going to be implemented? If it works, how do you implement it? I have a VBO field set up in my view, but I can't find any taxonomy operations for it.
Comment #68
pyrello commented@slefevre1 - Instead of "Modify taxonomy terms" it is now "Modify entity values" since taxonomy is added via taxonomy references now.
Comment #69
Valeratal commentedModify entity values - this help add term
But How mass-delete term? :)
Comment #70
philipz commentedHere's an attempt to add this functionality:
#1421656: Extend the "modify entity values" action to add a delete mode for multiple-value properties and fields