Two fields are not cloned properly. May be this module was not minded for clonning location info (in this case we can consider this report as a feature request) but, some of the location fields are cloned properly, then, we can consider this a bug report. Nevertheless, the fields can be corrected manually after the clone and the values fixed manually.
- Weight field (of weight module) is cloned with -20 value (or maybe -20 is the default in the screen after the clone)
- State/Province names (of location module) is cloned with a blank value. All other fields of the location module are cloned ok.
Comments about the module: It´s great. As per my experience, is very useful entering nodes with the same categories and location info. In this particular case, it makes me to save a lot of time.
Thanks in advance for your attention,
Gustavo
Comments
Comment #1
pwolanin commentedplease provide more details- which modules are you using that implement these fields?
Some modules may not clone fields properly if they don't properly handle a node_save() operation on a fully-built node object.
Comment #2
pwolanin commentedoops- now I see it's the weight and location modules.
Comment #3
pwolanin commentedOk, this isn't really something I can do anything about for the location module, at least. The problem (I think) is that the data is presented in the node edit form differently than it's finally saved in the node object. So, when a node object is directly submitted, there's a bug. I think the relevant code is highlighted below.
If I someone is highly motivated, they could re-write this clone module for 5.x to generate the appropriate node form and then submit the form- this might bypass this (and similar) problems.
see above in hook_node_api where the location is processed through the location_form2api function. This function is below, and I think what's happening is that the call to substr is chopping off the information when only the 2-letter code is present in that field:
Comment #4
pwolanin commentedI took a quick look at the weight module's code. The weight module saves it's data in the node's "sticky" column through some tricks.
So, I think what the problem could be is that the "weight" is stuffed into the sticky field using the "submit" op of hook_nodeapi, which is never called if we go straight to node_save(). So, I don't really think this is fixable in 4.7 (at least on my end). Again, I think the only possible way to fix this would be in 5.x to build a node form and execute it so all the hooks get called.
Comment #5
pwolanin commentedYou might try this alternate version of the module I just posted: http://drupal.org/node/110294
Comment #6
pwolanin commentedComment #7
timtyler commentedIt still is not possible to successfully clone nodes with location-module info.
It is not clear to me why this bug has been closed.
Comment #8
timtyler commentedI see different behaviour from the OP. A cloned location is created OK,
with the fields filled in, and it is submitted OK.
But the node it was cloned from is now missing all its location details.
The same behaviour arises with the 1.0 and 2.0 versions of the clone module.
Comment #9
timtyler commentedISTM that what I am seeing is a eid/lid problem.
The cloned form contains:
ISTM that that's going to change the old location and associate it with the new node
(removing its association with the old node in the process).
The only puzzle is how it ever worked at all - /surely/ other people would have
noticed this problem.
Reactivating - in case someone can help.
Comment #10
timtyler commentedI forgot to 'quote' the code - sorry:
The cloned form contains:
Comment #11
timtyler commentedI've raised an issue with the location module:
http://drupal.org/node/188175
One possible fix works from that end.
Comment #12
pwolanin commentedI closed the this issue at one point because the bug seems to lie with the module creating the node type and is not something that can be fixed readily by the clone module (which is a pretty minimal piece of code).
Comment #13
pwolanin commentedclosing again.
Comment #14
csc4 commentedSorry pwolanin - opening again as I think this properly belongs here rather than in the location thread.
I've made some progress on this, though it's not the definitive answer I thought I'd share what I'd got.
ISTM the problem stems from location deleting the location before reentering it - and the location array contains the eid (which is the link to the node revision - not nid) of the node you're cloning, thus the location is lost. The other problem is location_form2api attempts to change provinces from CC-province to province so provinces need 'paddiing'
I know there's big work on location at the moment but I need this now and figure it might help someone else too. So I've gone with a fix to node_clone as probably making most sense in the short term...
I'm experimenting with
in function clone_node in clone.module around line 172 and it seems to be working for me - I realise this is hard coded for only one location ATM - I only use one location and it's experimental code.
It seems to be working for me so far, but as it's a workaround (as location is hopefully changing with all bdragon's work) I'm not sure it's worth generalising it to many locations and then submitting it as a node_clone patch.
Comment #15
Leeteq commentedSubscribing.
Comment #16
pwolanin commentedthe 5.x versions now have an extra hook so you can add on a module that does cleanup like this as needed.
Comment #17
vegasphotog commentedAny clear resolution here? I have the location module as part of a "meeting" content. I want to have the address clone with the meeting. I am in 5.7. Is there a workaround now?
Comment #18
richygecko commentedHas anyone come up with a working solution to this issue?
Comment #19
pwolanin commented