We have a book that we want to use as the basis for a new book. The easiest way to do this is to clone the book (using the node_clone module) and edit it.

So, we clone the top-level page and child pages, remove them from the old book, and move them into a new book.

However, when we use VBO to do this, the menu system is updated but the book outline is not.

Animated GIF of the bug: http://i.imgur.com/DNKNCrQ.gif

How to reproduce:

  1. In the admin view, select the top-level page and the child pages of a book.
  2. Select the VBO operation 'Clone item'
  3. Select the newly cloned nodes.
  4. Select the VBO operation 'Remove from book'
  5. In the 'Outline' tab of the new top-level page, set it as a new book.
  6. In the admin view, select the cloned child pages.
  7. Select the VBO operation 'Move to book', then select the new book.

Expected result:

The outline of the new book is updated with the new child pages, and the book navigation block (driven by the menu system) is also updated.

Actual result:

The outline is not updated but the navigation block is. The menu_links DB table is updated, but the books DB table is not.

CommentFileSizeAuthor
#4 2800227-4.patch1.26 KBjoelpittet

Comments

cudevdev created an issue. See original summary.

joelpittet’s picture

I'm not sure where we can help with this. Have you considered modules like:
https://www.drupal.org/project/book_copy

The hierarchy needs to be copied over to the new nodes with their new nids which I don't think node_clone does.

cudevdev’s picture

I looked a bit closer, and the node clone business is a red herring.

There are two bugs, in the two VBO Operations 'Remove from book' and 'Move to book'.

The VBO Operation 'Remove from book' will remove a book from a book outline, but it won't rebuild the menu for the book. So, the child page still appears in the book navigation block. Clearing caches doesn't help.

Non-Looping GIF here: http://i.imgur.com/jb8W1Gm.gif

And:

After removing a page from a book using the VBO operation, adding it back to a book using the 'Move to book' operation doesn't add the page to the book outline. This doesn't happen when you add a newly created page to a book, or remove the page from the book manually.

Non-Looping GIF here: http://i.imgur.com/JyHLach.gif

joelpittet’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
Status: Active » Needs review
Issue tags: -book
StatusFileSize
new1.26 KB

Regarding the first non looping gif for remove from book (animated gifs are awesome btw)

The code is doing what it's supposed to but then right after the node updates calling book_node_update() which resaves the menu link... try out this patch for the Remove from book case. (sorry didn't do both, ran out of steam)

joelpittet’s picture

@cudevdev does this resolve your issue?

joelpittet’s picture

  • joelpittet committed 33bbc6e on 7.x-3.x
    Issue #2800227 by joelpittet, cudevdev: 'Move to book' populates the...
joelpittet’s picture

Status: Needs review » Fixed

I've pushed the change to dev because I tested this a while back and it worked.

Status: Fixed » Closed (fixed)

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