Index: openacs-4/packages/bug-tracker/www/map-patch-to-bugs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/map-patch-to-bugs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/map-patch-to-bugs.tcl 13 Sep 2002 10:43:58 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/map-patch-to-bugs.tcl 5 Mar 2003 17:41:04 -0000 1.3 @@ -20,6 +20,8 @@ set user_id [ad_conn user_id] set redirect_url [ad_decode $return_url "" "patch?patch_number=$patch_number" $return_url] +bug_tracker::get_pretty_names -array pretty_names + if { [exists_and_not_null cancel] } { # The user chose to abort the mapping so redirect without further processing ad_returnredirect $redirect_url @@ -38,8 +40,8 @@ if { [exists_and_not_null bug_number] } { # Do the mapping foreach one_bug_number $bug_number { - set bug_id [db_string get_bug_id_for_number "select bug_id from bt_bugs where bug_number = :one_bug_number and project_id = :package_id"] - set patch_id [db_string get_patch_id_for_number "select patch_id from bt_patches where patch_number = :patch_number and project_id = :package_id"] + set bug_id [db_string get_bug_id_for_number {}] + set patch_id [db_string get_patch_id_for_number {}] bug_tracker::map_patch_to_bug -patch_id $patch_id -bug_id $bug_id } @@ -48,18 +50,18 @@ ad_script_abort } -set patch_summary [db_string get_patch_summary "select summary from bt_patches where patch_number = :patch_number and project_id = :package_id"] +set patch_summary [db_string get_patch_summary {}] set page_title "Mapping Patch #$patch_number \"$patch_summary\" to a Bug" set context_bar [ad_context_bar "$page_title"] # Build the component filter if { ![exists_and_not_null component_id] } { - set component_id [db_string component_id_for_patch "select component_id from bt_patches where patch_number = :patch_number and project_id = :package_id"] + set component_id [db_string component_id_for_patch {}] } set component_where_clause "" set component_filter "" if { ![empty_string_p $component_id] } { - set component_name [db_string component_name "select component_name from bt_components where component_id = :component_id"] + set component_name [bug_tracker::component_get_name -component_id $component_id] set component_filter_url "map-patch-to-bugs?[export_vars -url {patch_number component_id return_url offset show_only_open_p interval_size}]" if { $show_all_components_p } { set component_filter "\[ Only Component \"$component_name\" | All Components \]" @@ -71,18 +73,23 @@ } # Build the bug status filter +set workflow_id [bug_tracker::bug::get_instance_workflow_id] +set initial_state_id [workflow::fsm::get_initial_state -workflow_id $workflow_id] + set open_filter_url "map-patch-to-bugs?[export_vars -url {patch_number component_id return_url offset show_all_components_p interval_size}]" set only_open_label "Only Open Bugs" set any_status_label "Bugs of any Status" if { $show_only_open_p } { - set open_where_clause "and bt_bugs.status = 'open'" + set open_where_clause "and cfsm.current_state = :initial_state_id" set open_filter "$only_open_label | $any_status_label" } else { set open_where_clause "" set open_filter "$only_open_label | $any_status_label" } set sql_where_clause "bt_bugs.project_id = :package_id + and bt_bugs.bug_id = cas.object_id + and cas.case_id = cfsm.case_id $open_where_clause $component_where_clause and bt_bugs.bug_id not in (select bug_id @@ -95,20 +102,9 @@ )" # Build the pagination filter -set bug_count [db_string bug_count_for_mapping \ - "select count(*) - from bt_bugs - where $sql_where_clause"] +set bug_count [db_string bug_count_for_mapping {}] set pagination_export_var_set [ad_tcl_vars_to_ns_set patch_number component_id return_url show_all_components_p show_only_open_p] -db_multirow open_bugs select_open_bugs \ - "select bt_bugs.bug_number, - bt_bugs.summary, - to_char(acs_objects.creation_date, 'fmMM/DDfm/YYYY') as creation_date_pretty - from bt_bugs, acs_objects - where bt_bugs.bug_id = acs_objects.object_id - and $sql_where_clause - order by acs_objects.creation_date desc - limit $interval_size offset $offset" +db_multirow open_bugs select_open_bugs {} ad_return_template