From daa4d28a6ea09cf654d442656aad21b822dbf8c1 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 7 Oct 2015 22:51:12 +0200 Subject: [PATCH] Merged pull request #60 which fixes issue #56 --- src/application/controllers/appointments.php | 6 + .../views/appointments/book_success.php | 240 +++++++++--------- 2 files changed, 128 insertions(+), 118 deletions(-) diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index 6b6434c7..32ed3d6b 100755 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -114,6 +114,7 @@ class Appointments extends CI_Controller { // sync is enabled then add the appointment to the provider's account. try { + $view = array(); $post_data = json_decode($_POST['post_data'], true); $appointment = $post_data['appointment']; $customer = $post_data['customer']; @@ -213,6 +214,11 @@ class Appointments extends CI_Controller { } catch(Exception $exc) { $view['exceptions'][] = $exc; } + + // Save any exceptions to the session and redirect to another page so that the user + // will not add a new appointment on page reload. + $this->load->helper('url'); + $view['exceptions'] = (!empty($view['exceptions'])) ? $view['exceptions'] : array(); $this->session->set_flashdata('book_exceptions', $view['exceptions']); redirect('appointments/book_success/'.$appointment['id']); } diff --git a/src/application/views/appointments/book_success.php b/src/application/views/appointments/book_success.php index c067cee2..db0ba229 100755 --- a/src/application/views/appointments/book_success.php +++ b/src/application/views/appointments/book_success.php @@ -1,118 +1,122 @@ - - - - - - - - <?php echo $this->lang->line('appointment_registered') . ' - ' . $company_name; ?> - - - - - - - - - - - - - -
-
-
- -
- -
-
- ' . $this->lang->line('appointment_registered') . ''; - echo '

' . $this->lang->line('appointment_details_was_sent_to_you') . '

'; - echo ' - '.$this->lang->line('go_to_booking_page').''; - - if ($this->config->item('ea_google_sync_feature')) { - echo ' - '; - } - - // Display exceptions (if any). - if (isset($exceptions)) { - echo '
'; - echo '

Unexpected Errors

'; - foreach($exceptions as $exc) { - echo exceptionToHtml($exc); - } - echo '
'; - } - ?> -
-
-
-
- - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + <?php echo $this->lang->line('appointment_registered') . ' - ' . $company_name; ?> + + + + + + + + + + + + + +
+
+
+ +
+ +
+
+ ' . $this->lang->line('appointment_registered') . ' +

' . $this->lang->line('appointment_details_was_sent_to_you') . '

+ + ' . + $this->lang->line('go_to_booking_page') . ' + + '; + + if ($this->config->item('ea_google_sync_feature')) { + echo ' + '; + } + + // Display exceptions (if any). + if (isset($exceptions)) { + echo '
'; + echo '

Unexpected Errors

'; + foreach($exceptions as $exc) { + echo exceptionToHtml($exc); + } + echo '
'; + } + ?> +
+
+
+
+ + + + + + + + + + + + + + + +