Editing and Saving Book top pages removes them from new advanced book blocks.

osomphane - February 28, 2009 - 20:05
Project:Advanced Book Blocks
Version:6.x-1.9
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Editing and Saving book top pages removes them from new advanced book blocks. I have not seen this issue in the older version.

#1

osomphane - February 28, 2009 - 20:07

Also, the automation system does not work properly - Automation Settings & Taxonomy Automation Options do not get remembered after changes are saved.

#2

Aaron Hawkins - March 3, 2009 - 18:12
Category:bug report» support request
Status:active» postponed (maintainer needs more info)

I am testing this on two sites with version 1.6 and cannot reproduce. Make sure you are actually using 1.6 and that you have cleared the cache.

#3

Aaron Hawkins - March 3, 2009 - 19:17

Try the 1.7 version and see if that helps. I found a bug that was causing some hard to trace problems. Perhaps it was causing this for you.

#4

mlaffoon - March 24, 2009 - 00:50

This problem is occurring for me in 1.7, 1.8, and 1.9. Using jquery menu 6.x.2.3 Drupal 6.10

#5

Madduck - April 8, 2009 - 11:33

I am having trouble with this also. I edit a book assigned to it and one setting enables every book on the site to that block. Another says to lock out all other books and the block that book is assigned to disappears when that book is edited as it sees the edited book as a new book. I like the navigation of it, but you can't edit any books without changing it all the time.

You have one spelling error and you have to redo the Advanced Book Block setting for every book block.

Using:
Drupal 6.10
advancedbookblocks-6.x-1.9
jquerymenu-6.x-2.3

#6

Madduck - April 9, 2009 - 11:33

Aaron,
I have two drupal sites.

One has Pixture - ABB is working properly here

The second has Pixture Reloaded - ABB is not working on this page

It seems the ABB's problems maybe theme related. I will post an issue on Pixture Reloaded and see if the developer knows since he created both and one is working and one is not.

#7

ShannonOake - May 28, 2009 - 00:46

Cache cleared, and a few different ways tested - still an issue - check http://drupal.org/node/474844 for my issue log and testing notes.

#8

endiku - August 19, 2009 - 23:13

The problem is that the enable settings are too strict. They don't take into account previous settings for a book.

Here is the culprit, at line 539 of the advancedbooksblock.module

function advancedbookblocks_nodeapi(&$node, $op) {
  if ($op == 'update' || $op == 'insert' ) {
    $bid = $node->book['bid'];

this is the hook into the save done when you are in a book. No problems yet, totally normal.

Now down a little more in this function at line 559 we retrieve the setting for the book in question from the advanced book block in question
          $has_bid = db_result(db_query("SELECT enabled FROM {adv_book_custom} WHERE bid = %d AND delta = %d", $bid, $delta));
So if I had my advanced book block "Block1" and inside of it I have a book "Book1" and my Book1 book is set to enabled then this little querry will return 1. $has_bid = 1
if it was set to be off (unchecked) then $has_bid would equal 0

Now we get to the solution.
Farther down we have different things happening for each type of Automation settings. For "lock this block to any new books" it is case 4.

            case '4':
              $enable_setting = 0;
          }

What is happening here is that any time a book which is a top level book is updated, it meets its critera and we end up with a $has_bid (if its not a brand new book) that is pulled from your settings. However that $bid is never used. Instead we have a blanket statement that $enabled settings = 0 in any top level book that is updated. Which translates to any update of any top level book which is currently in activated in your block... will be set to 0 and not displayed.

The solution is rather simple

            case '4':
              $enable_setting = 0;
      if ($has_bid) $enable_setting = $has_bid; //add this line
          }

Now $enable_setting will stay at zero if this is a brand new book and fulfill our statement to "look this block to any new books" however if it is a book that has already been set in our Enabled Books list then $enable_setting will keep that setting, wether it be 0 or 1, and retain its status.

I've only had time to look at this one case for the book lock option. But I'll probably look into the other options as well and if I find anything I'll follow up with it. I don't know the whole drupal patching procedure yet but if you want to fix this one case for now you can just add that one line of code until things are fixed in a new version.

#9

Azol - September 24, 2009 - 07:16

#8 is the solution here, thank you, endiku.
I hope this will find it's way into next version of ABB

#10

Azol - September 24, 2009 - 08:47
Version:6.x-1.6» 6.x-1.9
Category:support request» bug report
Status:postponed (maintainer needs more info)» needs work

I uploaded patched module here #585716: New book never becomes enabled automatically if any ABB use taxonomy terms as condition. it contans several other bugfixes along with this one.

 
 

Drupal is a registered trademark of Dries Buytaert.