Index: openacs-4/packages/bug-tracker/tcl/bug-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs-oracle.xql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/bug-tracker/tcl/bug-procs-oracle.xql 6 Jul 2016 09:01:02 -0000 1.10 +++ openacs-4/packages/bug-tracker/tcl/bug-procs-oracle.xql 23 Nov 2017 16:41:46 -0000 1.11 @@ -3,29 +3,8 @@ oracle8.1.6 - - - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - b.component_id, - b.creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.resolution, - b.user_agent, - b.found_in_version, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') as now_pretty - from bt_bugs b - where b.bug_id = :bug_id - - - - - + + begin :1 := bt_bug_revision.new ( bug_revision_id => null, @@ -42,210 +21,30 @@ creation_ip => :creation_ip ); end; - - + + - - - select sysdate from dual - - - - - - + + begin workflow_case_pkg.delete(:case_id); end; - - + + - - - begin - notification.delete(:notification_id); - end; - - - - - - begin - content_item.delete(:bug_id); - end; - - - - - + + content_keyword.is_assigned(b.bug_id, :f_category_$parent_id, 'none') = 't' - - + + - - - - , cr_item_keyword_map km_order, - cr_keywords kw_order - - - - - - and km_order.item_id (+) = b.bug_id - and km_order.keyword_id = kw_order.keyword_id - and kw_order.parent_id = '[db_quote $orderby_parent_id]' - - - - - - - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - lower(b.summary) as lower_summary, - b.comment_content, - b.comment_format, - b.component_id, - b.creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.creation_user as submitter_user_id, - submitter.first_names as submitter_first_names, - submitter.last_name as submitter_last_name, - submitter.email as submitter_email, - lower(submitter.first_names) as lower_submitter_first_names, - lower(submitter.last_name) as lower_submitter_last_name, - lower(submitter.email) as lower_submitter_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - b.resolution, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - cas.case_id - $more_columns - from $from_bug_clause, - acs_users_all submitter, - workflow_cases cas, - workflow_case_fsm cfsm, - workflow_fsm_states st - where submitter.user_id = b.creation_user - and cas.workflow_id = :workflow_id - and cas.object_id = b.bug_id - and cfsm.case_id = cas.case_id - and cfsm.parent_enabled_action_id is null - and st.state_id = cfsm.current_state - $orderby_category_where_clause - [template::list::filter_where_clauses -and -name "bugs"] - [template::list::orderby_clause -orderby -name "bugs"] - - - - - -select q.*, - km.keyword_id, - assign_info.* -from ( - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - lower(b.summary) as lower_summary, - b.comment_content, - b.comment_format, - b.component_id, - b.creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.creation_user as submitter_user_id, - submitter.first_names as submitter_first_names, - submitter.last_name as submitter_last_name, - submitter.email as submitter_email, - lower(submitter.first_names) as lower_submitter_first_names, - lower(submitter.last_name) as lower_submitter_last_name, - lower(submitter.email) as lower_submitter_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - b.resolution, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - cas.case_id - $more_columns - from $from_bug_clause, - acs_users_all submitter, - workflow_cases cas, - workflow_case_fsm cfsm, - workflow_fsm_states st - where submitter.user_id = b.creation_user - and cas.workflow_id = :workflow_id - and cas.object_id = b.bug_id - and cfsm.case_id = cas.case_id - and cfsm.parent_enabled_action_id is null - and st.state_id = cfsm.current_state - $orderby_category_where_clause - [template::list::page_where_clause -and -name bugs -key bug_id] -) q, - cr_item_keyword_map km, - (select cru.user_id as assigned_user_id, - aa.action_id, - aa.case_id, - wa.pretty_name as action_pretty_name, - p.first_names as assignee_first_names, - p.last_name as assignee_last_name - from workflow_case_assigned_actions aa, - workflow_case_role_user_map cru, - workflow_actions wa, - persons p - where aa.case_id = cru.case_id - and aa.role_id = cru.role_id - and cru.user_id = p.person_id - and wa.action_id = aa.action_id - ) assign_info -where q.bug_id = km.item_id (+) - and q.case_id = assign_info.case_id (+) -[template::list::orderby_clause -orderby -name "bugs"] - - - - - - - exists (select 1 - from workflow_case_assigned_actions aa, - workflow_case_role_party_map wcrpm - where aa.case_id = cas.case_id - and aa.action_id = $action_id - and wcrpm.case_id (+) = aa.case_id - and wcrpm.role_id (+) = aa.role_id - and wcrpm.party_id is null - ) - - - - - + + and exists (select 1 from acs_object_party_privilege_map where object_id = b.bug_id and party_id = :user_id and privilege = 'read') - - + + Index: openacs-4/packages/bug-tracker/tcl/bug-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs-postgresql.xql,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/bug-tracker/tcl/bug-procs-postgresql.xql 6 Jul 2016 09:01:02 -0000 1.14 +++ openacs-4/packages/bug-tracker/tcl/bug-procs-postgresql.xql 23 Nov 2017 16:41:46 -0000 1.15 @@ -1,29 +1,8 @@ - postgresql7.1 + postgresql7.1 - - - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - b.component_id, - to_char(b.creation_date,'YYYY-MM-DD HH24:MI:SS') as creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.resolution, - b.user_agent, - b.found_in_version, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - to_char(now(), 'YYYY-MM-DD HH24:MI:SS') as now_pretty - from bt_bugs b - where b.bug_id = :bug_id - - - select bt_bug_revision__new ( @@ -43,197 +22,22 @@ - - - select current_timestamp - - - - - + - select workflow_case_pkg__delete(:case_id); + select workflow_case_pkg__delete(:case_id); - + - + - select notification__delete(:notification_id); + content_keyword__is_assigned(b.bug_id, :f_category_$parent_id, 'none') = 't' - - - - - select content_item__delete(:bug_id); - - - - - - content_keyword__is_assigned(b.bug_id, :f_category_$parent_id, 'none') = 't' - - - - left outer join cr_item_keyword_map km_order on (km_order.item_id = b.bug_id) - join cr_keywords kw_order on (km_order.keyword_id = kw_order.keyword_id and kw_order.parent_id = '[db_quote $orderby_parent_id]') - - - - - - - - - - - - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - lower(b.summary) as lower_summary, - b.comment_content, - b.comment_format, - b.component_id, - b.creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.creation_user as submitter_user_id, - submitter.first_names as submitter_first_names, - submitter.last_name as submitter_last_name, - submitter.email as submitter_email, - lower(submitter.first_names) as lower_submitter_first_names, - lower(submitter.last_name) as lower_submitter_last_name, - lower(submitter.email) as lower_submitter_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - b.resolution, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - cas.case_id - $more_columns - from $from_bug_clause, - acs_users_all submitter, - workflow_cases cas, - workflow_case_fsm cfsm, - workflow_fsm_states st - where submitter.user_id = b.creation_user - and cas.workflow_id = :workflow_id - and cas.object_id = b.bug_id - and cfsm.case_id = cas.case_id - and cfsm.parent_enabled_action_id is null - and st.state_id = cfsm.current_state - $orderby_category_where_clause - [bug_tracker::user_bugs_only_where_clause] - [template::list::filter_where_clauses -and -name "bugs"] - [template::list::orderby_clause -orderby -name "bugs"] - - - - - -select q.*, - km.keyword_id, - assign_info.* -from ( - select b.bug_id, - b.project_id, - b.bug_number, - b.summary, - lower(b.summary) as lower_summary, - b.comment_content, - b.comment_format, - b.component_id, - to_char(b.creation_date,'YYYY-MM-DD HH24:MI:SS') as creation_date, - to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, - b.creation_user as submitter_user_id, - submitter.first_names as submitter_first_names, - submitter.last_name as submitter_last_name, - submitter.email as submitter_email, - lower(submitter.first_names) as lower_submitter_first_names, - lower(submitter.last_name) as lower_submitter_last_name, - lower(submitter.email) as lower_submitter_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - b.resolution, - b.found_in_version, - b.fix_for_version, - b.fixed_in_version, - cas.case_id - $more_columns - from $from_bug_clause, - acs_users_all submitter, - workflow_cases cas, - workflow_case_fsm cfsm, - workflow_fsm_states st - where submitter.user_id = b.creation_user - and cas.workflow_id = :workflow_id - and cas.object_id = b.bug_id - and cfsm.case_id = cas.case_id - and cfsm.parent_enabled_action_id is null - and st.state_id = cfsm.current_state - [template::list::filter_where_clauses -and -name "bugs"] - $orderby_category_where_clause - [bug_tracker::user_bugs_only_where_clause] - [template::list::page_where_clause -and -name bugs -key bug_id] -) q -left outer join - cr_item_keyword_map km -on (bug_id = km.item_id) -left outer join - (select cru.user_id as assigned_user_id, - aa.action_id, - aa.case_id, - wa.pretty_name as action_pretty_name, - p.first_names as assignee_first_names, - p.last_name as assignee_last_name - from workflow_case_assigned_actions aa, - workflow_case_role_user_map cru, - workflow_actions wa, - persons p - where aa.case_id = cru.case_id - and aa.role_id = cru.role_id - and cru.user_id = p.person_id - and wa.action_id = aa.action_id - ) assign_info -on (q.case_id = assign_info.case_id) - [template::list::orderby_clause -orderby -name "bugs"] - - - - - - exists (select 1 - from workflow_case_assigned_actions aa left outer join - workflow_case_role_party_map wcrpm - on (wcrpm.case_id = aa.case_id and wcrpm.role_id = aa.role_id) - where aa.case_id = cas.case_id - and aa.action_id = $action_id - and wcrpm.party_id is null - ) - - - - and acs_permission__permission_p(b.bug_id, :user_id, 'read') - + and acs_permission__permission_p(b.bug_id, :user_id, 'read') + 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 -N -r1.36 -r1.37 --- openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 17 Aug 2016 11:25:04 -0000 1.36 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 23 Nov 2017 16:41:46 -0000 1.37 @@ -323,12 +323,8 @@ set case_id [db_string get_case_id {}] db_exec_plsql delete_bug_case {} - set notifications [db_list get_notifications {}] - foreach notification_id $notifications { - db_exec_plsql delete_notification {} - } - db_dml unset_revisions {} - db_exec_plsql delete_cr_item {} + + content::item::delete -item_id $bug_id } @@ -996,14 +992,12 @@ # Needed to handle ordering by categories set from_bug_clause "bt_bugs b" - set orderby_category_where_clause {} # Lars: This is a little hack because we actually need to alter the query to sort by category # but list builder currently doesn't support that. if { [info exists orderby] && [regexp {^category_(.*),.*$} $orderby match orderby_parent_id] } { append from_bug_clause [db_map orderby_category_from_bug_clause] - set orderby_category_where_clause [db_map orderby_category_where_clause] # Branimir: The ORDER BY clause needs to be at the very end of the # query. That also means that we need to have in the select list every 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 -N -r1.7 -r1.8 --- openacs-4/packages/bug-tracker/tcl/bug-procs.xql 29 Jun 2008 01:05:36 -0000 1.7 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.xql 23 Nov 2017 16:41:46 -0000 1.8 @@ -1,33 +1,193 @@ - + - select project_id from bt_bugs where bug_id = :bug_id + select b.bug_id, + b.project_id, + b.bug_number, + b.summary, + b.component_id, + to_char(b.creation_date,'YYYY-MM-DD HH24:MI:SS') as creation_date, + to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, + b.resolution, + b.user_agent, + b.found_in_version, + b.found_in_version, + b.fix_for_version, + b.fixed_in_version, + to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS') as now_pretty + from bt_bugs b + where b.bug_id = :bug_id - + - select case_id - from workflow_cases - where object_id = :bug_id + select current_timestamp from dual - + + + left outer join cr_item_keyword_map km_order on (km_order.item_id = b.bug_id) + join cr_keywords kw_order on (km_order.keyword_id = kw_order.keyword_id and kw_order.parent_id = '[db_quote $orderby_parent_id]') + + + + + + + select b.bug_id, + b.project_id, + b.bug_number, + b.summary, + lower(b.summary) as lower_summary, + b.comment_content, + b.comment_format, + b.component_id, + b.creation_date, + to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, + b.creation_user as submitter_user_id, + submitter.first_names as submitter_first_names, + submitter.last_name as submitter_last_name, + submitter.email as submitter_email, + lower(submitter.first_names) as lower_submitter_first_names, + lower(submitter.last_name) as lower_submitter_last_name, + lower(submitter.email) as lower_submitter_email, + st.pretty_name as pretty_state, + st.short_name as state_short_name, + st.state_id, + st.hide_fields, + b.resolution, + b.found_in_version, + b.fix_for_version, + b.fixed_in_version, + cas.case_id + $more_columns + from $from_bug_clause, + acs_users_all submitter, + workflow_cases cas, + workflow_case_fsm cfsm, + workflow_fsm_states st + where submitter.user_id = b.creation_user + and cas.workflow_id = :workflow_id + and cas.object_id = b.bug_id + and cfsm.case_id = cas.case_id + and cfsm.parent_enabled_action_id is null + and st.state_id = cfsm.current_state + [bug_tracker::user_bugs_only_where_clause] + [template::list::filter_where_clauses -and -name "bugs"] + [template::list::orderby_clause -orderby -name "bugs"] + + + + + +select q.*, + km.keyword_id, + assign_info.* +from ( + select b.bug_id, + b.project_id, + b.bug_number, + b.summary, + lower(b.summary) as lower_summary, + b.comment_content, + b.comment_format, + b.component_id, + to_char(b.creation_date,'YYYY-MM-DD HH24:MI:SS') as creation_date, + to_char(b.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, + b.creation_user as submitter_user_id, + submitter.first_names as submitter_first_names, + submitter.last_name as submitter_last_name, + submitter.email as submitter_email, + lower(submitter.first_names) as lower_submitter_first_names, + lower(submitter.last_name) as lower_submitter_last_name, + lower(submitter.email) as lower_submitter_email, + st.pretty_name as pretty_state, + st.short_name as state_short_name, + st.state_id, + st.hide_fields, + b.resolution, + b.found_in_version, + b.fix_for_version, + b.fixed_in_version, + cas.case_id + $more_columns + from $from_bug_clause, + acs_users_all submitter, + workflow_cases cas, + workflow_case_fsm cfsm, + workflow_fsm_states st + where submitter.user_id = b.creation_user + and cas.workflow_id = :workflow_id + and cas.object_id = b.bug_id + and cfsm.case_id = cas.case_id + and cfsm.parent_enabled_action_id is null + and st.state_id = cfsm.current_state + [template::list::filter_where_clauses -and -name "bugs"] + [bug_tracker::user_bugs_only_where_clause] + [template::list::page_where_clause -and -name bugs -key bug_id] +) q +left outer join + cr_item_keyword_map km +on (bug_id = km.item_id) +left outer join + (select cru.user_id as assigned_user_id, + aa.action_id, + aa.case_id, + wa.pretty_name as action_pretty_name, + p.first_names as assignee_first_names, + p.last_name as assignee_last_name + from workflow_case_assigned_actions aa, + workflow_case_role_user_map cru, + workflow_actions wa, + persons p + where aa.case_id = cru.case_id + and aa.role_id = cru.role_id + and cru.user_id = p.person_id + and wa.action_id = aa.action_id + ) assign_info +on (q.case_id = assign_info.case_id) + [template::list::orderby_clause -orderby -name "bugs"] + + + + + + exists (select 1 + from workflow_case_assigned_actions aa left outer join + workflow_case_role_party_map wcrpm + on (wcrpm.case_id = aa.case_id and wcrpm.role_id = aa.role_id) + where aa.case_id = cas.case_id + and aa.action_id = $action_id + and wcrpm.party_id is null + ) + + + + - select notification_id - from notifications - where response_id = :bug_id + select project_id from bt_bugs where bug_id = :bug_id - + - update cr_items - set live_revision = null, latest_revision = null - where item_id = :bug_id + select case_id + from workflow_cases + where object_id = :bug_id