Allow overlapping timestamps & multiple uncompleted records

Discussion forum about Anuko Time Tracker
Post Reply
tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Allow overlapping timestamps & multiple uncompleted records

Post by tlynnec » Wed Mar 09, 2016 4:12 pm

Is there anyway to allow overlapped times and multiple uncompleted records? We'd like to be able to have a master time record (ie. total time work on project a in day) and then sub records as individual tasks are completed.

I see in time.php and time-edit.php (see below) where those check functions are and I've commented them out, but then when hitting submit I get a database error - so I suspect I've missed one more location where those functions are prevented?

time.php
// Prohibit creating another uncompleted record.
//if ($errors->isEmpty()) {
// if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
// $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
//}

// Prohibit creating an overlapping record.
//if ($errors->isEmpty()) {
// if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
// $errors->add($i18n->getKey('error.overlap'));
//}
time-edit.php
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
//$uncompleted = ($cl_finish == '' && $cl_duration == '');
//if ($uncompleted) {
// $not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
// if ($not_completed_rec && ($time_rec['id'] <> $not_completed_rec['id'])) {
// We have another not completed record.
// $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
// }
}
}

// Prohibit creating an overlapping record.
//if ($errors->isEmpty()) {
// if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
// $errors->add($i18n->getKey('error.overlap'));
//}

peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Allow overlapping timestamps & multiple uncompleted reco

Post by peter » Wed Mar 09, 2016 6:10 pm

tlynnec wrote:Is there anyway to allow overlapped times and multiple uncompleted records? We'd like to be able to have a master time record (ie. total time work on project a in day) and then sub records as individual tasks are completed
Doing so may get you wrong reporting - double work time for users.

Disabling overlap restriction is easy, just comment out the calls to ttTimeHelper::overlaps function like so:

Code: Select all

    // Prohibit creating an overlapping record.
    if ($errors->isEmpty()) {
//      if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
//        $errors->add($i18n->getKey('error.overlap'));
    } 
It should probably be a global setting in config.php to enable / disable this.

Having multiple uncompleted records is a separate story, though.

peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Allow overlapping timestamps & multiple uncompleted reco

Post by peter » Wed Mar 09, 2016 6:53 pm

Regarding multiple uncompleted entries - unfortunately, it's not a simple change as the system is designed around an idea of only one uncompleted entry at a time.

Database error occurs because there is another check for uncompleted entry during a record insertion in ttTimeHelper::insert function in WEB-INF/lib/ttTimeHelper.class.php. You may want to comment out this call:

Code: Select all

// if (!$duration && ttTimeHelper::getUncompleted($user_id)) return false;
This will allow another uncompleted entry to be created, assuming you commented out this as well in time.php:

Code: Select all

// Prohibit creating another uncompleted record.
if ($errors->isEmpty()) {
  //  if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
  //    $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
 }
However, there is at least one outstanding issue with the "Stop" button that allows you to complete an unfinished entry. You may want to remove the buttons to make things work, as with the above change they work on the same entry, not individual entries.

Hope it helps.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Allow overlapping timestamps & multiple uncompleted reco

Post by tlynnec » Wed Mar 09, 2016 7:11 pm

peter wrote: Doing so may get you wrong reporting - double work time for users.
Yup, but in our case that is expected. Basically we're tracking a master time (all time spent on a project in a day) and then sub times (time spent on certain specific tasks, which are part of the larger project, in the same day).
peter wrote: It should probably be a global setting in config.php to enable / disable this.
That would be nice!

Nik
Posts: 484
Joined: Wed May 26, 2010 5:55 pm

Re: Allow overlapping timestamps & multiple uncompleted reco

Post by Nik » Sat Mar 12, 2016 11:41 pm

Since version 1.9.15.3413 you can use the ALLOW_OVERLAP setting in config.php that enables / disables overlapping time records.

To allow overlaps, define it like this:

Code: Select all

// ALLOW_OVERLAP - defines whether overlapping time entries are allowed. Defaults to false.
//
define('ALLOW_OVERLAP', true);

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Allow overlapping timestamps & multiple uncompleted reco

Post by tlynnec » Mon Mar 14, 2016 6:36 pm

works like a charm. Thanks!

toth1156
Posts: 2
Joined: Mon Aug 26, 2019 10:27 am

Re: Allow overlapping timestamps & multiple uncompleted records

Post by toth1156 » Mon Aug 26, 2019 10:42 am

Hi,
I really like your tool, and i trying to enable group settings to make it work for my organization.
Like: punch mode, allow overlap and so on.
but when i enabled allow_overlap it just not working for me.
i try to submit 1 entry and a minute later another but got the same error
Uncompleted entry already exists. Close or delete it. Go to uncompleted entry.
Everything else work just fine.
i defined the allow overlap in the WEB-INF/config.php but still nothing, could you help with this ?
my database version is 1.19.7. so it should be problem.

wrc
Posts: 284
Joined: Tue May 25, 2010 8:30 pm

Re: Allow overlapping timestamps & multiple uncompleted records

Post by wrc » Mon Aug 26, 2019 12:20 pm

"Allow overlap" is a setting for completed entries (with defined start and finish times).

Multiple uncompleted records is a different issue. Current design allows only 1 uncompleted record to exist per user. If you need to change that, you need to have customization work done in multiple places.

toth1156
Posts: 2
Joined: Mon Aug 26, 2019 10:27 am

Re: Allow overlapping timestamps & multiple uncompleted records

Post by toth1156 » Mon Aug 26, 2019 12:50 pm

wrc wrote:
Mon Aug 26, 2019 12:20 pm
"Allow overlap" is a setting for completed entries (with defined start and finish times).

Multiple uncompleted records is a different issue. Current design allows only 1 uncompleted record to exist per user. If you need to change that, you need to have customization work done in multiple places.
I See, so currently no option available for this type of overlapping.
Thank you for the answer.

Post Reply