Time Tracking Timer

Project:ProjectPier
Version:0.8.0.2
Component:Code
Category:feature request
Priority:normal
Assigned:rmccue
Status:patch - code needs work
Description

There is a lively discussion aboout time tracking features in the aC foums and it is implemented in Basejumpr. It would be nice if we can add this feature to PP.

Yep, TimeTracking would be awesome!!!!!!

Definitely. What we need around here is someone who can go through the patches posted on the AC forums and find the best/cleanest/most versatile ones and work through them, preferably creating patches for PP that we can test. The work is mostly done  i think, but processing it is hard. (we should also get in contact wth basejumpr, as if they are s till in business, they will likely want PP.)

For anyone curious, I think this is the main patch for time tracking: http://www.activecollab.com/forums/topic/1342/1/

Version:»

this was first feature, I missed ProjectPier.

Status:new» patch - code needs review

Here is a patch for ProjectPier containing the TimeTracker module as it existed in aC 0.7.2 SVN right before the source was closed. I generated this patch against the SVN repository, but it also applies cleanly to the "official" release in the ZIP file. Apply in the PP base directory with "patch -p0 < time_tracker.diff.txt".

Also, the Project.class.php file was in Windoze format (\r\n) while I operate in Linux, so the whole file appears to be changed in this patch even though only a few lines were actually added. Several files are in the SVN repository with Windoze end-of-lines, despite the official policy in the developer docs being Unix end-of-lines.

AttachmentSize
time_tracker.diff_.txt132.47 KB

I guess I probably should have included the SQL table structure in the patch somewhere. Here is the CREATE TABLE statement for the 'project_time' table.

Also, I mentioned that this was the code as it existed in aC 0.7.2 SVN. I seem to recall now that I added the concept of 'private' time entries to the code myself. So this patch is the aC code plus a tiny feature tweak I wrote.

AttachmentSize
time_track.sql_.txt934 bytes

Hi,
I downloaded the patch and Installed it on our test server. This is what I think.
First Of all I get this Error message

Notice: Undefined property: Project::$all_times in /var/www/susi/pp2/application/models/projects/Project.class.php on line 492

I am not sure If its because I installed it wrong in some way, but it might be of interest.

Then I have this usability issue. I find decimal time always a bit confusing. I would rather have 2 input fields. One field for hours, and one for minutes. The hours field can still accept floating point decimal time. The report should also display real hours and minutes as well.

Thanks,
Hermann

hermann: To fix the Project.class.php, remove your /cache/autoloader.php file. The autloader.php will be automatically recreated with the update Project.class.php. Any time the methods in any class change, this step appears to be necessary.

If that does not fix your issue, then the patch was not applied correctly.

As per the 'confusing' decimal time field: most accounting packages I have ever seen that track employee time do so using floating point times. Generally, a granularity of greater than 15 minutes (.25 hours) is not very useful for accounting purposes.

Furthermore, I feel that allowing both decimal time (in an 'hours' field) and a 'minute' field would be many times more confusing that a single decimal time field.

I am, of course, open to discussion and suggestions from the community. If a large percentage of users feel the alternate entry method would be useful, we can certainly add in some code to give administrators a choice of entry methods.

Maybe having a greater granularity doesn’t come very often in accounting programs but I see no reason to allow that. It’s the users choice. Anyway I lookt at MindJets Mindmanager and there you have the option in a dropdownmenu like the first version in my attached mockup.

Another thing with decimal figures is the Internationalisation. Here in Germany we separate floats with a comma not the point. So 2.4 == 2,4 .With 2 fields this wouldn’t be much of a problem.

~Hermann

AttachmentSize
time.html1.07 KB

This patch seems to be working fine but I think it should let you assign time records to specific tasks. It would be great to have a time input box when editing tasks. I find myself having to be redundant and rewrite the task info in each time description so I know what it's for. This is very inefficient and really defeats the purpose of having time tracking inside ProjectPier. I might as well just use an external time tracker like SlimTimer or do it in something like Freshbooks.

I think the key here is to integrate time tracking with task management - this is where it's most useful. A standalone time tracking feature really isn't that beneficial. But thanks to everyone involved in providing this patch - it does establish a starting point.

I'm confused. To which codebase should this patch be applied? Projectpier 0.8 RC (i.e., current svn trunk) or some version of activeCollab? If this is for activeCollab shouldn't it be adapted for the projectpier codebase? If we're forking, let's fork.

I applied the patch to pp 0.8RC and got the "Undefined property: Project::$all_times" error because Project::$all_times doesn't exist in that code base.

I notice that applying the patch to this code base at activeCollab shows some errors as well.

At the moment, the 0.8 release of ProjectPier is not significantly different from activeCollab 0.7.1 which is why several of the hacks for aC can also work for PP. This issue is here so that we can adapt this code to fit newer versions of PP and improve the quality of the contribution.

As for your error, make sure you run the sql to great the appropriate tables. I think that is the source of your error.

Nope. I got a clean set of pp 0.8 code from svn, applied the patch, went through a site install/setup, ran the time\_track.sql\_.txt. The error (as noted in log.php) happens on Project.class.php, line 492 where it's trying to use $this->all\_times and $all\_times is never defined as a member variable.

So - to get it working, I had to add private $all\_times; to Project.class.php (line 246).

Someone please double check this - but I'm pretty confident that the patch needs a patch.

Then I had an error on line 60 of application/views/time/index.php:
<? } ?>

was changed to:

<?php } ?>

My Mac seemed to like that better.

jray, see comment #5 above. The cache/autoloader.php file must be removed after changing anything in the "symbol table" of a pre-existing class file (like Project.class.php). By changing anything in the "symbol table" I mean:
1) adding/removing/renaming a variable name
2) adding/removing/renaming/changing the signature of any function
3) maybe some others that I can think of right now as it is far too early in the morning...

So the TimeTracking patch adds a variable and a function to the Project.class.php file, thereby changing its symbol table via the class autoloader.

This should probably be documented in big red letters somewhere in the PP docs. :)

I started with a new set of code before running the app (i.e., before autoloader.php is created), applied the patch, then ran the app (i.e., installed it).

Steps to recreate:
1) create new database
2) Get a new set of code from svn (ProjectPier/Trunk)
3) get patch from the post above, place in root of project pier
4) apply patch: patch -p0 < time\_tracker.diff.txt
5) run the sql: time_track.sql\_.txt (make sure it uses the same table prefix as the installer or make sure the installer doesn't use a table prefix)
6) Check to see if cache/autoloader.php exists (it doesn't)
7) run the installer (projectpier/public/install/)
8) set write permissions for cache, upload, files and config.php
9) Complete the installation
10) Create a project
11) Click "Time" in the menu

A blank page is displayed. An error is logged.

I've reproduced the error twice now.

Do a search for $all\_times in the patch. It is never defined.

Am I using the wrong code or the wrong patch? Or is does the patch have a bug?

Okay, okay, the patch had a bug. When I tested the patch, my php settings somehow prevented the failure from stopping the application. My error log has all kinds of warnings about the missing variable, but I could still add/edit/remove/view Time entries. Weird.

Here's a patch that includes the variable and the SQL table template for the installation script to use.

AttachmentSize
time-tracker-update2.diff_.txt177.06 KB

I can't seem to get the patch to apply cleanly. The Project.class.php file in the applications/models/project folder is causing issues. Tried both the version on this site and the svn code. Neither worked.

The patch worked for me without any problems. This is what did:

  1. svn co https://projectpier.svn.sourceforge.net/svnroot/projectpier/ProjectPier/Tags/0.8.0
  2. wget http://www.projectpier.org/files/issues/time-tracker-update2.diff_.txt
  3. cd 0.8.0
  4. patch -p1 < ../time-tracker-update2.diff_.txt
  5. Install ProjectPier: http://localhost/0.8.0/public/install/
Assigned to:Visitor» TheWalrus

here's a patch for SVN revision 104

AttachmentSize
time-tracker_r104.patch53.75 KB

Just trying to condense all the various time tracking code that I have received so that we can move towards committing something.

Attached here is a piece of code from xeta

AttachmentSize
PP-TT.zip82.35 KB

Here is one from Michael/wms

AttachmentSize
time-tracking-code.tar.gz833.1 KB

Also for my sanity and clarity, my understanding is that the original patch supplied in the tracker is based off of the basejumpr code which was available in the activeCollab repository at http://code.activecollab.com/svn/ac/branches/EXP0.7.1-TT/

I remember noting that the code there used short tags, which won't work in many cases. Also need to clean up any code posted to meet the coding standards (http://projectpier.org/coding-standards)

Can anyone explain, in graphic detail, how to install this time tracking module? I'm a designer, not a programmer, and I'm a bit lost. I tried downloading the patch files, copied them into what seemed liked the correct directories, uploaded, installed. It seemed to work fine but now I'm unable to create projects.

The time tracking is really the most important part of this for me.

Thanks in advance for any help.

The code looks pretty good for the upcoming release(I've implemented similar code to a production system I've been using for a while). A few items to consider if we are going to include this in a release:

Reporting:
-Reporting how many hours were submitted by project in a date range
-Reporting how many hours were submitted by user in a date range across all projects
-Reporting all hours across all projects in a date range.

Functionality:
- Ability to add time for mulitple days in a single window (Example: I have several meetings that account for X amount of time each week. Rather than enter time for each day the meeting occurs, allow the user to add 1 time entry and set the dates that correspond to the amount of hours on those days)

Design:
- Icons need to be added for "Time" in all themes.

When will it be ready the time tracking feature?

I would like to see a way to track time also at the task/milestone level. E.g. when a task is completed or a note is added to a milestone. Any other interest in this? I can probably play with it if/when I get the patch working.

This would be awesome to have implemented into the main codebase. I did get it to install, but it took me a bit to get it together. Here's what I did and here are the problems I'm still seeing:

svn co https://projectpier.svn.sourceforge.net/svnroot/projectpier/ProjectPier/Trunk/
wget http://projectpier.org/files/issues/time-tracker_r104.patch
cd Trunk
patch -b -u -p0 < ../time-tracker_r104.patch
cd ..
mv ./Trunk/* ./
rm -rf ./Trunk
chmod a+w ./cache; chmod a+w ./upload; cd config; chmod a+w ./config.php; cd ..; cd public; chmod a+w ./files; cd..;

Then Install as you would... The only problem I've noticed thus far is after I add a new time entry and navigate to the time tab you see this:

Monday, 17 March lotek setup 2 Edit | Missing lang: confirm delete time')">Delete

The time entry deletes fine, but it still seemed weird to output that... BTW I'm using a custom install of Ubuntu 7.10 with everything up to date. I checked out revision 146

Hope this helps someone... Also, I tested it on every theme and all of the themes do implement the time tab. It would be nice if all of the themes were included with the svn checkout or if there were a .tgz of them all.

If you enable the contributors links block in your account settings, you will see a link for a nightly build.

Patches in the que are being developed and considered for inclusion in the next version of the software. While it is nice to provide additional functionality for users, this is really a place for testing and review and should not be considered acceptable for a production system.

Thanks for the tip and I fully agree. Patches are meant for developers, not production. I was simply voting for it to be included. =)

Hello, I just wanted to say that I find this patch/hack to work great. I have it running on a test server and have not encountered any problems yet. I will continue to test it in any case before moving it to the productions server.

Thanks

lotek, add the following line to projectpier/language/en_us/messages.php:

'confirm delete time' => 'Are you sure that you want to delete this time?',

Until a maintainer decides to add TT officially to ProjectPier, I thought I'd give a clean patch that works for latest commit (revision [r154]) -as of this writing. The r104 patch (time-tracker_r104.patch) is pretty "fuzz factor" (and some .rej too), if you try to use r104 against latest commit of the repo. Again, latest as of this writing is r154

So, in keeping symetry in all that has been mentioned so far in this thread (now me #29), and the best patch I used to start with (the r104) and clean up to work against r154 miknight commit, here are some instructions as per `lotek' style for a COMPLETE and CLEAN and LATEST patch...

svn export -r 154 https://projectpier.svn.sourceforge.net/svnroot/projectpier/ProjectPier/Trunk/

wget http://svn.webplanet.ca/pp/projectpier-0.8.0.2r154-TT.patch

cd Trunk
patch -u -p0 < ../projectpier-0.8.0.2r154-TT.patch
chmod a+w cache/ upload/ config/config.php public/files

...depending on where you want Trunk to go, rename it or move(mv) the files out, cp them to your webroot, or whatever. Just make sure chmod on the files permissions are correct, and do the web install.

You should now have a clean install, with a TimeTracker patch agains r154

NO patch fuzz, NO .rej, and NO: Missing lang: confirm delete time')">Delete

I also agree with lotek here...

"This would be awesome to have implemented into the main codebase"

...and here...

"It would be nice if all of the themes were included with the svn checkout or if there were a .tgz of them all."

Cheers.

rmoore :)+<

Title:Time Tracking» Time Tracking Timer

I agree with ph23man that integrating time tracking with tasks is very important. It helps give accurate information for how long tasks take, which is great for future estimates and when clients want to see time records.

I wanted to throw in another idea. What about an actual timer associated with tasks. With a timer, a user can simply click "start" and "stop" on individual tasks as they work throughout the day. Each time a user stops the timer on a task, the the duration is recorded. This way users don't have to think about tracking how long they have worked on a task. Of course the manual entry should still be available for those times when we forget or don't want to use the timer.

I second what ph23man said about integrating time tracking with tasks. Not quiet as urgent of a feature, but the start/stop timer that david_setwise suggests is also something to consider for the future.

Has anyone started integrating time tracking with tasks? This is something that I would like to discuss in detail and help develop.

How about allowing the fallowing data for each task time record:

date | projectId | userId | taskId | taskDescription | workType | time | status

taskDescription (optional)
workType (Design, Programming, Project Managment, etc..)

We are working hard to get this feature implemented correctly. Timetracking isn't something that should be rushed since it will be a much used feature.

Hi there,

I use SlimTimer for my time tracking, but having a TT feature in ProjectPier in sync with the task lists would be a must-use feature for any project.

What I like about SlimTimer is the ability to open the time counter on the sidebar of the browser while you work on the project or browse other PP pages.

Having task and timer in sync, it would be very handy if the timer sidebar allows you to collapse/expand the task list and filter tasks by categories/tags.

SlimTimer is worth a look for some simple yet useful features for reporting invoicing and other TT related tasks.

Thanks to all developers and contributors. Amazing job!

Version:» 0.8.0.2

Hey,

Just a quick note that we are running an install of PP with the time tracking patch as detailed:

svn export -r 154 https://projectpier.svn.sourceforge.net/svnroot/projectpier/ProjectPier/Trunk/

wget http://svn.webplanet.ca/pp/projectpier-0.8.0.2r154-TT.patch

but we had to add

private $all_times;

to the Project class declaration to get rid of the warning

Notice: Undefined property: Project::$all_times

Thanks

Any update on this?

I would love to get my hands on it :)

Greets

Has this been finalized yet?

as i installed it
it was as on the picture at the top, just time reporting.

it needed to add the all_time variable.

timer
http://www.projectpier.org/node/259

time report
http://www.projectpier.org/node/920

Is this ready to go? which patch file is needed and what are the dependancies?

A lot of comments, and none of them describes the biggest error:
On a productive system, not everyone is admin, and therefore one must be able to set permissions for the time tracker.
For this, a few parts are missing, both in the source files and in the database.

As for the source files, one must implement the following changes/enhencements:

File /application/models/project_users/ProjectUsers.class.php:
  + line 19:
    const CAN_MANAGE_TIME       = 'can_manage_time';
  + line 131:
        self::CAN_MANAGE_TIME,
  + line 150:
        ProjectUsers::CAN_MANAGE_TIME       => lang('can manage time'),

File /application/models/project_users/base/BaseProjectUser.class.php:
  + lines 255-275:
    /**
    * Return value of 'can_manage_time' field
    *
    * @access public
    * @param void
    * @return boolean
    */
    function getCanManageTime() {
      return $this->getColumnValue('can_manage_time');
    } // getCanManageTime()
   
    /**
    * Set value of 'can_manage_time' field
    *
    * @access public  
    * @param boolean $value
    * @return boolean
    */
    function setCanManageTime($value) {
      return $this->setColumnValue('can_manage_time', $value);
    } // setCanManageTime()

File /application/models/project_users/base/BaseProjectUsers.class.php:
  add to line 17 just before ");":
    , 'can_manage_time' => DATA_TYPE_BOOLEAN
 
File /application/models/projects/Project.class.php:
  + lines 121-122:
    private $all_times;
    private $times;

As for the database, execute the following SQL statement to add the field can_manage_time to table pp_project_users:

ALTER TABLE pp_project_users ADD COLUMN can_manage_time tinyint(1) unsigned not null default 0;

(please note that eventually one must correct the table name in case another prefix was chosen while installing).

After making those changes, one can set the permission for time management to each user in a project.
Without the permission a user can only see the time entries, with the permission he/she can make new entries.

Hope this helps...

Status:patch - code needs review» patch - code needs work

please attach a reworked patch

I would if I could, but I can't so I won't.
Sorry!
Maybe someone else can?

http://projectpier.org/patch

if you can't, you can learn,
if you won't, well...

Yeah, very nice.
But, as I'm on Windows machines only, and neither have access to such things nor know how to use them, I simply can't.

And if you think I shouldn't contribute to PP just because of that, well, are you one of the PP team?
If so, just tell me and I'll delete my post and never again do anything for you.
If not, just shut up and enjoy the effort of my work, which I did in my very rare free time.
I think implementing those few changes and then creating a patch won't be that much work, which maybe the first uploader might wanna do in just 2 minutes.

I apologize for my cheeky comment, just trying to have a little fun.

It really shouldn't matter whether I am part of the PP "team" or not. I am just trying to help you get your work to be included into the code as a valued contribution and to point out the documented workflow for this development community.

Since you have contributed a section of code, its quite obvious that you're using PP and are enjoying the collected efforts of many other people's very rare time. The rest of the developers have agreed to this workflow, which is very standard in open source projects, so to assume your contribution shouldn't have to follow the conventions seems a bit arrogant. Many others have been unfamiliar with using patches, and I have helped some of them personally and would offer the same to you if you needed.

Being on windows really isn't an excuse either - there are lots of tools available to work with patches and several of which are documented at that link. Its also not an issue of the "2 mins" for someone else to create the patch. If every contribution required that work, it would be very burdensome to the "team" and that is why your contribution will be incorporated much quicker if additional work isn't needed before moving to the next step. You might note that there is still code review/testing that has to be done on your code before it can be incorporated and that is also facilitated by a good patch file.

We always welcome contributions, and if you need more direct help I encourage you to come chat to someone in the IRC channel (which you can also access via http://projectpier.org/live-support )

Apologies accepted :o)

I'll have another look at the links in the section ASAP.
But remember, my spare time is very rare, so it might take a while.

Yes, I do use PP (started using it today after bugfixing it for a business partner), and I think it's a good piece of software, but the time management should be implemented in the core system (w/o the bugs :o)).

Kind regards

Assigned to:TheWalrus» rmccue