CraigT543 / EasyBlue

Modifications for Easy!Appointments
21 stars 23 forks source link

Client not receiving emails, I am getting confirmation emails to provider but not client. #24

Open xxnumbxx opened 6 years ago

CraigT543 commented 6 years ago

There are a few reasons this can happen:

  1. Check the General Settings page. You should see Customer Notifications and a button that is colored blue (blue means it is selected and customers should receive notifications)

  2. Also in the General Settings page, if "Show Confidentiality Notice and Agreement" is set to yes, then the client is able to decline receiving messages if they choose. So if it is set to yes, then I would check in the client customers details page. You should see a Receive Notifications option there, if it is set to "yes" then the client will receive notifications.

  3. Then there are faults in the server, such as the email method is set up incorrectly. I doubt that is the case here. But, I have had some instances when my email would not send due to little glitches when the server system updates. I have made some modifications to how my reminders and waiting list are sending so that they are all using the PHPMailer like is done in EA. I have not yet put that into this build but I will in a few months.

Craig

liberatorcnx commented 6 years ago

I am having exactly the same problem - no customer notification emails. 'Customer Notifications' is ON, 'Show Confidentiality Notice and Agreement' is OFF, but no emails sent to customer (provider emails are sent fine). Individual customer records all have 'Receive Notifications' set to YES.

I also have vanilla 'Easy!Appointments' installed on my server (separate database etc) and it works fine. If you could point me to the relevant script(s) I am happy to take a look.

CraigT543 commented 6 years ago

I wonder if the issue is the logic for if the Confidentiality option is off. Try turning it on, make an appointment and see if the notice sends. If it sends, then it is clearly that bit of logic. I will then try to track that down. I am running with the option on and I have no problem. So I would suppose that is the issue. I do not have my test site up to run myself right now so if you can try let me know.

And, by notifications I am supposing that you are referring to the notification that sends when you book the appointment, not just the reminders and waiting list items that I added, correct?

xxnumbxx commented 6 years ago

Turning on the confidentiality option function does in fact fix the problem.

CraigT543 commented 6 years ago

That narrows it down a lot, thanks. I will dig in and find the error.

CraigT543 commented 6 years ago

The logic is in /application/controllers/Appointments.php starting at line 512

CraigT543 commented 6 years ago

I did not include any logic for $clientnotification == 'no'

I think adding this after line 529 may work:

`

            if (($send_customer === TRUE) && ( $clientnotification == 'no')) {
                $go_customer = TRUE;
            }

            if (($send_customer === TRUE) && ( $clientnotification == 'no') && ($customer['notifications']==1)) {
                $go_customer = TRUE;
            }

            if (($send_customer === TRUE) && ( $clientnotification == 'no') && ($customer['notifications']==0)) {
                $go_customer = FALSE;
            }               

`

I cannot test it. It is just a guess. That is all I can do for today. I have to get back to work.

xxnumbxx commented 6 years ago

This fixed the problem. Thanks for your help.

CraigT543 commented 6 years ago

Ok, I will update the code. Thanks for testing it out.

liberatorcnx commented 6 years ago

Thank you for that - it has fixed the problem.

I think the code can be simplified quite a lot now, because $go_customer is FALSE anyway, unless set by this code to true. I changed that whole section to;

            if (($send_customer === TRUE) && ($customer['notifications']==1)) {
                $email->sendAppointmentDetails($appointment, $provider,
                $service, $customer,$company_settings, $customer_title,
                $customer_message, $customer_link, new Email($customer['email']));
            }

It works for me but I can't check all scenarios easily (I've removed some of the code because I don't use it).