Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2.tcl,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 2 Jul 2004 23:13:49 -0000 1.6.2.2 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 25 Nov 2004 01:16:07 -0000 1.6.2.3 @@ -22,41 +22,15 @@ {estimated_hours_work:array ""} {estimated_hours_work_min:array ""} {estimated_hours_work_max:array ""} + {estimated_days_work:array ""} + {estimated_days_work_min:array ""} + {estimated_days_work_max:array ""} {ordering:array ""} {assignee:multiple ""} process_task_id:integer,multiple {use_dependency:array ""} } -validate { - no_estimated_hours { - - set flag1 0 - set flag2 0 - - foreach {index value} [array get estimated_hours_work] { - if {[empty_string_p $value]} { - set flag1 1 - } - } - - foreach {index value} [array get estimated_hours_work_min] { - if {[empty_string_p $value]} { - set flag2 1 - } - } - - foreach {index value} [array get estimated_hours_work_max] { - if {[empty_string_p $value]} { - set flag2 1 - } - } - - if {[string is true $flag1] && [string is false $flag2]} { - ad_complain - } elseif {[string is false $flag1] && [string is true $flag2]} { - ad_complain - } - } process_id_missing { if {![exists_and_not_null process_id]} { ad_complain @@ -98,7 +72,6 @@ } } } -errors { - no_estimated_hours {You must enter estimated hours. If nothing else, enter 0 for the estimated hours} process_id_missing {I don't know which process these tasks are for!} task_title_too_long {A task subject is too long. It must be 198 characters or less} description_too_long {A description subject is too long. It must be 3998 characters or less} @@ -115,6 +88,8 @@ set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] +set use_days_p [parameter::get -parameter "UseDayInsteadOfHour" -default "t"] +set hours_day [pm::util::hours_day] # ------------------------------------------------------------ # we need to determine if these tasks are new or being edited. @@ -144,15 +119,27 @@ set one_line $task_title($array_index) set desc $description($array_index) set order $ordering($array_index) - - if {[string equal $use_uncertain_completion_times_p "1"]} { - set work_min $estimated_hours_work_min($array_index) - set work_max $estimated_hours_work_max($array_index) - set work [expr .5 * [expr $work_max - $work_min] + $work_min] + + if {[string is true $use_days_p]} { + if {[string is true $use_uncertain_completion_times_p]} { + set work_min [expr $estimated_days_work_min($array_index) * $hours_day] + set work_max [expr $estimated_days_work_max($array_index) * $hours_day] + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work [expr $estimated_hours_work($array_index) * $hours_day] + set work_min $work + set work_max $work + } } else { - set work $estimated_hours_work($array_index) - set work_min $work - set work_max $work + if {[string is true $use_uncertain_completion_times_p]} { + set work_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work $estimated_hours_work($array_index) + set work_min $work + set work_max $work + } } db_dml new_task { *SQL* } @@ -182,14 +169,26 @@ set desc $description($array_index) set order $ordering($array_index) - if {[string equal $use_uncertain_completion_times_p "1"]} { - set work_min $estimated_hours_work_min($array_index) - set work_max $estimated_hours_work_max($array_index) - set work [expr .5 * [expr $work_max - $work_min] + $work_min] + if {[string is true $use_days_p]} { + if {[string is true $use_uncertain_completion_times_p]} { + set work_min [expr $estimated_days_work_min($array_index) * $hours_day] + set work_max [expr $estimated_days_work_max($array_index) * $hours_day] + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work [expr $estimated_hours_work($array_index) * $hours_day] + set work_min $work + set work_max $work + } } else { - set work $estimated_hours_work($array_index) - set work_min $work - set work_max $work + if {[string is true $use_uncertain_completion_times_p]} { + set work_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work $estimated_hours_work($array_index) + set work_min $work + set work_max $work + } } db_dml edit_task { *SQL* }