Skip to content

Commit

Permalink
- Timesheet Task List & Portlet:
Browse files Browse the repository at this point in the history
  Introduced number format for formatting planned, billable and logged hours
  • Loading branch information
derklaus committed Dec 31, 2013
1 parent 65a604c commit cf37823
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions intranet-timesheet2-tasks.info
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<inherit-templates-p>t</inherit-templates-p>
<auto-mount>intranet-timesheet2-tasks</auto-mount>

<version name="4.0.5.0.0" url="http://www.project-open.org/download/apm/intranet-timesheet2-tasks-4.0.5.0.0.apm">
<version name="4.0.5.0.6" url="http://www.project-open.org/download/apm/intranet-timesheet2-tasks-4.0.5.0.6.apm">
<owner url="mailto:frank.bergmann@project-open.com">Frank Bergmann</owner>
<vendor url="http://www.project-open.com/">]project-open[</vendor>
<maturity>0</maturity>
Expand All @@ -34,7 +34,7 @@
<parameter scope="instance" datatype="string" min_n_values="1" max_n_values="1" name="TaskListHomeDefaultSortOrder" default="sort_order" description="Default sort order for tasks in the 'short' list of tasks in Project page. You can specify any field of im_projects, im_timesheet_tasks and im_gantt_projects. Default is 'sort_order' which will show tasks in the same order as imported from Microsoft Project, GanttProject or OpenProj."/>
<parameter scope="instance" datatype="number" min_n_values="1" max_n_values="1" name="DefaultLengthTaskName" default="50" description="Defines size of column task name in project task view" />
<parameter scope="instance" datatype="number" min_n_values="1" max_n_values="1" name="AddParentProjectMembersToNewTaskP" default="0" description="When creating a new task manually, should we add the members of the parent? Default is 0." />
<parameter scope="instance" datatype="string" min_n_values="1" max_n_values="1" name="TaskListNumberFormat" default="99999990.9" description="PostgreSQL Number format for TaskListPage an TaskListPortlet. Default is '99999990.9'"/>
</parameters>
</version>
</package>

12 changes: 8 additions & 4 deletions tcl/intranet-timesheet2-tasks-procs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ ad_proc -public im_timesheet_task_list_component {
set bgcolor(0) " class=roweven"
set bgcolor(1) " class=rowodd"
set date_format "YYYY-MM-DD"
set number_format "999999.0"
set number_format [parameter::get_from_package_key -package_key "intranet-timesheet2-tasks" -parameter "TaskListNumberFormat" -default "99999990.9"]

set timesheet_report_url [parameter::get -package_id [apm_package_id_from_key intranet-timesheet2-tasks] -parameter "TimesheetReportURL" -default "/intranet-timesheet2-tasks/report-timesheet"]
set current_url [im_url_with_query]
Expand Down Expand Up @@ -470,6 +470,8 @@ ad_proc -public im_timesheet_task_list_component {
pp.tree_sortkey between child.tree_sortkey and tree_right(child.tree_sortkey) and
pp.project_type_id = [im_project_type_task]
) as billable_units,
to_char(child.reported_hours_cache, :number_format) as reported_hours_cache_pretty,
to_char(child.reported_days_cache, :number_format) as reported_days_cache_pretty,
im_biz_object_member__list(child.project_id) as project_member_list,
gp.*,
child.*,
Expand Down Expand Up @@ -623,13 +625,15 @@ ad_proc -public im_timesheet_task_list_component {
# Replace "0" by "" to make lists better readable
if {0 == $reported_hours_cache} { set reported_hours_cache "" }
if {0 == $reported_days_cache} { set reported_days_cache "" }
if {0 == $reported_hours_cache_pretty} { set reported_hours_cache_pretty "" }
if {0 == $reported_days_cache_pretty} { set reported_days_cache_pretty "" }

# Select the "reported_units" depending on the Unit of Measure
# of the task. 320="Hour", 321="Day". Don't show anything if
# UoM is not hour or day.
switch $uom_id {
320 { set reported_units_cache $reported_hours_cache }
321 { set reported_units_cache $reported_days_cache }
320 { set reported_units_cache $reported_hours_cache_pretty }
321 { set reported_units_cache $reported_days_cache_pretty }
default { set reported_units_cache [lang::message::lookup "" intranet-timesheet2-tasks.Invalid_UoM_uom "Invalid UoM '%uom%'"] }
}
if {$debug} { ns_log Notice "im_timesheet_task_list_component: project_id=$project_id, hours=$reported_hours_cache, days=$reported_days_cache, units=$reported_units_cache" }
Expand Down Expand Up @@ -686,7 +690,7 @@ ad_proc -public im_timesheet_task_list_component {
set uom_id [im_uom_hour]
set uom [im_category_from_id $uom_id]
set material_id [im_material_default_material_id]
set reported_units_cache $reported_hours_cache
set reported_units_cache $reported_hours_cache_pretty

set percent_done_input $percent_completed_rounded
set billable_hours_input $billable_units
Expand Down

0 comments on commit cf37823

Please sign in to comment.