diff --git a/dvg_appointments.module b/dvg_appointments.module index 25d9251..d4fad6f 100644 --- a/dvg_appointments.module +++ b/dvg_appointments.module @@ -1851,25 +1851,29 @@ function _dvg_appointments_get_task_confirm_text_by_product_code($product_code) * Rendered output. */ function _dvg_appointments_create_info($appointment, $html = TRUE) { - $confirm_text = $appointment_tables = $output = array(); - - $markup = array( - '#markup' => _dvg_appointments_table($appointment, $html), - '#prefix' => '
', - '#suffix' => '
', - ); - $output[] = render($markup); - + if ($appointment) { + $confirm_text = $appointment_tables = $output = array(); + $markup = array( + '#markup' => _dvg_appointments_table($appointment, $html), + '#prefix' => '
', + '#suffix' => '
', + ); + $output[] = render($markup); - foreach ($appointment->getProductIds() as $product_id) { - $confirm_text[] = _dvg_appointments_get_task_confirm_text_by_product_code($product_id); - } - $output[] = implode('
', $confirm_text); + foreach ($appointment->getProductIds() as $product_id) { + $confirm_text[] = _dvg_appointments_get_task_confirm_text_by_product_code($product_id); + } - $output = implode("\n", $output); + $output[] = implode('
', $confirm_text); + $output = implode("\n", $output); - return ($html) ? $output : drupal_html_to_text($output); + return ($html) ? $output : drupal_html_to_text($output); + } + else { + watchdog('dvg_appointments', 'An appointment confirmation page was loaded, but there is no appointment. Maybe it is already canceled in another window?'); + drupal_goto('node/' . variable_get('functional_content_nid__dvg_appointments_create')); + } } /**