initial work on early access codes

This commit is contained in:
2017-06-26 21:55:10 +10:00
parent 3af311609c
commit e332a35fa0
7 changed files with 87 additions and 44 deletions

View File

@@ -71,6 +71,8 @@ module_load_include('inc', 'booking', 'booking.rooms_allocate');
module_load_include('inc', 'booking', 'booking.rooms_admin');
// Load the include for stripe payments
module_load_include('inc', 'booking', 'booking.stripe');
// Load the include for miscellaneous functions
module_load_include('inc', 'booking', 'booking.misc');
function booking_init() {
date_default_timezone_set(date_default_timezone(FALSE));
@@ -946,46 +948,6 @@ function booking_requirements($phase) {
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) {
// Add your own function to the array of validation callbacks