From d1dc168197c8ddfa6d0435ffa1fc63f764035127 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 29 Jun 2017 11:38:26 +1000 Subject: [PATCH] early access code development --- booking.regn_form.inc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/booking.regn_form.inc b/booking.regn_form.inc index 5a22dcd..0372da7 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -36,8 +36,9 @@ function booking_register_page() '#markup' => $output ) ); + //even if we are allowed to show the early access code, only show it if it is prior to the normal registration opening time $return_array[] = array( - 'form' => drupal_get_form('booking_form', true, true) + 'form' => drupal_get_form('booking_form', true, ($booking_times->booking_register_open < time())) ); } elseif ($booking_times->booking_register_close < time()) { //too late to register @@ -938,6 +939,16 @@ function booking_form_validate($form, &$form_state) { $node = $form_state['values']['form_id']; $data = $form_state['input']; //watchdog('booking', '
Booking registration form validation:\n@info
', array('@info' => print_r( $data, true))); + + //if necessary, validate early access code + if (variable_get('booking_enable_earlyaccess_codes', 0) == 1) { + if (isset($data['booking_regn_earlyaccess_code']) && $data['booking_regn_earlyaccess_code'] != '') { + + } + else { + form_set_error('booking_regn_earlyaccess_code', t('You must enter an early access code to register now. If you do not have a code, please wait until normal registrations open.')); + } + } //in case the date of birth field hasn't been filled out watchdog('booking', 'Blank date of birth checking: @info', array( @@ -970,7 +981,6 @@ function booking_form_validate($form, &$form_state) { //verify partner id is in the correct format if (isset($data['booking_partner_id']) && $data['booking_partner_id'] != '') { - if (!is_numeric($data['booking_partner_id'])) { form_set_error('booking_partner_id', t('You have entered an invalid partner registration id. Please ensure you are using only the registration reference number your partner received via email. If you believe this to be incorrect, please !contact using the details provided.', array( '!contact' => l('contact us', 'contact')