workflow::case::get_activity_log_info_not_cached (private)

 workflow::case::get_activity_log_info_not_cached -case_id case_id

Defined in packages/workflow/tcl/case-procs.tcl

Get the data for the case activity log. This version is cached for a single thread.

Switches:
-case_id
(required)
Returns:
a list of array-lists with the following entries: comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title user_first_names user_last_name user_email creation_user data_arraylist
Author:
Lars Pind

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::case::action::notify workflow::case::action::notify (public) workflow::case::get_activity_log_info_not_cached workflow::case::get_activity_log_info_not_cached workflow::case::action::notify->workflow::case::get_activity_log_info_not_cached workflow::case::get_activity_html workflow::case::get_activity_html (private) workflow::case::get_activity_html->workflow::case::get_activity_log_info_not_cached workflow::case::get_activity_log_info workflow::case::get_activity_log_info (private) workflow::case::get_activity_log_info->workflow::case::get_activity_log_info_not_cached acs_sc::invoke acs_sc::invoke (public) workflow::case::get_activity_log_info_not_cached->acs_sc::invoke ad_decode ad_decode (public) workflow::case::get_activity_log_info_not_cached->ad_decode db_multirow db_multirow (public) workflow::case::get_activity_log_info_not_cached->db_multirow lang::util::localize lang::util::localize (public) workflow::case::get_activity_log_info_not_cached->lang::util::localize template::multirow template::multirow (public) workflow::case::get_activity_log_info_not_cached->template::multirow

Testcases:
No testcase defined.
Source code:
    set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id]
    set object_id [workflow::case::get_element -case_id $case_id -element object_id]
    set contract_name [workflow::service_contract::activity_log_format_title]
    
    # Get the name of any title Tcl callback proc
    set impl_names [workflow::get_callbacks  -workflow_id $workflow_id  -contract_name $contract_name]

    # First, we build up a multirow so we have all the data in memory, which lets us peek ahead at the contents
    db_multirow -extend {comment} -local entries select_log {} {
       set comment $comment_string
       set action_pretty_past_tense [lang::util::localize $action_pretty_past_tense]
    }

    
    set rowcount [template::multirow -local size entries]

    set counter 1

    set last_entry_id {}
    set data_arraylist [list]

    # Then iterate over the multirow to build up the activity log HTML
    # We need to peek ahead, because this is an outer join to get the rows in workflow_case_log_data

    set entries [list]
    template::multirow -local foreach entries {

        if { $key ne "" } {
            lappend data_arraylist $key $value
        }

        if { $counter == $rowcount || $last_entry_id ne [set "entries:[expr {$counter + 1}](entry_id)"] } {
            
            set log_title_elements [list]
            foreach impl_name $impl_names {
                set result [acs_sc::invoke  -contract $contract_name  -operation "GetTitle"  -impl $impl_name  -call_args [list $case_id $object_id $action_id $entry_id $data_arraylist]]
                if { $result ne "" } {
                    lappend log_title_elements $result
                }
            }
            set log_title [ad_decode [llength $log_title_elements] 0 "" "([join $log_title_elements ""])"]
            
            set row [list]
            foreach var { 
                comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title 
                user_first_names user_last_name user_email creation_user data_arraylist
            } {
                lappend row $var [set $var]
            }
            lappend entries $row

            set data_arraylist [list]
        }
        set last_entry_id $entry_id
        incr counter
    }

    return $entries
Generic XQL file:
<fullquery name="workflow::case::get_activity_log_info_not_cached.select_log">
    <querytext>
        select l.entry_id,
               l.case_id,
               l.action_id,
               a.short_name as action_short_name,
               a.pretty_past_tense as action_pretty_past_tense,
               io.creation_user,
               iou.first_names as user_first_names,
               iou.last_name as user_last_name,
               iou.email as user_email,
               io.creation_date,
               to_char(io.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty,
               r.content as comment_string,
               r.mime_type as comment_mime_type,
               d.key,
               d.value
        from   workflow_case_log l join 
               workflow_actions a using (action_id) join 
               cr_items i on (i.item_id = l.entry_id) join 
               acs_objects io on (io.object_id = i.item_id) left outer join 
               acs_users_all iou on (iou.user_id = io.creation_user) join
               cr_revisions r on (r.revision_id = i.live_revision) left outer join 
               workflow_case_log_data d using (entry_id)
        where  l.case_id = :case_id
        order  by creation_date
    </querytext>
</fullquery>
packages/workflow/tcl/case-procs.xql

PostgreSQL XQL file:
packages/workflow/tcl/case-procs-postgresql.xql

Oracle XQL file:
packages/workflow/tcl/case-procs-oracle.xql

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