I think it'd be helpful if a user could clone a storm project and all the tasks inside of it. Just changing the project field inside each task it clones. Most projects have the same base tasks and it would save a lot of time spent on recreating the same tasks for each project.

Currently, node clone module will only clone the project or each individual task one by one.

CommentFileSizeAuthor
#13 storm-345304.patch11.89 KBrecrit
#10 storm-345304-D6.patch11.89 KBrecrit

Comments

cstachris’s picture

Roberto,

As it stands now, I'm not familiar with much drupal module stuff, but could you give some sort of high-level direction how this could be done seeing as you're familiar with your own code.

Cheers
Chris

cstachris’s picture

There is a module called "save as draft" where you create a draft node. Then once published it deletes it. I have just asked if they can "not delete" the finished draft so it can be used again. Therefore creating the project, and it's subtasks and all that has to happen is a new published task node with the changed related project.
http://drupal.org/node/369042

I reckon it'll work until the full-blown version works - would that be enough for now?

flickerfly’s picture

Will 'Save As Draft' handle the connected task nodes as well as the project node?

cstachris’s picture

I'll check it out when I have more time. I'd say there'd be a little bit of parent node lookups. May only need a little bit of code added to the save as draft module. They've commented on where to 'not-delete' the draft, so it should be do-able.

cstachris’s picture

http://drupal.org/node/369042

The drafts module now incorporates a "don't delete draft". I'll check back here if it's been tested by someone, otherwise one day I'll get around to it.

Magnity’s picture

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

Marked #316662: Project Templates as a duplicate of this.

grandfso’s picture

I can see this issue died naturally, would anyone have any interest in such mod?

dbt102’s picture

Yes, the ability to replicate projects and associated tasks and tickets would be quite useful.

grandfso’s picture

Hi, dbt102 - thanks for your feedback, I am not a developer, rather a Drupal newbie... But wanted to create some buzz, to get someone interested in this (in the end, I will learn drupal development, but due to tight schedules, this is gonna take some time)

recrit’s picture

Status: Active » Needs review
StatusFileSize
new11.89 KB

The attached patch allows projects to be cloned with all tasks and tickets. This makes it easy to create a skeleton project and then clone it to start another with all tasks and/or initial tickets. When cloning a project, the node edit form will have checkboxes to "Clone all Tasks" and "Clone all Tickets". I have successfully tested using node_clone with 'prepopulate' method.

Patch Details

storm version: latest 6.x-1.x HEAD
defendencies: node_clone needs to be installed for cloning; however, this is not a dependency for any storm modules

files affected:

  • storm.module:
    • storm_clone_node_alter() - node_clone modules' hook
    • storm_invoke_clone() - custom function to invoke nodeapi for new 'clone' operation. This allows any storm module to implement hook_clone($node, $orig_node, $method) and hook_nodeapi() with op ='clone' $a3 = $orig_node, and $a4 =$method
    • date handling functions added for _storm_timestamp_add(), _storm_convert_to_seconds(), _storm_reset_node_dates()
  • stormproject/stormproject.module:
    • stormproject_form() - add cloning options to node edit form
    • stormproject_clone() - tag node as being cloned by storing original nid
    • stormproject_insert() - handle cloning of tasks and tickets related to project
    • stormproject_nodeapi(): op='clone' - update tasks and tickets being cloned to new project nid
  • stormtask/stormtask.module:
    • stormtask_clone() - reset status to default
  • stormticket/stormticket.module:
    • stormticket_clone() - reset status to default
juliangb’s picture

Patch needs to be reuploaded without the -D6 suffix to be tested. Haven´t reviewed the contents yet, but will do once testbot shows green.

juliangb’s picture

Status: Needs review » Needs work

CNW based on #11.

recrit’s picture

StatusFileSize
new11.89 KB

patch renamed

JGonzalez’s picture

Status: Needs work » Needs review
juliangb’s picture

Thanks. Am abroad at the moment and will review and test soon (a week or so).

In the meantime, anybody else care to review / comment?

tchurch’s picture

This is an interesting addition which would save people a lot of time.

I've downloaded and installed the patch and tested it.

It works OK for me.
I tested:
- create project with tasks and tickets
- clone this project with no tasks/tickets
- clone this project with tasks only
- clone this project with tickets only

In all cases it did what it was suppose to do.

Anyone else like to test or should I set to RTBC and commit?

tchurch’s picture

Sorry, I've just done another test with sub-tasks.
It didn't work. The sub-task wasn't cloned.

I had a project with a task and that had a sub-task.
Project and task were cloned but not sub-task.

Is this a problem?

juliangb’s picture

Status: Needs review » Needs work

My review from reading through led to only the one question below. Also though I think the patch should include some documentation for the README.txt - as otherwise I fear that people will not know this functionality is there.

tchurch - happy for you to commit when you are happy with your tests.

CNW based on my comments and tchurch's from #17.

+++ stormproject/stormproject.module	1 Aug 2010 17:33:27 -0000
@@ -625,7 +699,7 @@ function _stormproject_beforesave(&$node
 
-function stormproject_nodeapi(&$node, $op, $teaser, $page) {
+function stormproject_nodeapi(&$node, $op, $a3, $a4) {

What is the rational behind this change? For me, it is not clear what a variable a3 and a4 are meant to hold.

Powered by Dreditor.

recrit’s picture

@tchurch:
When cloning a project, the project module calls for all children tasks and tickets.

function _stormproject_get_tasks($project_nid) {
  $s = "SELECT n.nid FROM {node} AS n INNER JOIN {stormtask} AS sta
  ON n.vid=sta.vid WHERE n.status=1 AND n.type='stormtask' AND sta.project_nid=%d";

My thoughts are there are 2 options to handle subtasks:

  1. expand sql in _stormproject_get_tasks to pull subtasks also
  2. leave _stormproject_get_tasks as is and let stormtask_clone() handle cloning of any sub tasks. stormtask_clone() is called on project cloning and also when an individual task is cloned. So if you clone an individual task with a subtask, they would both get cloned.

@juliangb:
The change from $teaser and $page is to restore the generic arguments as specified in hook_nodeapi. These parameters vary based on the $op the hook is called for. In the case of op="clone", $a3 = original node being cloned and $a4 = cloning method.

rough documentation:

Cloning:
Storm projects can be cloned with all tasks and tickets cloned also. 
Cloning of individual tasks and tickets will reset some Storm fields for your convenience.

Dependencies: node_clone

Settings:
An extra fieldset 'Storm Clone' is added to the project node edit form during cloning.  This fieldset  provides options to 'Clone all Tasks' and 'Clone all Tickets'.

Notes:
Successfully tested using node_clone with 'prepopulate' method
juliangb’s picture

OK, I see the logic behind the argument name change. I don't see it as particularly clear, but if it is the Drupal standard, we can stick with it.

ymmatt’s picture

What is the status of this functionality, has the ability to clone sub-tasks been implemented? If so, can you attach a new patch?

vagabumming’s picture

Just chiming in here to say that I'd really like to see this functionality as well. Cheers and thanks for the great work!

kfritsche’s picture

There is a similar functionality in storm contrib
You can setup default tasks, which you can select when creating a new project. After the creation of the project, this default tasks will be created and appended to the project.

juliangb’s picture

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

Is the functionality in Storm Contrib fairly stable?

If so, let's mark this as won't fix so that we don't reinvent the wheel.

Is there documentation about which features are available in Storm Contrib? Perhaps we could add a few more links from Storm?

kfritsche’s picture

There is reported a issue with this function, which was fixed last week.

This function issn't properly documented yet, this should be done... I think it would be good to have more links to Storm Contrib, because of all the extensions. But to see what all is done, there should be a proper documentation...

tazus’s picture

I had tested the patch on #13 manually to storm-2.x, it work ok at this moment. But I don't know the sub-task code should patch to which file? So, could you please let me know and after I test it, I can put a new patch for 2.x here.

tazus’s picture

Actually, the patch here is better than Strom_contrib's function.

In this patch, we can select any project to make a clone with its tasks and tickets but in Strom_contrib it provide a system-wide default tasks and ticket name only. So every time you want to create a new type of project, you have to modified the list again.

So, please keep this patch going and let make it to the formal function of Storm.