Hi,

How hard is it to make it so the draft is not deleted. Reason is there is another feature request for the STORM module where we'd like to 'clone' related nodes changing one field. It might be a bit of time before that happens, so this would be a great in-the-meantime feature to have for STORM projects and project tasks.

STORM is a project management set of modules.
Cheers
Chris

Comments

cstachris’s picture

http://drupal.org/node/345304
Here is what I mean.

bsimon’s picture

Draft doesn't automatically delete the drafts - it's actually a minor problem that you can end up with hundreds of old draft copies in the db. :/

Draft does overwrite autosaved copies with newer versions of the same node, I think, so you shouldn't get multiple drafts of the same article at different stages of development (unless you copy and paste the content into a new editor form or something like that)

Edit: Sorry, I was wrong about this. Draft does delete the drafts in normal situations (when the node is saved, I think). The reason for all the old draft copies is probably windows that have been closed without clicking the save button.

nquocbao’s picture

Try the version here: http://drupal.org/node/368030

This version implement a cron to delete all empty draft.

bsimon’s picture

Look at the file draft.module and the section titled '* Submission handler for when the node is submitted' (around line 190).

I would guess that db_query("DELETE FROM {drafts} WHERE draft_id = %d", $form_state['values']['draft_id']); is the part which actually deletes the draft from the DB.

So maybe you can just remove that ?

note: the code after that section (such as '* Form submit handler....' etc) handles the user manually deleting drafts

nquocbao’s picture

Hmmm, it's reasonable to remove draft after the node is saved. The draft may confused user.

So what is your trouble actually ?

bsimon’s picture

So what is your trouble actually ?

According to the link, they want to know if they can use the Draft module to copy content in the Storm module. That's why they want to keep all the drafts.

Whether it can easily be made to work probably depends on how Storm implements/links its data structures (Draft can handle CCK-created custom content types and fields, I think, though I've never tried that)

cstachris’s picture

bsimon, thanks for your February 7, 2009 - 21:41 post.
I'll look into it when I have more time, which should be a few days away.

darren.ferguson’s picture

Status: Active » Fixed

This has now been incorporated into the draft module. The administration screen has a check box which if they check will force the system not to remove any drafts using cron. By default the module will remove the drafts via cron.

darren.ferguson’s picture

Status: Fixed » Closed (fixed)