Index: openacs-4/packages/workflow/tcl/case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs.tcl,v diff -u -N -r1.39 -r1.40 --- openacs-4/packages/workflow/tcl/case-procs.tcl 1 Mar 2006 13:16:34 -0000 1.39 +++ openacs-4/packages/workflow/tcl/case-procs.tcl 8 Aug 2006 21:27:25 -0000 1.40 @@ -62,6 +62,7 @@ -user_id -assignment -package_id + {-initial_action_id ""} } { Start a new case for this workflow and object. @@ -89,8 +90,17 @@ db_transaction { # Initial action - set initial_action_id [workflow::get_element -workflow_id $workflow_id -element initial_action_id] + if {0} { + # get initial action not from cache + array set row [workflow::get_not_cached -workflow_id $workflow_id] + set initial_action_id $row(initial_action_id) + array unset row + } + if {[empty_string_p $initial_action_id]} { + set initial_action_id [workflow::get_element -workflow_id $workflow_id -element initial_action_id] + } + if { [empty_string_p $initial_action_id] } { # If there is no initial-action, we create one now # TODO: Should we do this here, or throw an error like we used to? @@ -1667,7 +1677,7 @@ set hr [string repeat "=" 70] # TODO: Get activity log for top-case - array set latest_action [lindex [workflow::case::get_activity_log_info -case_id $case_id] end] + array set latest_action [lindex [workflow::case::get_activity_log_info_not_cached -case_id $case_id] end] # Variables used by I18N messages: set action_past_tense "$latest_action(action_pretty_past_tense)[ad_decode $latest_action(log_title) "" "" " $latest_action(log_title)"]" @@ -1751,8 +1761,15 @@ # This takes deputies into account #XXXXX Verify this ... probably wrong - set assignee_list [db_list enabled_action_assignees {}] - + set assigned_role_id [workflow::action::get_assigned_role -action_id $action_id] + set assignee_list [list] + foreach assignee_array [workflow::case::role::get_assignees \ + -case_id $case_id \ + -role_id $assigned_role_id] { + array set ass $assignee_array + lappend assignee_list $ass(party_id) + } + # List of users who play some role in this case # This takes deputies into account set case_player_list [db_list case_players {}] @@ -1807,25 +1824,24 @@ foreach type { workflow_assignee workflow_my_cases workflow_case workflow } { - set object_id [workflow::case::get_notification_object \ - -type $type \ - -workflow_id $case(workflow_id) \ - -case_id $case_id] + set object_id [workflow::case::get_notification_object \ + -type $type \ + -workflow_id $case(workflow_id) \ + -case_id $case_id] - if { ![empty_string_p $object_id] } { - - set notified_list [concat $notified_list [notification::new \ - -type_id [notification::type::get_type_id -short_name $type] \ - -object_id $object_id \ - -action_id $entry_id \ - -response_id $case(object_id) \ - -notif_subject $subject($type) \ - -notif_text $body($type) \ - -already_notified $notified_list \ - -subset $subset($type) \ - -return_notified]] + if { ![empty_string_p $object_id] && ($type eq "workflow" || ![empty_string_p $subset($type)] || $type eq "workflow_case")} { + set notified_list [concat $notified_list [notification::new \ + -type_id [notification::type::get_type_id -short_name $type] \ + -object_id $object_id \ + -action_id $entry_id \ + -response_id $case(object_id) \ + -notif_subject $subject($type) \ + -notif_text $body($type) \ + -already_notified $notified_list \ + -subset $subset($type) \ + -return_notified]] + } } - } } @@ -1849,6 +1865,7 @@ ad_proc -public workflow::case::action::execute { {-no_notification:boolean} {-no_perm_check:boolean} + {-no_logging:boolean} {-enabled_action_id {}} {-case_id {}} {-action_id {}} @@ -1883,6 +1900,8 @@ @param no_perm_check Set this switch if you do not want any permissions chcecking, e.g. for automatic actions. + @param no_perm_check Set this switch if you do not want to have any workflow_case loggings. + @param package_id The package_id the case object belongs to. This is optional but is useful if the case objects are not CR items. @return entry_id of the new log entry (will be a cr_item). @@ -1981,13 +2000,15 @@ oacs_util::vars_to_ns_set \ -ns_set $extra_vars \ -var_list { entry_id case_id action_id comment comment_mime_type package_id} - - set entry_id [package_instantiate_object \ - -creation_user $user_id \ - -extra_vars $extra_vars \ - -package_name "workflow_case_log_entry" \ - "workflow_case_log_entry"] + if {!$no_logging_p} { + set entry_id [package_instantiate_object \ + -creation_user $user_id \ + -extra_vars $extra_vars \ + -package_name "workflow_case_log_entry" \ + "workflow_case_log_entry"] + } + # Fire side-effects workflow::case::action::do_side_effects \ -case_id $case_id \