initial work on early access codes
This commit is contained in:
@@ -607,6 +607,17 @@ function booking_admin() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form['regn_options']['booking_enable_earlyaccess_codes'] = array(
|
||||||
|
'#type' => 'radios',
|
||||||
|
'#title' => t('Allow early access to registration form with unique code?'),
|
||||||
|
'#description' => t('Select whether to enable the feature that will allow early registrations with a unique code. Note this feature is still under development.'),
|
||||||
|
'#options' => array(
|
||||||
|
0 => t('No'),
|
||||||
|
t('Yes')
|
||||||
|
),
|
||||||
|
'#default_value' => variable_get('booking_enable_earlyaccess_codes', 0)
|
||||||
|
);
|
||||||
|
|
||||||
$form['management'] = array(
|
$form['management'] = array(
|
||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// $Id: booking.import_data.inc,v 0.1
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Provide functionality to upload csv for bulk update of payment data
|
* Provide functionality to upload csv for bulk update of payment data
|
||||||
|
@@ -674,7 +674,8 @@ function booking_schema() {
|
|||||||
//identifiers
|
//identifiers
|
||||||
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||||
'booking_eventid' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
'booking_eventid' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
||||||
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
|
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
|
||||||
|
'booking_earlyaccess_code_id' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
|
||||||
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
|
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
|
||||||
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
||||||
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
|
||||||
@@ -988,5 +989,16 @@ function booking_schema() {
|
|||||||
'primary key' => array('mid'),
|
'primary key' => array('mid'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//This lists all the early registration access codes
|
||||||
|
$schema['booking_regn_earlyaccess_codes'] = array(
|
||||||
|
'fields' => array(
|
||||||
|
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||||
|
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||||
|
'booking_regn_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
|
||||||
|
'booking_regn_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||||
|
),
|
||||||
|
'primary key' => array('cid'),
|
||||||
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
50
booking.misc.inc
Normal file
50
booking.misc.inc
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Provide a home for miscellaneous functions that don't really belong anywhere else
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for generating the "lucky number" to be used on the lanyard
|
||||||
|
*/
|
||||||
|
function booking_generate_luckynumbers() {
|
||||||
|
global $event;
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
//query for the mappings relating to $readinggroup_studygroup_id
|
||||||
|
$attendee_query = db_query("SELECT * FROM {booking_person} WHERE booking_eventid = :eid",
|
||||||
|
array(':eid' => $event->eid));
|
||||||
|
$attendees = $attendee_query->fetchAll();
|
||||||
|
|
||||||
|
//assuming there's less than 900 people, generate numbers within that range and shuffle the order
|
||||||
|
$numbers = range(100,750);
|
||||||
|
shuffle($numbers);
|
||||||
|
|
||||||
|
foreach ($attendees as $attendee)
|
||||||
|
{
|
||||||
|
$luckynum = $numbers[$i++];
|
||||||
|
|
||||||
|
drupal_set_message(t('Updating user !id to have lucky number !num.',
|
||||||
|
array('!id' => $attendee->nid, '!num' => $luckynum)));
|
||||||
|
|
||||||
|
//run an update query
|
||||||
|
db_update('booking_person')
|
||||||
|
->fields(array (
|
||||||
|
'booking_luckynum' => $luckynum,
|
||||||
|
))
|
||||||
|
->condition('nid', $attendee->nid)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
drupal_set_message(t('Finished.'));
|
||||||
|
|
||||||
|
return t("<h3>Generate Lucky Numbers</h3>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to populate the booking_regn_earlyaccess_codes table used for storing and checking early registration access codes
|
||||||
|
*/
|
||||||
|
function booking_generate_earlyregn_codes() {
|
||||||
|
global $event;
|
||||||
|
}
|
@@ -71,6 +71,8 @@ module_load_include('inc', 'booking', 'booking.rooms_allocate');
|
|||||||
module_load_include('inc', 'booking', 'booking.rooms_admin');
|
module_load_include('inc', 'booking', 'booking.rooms_admin');
|
||||||
// Load the include for stripe payments
|
// Load the include for stripe payments
|
||||||
module_load_include('inc', 'booking', 'booking.stripe');
|
module_load_include('inc', 'booking', 'booking.stripe');
|
||||||
|
// Load the include for miscellaneous functions
|
||||||
|
module_load_include('inc', 'booking', 'booking.misc');
|
||||||
|
|
||||||
function booking_init() {
|
function booking_init() {
|
||||||
date_default_timezone_set(date_default_timezone(FALSE));
|
date_default_timezone_set(date_default_timezone(FALSE));
|
||||||
@@ -946,46 +948,6 @@ function booking_requirements($phase) {
|
|||||||
return $requirements;
|
return $requirements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function for generating the "lucky number" to be used on the lanyard
|
|
||||||
* @todo move this into a better place. It doesn't belong here
|
|
||||||
*/
|
|
||||||
function booking_generate_luckynumbers() {
|
|
||||||
global $event;
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
//query for the mappings relating to $readinggroup_studygroup_id
|
|
||||||
$attendee_query = db_query("SELECT * FROM {booking_person} WHERE booking_eventid = :eid",
|
|
||||||
array(':eid' => $event->eid));
|
|
||||||
$attendees = $attendee_query->fetchAll();
|
|
||||||
|
|
||||||
//assuming there's less than 900 people, generate numbers within that range and shuffle the order
|
|
||||||
$numbers = range(100,750);
|
|
||||||
shuffle($numbers);
|
|
||||||
|
|
||||||
foreach ($attendees as $attendee)
|
|
||||||
{
|
|
||||||
$luckynum = $numbers[$i++];
|
|
||||||
|
|
||||||
drupal_set_message(t('Updating user !id to have lucky number !num.',
|
|
||||||
array('!id' => $attendee->nid, '!num' => $luckynum)));
|
|
||||||
|
|
||||||
//run an update query
|
|
||||||
|
|
||||||
db_update('booking_person')
|
|
||||||
->fields(array (
|
|
||||||
'booking_luckynum' => $luckynum,
|
|
||||||
))
|
|
||||||
->condition('nid', $attendee->nid)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
}
|
|
||||||
drupal_set_message(t('Finished.'));
|
|
||||||
|
|
||||||
return t("<h3>Generate Lucky Numbers</h3>");
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
function booking_form_user_profile_form_alter(&$form, &$form_state) {
|
function booking_form_user_profile_form_alter(&$form, &$form_state) {
|
||||||
// Add your own function to the array of validation callbacks
|
// Add your own function to the array of validation callbacks
|
||||||
|
@@ -116,7 +116,16 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
$payment_type_options[$row->pid] = $row->booking_price_descrip . ' ($' . $price . ')';
|
$payment_type_options[$row->pid] = $row->booking_price_descrip . ' ($' . $price . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
//form starts here
|
// ------- form starts here ---------
|
||||||
|
|
||||||
|
//add new feature for early registration access
|
||||||
|
if ($inserting == TRUE && variable_get('booking_enable_earlyaccess_codes', 1) == 1) {
|
||||||
|
$form['early-access'] = array(
|
||||||
|
'#type' => 'fieldset',
|
||||||
|
'#title' => 'Early Registration Code'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$form['your-details'] = array(
|
$form['your-details'] = array(
|
||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => 'Personal details'
|
'#title' => 'Personal details'
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Admin pages for configuring a variety session
|
* Admin pages for configuring a variety session
|
||||||
|
* NOTE: This feature is not complete and probably never will be
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function booking_variety_admin()
|
function booking_variety_admin()
|
||||||
|
Reference in New Issue
Block a user