Closed (fixed)
Project:
Bibliography Module
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jun 2010 at 01:21 UTC
Updated:
15 Nov 2011 at 21:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
tdombos commentedIt is a biblio bug according to Node Export developer. See http://drupal.org/node/826504#comment-3106714
Comment #2
rjerome commentedI suspect the problem lies in the fact that the author "cid" is included in the export, thus when it's imported biblio assumes that it should already exists since it couldn't have a "cid" value if it didn't exist in the database. I bet if you were to delete the cid value it would work.
Comment #3
tdombos commentedThat was indeed the problem, thank you for pointing that out. Node export has a hook method for export/import transformations (hook_node_export_node_alter). If I simply delete all the cid programmatically, will that mean a double author entry for the same name will be created?
Comment #4
rjerome commentedNo it should not create duplicates becuase when a new author is inserted, the "md5" value is compared with existing database entries and if a match exists, then the two entries are assumed to be the same and the existing "cid" value is used rather than creating a duplicate.
Ron.
Comment #5
rjerome commentedJust out of curiosity, what is your motivation for this export/import operation? Are you moving to a different installation or did you just want to duplicate the biblio data on another installation?
Comment #6
tdombos commentedI'm creating a metarepositosy based on project bibliographies running on different drupal instances. The ideal solution would be a services based push synchronization, but until those modules are working well, I'll use this manual method.
#4 great news, I hoped for this. I'll try to do a patch and post it, if I have more time, this could be included in biblio by default.
Comment #7
rjerome commentedThe reason I asked was that I have developed a client/server module for biblio that, in conjunction with the services module and turns any biblio installation into a remote client of any biblio installation running the service module. The client side appears to be a normal biblio installation but there is no biblio data stored on the client and it's read-only, meaning you can't create, modify or delete biblio items on the client side.
Comment #8
daengo commentedwould you mind sharing your code for how you did this programmatically? I need to figure this out too.
Comment #9
daengo commentedHello,
I am trying to use Node Export also since it lets me export a group of records on a test site and import them on the production site. When using biblio's export records, I don't see a way to control how many it exports thus creating a HUGE file of my 8,000+ bibs. Is there an easier way or do you have advice on the code how to control the hook_node_export_node_alter to remove the 'cid' line for Node Export?
Comment #10
rjerome commentedI haven't actually tested this code, but if you paste the following at the end of your biblio.module file, it should remove the "cid" value for you...
Comment #11
daengo commentedThank you so much! That seems to work. At first I had trouble getting it to work because I only enabled the hook on the destination and not the source site. I'm not sure if the hook has to been enabled on the destination, but obviously based on the the fact that it is dealing with an export, the source has to have the hook enabled. I'll have to see what happens when I try to export from my 6.x-1.x-dev test site to the 6.x-1.15 production site. Hopefully, it will be no problem.
Comment #12
daengo commentedThank you so much! That seems to work. At first I had trouble getting it to work because I only enabled the hook on the destination and not the source site. I'm not sure if the hook has to been enabled on the destination, but obviously based on the the fact that it is dealing with an export, the source has to have the hook enabled. I'll have to see what happens when I try to export from my 6.x-1.x-dev test site to the 6.x-1.15 production site. Hopefully, it will be no problem.
Comment #13
rjerome commentedLet me know if it imports OK and if so I'll put that code in the module.
Ron.
Comment #14
rory_o commentedHi, I'm having the same problem using the 7-x version. I tried removing the cid field and it works fine, but the node_export_node_alter hook doesn't appear to be valid in Node Export 3.x... I'm not sure. I cross posted asking this here to get a definitive answer from Node Export.
Comment #15
rjerome commentedI believe the issue here is that the $node->biblio_contributors data structure has changed in 7.x
The following will probably work...
Comment #16
rory_o commentedThat didn't unfortunately :( but I'll play around with it and see what I can come up with.
Though on a different going the different, could you ignore cid on biblio_node_save instead? I'm thinking on other external manipulations that can manipulate entities directly like Services.
Comment #17
rory_o commentedGot it, here's what works now:
The $method is removed from the signature since node_export_node_alter is only called on export now.
Comment #18
rjerome commentedOK, thanks for tracking that down.
Comment #20
rory_o commentedRan into this again, guess it didn't get rolled in. Here's a patch.
Comment #21
rjerome commentedOK, this time it's committed...
http://drupalcode.org/project/biblio.git/commit/8ec5612
Thanks,
Ron.
Comment #22
rory_o commentedActually there's a bit of a problem, that hook gets run on every node export so we need to check to see if the exported node really does have the biblio_contributors property, otherwise it will give a ton of PHP warnings. This really really fixes it, sorry about that.
Comment #23
rjerome commentedOK, commit take 2...
http://drupalcode.org/project/biblio.git/commit/6106254
Ron.