Index: openacs-4/contrib/packages/simulation/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/tasks.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/lib/tasks.tcl 12 Jan 2004 15:52:44 -0000 1.10 +++ openacs-4/contrib/packages/simulation/lib/tasks.tcl 23 Jan 2004 11:11:28 -0000 1.11 @@ -49,6 +49,7 @@ role { label "Role" hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + display_col role_pretty } case_label { label "Case" @@ -66,30 +67,38 @@ -no_data "You don't have any tasks." \ -elements $elements +# NOTE: Our "pick case and role" design of simplay doesn't work if a child workflow uses per_user mapping +# because the role in the child workflow will then no longer match any role in the top case. + db_multirow -extend { task_url } tasks select_tasks " - select wcea.enabled_action_id, + select wcaa.enabled_action_id, wa.pretty_name as name, - wcea.case_id, + wcaa.top_case_id as case_id, + wcaa.real_role_id as role_id, sc.label as case_label, w.pretty_name as sim_name, - wr.pretty_name as role, - wr.role_id as role_id - from workflow_case_enabled_actions wcea, + wr.pretty_name as role_pretty, + wr.role_id + from workflow_case_assigned_actions wcaa, workflow_actions wa, - workflow_cases wc, + workflow_cases topwc, sim_cases sc, workflows w, workflow_roles wr - where wcea.enabled_state = 'enabled' - and wa.action_id = wcea.action_id - and wr.role_id = wa.assigned_role - and wc.case_id = wcea.case_id - and sc.sim_case_id = wc.object_id - and w.workflow_id = wc.workflow_id - [ad_decode [exists_and_not_null role_id] 1 "and wr.role_id = :role_id" ""] - [ad_decode [exists_and_not_null case_id] 1 "and wcea.case_id = :case_id" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and wa.assigned_role = role_id and user_id = :user_id)"] - + where wa.action_id = wcaa.action_id + and topwc.case_id = wcaa.top_case_id + and sc.sim_case_id = topwc.object_id + and w.workflow_id = topwc.workflow_id + and wr.role_id = wcaa.real_role_id + [ad_decode [exists_and_not_null role_id] 1 "and wcaa.real_role_id = :role_id" ""] + [ad_decode [exists_and_not_null case_id] 1 "and wcaa.top_case_id = :case_id" "and exists (select 1 + from workflow_case_role_user_map + where case_id = wcaa.real_case_id + and role_id = wcaa.real_role_id + and user_id = :user_id)"] order by wa.sort_order " { set task_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/task-detail" { enabled_action_id case_id role_id }] } + +