bug_tracker::bug::get_list (public)

 bug_tracker::bug::get_list [ -ulevel ulevel ] \
    [ -package_id package_id ] [ -user_id user_id ] \
    [ -no_bulk_actions ]

Defined in packages/bug-tracker/tcl/bug-procs.tcl

Switches:
-ulevel (optional, defaults to "1")
-package_id (optional)
-user_id (optional)
-no_bulk_actions (optional, boolean)

Partial Call Graph (max 5 caller/called nodes):
%3 bug_tracker::bug::get_bug_numbers bug_tracker::bug::get_bug_numbers (public) bug_tracker::bug::get_list bug_tracker::bug::get_list bug_tracker::bug::get_bug_numbers->bug_tracker::bug::get_list packages/bug-tracker/www/core.tcl packages/bug-tracker/ www/core.tcl packages/bug-tracker/www/core.tcl->bug_tracker::bug::get_list packages/bug-tracker/www/index.tcl packages/bug-tracker/ www/index.tcl packages/bug-tracker/www/index.tcl->bug_tracker::bug::get_list _ _ (public) bug_tracker::bug::get_list->_ ad_conn ad_conn (public) bug_tracker::bug::get_list->ad_conn ad_return_url ad_return_url (public) bug_tracker::bug::get_list->ad_return_url bug_tracker::assignee_get_filter_data bug_tracker::assignee_get_filter_data (public) bug_tracker::bug::get_list->bug_tracker::assignee_get_filter_data bug_tracker::bug::get_instance_workflow_id bug_tracker::bug::get_instance_workflow_id (public) bug_tracker::bug::get_list->bug_tracker::bug::get_instance_workflow_id

Testcases:
No testcase defined.
Source code:
    upvar \#[template::adp_level] admin_p admin_p
    if { $package_id eq "" } {
        set package_id [ad_conn package_id]
    }
    set workflow_id [bug_tracker::bug::get_instance_workflow_id -package_id $package_id]
    bug_tracker::get_pretty_names -array pretty_names -package_id $package_id

    set elements {
        bug_number {
            label "[bug_tracker::conn Bug] [_ bug-tracker.number_symbol]"
            display_template {[_ bug-tracker.number_symbol]@bugs.bug_number@}
            html { align right }
        }
        summary {
            label "[_ bug-tracker.Summary]"
            link_url_eval {[export_vars -base bug -entire_form -override { bug_number }]}
            display_template {@bugs.summary;noi18n@}
            aggregate_label {[_ bug-tracker.Number]}
        }
        comment {
            label "[_ bug-tracker.Details]"
            display_col comment_short
            hide_p 1
        }
        state {
            label "[_ bug-tracker.State]"
            display_template {@bugs.pretty_state@<if @bugs.resolution@ not nil> (@bugs.resolution_pretty@)</if>}
            aggregate count
        }
        creation_date_pretty {
            label "[_ bug-tracker.Submitted]"
        }
        submitter {
            label "[_ bug-tracker.Submitter]"
            display_template {<a href="@bugs.submitter_url@">@bugs.submitter_first_names@ @bugs.submitter_last_name@</a>}
        }
        assigned_to {
            label "Assigned To"
            display_template {<a href="@bugs.assignee_url@">@bugs.assignee_first_names@
                               @bugs.assignee_last_name@</a>
                               <if @bugs.action_pretty_name@ not nil> to </if>
                               @bugs.action_pretty_name@}
        }
    }

    if { [bug_tracker::versions_p] } {
        lappend elements fix_for_version {
            label "[_ bug-tracker.Fix_1]"
            display_col fix_for_version_name
        }
    }

    lappend elements component {
        label "[_ bug-tracker.Component]"
        display_col component_name
    }

    set state_values [bug_tracker::state_get_filter_data  -package_id $package_id  -workflow_id $workflow_id  -user_id $user_id  -admin_p $admin_p]
    set state_default_value [lindex $state_values 0 1]

    set filters {
        project_id {}
        f_state {
            label "[_ bug-tracker.State]"
            values $state_values
            where_clause {cfsm.current_state = :f_state}
            default_value $state_default_value
        }
    }

    set orderbys {
        default_value bug_number,desc
        bug_number {
            label "[bug_tracker::conn Bug] \#"
            orderby bug_number
            default_direction desc
        }
        summary {
            label "[_ bug-tracker.Summary]"
            orderby_asc {lower_summary asc, summary asc, bug_number asc}
            orderby_desc {lower_summary desc, summary desc, bug_number desc}
        }
        submitter {
            label "[_ bug-tracker.Submitter]"
            orderby_asc {lower_submitter_first_names asc, lower_submitter_last_name asc, bug_number asc}
            orderby_desc {lower_submitter_first_names desc, lower_submitter_last_name desc, bug_number desc}
        }
    }

    set category_defaults [list]


    foreach { parent_id parent_heading } [bug_tracker::category_types] {
        lappend elements category_$parent_id [list label [bug_tracker::category_heading -keyword_id $parent_id] display_col category_name_$parent_id]

        set values [bug_tracker::category_get_filter_data  -package_id $package_id  -parent_id $parent_id  -user_id $user_id  -admin_p $admin_p]

        set name category_$parent_id

        set where_clause [db_map category_where_clause]

        lappend filters f_$name  [list  label $parent_heading  values $values  where_clause $where_clause]

        lappend orderbys $name  [list  label $parent_heading  orderby_desc {heading desc, bug_number desc}  orderby_asc {heading asc, bug_number asc}]
    }
     
    set component_keyword_id [bug_tracker::get_component_keyword -package_id $package_id]
     
    set distributions [db_list_of_lists get_distributions {}]
     
    if {[llength distributions] > 0} {
             lappend filters f_distribution  [list  label Distributions  values $distributions  where_clause "b.component_id in (select bkcm.component_id from cr_keywords ck, bt_keyword_component_map bkcm where ck.parent_id = :f_distribution and ck.keyword_id = bkcm.keyword_id)"]
    }
     
    if { [bug_tracker::versions_p] } {
        lappend filters f_fix_for_version {
            label "[_ bug-tracker.Fix]"
            values {[bug_tracker::version_get_filter_data -package_id $package_id -user_id $user_id -admin_p $admin_p]}
            where_clause { b.fix_for_version = :f_fix_for_version }
            null_where_clause { b.fix_for_version is null }
            null_label "[_ bug-tracker.Undecided]"
        }
    }

    foreach action_id [workflow::get_actions -workflow_id $workflow_id] {
        array unset action
        workflow::action::get -action_id $action_id -array action

        set values [bug_tracker::assignee_get_filter_data  -package_id $package_id  -workflow_id $workflow_id  -action_id $action_id  -user_id $user_id  -admin_p $admin_p]

        lappend filters f_action_$action_id  [list  label $action(pretty_name)  values $values  null_label "[_ bug-tracker.Unassigned]"  where_clause [db_map filter_assignee_where_clause]  null_where_clause [db_map filter_assignee_null_where_clause]]
    }

    # Stat: By Component

    lappend filters f_component {
        label "[_ bug-tracker.Component]"
        values {[bug_tracker::component_get_filter_data -package_id $package_id -user_id $user_id -admin_p $admin_p]}
        where_clause {b.component_id = :f_component}
    }

    upvar \#[template::adp_level] format format
    #
    # For now, use just "table" format, this there is a broken
    # substitution in the list variant, leading to
    # "package_key.message_key' does not exist in en_US", when the
    # message key is used in one of the <listelements> (such as "summary
    # or "comment").
    #
    set format table

    foreach var [bug_tracker::get_export_variables -package_id $package_id] {
        upvar \#[template::adp_level$var $var
    }

    # Get enabled actions on the filtered state
    if {[info exists f_state]} {
        set bulk_action_f_state $f_state
    } else {
        set bulk_action_f_state $state_default_value
    }
    set enabled_actions_for_this_state [db_list get_action_ids {
        select action_id
        from workflow_fsm_action_en_in_st
        where state_id = :bulk_action_f_state
    }]

    # Generate bulk actions

    set bulk_actions {}
    if { !$no_bulk_actions_p } {
        foreach action_id [workflow::get_actions -workflow_id $workflow_id] {
            if {$action_id in $enabled_actions_for_this_state} {
                # this particular action is enabled
                # add to bulk actions
                workflow::action::get -action_id $action_id -array bulk_action_array_info
                set action_pretty_name $bulk_action_array_info(pretty_name)
                set action_short_name $bulk_action_array_info(short_name)
                lappend bulk_actions "$action_pretty_name" "bulk-update/${action_short_name}" "$action_pretty_name"
            }
        }
        lappend bulk_actions "[_ bug-tracker.Send_Summary_Email]" "send-summary-email" "[_ bug-tracker.Send_Summary_Email]"
    }

    set bulk_action_export_vars [list [list workflow_id $workflow_id] [list return_url [ad_return_url]]]

    template::list::create  -ulevel [expr {$ulevel + 1}]  -name bugs  -multirow bugs  -key bug_id  -class "list-tiny"  -sub_class "narrow"  -pass_properties { pretty_names }  -bulk_actions $bulk_actions  -bulk_action_method get  -bulk_action_export_vars $bulk_action_export_vars  -elements $elements  -filters $filters  -orderby $orderbys  -page_size [parameter::get -package_id [ad_conn package_id] -parameter PageSize]  -page_flush_p 0  -page_query {[bug_tracker::bug::get_query -query_name bugs_pagination]}  -formats {
            table {
                label "[_ bug-tracker.Table]"
                layout table
            }
            list {
                label "[_ bug-tracker.List]"
                layout list
                template {
                    <p class="bt">
                      <span style="font-size: 115%;">
                        <listelement name="bug_number"><span class="bt_douce">. </span>
                        <listelement name="summary"><br>
                      </span>
                      <listelement name="comment"><br>
                      <span class="bt_douce">@pretty_names.Component@:</span> <listelement name="component">
                      <span class="bt_douce">- Opened</span> <listelement name="creation_date_pretty">
                      <span class="bt_douce">By</span> <listelement name="submitter"><br>
                      <span class="bt_douce">Status:</span>
                      <span style="color: #008000;"><b><listelement name="state"></b>
                    </p>
                }
            }
        }  -selected_format $format
Generic XQL file:
<fullquery name="bug_tracker::bug::get_list.filter_assignee_null_where_clause">
    <querytext>
          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
                 )
  </querytext>
</fullquery>

<fullquery name="bug_tracker::bug::get_list.filter_assignee_where_clause">
    <querytext>
          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 = :f_action_$action_id
                 )
      </querytext>
</fullquery>

<fullquery name="bug_tracker::bug::get_list.get_distributions">
    <querytext>
       select k.heading, k.keyword_id, 
         (select count(*) 
          from bt_bugs b 
          where b.component_id in 
          (select cm.component_id 
           from bt_keyword_component_map cm 
           where cm.keyword_id in 
           (select kk.keyword_id 
            from cr_keywords kk 
            where kk.parent_id = k.keyword_id))) as num_bugs
       from   cr_keywords k
       where  k.parent_id = :component_keyword_id
     </querytext>
</fullquery>
packages/bug-tracker/tcl/bug-procs.xql

PostgreSQL XQL file:
<fullquery name="bug_tracker::bug::get_list.category_where_clause">
    <querytext>
      content_keyword__is_assigned(b.bug_id, :f_category_$parent_id, 'none') = 't'
    </querytext>
</fullquery>
packages/bug-tracker/tcl/bug-procs-postgresql.xql

Oracle XQL file:
<fullquery name="bug_tracker::bug::get_list.category_where_clause">
    <querytext>
         content_keyword.is_assigned(b.bug_id, :f_category_$parent_id, 'none') = 't'
     </querytext>
</fullquery>
packages/bug-tracker/tcl/bug-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: