Added check before sending the notification.

This commit is contained in:
Alex Tselegidis 2015-11-24 23:12:37 +01:00
parent 7cbd6901b0
commit 8fd024d34d
3 changed files with 30 additions and 36 deletions

View file

@ -192,9 +192,14 @@ class Appointments extends CI_Controller {
$_POST['cancel_reason']);
}
$this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $customer['email'],
$_POST['cancel_reason']);
$send_customer = $this->settings_model->get_setting('customer_notifications');
if ((bool)$send_customer === TRUE) {
$this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $customer['email'],
$_POST['cancel_reason']);
}
} catch(Exception $exc) {
$exceptions[] = $exc;
}
@ -458,9 +463,13 @@ class Appointments extends CI_Controller {
. $appointment['hash'];
}
$this->notifications->send_appointment_details($appointment, $provider,
$service, $customer,$company_settings, $customer_title,
$customer_message, $customer_link, $customer['email']);
$send_customer = $this->settings_model->get_setting('customer_notifications');
if ((bool)$send_customer === TRUE) {
$this->notifications->send_appointment_details($appointment, $provider,
$service, $customer,$company_settings, $customer_title,
$customer_message, $customer_link, $customer['email']);
}
if ($send_provider == TRUE) {
$this->notifications->send_appointment_details($appointment, $provider,

View file

@ -230,9 +230,14 @@ class Backend_api extends CI_Controller {
. $appointment['hash'];
}
$this->notifications->send_appointment_details($appointment, $provider,
$service, $customer, $company_settings, $customer_title,
$customer_message, $customer_link, $customer['email']);
$send_customer = $this->settings_model->get_setting('customer_notifications');
if ((bool)$send_customer === TRUE) {
$this->notifications->send_appointment_details($appointment, $provider,
$service, $customer, $company_settings, $customer_title,
$customer_message, $customer_link, $customer['email']);
}
if ($send_provider == TRUE) {
$this->notifications->send_appointment_details($appointment, $provider,
@ -329,9 +334,13 @@ class Backend_api extends CI_Controller {
$_POST['delete_reason']);
}
$this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $customer['email'],
$_POST['delete_reason']);
$send_customer = $this->settings_model->get_setting('customer_notifications');
if ((bool)$send_customer === TRUE) {
$this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $customer['email'],
$_POST['delete_reason']);
}
} catch(Exception $exc) {
$warnings[] = exceptionToJavaScript($exc);
}

View file

@ -240,30 +240,6 @@ class Notifications {
return TRUE;
}
/**
* Sends a simple email to notify for a new installation.
*
* This method will be only used for tracking the number of installations. No personal
* data will be retrieved for any other cause.
*
* @returns bool Returns the "send()" method result.
*/
public function send_new_installation($company_name, $company_email, $company_link) {
$mail = new PHPMailer();
$mail->From = $company_email;
$mail->FromName = 'New Installation: ' . $company_name ;
$mail->AddAddress('info@easyappointments.org');
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Subject = 'New Easy!Appointments Installation';
$mail->Body = 'Base URL: ' . $this->ci->config->item('base_url') . '<br>'
. 'E!A Version: ' . $this->ci->config->item('ea_version') . '<br>'
. 'Company Name: ' . $company_name . '<br>'
. 'Company Email: ' . $company_email . '<br>'
. 'Company Link: ' . $company_link . '<br>';
return $mail->Send();
}
}
/* End of file notifications.php */