Task

Timing dropdown small refactoring

Summary

open
Oct 1, 2007
Oct 1, 2007 / jd
Oct 13, 2011 / guest
jd
 

Attached files

Summary
timing.inc.php
1115 bytes / ID 5999 / Oct 1, 2007
Show Details
Blue hills.jpg
Blue hills.jpg

#8290 by vp, 27k
 
When you create task you have two dropdowns to set task timing Estimated time and Estimated worst case. The same dropdowns you have on the quick update area on the bottom of the task info page. The values for both of them are hardcoded in separate places (in pages/task_more.inc.php and pages/task_view.inc.php). So, if you need to modify them, you need to find the definition in both of them modify both files.

Suggestion
Move timing definition to the separate file (ex. timing.inc.php) and put it into conf/ dir.
Change this code in pages/task_more.inc.php and pages/task_view.inc.php files:
                $ar= array(
                    __('undefined')=> 0,
                    __('30 min')    => 30*60,
                    __('1 h')  => 60*60,
                    __('2 h') => 2*60*60,
                    __('4 h') => 4*60*60,
                    __('1 Day')     =>   1 * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('2 Days')    =>   2 * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('3 Days')    =>   3 * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('4 Days')    =>   4 * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('1 Week')   =>   1 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    #__('1,5 Weeks')=> 1.5 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('2 Weeks')  =>   2 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                    __('3 Weeks')  =>   3 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60,
                );

to
$ar = include('conf/timing.inc.php');

No Comments