hey there,

are the any plans in porting this module for drupal 7?

best,
walter

Comments

valderama’s picture

StatusFileSize
new9.35 KB

here is a working d7 port.. not everything's tested yet, but its a start..

VenDG’s picture

I tried to use this with the current version and got an error:

DatabaseSchemaObjectExistsException: Table book_copy_history already exists. in DatabaseSchema->createTable() (line 652 of /includes/database/schema.inc).

thummel’s picture

Using the zip file above, I tried to copy a book and go the error: "Page not found /book_copy/copy/603" [where 603 is the nid of the book being copied].

Is there any further interest in developing the drupal 7 version?

thummel’s picture

StatusFileSize
new9.29 KB

There was an error in the install file that I believe I corrected. It appears to install correctly and seems to work now.

pfrilling’s picture

StatusFileSize
new20.93 KB
new3.67 KB
new341 bytes

Great job thummel! The code seems to be working for me. Attached are three patch files with your changes. Sorry for the three files, I wasn't sure how to roll three commits into one patch.

thummel’s picture

Thanks for the patches! It would be really nice to put out a drupal 7 release for this module. Hopefully, the module's maintainer can do that.

vm’s picture

Status: Active » Needs review

Marking as needs review

bradallenfisher’s picture

Doesn't create a book_copy_history table for me. I keep getting this error after clicking derive a copy:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ashercinder.book_copy_history' doesn't exist: INSERT INTO {book_copy_history} (nid, bid, sbid, snid, copied) VALUES (:nid, :bid, :sbid, :snid, :copied); Array ( [:nid] => 30 [:bid] => 30 [:sbid] => 1 [:snid] => 1 [:copied] => 1354906074 ) in book_copy_copy_book() (line 152 of /var/www/html/ashercinder.com/sites/all/modules/contrib/book_copy/book_copy.module).

However it does create a new book as expected.

btopro’s picture

copys it within the previous item copied in my testing. I clone a book from its root and it doesn't make a new book, adds clones of the entire structure inside the current one. Not a huge deal to then move it over to its own book from there but I clicked on the book root so I wouldn't expect it to clone inside itself.

jduhls’s picture

I got the same error as you, baf139. I commented out 151-153 of book_copy.module to fix (also, if anyone wants to create a patch).

btopro’s picture

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

valderama 's initial port has been committed to dev, I'm working through versions to give people credit to get up to a working dev now

btopro’s picture

thummel 's changes from zip file merged in

btopro’s picture

baf139's coder audit and bug fixing applied. I've also done a general coding practices audit on the module. It still needs work to be 100% stable but is at least dev worthy. Some early testing suggests that it will bomb out on large structures but smaller structures appear to be creating successfully.

jduhls’s picture

RE: #8 and #10. FWIW: "no book_copy_history table" error when click "Show book history" from within a book:

PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "book_copy_history" does not exist LINE 1: SELECT * FROM book_copy_history WHERE bid = '1279' ^: SELECT * FROM {book_copy_history} WHERE bid = :bid; Array ( [:bid] => 1279 ) in _book_copy_initial_source() (line 265 of /sites/default/modules/contrib/book_copy/book_copy.module).

btopro’s picture

jduhls checkout the latest dev, I believe baf139's changes have fixed this. A dev branch will publish tonight if you don't want to mess with git

jduhls’s picture

ah yes...sorry. my first git clone from a drupal repo. thought I had to wait for the dev version to appear on home page for this project. got it now. thanks!

aitala’s picture

Seems to work fine on a test site...

Eric

mallin’s picture

I've done a lot of testing on a test site, copied a book with ca. 400 nodes. Done it several times, succeeded every time.

btopro’s picture

that's two confirmed workings out there. how bout 1 more and I'll flag for an alpha? I'm pretty impressed you got it to copy 400 successfully, some testing by a coworker was bombing out after 50 or so, though that may be an unrelated issue.

mallin’s picture

It took a while and I got some timeouts in the browser, but it didn't influence the way module works. It copied the book without errors.

mcpuddin’s picture

This code works for me.. however when cloning a new book, its not creating a new one but rather appending it to the existing one. Is that intended? or am I missing something?

btopro’s picture

Status: Needs review » Needs work

I believe this is a glitch with the current implementation. As this is ported from D6 I think a coworker and I are going to sit down and take a closer look at the project as a whole, possibly creating a 2nd branch using replicate as the backend for this module.

mcpuddin’s picture

Cool! I won't spend time then bugging this one and reposting it. I have a project coming soon that will need this and would be happy to pitch in as needed. Maybe we can hack it out at DrupalCon if ya'll be there.

btopro’s picture

I wish. I hang out on #drupal-edu on irc (freenode) if you'd like to discuss. Hopefully I'll get to it today because with how simple replicate is to implement is more just about building a simple Book item-tree spider of sorts and let it go to town.

btopro’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Assigned: Unassigned » btopro
Category: feature » task
Status: Needs work » Needs review

initial port to a 2.x branch has been pushed up to VC, dev will publish tonight.

Changes

- uses batch API to replicate large groups of items without issue, 5 at a time
- Works with full book outlines and is a cleaner implementation
- requires the replicate module (which requires entity)

Known issues

- outline designer integration shows up but does nothing, I think this has something to do with attempting to execute the batch API in the background
- While you are able to copy parts of branches, it currently doesn't appear to select these correctly when you force it through the URL, its inconsistent (like copying a branch and sibling branches instead of just the selected branch).

Dropped

- history functionality, seemed like cruft to me but will add in a sub-module for it if people want that
- book_copy specific api. this can be achieved via the replicate api functions though I'm not opposed to getting it back in
- at the moment the textual link on a node in a book outline isn't there, I'm waiting til issue 2 is resolved before putting this back on the interface. for now, you can enter a node id in the url when you go to copy a full book outline to change it to parts of outlines

If there is verification that this copies entire outlines successfully in other peoples environments then I'll close this out and we can start working on the other issues

btopro’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta1
Status: Needs review » Fixed

The previously reported issues have been resolved and support for a new title on copy has been added! Please try out the Beta though I'm very happy with the results I'm seeing.

Status: Fixed » Closed (fixed)

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