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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 3 Oct 2003 23:13:15 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 8 Oct 2003 20:16:11 -0000 1.3 @@ -85,29 +85,77 @@ set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] -set index 0 -foreach ptid $process_task_id { +# ------------------------------------------------------------ +# we need to determine if these tasks are new or being edited. +# we know this by checking if the numbers exist. +# we assume that if any of them exist, that we're editing. +# ------------------------------------------------------------ - # set up the values - set task_id [lindex $process_task_id $index] +set edit_p [db_string editing_process_tasks_p { } -default "0"] - set one_line [lindex $task_title $index] - set desc [lindex $description $index] - if {[string equal $use_uncertain_completion_times_p "1"]} { - set work_min [lindex $estimated_hours_work_min $index] - set work_max [lindex $estimated_hours_work_max $index] - set work [expr .5 * [expr $work_max - $work_min] + $work_min] - } else { - set work [lindex $estimated_hours_work $index] - set work_min $work - set work_max $work +ns_log Notice "edit_p: $edit_p" + +if {[string equal $edit_p "0"]} { + + # ----------------------------- + # if we're adding process tasks + # ----------------------------- + + set index 0 + foreach ptid $process_task_id { + + # set up the values + set task_id [lindex $process_task_id $index] + + set one_line [lindex $task_title $index] + set desc [lindex $description $index] + + if {[string equal $use_uncertain_completion_times_p "1"]} { + set work_min [lindex $estimated_hours_work_min $index] + set work_max [lindex $estimated_hours_work_max $index] + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work [lindex $estimated_hours_work $index] + set work_min $work + set work_max $work + } + + db_dml new_task { *SQL* } } +} else { - db_dml new_task { *SQL* } -} + # ----------------------------- + # if we're editing process tasks + # ----------------------------- + # ----------------------------- + # if we're adding process tasks + # ----------------------------- + set index 0 + foreach ptid $process_task_id { + + # set up the values + set task_id [lindex $process_task_id $index] + + set one_line [lindex $task_title $index] + set desc [lindex $description $index] + + if {[string equal $use_uncertain_completion_times_p "1"]} { + set work_min [lindex $estimated_hours_work_min $index] + set work_max [lindex $estimated_hours_work_max $index] + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work [lindex $estimated_hours_work $index] + set work_min $work + set work_max $work + } + + db_dml edit_task { *SQL* } + } +} + if {1 == 0} { set revision_has_dependencies [list]