Merge branch 'release-1.1.1' into develop

This commit is contained in:
Alex Tselegidis 2016-02-14 14:28:27 +01:00
commit e243a7b16c
4 changed files with 38 additions and 33 deletions

View file

@ -3,6 +3,11 @@ This file contains the code changes that were introduced into each release
(starting from v1.1.0) so that is easy for developers to maintain and readjust (starting from v1.1.0) so that is easy for developers to maintain and readjust
their custom modifications on the main project codebase. their custom modifications on the main project codebase.
### Version 1.1.1
- Issue #116: Book advance timeout not taken into account for proposed appointments.
- Issue #118: Google Calendar and notification mail problem bug.
- Issue #120: Invalid appointment date set after editing an existing appointment.
### Version 1.1.0 ### Version 1.1.0
- Issue #4: Raising more useful exceptions and enable error logging by default. - Issue #4: Raising more useful exceptions and enable error logging by default.
- Issue #6: Business Logic created is not getting assigned to service provider. - Issue #6: Business Logic created is not getting assigned to service provider.

View file

@ -9,7 +9,7 @@
| the global "config" variable. | the global "config" variable.
| |
*/ */
$config['ea_version'] = '1.1.0'; // This must be changed manually. $config['ea_version'] = '1.1.1'; // This must be changed manually.
$config['ea_release_title'] = ''; // Leave empty for no title or add BETA, TEST etc ... $config['ea_release_title'] = ''; // Leave empty for no title or add BETA, TEST etc ...
$config['ea_google_sync_feature'] = Config::GOOGLE_SYNC_FEATURE; $config['ea_google_sync_feature'] = Config::GOOGLE_SYNC_FEATURE;

View file

@ -104,10 +104,10 @@ class Appointments extends CI_Controller {
} else { } else {
// The customer is going to book a new appointment so there is no // The customer is going to book a new appointment so there is no
// need for the manage functionality to be initialized. // need for the manage functionality to be initialized.
$manage_mode = FALSE; $manage_mode = FALSE;
$appointment = array(); $appointment = array();
$provider = array(); $provider = array();
$customer = array(); $customer = array();
} }
// Load the book appointment view. // Load the book appointment view.
@ -174,7 +174,8 @@ class Appointments extends CI_Controller {
// :: SYNC APPOINTMENT REMOVAL WITH GOOGLE CALENDAR // :: SYNC APPOINTMENT REMOVAL WITH GOOGLE CALENDAR
if ($appointment['id_google_calendar'] != NULL) { if ($appointment['id_google_calendar'] != NULL) {
try { try {
$google_sync = $this->providers_model->get_setting('google_sync',$appointment['id_users_provider']); $google_sync = filter_var($this->providers_model
->get_setting('google_sync',$appointment['id_users_provider']), FILTER_VALIDATE_BOOLEAN);
if ($google_sync == TRUE) { if ($google_sync == TRUE) {
$google_token = json_decode($this->providers_model $google_token = json_decode($this->providers_model
@ -192,8 +193,8 @@ class Appointments extends CI_Controller {
try { try {
$this->load->library('Notifications'); $this->load->library('Notifications');
$send_provider = $this->providers_model $send_provider = filter_var($this->providers_model
->get_setting('notifications', $provider['id']); ->get_setting('notifications', $provider['id']), FILTER_VALIDATE_BOOLEAN);
if ($send_provider == TRUE) { if ($send_provider == TRUE) {
$this->notifications->send_delete_appointment($appointment, $provider, $this->notifications->send_delete_appointment($appointment, $provider,
@ -201,9 +202,10 @@ class Appointments extends CI_Controller {
$_POST['cancel_reason']); $_POST['cancel_reason']);
} }
$send_customer = $this->settings_model->get_setting('customer_notifications'); $send_customer = filter_var($this->settings_model->get_setting('customer_notifications'),
FILTER_VALIDATE_BOOLEAN);
if ((bool)$send_customer === TRUE) { if ($send_customer === TRUE) {
$this->notifications->send_delete_appointment($appointment, $provider, $this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $customer['email'], $service, $customer, $company_settings, $customer['email'],
$_POST['cancel_reason']); $_POST['cancel_reason']);
@ -310,7 +312,7 @@ class Appointments extends CI_Controller {
$_POST['selected_date'], $exclude_appointments); $_POST['selected_date'], $exclude_appointments);
$available_hours = $this->calculate_available_hours($empty_periods, $_POST['selected_date'], $available_hours = $this->calculate_available_hours($empty_periods, $_POST['selected_date'],
$_POST['service_duration'], (bool)$_POST['manage_mode']); $_POST['service_duration'], filter_var($_POST['manage_mode'], FILTER_VALIDATE_BOOLEAN));
echo json_encode($available_hours); echo json_encode($available_hours);
@ -329,6 +331,7 @@ class Appointments extends CI_Controller {
public function ajax_register_appointment() { public function ajax_register_appointment() {
try { try {
$post_data = $_POST['post_data']; // alias $post_data = $_POST['post_data']; // alias
$post_data['manage_mode'] = filter_var($post_data['manage_mode'], FILTER_VALIDATE_BOOLEAN);
$this->load->model('appointments_model'); $this->load->model('appointments_model');
$this->load->model('providers_model'); $this->load->model('providers_model');
@ -377,8 +380,8 @@ class Appointments extends CI_Controller {
// The provider must have previously granted access to his google calendar account // The provider must have previously granted access to his google calendar account
// in order to sync the appointment. // in order to sync the appointment.
try { try {
$google_sync = $this->providers_model->get_setting('google_sync', $google_sync = filter_var($this->providers_model->get_setting('google_sync',
$appointment['id_users_provider']); $appointment['id_users_provider']), FILTER_VALIDATE_BOOLEAN);
if ($google_sync == TRUE) { if ($google_sync == TRUE) {
$google_token = json_decode($this->providers_model $google_token = json_decode($this->providers_model
@ -411,10 +414,7 @@ class Appointments extends CI_Controller {
try { try {
$this->load->library('Notifications'); $this->load->library('Notifications');
$send_provider = $this->providers_model if ($post_data['manage_mode'] == FALSE) {
->get_setting('notifications', $provider['id']);
if (!$post_data['manage_mode']) {
$customer_title = $this->lang->line('appointment_booked'); $customer_title = $this->lang->line('appointment_booked');
$customer_message = $this->lang->line('thank_you_for_appointment'); $customer_message = $this->lang->line('thank_you_for_appointment');
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/' $customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
@ -436,14 +436,18 @@ class Appointments extends CI_Controller {
. $appointment['hash']; . $appointment['hash'];
} }
$send_customer = $this->settings_model->get_setting('customer_notifications'); $send_customer = filter_var($this->settings_model->get_setting('customer_notifications'),
FILTER_VALIDATE_BOOLEAN);
if ((bool)$send_customer === TRUE) { if ($send_customer == TRUE) {
$this->notifications->send_appointment_details($appointment, $provider, $this->notifications->send_appointment_details($appointment, $provider,
$service, $customer,$company_settings, $customer_title, $service, $customer,$company_settings, $customer_title,
$customer_message, $customer_link, $customer['email']); $customer_message, $customer_link, $customer['email']);
} }
$send_provider = filter_var($this->providers_model ->get_setting('notifications', $provider['id']),
FILTER_VALIDATE_BOOLEAN);
if ($send_provider == TRUE) { if ($send_provider == TRUE) {
$this->notifications->send_appointment_details($appointment, $provider, $this->notifications->send_appointment_details($appointment, $provider,
$service, $customer, $company_settings, $provider_title, $service, $customer, $company_settings, $provider_title,
@ -539,7 +543,7 @@ class Appointments extends CI_Controller {
$this->load->model('providers_model'); $this->load->model('providers_model');
// Get the provider's working plan and reserved appointments. // Get the provider's working plan and reserved appointments.
$working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), true); $working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), TRUE);
$where_clause = array( $where_clause = array(
'id_users_provider' => $provider_id 'id_users_provider' => $provider_id
@ -756,11 +760,7 @@ class Appointments extends CI_Controller {
// booking that is set in the backoffice the system. Normally we might want the customer to book // booking that is set in the backoffice the system. Normally we might want the customer to book
// an appointment that is at least half or one hour from now. The setting is stored in minutes. // an appointment that is at least half or one hour from now. The setting is stored in minutes.
if (date('m/d/Y', strtotime($selected_date)) === date('m/d/Y')) { if (date('m/d/Y', strtotime($selected_date)) === date('m/d/Y')) {
if ($manage_mode) { $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
$book_advance_timeout = 0;
} else {
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
}
foreach($available_hours as $index => $value) { foreach($available_hours as $index => $value) {
$available_hour = strtotime($value); $available_hour = strtotime($value);

View file

@ -291,7 +291,7 @@ var BackendCalendar = {
$('#enable-sync span:eq(1)').text(EALang['disable_sync']); $('#enable-sync span:eq(1)').text(EALang['disable_sync']);
$('#google-sync').prop('disabled', false); $('#google-sync').prop('disabled', false);
} else { } else {
$('#enable-sync').removeClass('btn-success enabled'); $('#enable-sync').removeClass('btn-danger enabled');
$('#enable-sync span:eq(1)').text(EALang['enable_sync']); $('#enable-sync span:eq(1)').text(EALang['enable_sync']);
$('#google-sync').prop('disabled', true); $('#google-sync').prop('disabled', true);
} }
@ -382,11 +382,13 @@ var BackendCalendar = {
// Set the start and end datetime of the appointment. // Set the start and end datetime of the appointment.
var startDatetime = Date.parseExact(appointment['start_datetime'], var startDatetime = Date.parseExact(appointment['start_datetime'],
'yyyy-MM-dd HH:mm:ss'); 'yyyy-MM-dd HH:mm:ss');
$dialog.find('#start-datetime').val(GeneralFunctions.formatDate(startDatetime, GlobalVariables.dateFormat, true)); // $dialog.find('#start-datetime').val(GeneralFunctions.formatDate(startDatetime, GlobalVariables.dateFormat, true));
$dialog.find('#start-datetime').datetimepicker('setDate', startDatetime);
var endDatetime = Date.parseExact(appointment['end_datetime'], var endDatetime = Date.parseExact(appointment['end_datetime'],
'yyyy-MM-dd HH:mm:ss'); 'yyyy-MM-dd HH:mm:ss');
$dialog.find('#end-datetime').val(GeneralFunctions.formatDate(endDatetime, GlobalVariables.dateFormat, true)); // $dialog.find('#end-datetime').val(GeneralFunctions.formatDate(endDatetime, GlobalVariables.dateFormat, true));
$dialog.find('#end-datetime').datetimepicker('setDate', endDatetime);
var customer = appointment['customer']; var customer = appointment['customer'];
$dialog.find('#customer-id').val(appointment['id_users_customer']); $dialog.find('#customer-id').val(appointment['id_users_customer']);
@ -411,9 +413,9 @@ var BackendCalendar = {
// :: APPLY UNAVAILABLE DATA TO DIALOG // :: APPLY UNAVAILABLE DATA TO DIALOG
$dialog.find('.modal-header h3').text('Edit Unavailable Period'); $dialog.find('.modal-header h3').text('Edit Unavailable Period');
$dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime);
$dialog.find('#unavailable-id').val(unavailable.id); $dialog.find('#unavailable-id').val(unavailable.id);
$dialog.find('#unavailable-start').val(unavailable.start_datetime.toString('dd/MM/yyyy HH:mm')); $dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime);
$dialog.find('#unavailable-end').val(unavailable.end_datetime.toString('dd/MM/yyyy HH:mm'));
$dialog.find('#unavailable-notes').val(unavailable.notes); $dialog.find('#unavailable-notes').val(unavailable.notes);
} }
@ -774,7 +776,7 @@ var BackendCalendar = {
BackendCalendar.disableProviderSync(provider['id']); BackendCalendar.disableProviderSync(provider['id']);
$('#enable-sync').removeClass('btn-success enabled'); $('#enable-sync').removeClass('btn-danger enabled');
$('#enable-sync span:eq(1)').text(EALang['enable_sync']); $('#enable-sync span:eq(1)').text(EALang['enable_sync']);
$('#google-sync').prop('disabled', true); $('#google-sync').prop('disabled', true);
$('#select-filter-item option:selected').attr('google-sync', 'false'); $('#select-filter-item option:selected').attr('google-sync', 'false');
@ -1952,7 +1954,6 @@ var BackendCalendar = {
minuteText: EALang['minutes'], minuteText: EALang['minutes'],
firstDay: 1 firstDay: 1
}); });
// $dialog.find('#start-datetime').val(formattedStartDatetime);
$dialog.find('#start-datetime').datepicker('setDate', startDatetime); $dialog.find('#start-datetime').datepicker('setDate', startDatetime);
$dialog.find('#end-datetime').datetimepicker({ $dialog.find('#end-datetime').datetimepicker({
@ -1982,7 +1983,6 @@ var BackendCalendar = {
minuteText: EALang['minutes'], minuteText: EALang['minutes'],
firstDay: 1 firstDay: 1
}); });
// $dialog.find('#end-datetime').val(formattedEndDatetime);
$dialog.find('#end-datetime').datepicker('setDate', endDatetime); $dialog.find('#end-datetime').datepicker('setDate', endDatetime);
}, },