Index: openacs-4/contrib/packages/project-manager/www/log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/log.tcl 12 Mar 2004 13:44:44 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/log.tcl 27 Apr 2004 00:49:29 -0000 1.3 @@ -14,13 +14,25 @@ {edit:boolean "f"} {return_url "."} } -validate { - project_id_required_in_add_mode { + #project_id_required_in_add_mode { # For the sake of simplicity of the form # we are requiring a project_id to be provided in add mode - if { ![exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { - ad_complain "When adding a log entry a project_id must be provided (either entry_id or project_id must be present)." - } + #if { ![exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { + # ad_complain "When adding a log entry a project_id must be provided (either entry_id or project_id must be present)." + #} + #} +} + +if { ![exists_and_not_null project_id] } { + + if {[exists_and_not_null entry_id]} { + # do nothing + } else { + set project_id [pm::project::get_logger_project \ + -project_item_id $pm_project_id] + } + } set package_id [ad_conn package_id] @@ -189,12 +201,17 @@ else percent_complete end as percent_complete, estimated_hours_work, estimated_hours_work_min, - estimated_hours_work_max + estimated_hours_work_max, + s.description as status_description FROM pm_tasks_revisionsx p, - cr_items i + cr_items i, + pm_task_status s, + pm_tasks t WHERE i.item_id = p.item_id and p.item_id = :pm_task_id and + i.item_id = t.task_id and + t.status = s.status_id and p.revision_id = i.live_revision" ad_form -extend -name log_entry_form -form { @@ -205,6 +222,11 @@ {value $task_title} } + {status_description:text(inform) + {label "Status"} + {value $status_description} + } + } if {[string equal $use_uncertain_completion_times_p 1]} { @@ -297,6 +319,17 @@ cr_items where item_id = :pm_task_id)" + + if {$percent_complete >= 100} { + + pm::task::close -task_item_id $pm_task_id + + } else { + + pm::task::open -task_item_id $pm_task_id + + } + } } else { @@ -308,7 +341,7 @@
-You have already added this entry once. If you want to edit this entry, click here. +You have already added this entry once. If you want to edit this entry, click here. [ad_footer] " @@ -346,13 +379,34 @@ pm::task::update_hours \ -task_item_id $pm_task_id - pm::project::compute_status $pm_project_id + + if {$percent_complete >= 100} { + set status_code [pm::task::default_status_closed] + } else { + set status_code [pm::task::default_status_open] + } + + db_dml update_percent " + UPDATE + pm_tasks + SET + status = :status_code + WHERE + task_id = :pm_task_id" + + } set pm_task_id $old_pm_task_id } -after_submit { ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id return_url pm_project_id pm_task_id}]" + # ad_returnredirect $return_url + + if {![string equal $pm_task_id -1]} { + pm::project::compute_status $pm_project_id + } + ad_script_abort }