Motivation

Develop a contrib module that will allow Time Tracker module to update/create a storm timetracking node.

Proposed resolution

A function to create a storm timetracker node that would be triggered when time_tracker_time_entry_submit() is executed.

Remaining tasks

Populating of Activity list from the storm attributes if possible.

User interface changes

Enable this functionality check box somewhere in timetracker admin form.

API changes

None as far as i understand.

Note.

//TODO: Will attach the proposed patch and module in the follow up comment once i get the issue number.

Comments

d34dman’s picture

Status: Active » Needs review
StatusFileSize
new511 bytes
new2.16 KB
d34dman’s picture

Status: Needs review » Needs work

the above code has security vulnerability as it doesn't do validation of data before node_save().

drclaw’s picture

I can't view the patch. Goes to a page not found page.

d34dman’s picture

Updating files. Code cleanup has been done in the module file. Please ignore the files in comment #4.
EDIT NOTE: i meant ignore files in comment #1. Sorry for the confusion.

d34dman’s picture

Dear drclaw,

i think if you expose the $time variable in your function function time_tracker_time_entry_submit($form, &$form_state) in "time_tracker.module" file, those who want to save the data into custom tables ( like the one am trying to do) would be able to use it.

Possibly some hook if implemented in our custom module will be invoked. Thus all you have to do is module_invoke_all( '[hook_name]', $time ); after you have updated your tables in function time_tracker_time_entry_submit($form, &$form_state) .

A similar hook for deleting and updating can be decided upon.

NOTE: For some reason that i dont know my patch files are not being uploaded properly. So am pasting the patch file that was uploaded in comment #4 here.

diff --git a/time_tracker.module b/time_tracker.module
index 846cea3..24385e6 100644
--- a/time_tracker.module
+++ b/time_tracker.module
@@ -1095,6 +1095,7 @@ function time_tracker_time_entry_submit($form, &$form_state) {
   else {
     drupal_set_message(t('Time Entry Recorded'));
   }
+	time_tracker_storm_store_time( $time );
 }
 
 function time_tracker_time_entry_delete($form, &$form_state) {

d34dman’s picture

Status: Needs work » Needs review
StatusFileSize
new386 bytes
new7.72 KB

If this small patch is committed into the latest dev, then i can carry out further developement of the module, maybe as a separate project.

drclaw’s picture

I think the problem with your patch might be the square brackets in the filename?

Either way, I can't commit the patch in commen #5 as it uses a function from another module that isn't a dependency of time tracker. However some sort of hook implementation could be possible in the near future...

d34dman’s picture

StatusFileSize
new386 bytes

the patch in comment #6 actually calls a module_invoke_all('hook_name', $time);

Attaching the patch mentioned in comment #6 without the square brackets. Hopes it works.

Just in case it doesn't am pasting the patch here below.

Index: time_tracker.module
===================================================================
--- time_tracker.module	(revision 36)
+++ time_tracker.module	(working copy)
@@ -1095,6 +1095,7 @@
   else {
     drupal_set_message(t('Time Entry Recorded'));
   }
+	module_invoke_all('tt_store_time', $time);
 }
 
 function time_tracker_time_entry_delete($form, &$form_state) {

d34dman’s picture

StatusFileSize
new386 bytes

Noops the above patch wont show up cause of this #284899: Drupal url problem with clean urls.

Renaming the patch file again.

d34dman’s picture

Hi, i have created a sandbox project that is waiting for the patch to be commited .
This is the path to the sandbox project.

Thank you.

d34dman’s picture

Status: Needs review » Active

any updates?

drclaw’s picture

D34dMan

I haven't had a chance to do this just yet. I want to incorporate some hooks into time tracker, but I haven't had the time to fully think it through yet.

I'll let you know as soon as I get a chance to work on this.

Thanks!

d34dman’s picture

i appreciate your willingness to include some hooks.

Will be anxiously waiting for its release. Thank you.

codi’s picture

Assigned: Unassigned » codi

Hey D34dMan,

drclaw is off on holidays for a while so I'm diving back into time_tracker. I'm going to review the patches and code you've attached here and see what I can come up with.

d34dman’s picture

Hi codi Welcome,

Time tracker integrates nicely with atrium and i can see it plays well with case tracker too.

I think there might be people (like me) who want to use timetracker with other project management application. It would be a nice feature to include a hook like what i had proposed earlier (#9).

If some hook like that is implemented, i could use a hook like that to update Storm using Time tracker storm update

Thank you.

drclaw’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
Status: Active » Fixed

Well... it's about 9 months later, but I finally added a couple hooks to time tracker. There's two hooks: hook_time_tracker_time_entry_presave() and hook_time_tracker_time_entry_save(). Presave is before the record is saved to the db, and save is after it's been successfully saved. Hopefully nothing else got messed up in the process of adding these. I actually had to do some form array restructuring to make this work (or at least make it easier to do). Technically I also added a couple api functions for saving and deleting time entries instead of doing that directly in the submit handlers. =)

Status: Fixed » Closed (fixed)

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