| |
1631 |
1631 |
{-case_id:required} |
| |
1632 |
1632 |
{-action_id:required} |
| |
1633 |
1633 |
{-entry_id:required} |
| |
1634 |
1634 |
{-comment:required} |
| |
1635 |
1635 |
{-comment_mime_type:required} |
| |
1636 |
1636 |
} { |
| |
1637 |
1637 |
Send out notifications to relevant people. |
| |
1638 |
1638 |
} { |
| |
1639 |
1639 |
# Get workflow_id |
| |
1640 |
1640 |
workflow::case::get \ |
| |
1641 |
1641 |
-case_id $case_id \ |
| |
1642 |
1642 |
-array case |
| |
1643 |
1643 |
|
| |
1644 |
1644 |
workflow::get \ |
| |
1645 |
1645 |
-workflow_id $case(workflow_id) \ |
| |
1646 |
1646 |
-array workflow |
| |
1647 |
1647 |
|
| |
1648 |
1648 |
set hr [string repeat "=" 70] |
| |
1649 |
1649 |
|
| |
1650 |
1650 |
# TODO: Get activity log for top-case |
| |
1651 |
|
array set latest_action [lindex [workflow::case::get_activity_log_info -case_id $case_id] end] |
| |
|
1651 |
array set latest_action [lindex [workflow::case::get_activity_log_info_not_cached -case_id $case_id] end] |
| |
1652 |
1652 |
|
| |
1653 |
1653 |
# Variables used by I18N messages: |
| |
1654 |
1654 |
set action_past_tense "$latest_action(action_pretty_past_tense)[ad_decode $latest_action(log_title) "" "" " $latest_action(log_title)"]" |
| |
1655 |
1655 |
set user_name "$latest_action(user_first_names) $latest_action(user_last_name)" |
| |
1656 |
1656 |
set user_email $latest_action(user_email) |
| |
1657 |
1657 |
set latest_action_chunk [_ workflow.notification_email_latest_action_chunk] |
| |
1658 |
1658 |
|
| |
1659 |
1659 |
if { ![empty_string_p $latest_action(comment)] } { |
| |
1660 |
1660 |
append latest_action_chunk ":\n\n [join [split [ad_html_text_convert -from $latest_action(comment_mime_type) -to "text/plain" -maxlen 66 -- $latest_action(comment)] "\n"] "\n "]" |
| |
1661 |
1661 |
} |
| |
1662 |
1662 |
|
| |
1663 |
1663 |
# Callback to get notification info |
| |
1664 |
1664 |
# TODO: Should this be the parent/top-workflow that does this? |
| |
1665 |
1665 |
set contract_name [workflow::service_contract::notification_info] |
| |
1666 |
1666 |
set impl_names [workflow::get_callbacks \ |
| |
1667 |
1667 |
-workflow_id $case(workflow_id) \ |
| |
1668 |
1668 |
-contract_name $contract_name] |
| |
1669 |
1669 |
# We only use the first callback |
| |
1670 |
1670 |
set impl_name [lindex $impl_names 0] |
| |
1671 |
1671 |
|
|
| |
1776 |
1776 |
$hr |
| |
1777 |
1777 |
" |
| |
1778 |
1778 |
set force_p($type) 0 |
| |
1779 |
1779 |
set subset($type) {} |
| |
1780 |
1780 |
} |
| |
1781 |
1781 |
|
| |
1782 |
1782 |
set force_p(workflow_assignee) 1 |
| |
1783 |
1783 |
set subset(workflow_assignee) $assignee_list |
| |
1784 |
1784 |
set subset(workflow_my_cases) $case_player_list |
| |
1785 |
1785 |
|
| |
1786 |
1786 |
set notified_list [list] |
| |
1787 |
1787 |
|
| |
1788 |
1788 |
foreach type { |
| |
1789 |
1789 |
workflow_assignee workflow_my_cases workflow_case workflow |
| |
1790 |
1790 |
} { |
| |
1791 |
1791 |
set object_id [workflow::case::get_notification_object \ |
| |
1792 |
1792 |
-type $type \ |
| |
1793 |
1793 |
-workflow_id $case(workflow_id) \ |
| |
1794 |
1794 |
-case_id $case_id] |
| |
1795 |
1795 |
|
| |
1796 |
|
if { ![empty_string_p $object_id] } { |
| |
1797 |
|
|
| |
|
1796 |
if { ![empty_string_p $object_id] && ($type eq "workflow" || ![empty_string_p $subset($type)])} { |
| |
1798 |
1797 |
set notified_list [concat $notified_list [notification::new \ |
| |
1799 |
1798 |
-type_id [notification::type::get_type_id -short_name $type] \ |
| |
1800 |
1799 |
-object_id $object_id \ |
| |
1801 |
1800 |
-action_id $entry_id \ |
| |
1802 |
1801 |
-response_id $case(object_id) \ |
| |
1803 |
1802 |
-notif_subject $subject($type) \ |
| |
1804 |
1803 |
-notif_text $body($type) \ |
| |
1805 |
1804 |
-already_notified $notified_list \ |
| |
1806 |
1805 |
-subset $subset($type) \ |
| |
1807 |
1806 |
-return_notified]] |
| |
1808 |
1807 |
} |
| |
1809 |
1808 |
} |
| |
1810 |
1809 |
} |
| |
1811 |
1810 |
|
| |
1812 |
1811 |
|
| |
1813 |
1812 |
|
| |
1814 |
1813 |
####################################################################### |
| |
1815 |
1814 |
# |
| |
1816 |
1815 |
# WORKFLOW ENGINE PROCS |
| |
1817 |
1816 |
# |