Commit af277b21 authored by Frank Bergmann's avatar Frank Bergmann

-- WIP

parent 9ceacf3c
......@@ -53,6 +53,9 @@ ad_proc -public im_project_reminders_send { } {
set sql "
select
t.task_id as object_id,
p.project_name as object_name,
p.parent_id as parent_object_id,
(select project_name from im_projects where project_id = p.parent_id) as parent_object_name,
p.end_date,
(SELECT EXTRACT(EPOCH FROM (to_char(current_timestamp,'YYYY-MM-DD HH24:MI:00')::timestamp +
'$offset_end_date_timesheet_tasks seconds'::interval-to_char(p.end_date,'YYYY-MM-DD HH24:MI:00')::timestamp)))
......@@ -69,16 +72,19 @@ ad_proc -public im_project_reminders_send { } {
append sql "
UNION
select
task_id as object_id,
end_date,
tt.task_id as object_id,
tt.task_name as object_name,
tt.project_id as parent_object_id,
(select project_name from im_projects where project_id = tt.project_id) as parent_object_name,
tt.end_date,
(SELECT EXTRACT(EPOCH FROM (to_char(current_timestamp,'YYYY-MM-DD HH24:MI:00')::timestamp +
'$offset_end_date_translation_tasks seconds'::interval-to_char(end_date,'YYYY-MM-DD HH24:MI:00')::timestamp)))
'$offset_end_date_translation_tasks seconds'::interval-to_char(tt.end_date,'YYYY-MM-DD HH24:MI:00')::timestamp)))
as diff
from
im_trans_tasks
im_trans_tasks tt
where
(SELECT EXTRACT(EPOCH FROM (to_char(current_timestamp,'YYYY-MM-DD HH24:MI:00')::timestamp +
'$offset_end_date_translation_tasks seconds'::interval-to_char(end_date,'YYYY-MM-DD HH24:MI:00')::timestamp))) = 0
'$offset_end_date_translation_tasks seconds'::interval-to_char(tt.end_date,'YYYY-MM-DD HH24:MI:00')::timestamp))) = 0
and task_status_id not in (360, 365, 370, 372)
"
}
......@@ -104,7 +110,7 @@ ad_proc -public im_project_reminders_send { } {
}
}
im_project_reminders_send_notification_to_object_members $object_id "" 0
im_project_reminders_send_notification_to_object_members $object_id $object_name $parent_object_name "" 0
}
}
......@@ -112,6 +118,10 @@ ad_proc -public im_project_reminders_send { } {
ad_proc -private im_project_reminders_send_notification_to_object_members {
{ object_id "" }
{ object_name "" }
{ parent_object_id "" }
{ parent_object_name "" }
{ diff "" }
{ from_email "" }
{ do_not_send_email_p 0 }
} {
......@@ -149,7 +159,6 @@ ad_proc -private im_project_reminders_send_notification_to_object_members {
select
tt.task_type_id,
(select project_lead_id from im_projects where project_id = tt.project_id) as trans_project_lead_id,
tt.task_name as object_name,
tt.trans_id,
tt.edit_id,
tt.proof_id,
......@@ -187,7 +196,7 @@ ad_proc -private im_project_reminders_send_notification_to_object_members {
set object_name [db_string sql "select project_name from im_projects where project_id = :object_id" -default 0]
set sql "
select
u.email
u.user_id
from
cc_users u,
acs_rels r
......@@ -213,8 +222,23 @@ ad_proc -private im_project_reminders_send_notification_to_object_members {
# remove duplicates
set parties_to_be_notified_id [lsort -unique $parties_to_be_notified_id]
# Set mail attributes
switch $object_type {
"im_trans_task" {
set mail_body_txt "Planned end date of task: <br/>$object_name <br/> of project: <br/><a href='/intranet-translation/trans-tasks/task-list?project_id=$parent_object_id&view_name=trans_tasks'>$parent_object_name</a><br/>"
append mail_body_txt "will be reached shortly and task has not been marked as DONE yet.<br/>Please review."
}
"im_timesheet_task" {
set mail_body_txt "Planned end date of task: <br/><a href='/intranet/projects/view?project_id=$object_id'>$object_name<br/> of project: <br/>$parent_object_name<br/> will be reached shortly and task has not been marked as DONE yet.<br/>Please review."
}
default {
ns_log Notice "im_project_reminders_send_notification_to_object_members: Exit - object_type: $object_type not supported"
return
}
}
set mail_subject [lang::message::lookup "" intranet-project-reminders.Mail_Subject_Text "Friendly Reminder - Task is due soon "]
set mail_body [lang::message::lookup "" intranet-project-reminders.Mail_Body_Text_Html "Planned end date of task: <br/> $object_name <br/> will be reached shortly and task has not been marked as DONE yet.<br/>Please review."]
set mail_body [lang::message::lookup "" intranet-project-reminders.Mail_Body_Text_Html $mail_body_txt]
if { $log_p } {
if {[catch {
......
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