Author Topic: Getting task notification emails to send for Template created tasks  (Read 2788 times)

mcedwards54

  • Newbie
  • *
  • Posts: 18
    • View Profile
First off, great program - I really enjoy working with it.

Apologies if this has been asked/resolved, I searched but didn't find anything.

Using 1.6.2

Background: When tasks are created from a template with Assigned To set through parameters, no task notification email is sent. Working under the assumption that the "Send Email Notification" box must be unchecked when creating a task from template, I went through the code and found this in TaskController.class:

if(array_var($task_data, 'notify') == 'true') {
     try {
          Notifier::taskAssigned($task);
          } catch(Exception $e) {
     } // try
}

Which seems to be the piece that checks if "Send Email Notification" piece and then sends the notification. I can modify this piece to effects the send when manually creating a task, but the effects don't carry over to template created tasks.

Are templated created tasks created through TaskController.class, or are they added by a different controller (TemplateController.class maybe)?

Secondarily, is this (templated tasks not sending notifications) expected/intentional behavior?

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Getting task notification emails to send for Template created tasks
« Reply #1 on: June 28, 2010, 11:57:17 am »
Task assignment notification checkbox is not saved in the DB (it's only used immediately to send an email or not).
Consequently it is not remembered when templates are being instantiated and hence notifications are not sent.

This doesn't look like the desired outcome, so we'll revise it for future versions (it's an architectural decision, so it's not an easy change).

To hack it in, and notify for all assignments. I'd look at the instantiate method in the TemplateController and invoke:

Code: [Select]
          Notifier::taskAssigned($task);

Thanks for reporting

mcedwards54

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Getting task notification emails to send for Template created tasks
« Reply #2 on: June 28, 2010, 02:53:05 pm »
I appreciate the quick reply!

I'm not sure exactly where I should be inserting Notifier::taskAssigned($task);.

I went through TemplateController, tried dropping it in a few places that I thought made sense and got 500 internal server errors.

Do you have an idea of where this should be invoked?

Thanks!

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Getting task notification emails to send for Template created tasks
« Reply #3 on: June 28, 2010, 03:43:51 pm »
Line 429

Currenlty:
Code: [Select]
// copy reminders
$reminders = ObjectReminders::getByObject($object);

New

Code: [Select]
Notifier::taskAssigned($object); // <<---- NEW LINE
// copy reminders
$reminders = ObjectReminders::getByObject($object);

mcedwards54

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Getting task notification emails to send for Template created tasks
« Reply #4 on: June 29, 2010, 10:19:41 am »
Thanks for the reply! I've inserted the code, but I'm still not getting notification emails.

Just to be sure, I tested and manually assigned tasks receive the notifications, so the email functionality works.

Not sure if it matters, but I'm using 1.6.2.

Oh, and debug isn't showing errors.

Any help would be greatly appreciated.

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Getting task notification emails to send for Template created tasks
« Reply #5 on: June 30, 2010, 03:41:32 pm »
For the sake of testing ...

Have you tried moving that statement upwards immediately after the
foreach ($objects as $object) ?