Index: openacs-4/packages/bug-tracker/catalog/bug-tracker.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/catalog/bug-tracker.en_US.ISO-8859-1.xml,v diff -u -r1.11 -r1.12 --- openacs-4/packages/bug-tracker/catalog/bug-tracker.en_US.ISO-8859-1.xml 25 Jun 2008 21:06:35 -0000 1.11 +++ openacs-4/packages/bug-tracker/catalog/bug-tracker.en_US.ISO-8859-1.xml 29 Jun 2008 01:05:36 -0000 1.12 @@ -137,6 +137,7 @@ Name in shortcut URL Need_Info New + New Workflow New %Bug_name% Patch No %bugs_name% Index: openacs-4/packages/bug-tracker/tcl/bug-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 15 Jun 2008 19:37:01 -0000 1.25 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 29 Jun 2008 01:05:36 -0000 1.26 @@ -509,21 +509,30 @@ if { [empty_string_p $package_id] } { set package_id [ad_conn package_id] } - - return [workflow::get_id \ - -short_name [workflow_short_name] \ - -object_id $package_id] + return [db_string get_instance_workflow_id {}] } ad_proc -private bug_tracker::bug::instance_workflow_create { {-package_id:required} + -workflow_id } { - Creates a clone of the default bug-tracker package workflow for a - specific package instance + Creates a clone of the given workflow for a specific package instance, or reassign + an existing clone if it already exists. } { - set workflow_id [workflow::fsm::clone \ - -workflow_id [get_package_workflow_id] \ - -object_id $package_id] + if { ![info exists workflow_id] } { + set workflow_id [get_package_workflow_id] + } + + if { ![db_0or1row get_workflow_id {}] } { + # The workflow package only allows one instance of a workflow to be bound to + # a given object. If the workflow doesn't exist for this package instance, + # we clone the package workflow. If it does, we just reuse the existing clone. + set workflow_id [workflow::fsm::clone \ + -workflow_id $workflow_id \ + -object_id $package_id] + } + + db_dml update_project {} return $workflow_id } @@ -534,11 +543,10 @@ Deletes the instance workflow } { workflow::delete -workflow_id [get_instance_workflow_id -package_id $package_id] + db_dml update_project {} } - - ##### # # Capture resolution code Index: openacs-4/packages/bug-tracker/tcl/bug-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/bug-tracker/tcl/bug-procs.xql 1 Dec 2005 13:25:27 -0000 1.6 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.xql 29 Jun 2008 01:05:36 -0000 1.7 @@ -31,6 +31,40 @@ + + + select workflow_Id + from bt_projects + where project_id = :package_id + + + + + + select w1.workflow_id + from workflows w, workflows w1 + where w.workflow_id = :workflow_id + and w.short_name = w1.short_name + and w1.object_id = :package_id + + + + + + update bt_projects + set workflow_id = :workflow_id + where project_id = :package_id + + + + + + update bt_projects + set workflow_id = null + where project_id = :package_id + + + select ba.action_id, Index: openacs-4/packages/bug-tracker/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/index.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/bug-tracker/www/admin/index.adp 26 Jun 2008 22:09:10 -0000 1.9 +++ openacs-4/packages/bug-tracker/www/admin/index.adp 29 Jun 2008 01:05:36 -0000 1.10 @@ -109,7 +109,7 @@ - #bug-tracker.Workflow#: Foo! + #bug-tracker.Workflow#: @workflow_pretty_name@ #acs-kernel.common_edit# Index: openacs-4/packages/bug-tracker/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/index.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/bug-tracker/www/admin/index.tcl 26 Jun 2008 22:09:10 -0000 1.10 +++ openacs-4/packages/bug-tracker/www/admin/index.tcl 29 Jun 2008 01:05:36 -0000 1.11 @@ -33,7 +33,8 @@ set parameters_edit_url "/shared/parameters?[export_vars { { return_url [ad_return_url] } { package_id {[ad_conn package_id]} } }]" set severity_codes_edit_url "severity-codes" set priority_codes_edit_url "priority-codes" - +set workflow_pretty_name [workflow::get_element -element pretty_name \ + -workflow_id [bug_tracker::bug::get_instance_workflow_id]] db_multirow -extend { edit_url delete_url maintainer_url view_bugs_url } components components {} { set edit_url "component-ae?[export_vars { component_id }]" if { $num_bugs == 0 } {