Example #1
0
/**
 * Send out booking mails.
 *
 * @param  array		Booking details structure.
 */
function send_booking_emails($request)
{
    require_code('notifications');
    // Send receipt to customer
    $customer_email = $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member());
    $customer_name = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
    $receipt = do_template('BOOKING_CONFIRM_FCOMCODE', array('EMAIL_ADDRESS' => $customer_email, 'MEMBER_ID' => strval(get_member()), 'USERNAME' => $customer_name, 'PRICE' => float_format(find_booking_price($request)), 'DETAILS' => make_booking_request_printable($request)));
    dispatch_notification('booking_customer', NULL, do_lang('SUBJECT_BOOKING_CONFIRM', get_site_name()), static_evaluate_tempcode($receipt), array(get_member()), A_FROM_SYSTEM_PRIVILEGED);
    // Send notice to staff
    $notice = do_template('BOOKING_NOTICE_FCOMCODE', array('EMAIL_ADDRESS' => $customer_email, 'MEMBER_ID' => strval(get_member()), 'USERNAME' => $customer_name, 'PRICE' => float_format(find_booking_price($request)), 'DETAILS' => make_booking_request_printable($request)), get_site_default_lang());
    dispatch_notification('booking_inform_staff', NULL, do_lang('SUBJECT_BOOKING_NOTICE', $GLOBALS['FORUM_DRIVER']->get_username(get_member()), get_site_name()), static_evaluate_tempcode($notice), NULL, NULL, 2);
}
Example #2
0
 /**
  * Flesh out the details of a booking.
  *
  * @return tempcode	The result of execution.
  */
 function flesh_out()
 {
     $title = get_page_title('CREATE_BOOKING');
     // Check booking: redirect to last step as re-entrant if not valid
     $request = get_booking_request_from_form();
     $test = check_booking_dates_available($request, array());
     if (!is_null($test)) {
         attach_message($test, 'warn');
         return $this->choose_bookables_and_dates();
     }
     $bookables = array();
     $found = false;
     $bookable_rows = $GLOBALS['SITE_DB']->query_select('bookable', array('*'), NULL, 'ORDER BY sort_order');
     foreach ($bookable_rows as $bookable_row) {
         if (post_param_integer('bookable_' . strval($bookable_row['id']) . '_quantity', 0) > 0) {
             $found = true;
             $supplements = array();
             $supplement_rows = $GLOBALS['SITE_DB']->query_select('bookable_supplement a JOIN ' . get_table_prefix() . 'bookable_supplement_for b ON a.id=b.supplement_id', array('a.*'), array('bookable_id' => $bookable_row['id']), 'ORDER BY sort_order');
             foreach ($supplement_rows as $supplement_row) {
                 $supplements[] = array('SUPPLEMENT_ID' => strval($supplement_row['id']), 'SUPPLEMENT_TITLE' => get_translated_tempcode($supplement_row['title']), 'SUPPLEMENT_SUPPORTS_QUANTITY' => $supplement_row['supports_quantities'] == 1, 'SUPPLEMENT_QUANTITY' => strval(post_param_integer('bookable_' . strval($bookable_row['id']) . '_supplement_' . strval($supplement_row['id']) . '_quantity', 0)), 'SUPPLEMENT_SUPPORTS_NOTES' => $supplement_row['supports_notes'] == 1, 'SUPPLEMENT_NOTES' => post_param('bookable_' . strval($bookable_row['id']) . '_supplement_' . strval($supplement_row['id']) . '_notes', ''));
             }
             $bookables[] = array('BOOKABLE_ID' => strval($bookable_row['id']), 'BOOKABLE_TITLE' => get_translated_tempcode($bookable_row['title']), 'BOOKABLE_SUPPORTS_NOTES' => $bookable_row['supports_notes'] == 1, 'BOOKABLE_NOTES' => post_param('bookable_' . strval($bookable_row['id']) . '_notes', ''), 'BOOKABLE_SUPPLEMENTS' => $supplements, 'BOOKABLE_QUANTITY' => strval(post_param_integer('bookable_' . strval($bookable_row['id']) . '_quantity')));
         }
     }
     if (!$found) {
         warn_exit(do_lang_tempcode('BOOK_QUANTITY_NOTHING_CHOSEN'));
     }
     require_javascript('javascript_ajax');
     require_javascript('javascript_validation');
     return do_template('BOOKING_FLESH_OUT_SCREEN', array('TITLE' => $title, 'BOOKABLES' => $bookables, 'PRICE' => float_format(find_booking_price($request)), 'POST_URL' => build_url(array('page' => '_SELF', 'type' => 'account', 'usergroup' => get_param_integer('usergroup', NULL)), '_SELF'), 'BACK_URL' => build_url(array('page' => '_SELF', 'type' => 'misc', 'usergroup' => get_param_integer('usergroup', NULL)), '_SELF'), 'HIDDEN' => build_keep_post_fields()));
 }