Commit 71f75022 authored by Frank Bergmann's avatar Frank Bergmann

- Fixed rule-engine support for simple_survey

parent 52efaeaf
......@@ -153,7 +153,7 @@ ad_proc im_rule_callback_log {
# ---------------------------------------------------------------------
ad_proc im_rule_callback {
{ -debug_p 0}
{ -debug_p 1}
{ -action ""}
-object_id:required
{ -type_id ""}
......@@ -317,7 +317,7 @@ ad_proc im_rule_callback {
# Check if there are emails to be sent
if {"" != [string trim $rule_action_email_to_tcl]} {
im_rule_callback_fire_email -email_tcl $rule_action_email_to_tcl -object_id $object_id -rule_id $rule_id -env $env
im_rule_callback_fire_email -debug_p $debug_p -email_tcl $rule_action_email_to_tcl -object_id $object_id -rule_id $rule_id -env $env
}
}
}
......@@ -370,6 +370,7 @@ ad_proc im_rule_callback_fire_email {
-rule_id:required
-env:required
{-debug_p 0}
{-process_mail_queue_now_p 1}
} {
Send out an email to the users specified
} {
......@@ -379,6 +380,10 @@ ad_proc im_rule_callback_fire_email {
array set old [lindex $env 0]
array set new [lindex $env 1]
array set changed [lindex $env 2]
if {$debug_p} { ns_log Notice "im_rule_callback_fire_email: old=[array get old]" }
if {$debug_p} { ns_log Notice "im_rule_callback_fire_email: new=[array get new]" }
if {$debug_p} { ns_log Notice "im_rule_callback_fire_email: changed=[array get changed]" }
db_1row rule_info "
select r.*
......@@ -390,6 +395,8 @@ ad_proc im_rule_callback_fire_email {
# Execute the email action
#
if {"" != [string trim $rule_action_email_to_tcl]} {
if {$debug_p} { ns_log Notice "im_rule_callback_fire_email: rule_action_email_to_tcl=$rule_action_email_to_tcl" }
if {[catch {
set cmd "set out \[$rule_action_email_to_tcl\]"
eval $cmd
......@@ -400,6 +407,7 @@ ad_proc im_rule_callback_fire_email {
-message $out -statement $rule_action_email_to_tcl -env $env
return
}
if {$debug_p} { ns_log Notice "im_rule_callback_fire_email: sending emails to: '$out'" }
# Log the result of the command
im_rule_callback_log -object_id $object_id -rule_id $rule_id -source "action_email_to_fire" \
......@@ -472,13 +480,7 @@ ad_proc im_rule_callback_fire_email {
ns_log Notice "im_rule_callback_fire_email: Sending email to $email: $subject\n$body"
if {$debug_p} {
ad_return_complaint 1 "<pre> acs_mail_lite::send
-send_immediately
-to_addr $email
-from_addr $new(sender_email)
-subject $subject
-body $body"
ad_script_abort
# ad_return_complaint 1 "<pre> acs_mail_lite::send\n\t-send_immediately\n\t-to_addr $email\n\t-from_addr $new(sender_email)\n\t-subject $subject\n\t-body $body"; ad_script_abort
} else {
if {[catch {
acs_mail_lite::send \
......@@ -501,6 +503,13 @@ ad_proc im_rule_callback_fire_email {
}
}
# ---------------------------------------------------------------
# Process the mail queue right now
# ---------------------------------------------------------------
if {$process_mail_queue_now_p} {
acs_mail_process_queue
}
ns_log Notice "im_rule_callback_fire_email: finished: object_id=$object_id, rule_id="
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment