Skip to content

Commit

Permalink
Merge branch 'release-1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
alextselegidis committed Feb 14, 2016
2 parents 02505e8 + d3e8680 commit 58c996a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
- Issue #4: Raising more useful exceptions and enable error logging by default.
- Issue #6: Business Logic created is not getting assigned to service provider.
Expand Down
2 changes: 1 addition & 1 deletion src/application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 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_google_sync_feature'] = Config::GOOGLE_SYNC_FEATURE;

Expand Down
48 changes: 24 additions & 24 deletions src/application/controllers/appointments.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ public function index($appointment_hash = '') {
} else {
// The customer is going to book a new appointment so there is no
// need for the manage functionality to be initialized.
$manage_mode = FALSE;
$appointment = array();
$provider = array();
$customer = array();
$manage_mode = FALSE;
$appointment = array();
$provider = array();
$customer = array();
}

// Load the book appointment view.
Expand Down Expand Up @@ -174,7 +174,8 @@ public function cancel($appointment_hash) {
// :: SYNC APPOINTMENT REMOVAL WITH GOOGLE CALENDAR
if ($appointment['id_google_calendar'] != NULL) {
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) {
$google_token = json_decode($this->providers_model
Expand All @@ -192,18 +193,19 @@ public function cancel($appointment_hash) {
try {
$this->load->library('Notifications');

$send_provider = $this->providers_model
->get_setting('notifications', $provider['id']);
$send_provider = filter_var($this->providers_model
->get_setting('notifications', $provider['id']), FILTER_VALIDATE_BOOLEAN);

if ($send_provider == TRUE) {
$this->notifications->send_delete_appointment($appointment, $provider,
$service, $customer, $company_settings, $provider['email'],
$_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,
$service, $customer, $company_settings, $customer['email'],
$_POST['cancel_reason']);
Expand Down Expand Up @@ -310,7 +312,7 @@ public function ajax_get_available_hours() {
$_POST['selected_date'], $exclude_appointments);

$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);

Expand All @@ -329,6 +331,7 @@ public function ajax_get_available_hours() {
public function ajax_register_appointment() {
try {
$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('providers_model');
Expand Down Expand Up @@ -377,8 +380,8 @@ public function ajax_register_appointment() {
// The provider must have previously granted access to his google calendar account
// in order to sync the appointment.
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) {
$google_token = json_decode($this->providers_model
Expand Down Expand Up @@ -411,10 +414,7 @@ public function ajax_register_appointment() {
try {
$this->load->library('Notifications');

$send_provider = $this->providers_model
->get_setting('notifications', $provider['id']);

if (!$post_data['manage_mode']) {
if ($post_data['manage_mode'] == FALSE) {
$customer_title = $this->lang->line('appointment_booked');
$customer_message = $this->lang->line('thank_you_for_appointment');
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
Expand All @@ -436,14 +436,18 @@ public function ajax_register_appointment() {
. $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,
$service, $customer,$company_settings, $customer_title,
$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) {
$this->notifications->send_appointment_details($appointment, $provider,
$service, $customer, $company_settings, $provider_title,
Expand Down Expand Up @@ -539,7 +543,7 @@ private function get_provider_available_time_periods($provider_id, $selected_dat
$this->load->model('providers_model');

// 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(
'id_users_provider' => $provider_id
Expand Down Expand Up @@ -756,11 +760,7 @@ private function calculate_available_hours(array $empty_periods, $selected_date,
// 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.
if (date('m/d/Y', strtotime($selected_date)) === date('m/d/Y')) {
if ($manage_mode) {
$book_advance_timeout = 0;
} else {
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
}
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');

foreach($available_hours as $index => $value) {
$available_hour = strtotime($value);
Expand Down
16 changes: 8 additions & 8 deletions src/assets/js/backend_calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ var BackendCalendar = {
$('#enable-sync span:eq(1)').text(EALang['disable_sync']);
$('#google-sync').prop('disabled', false);
} else {
$('#enable-sync').removeClass('btn-success enabled');
$('#enable-sync').removeClass('btn-danger enabled');
$('#enable-sync span:eq(1)').text(EALang['enable_sync']);
$('#google-sync').prop('disabled', true);
}
Expand Down Expand Up @@ -382,11 +382,13 @@ var BackendCalendar = {
// Set the start and end datetime of the appointment.
var startDatetime = Date.parseExact(appointment['start_datetime'],
'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'],
'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'];
$dialog.find('#customer-id').val(appointment['id_users_customer']);
Expand All @@ -411,9 +413,9 @@ var BackendCalendar = {

// :: APPLY UNAVAILABLE DATA TO DIALOG
$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-start').val(unavailable.start_datetime.toString('dd/MM/yyyy HH:mm'));
$dialog.find('#unavailable-end').val(unavailable.end_datetime.toString('dd/MM/yyyy HH:mm'));
$dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime);
$dialog.find('#unavailable-notes').val(unavailable.notes);
}

Expand Down Expand Up @@ -774,7 +776,7 @@ var BackendCalendar = {

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']);
$('#google-sync').prop('disabled', true);
$('#select-filter-item option:selected').attr('google-sync', 'false');
Expand Down Expand Up @@ -1952,7 +1954,6 @@ var BackendCalendar = {
minuteText: EALang['minutes'],
firstDay: 1
});
// $dialog.find('#start-datetime').val(formattedStartDatetime);
$dialog.find('#start-datetime').datepicker('setDate', startDatetime);

$dialog.find('#end-datetime').datetimepicker({
Expand Down Expand Up @@ -1982,7 +1983,6 @@ var BackendCalendar = {
minuteText: EALang['minutes'],
firstDay: 1
});
// $dialog.find('#end-datetime').val(formattedEndDatetime);
$dialog.find('#end-datetime').datepicker('setDate', endDatetime);
},

Expand Down

0 comments on commit 58c996a

Please sign in to comment.