phpScheduleIt
May 21, 2013, 02:41:26 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Disable duplicate notification emails sent to reservation owner.  (Read 649 times)
tsjobom
Newbie
*

Karma: 0
Posts: 4


« on: April 22, 2012, 10:05:09 PM »

Hi, I'm looking for a way to remove the "owner" (the user who booked the resource) recipient from the "Notification: A Reservation Was Created" emails that is being sent to resource admin users when having $conf['settings']['reservation.notify']['resource.admin.add'] = 'true';

Right now I'm getting duplicate emails to the "owner user" who booked the resource when that users notification settings are turned on. I want the Notification email to be sent ONLY to the resource admin, NOT the user who booked the resource. Problem is I still want the "Your Reservation Was Created" email that is sent to the owner so I can't just turn off the notification for the "owner" user.

Best Regards, any help would be appreciated.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: April 23, 2012, 01:11:38 PM »

My suggestion would be what you described: Turn off email notifications for that user. Why doesn't that work for this situation?
Logged
tsjobom
Newbie
*

Karma: 0
Posts: 4


« Reply #2 on: April 23, 2012, 04:45:36 PM »

Hi Nick, thanks for your reply.

If I turn off email notifications for the user, he doesn't receive the "Your Reservation Was Created" email when booking a resource.
If it is on, he receives both the "Your Reservation Was Created" and the "Notification: A Reservation Was Created" emails. I only want the first one of these to be sent to the user who booked the appointment and the latter to be sent to the resource admin.

Regards,
Tobias
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #3 on: April 24, 2012, 09:46:07 AM »

I see. I'll put this on my list.
Logged
tsjobom
Newbie
*

Karma: 0
Posts: 4


« Reply #4 on: April 24, 2012, 05:00:32 PM »

Thank you Nick, much appreciated.

Just an FYI, the "owner" user also gets copies for notification emails sent to application and group admins, so he might receive up to 3 copies of the "Notification: Created/Updated/Deleted" emails.

Any idea where to look in the code to modify this myself?
Logged
IflyGC
Newbie
*

Karma: 0
Posts: 5


« Reply #5 on: April 24, 2012, 07:03:12 PM »

I'm pleased it's not just me seeing this.  I have an "admin" group with 4 users that have admin priviledges and everytime an email gets generated, the first person on the list gets an email addressed to him, a second email addressed to him and person #2, a third email with him, #2 and #3, and a 4th with all 4 recipients.
The second person gets three emails, the third person just 2 and the lucky last person only gets the one. 

The rather ugly work around was to give all 4 people a fake email address (.comm) and add a 5th person to the loop that sends an email to a distribution loop that then gets sent back to the 4 users.  Ugly, but works.

Any ideas how to fix this one?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #6 on: April 30, 2012, 01:27:12 PM »

Quote
a second email addressed to him and person #2, a third email with him, #2 and #3, and a 4th with all 4 recipients.

I'm not sure I understand. There's nowhere in the code appending recipients to a list. Each email is sent to only one recipient. How can I reproduce this?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #7 on: April 30, 2012, 01:30:26 PM »

Try changing line 86 of /lib/Application/Reservation/Notification/AdminEmailNotification.php to

Quote
if (array_key_exists($id, $adminIds) || $id == $owner->Id())
Logged
grego
Newbie
*

Karma: 0
Posts: 41


« Reply #8 on: May 04, 2012, 01:39:52 PM »

I guess, $phpMailer should forget email address.

In /phpScheduleIt/lib/Email/EmailService.php
Quote
class EmailService implements IEmailService
{
        ...
        public function Send(IEmailMessage $emailMessage)
        {
                $this->phpMailer->ClearAddresses();
                $this->phpMailer->CharSet = $emailMessage->Charset();
                ...
         }
}
Logged
ToniNord
Newbie
*

Karma: 0
Posts: 2


WWW
« Reply #9 on: May 06, 2012, 02:58:02 AM »

Try changing line 86 of /lib/Application/Reservation/Notification/AdminEmailNotification.php to

Quote
if (array_key_exists($id, $adminIds) || $id == $owner->Id())

Hahh, it worked for me too Kiss

Saved and bookmarked.

Thank you, all there.
Logged
tsjobom
Newbie
*

Karma: 0
Posts: 4


« Reply #10 on: May 12, 2012, 03:33:48 PM »

grego+Nicks fixes solved this issue for me. Thanks guys!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!