Views bulk operation "add to nodequeue" gives all node the same position.
mathis - March 2, 2009 - 20:20
| Project: | Nodequeue |
| Version: | 6.x-2.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | neoliminal |
| Status: | closed |
Description
Hello,
Has It is said in the title, when I use VBO to put multiple nodes in a nodequeue it gives them all the same position (see the screenshot).
Don't know if it is a bug or something else, and don't know neither if it's the right place to report it...
Also still using the "VBO", when using the add/remove links, they should update the field "show all queues" if present... see the 2nd screenshot...
That's all folks!
Thanks!
| Attachment | Size |
|---|---|
| bulk_nodequeue.png | 3.73 KB |
| bulk_nodequeue2.png | 10.07 KB |

#1
Thanks for taking the time to provide a screenshot! It looks like both symptoms you reported might be because the sqid column is not automatically incrementing.
Have you run the latest database updates, especially #5205 in update.php?
Did you upgrade from 5.x-2 or is this a fresh Drupal install?
#2
Hi,
Sorry but I don't really remember if it was a "fresh" install... In fact it was but I think had installed / uninstalled it before (should have been the 2.0 rc3 on drupal 6.9). I run update.php quite frequently, and did so before posting but it did not run any updates...
My instalation is : Drupal 6.10, NodeQueue 6.x 2.0, Views Bulk 1.5...
Thank you!
EDIT: I did misunderstand you I think, It was a fresh drupal 6.9, then install / uninstall NodeQ 2.0 rc3, update to drupal 6.10, install nodeQ 2.0..
Hope this is clear!
#3
Subscribing, greetings, Martijn
#4
I'm having the same problem when uploading in bulk using Image import where the taxonomy is set for the image en-masse. All the positions end up as 1 and then when I look at them in Node Queue they are all listed until I save (even if I don't change anything) and I end up with only 2 nodes left in the sub-queue.
#5
Ok, I think I've fixed this. nodequeue.module line 2092. Here's the new funtion (changed lines have ***):
<?php
/**
* Add a node to a queue.
*
* @param $queue
* The parent queue of the subqueue. This is required so that we can
* pop nodes out if the queue breaks size limits.
* @param $sqid
* The subqueue ID to add the node to.
* @param $nid
* The node ID
*/
function nodequeue_subqueue_add($queue, &$subqueue, $nid) { // *** new: passing subqueue by reference.
// If adding this would make the queue too big, pop the front node
// (or nodes) out.
if ($queue->size) {
// 0 means infinity so never do this if false
nodequeue_check_subqueue_size($queue, $subqueue, $queue->size - 1);
}
db_query("INSERT INTO {nodequeue_nodes} (sqid, qid, nid, position, timestamp) VALUES (%d, %d, %d, %d, %d)", $subqueue->sqid, $queue->qid, $nid, $subqueue->count + 1, time());
$subqueue->count++; // *** new: incrementing subqueue count here.
}
?>
#6
Thanks. Could you roll this as a patch and explain the change you're making?
http://drupal.org/patch/create
#7
Ok, here's a patch.
Basically what I did was change the function "nodequeue_subqueue_add ()" so that it will increment $subqueue->count after each insertion.
The SQL in that function is using $subqueue->count + 1 when inserting a new item into the nodequeue_nodes table, but since this is adding to a new subqueue the $subqueue->count == 0. Thus all batch uploads were inserting new items as position = 1 in table nodequeue_nodes.
This patch solves this problem by passing $subqueue->count by reference and adding $subqueue->count++; at the end of the function. Now all positions in batch uploads are incremented based on an accurate $subqueue->count.
#8
Thanks,
I'll try this this week-end, if I find my way in this patching world...
#9
You can always just edit the file directly from #5. There are only two lines of code that change.
#10
Indeed, it was a great idea! (hehe).
The "patch" seems to work well for me. Thanks!
Now, there is still the 'minor' issue with the js script (the one which handles the add/remove link) that doesn't update the column where are listed the differents queues the node belongs to.
There should be something in the $('a.nodequeue-ajax-toggle').click handler that seeks for the right column if it exist and append or remove the queue name to that column...
#11
Looks good to me, thanks! This is committed.
I remove your code comments -- No need to write your name in the code with CVS ;).
@mathis: You're probably having trouble with the links because there are still corrupt values in the nodequeue_nodes table -- You should probably clear out data related to the affected subqueues.
#12
lol, thanks. I forgot to remove it for the patch, it's in my version for me to grep. Glad this is working. :)
#13
Automatically closed -- issue fixed for 2 weeks with no activity.