revert changes

This commit is contained in:
2017-06-29 16:10:36 +10:00
parent 6459d7d243
commit 238c8a8ed7
3 changed files with 24 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ function booking_earlyaccess_admin() {
//get a list of all the early access codes for this event //get a list of all the early access codes for this event
$codelist_query = db_select('booking_earlyaccess_codes', 'c'); $codelist_query = db_select('booking_earlyaccess_codes', 'c');
$codelist_query->leftJoin('booking_person', 'p', 'p.booking_earlyaccess_code = c.booking_earlyaccess_code'); $codelist_query->leftJoin('booking_person', 'p', 'c.cid = p.booking_earlyaccess_code_id');
$codelist_query->condition('c.booking_eventid', $event->eid, '=') $codelist_query->condition('c.booking_eventid', $event->eid, '=')
->fields('c') ->fields('c')
->fields('p') ->fields('p')

View File

@@ -631,7 +631,7 @@ function booking_update_7241() {
*/ */
function booking_update_7242() { function booking_update_7242() {
//add field to booking_person table //add field to booking_person table
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE); $spec = array('type' => 'int', 'length' => '11', 'not null' => FALSE);
db_add_field('booking_person', 'booking_earlyaccess_code_id', $spec); db_add_field('booking_person', 'booking_earlyaccess_code_id', $spec);
//create new table to store the valid codes //create new table to store the valid codes
@@ -661,12 +661,9 @@ function booking_update_7243() {
} }
/** /**
* Rename booking_earlyaccess_code_id in booking_person table to booking_earlyaccess_code * Rename booking_regn_earlyaccess_codes table to booking_earlyaccess_codes
*/ */
function booking_update_7244() { function booking_update_7244() {
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
db_change_field('booking_person', 'booking_earlyaccess_code_id', 'booking_earlyaccess_code', $spec);
db_drop_table('booking_regn_earlyaccess_codes'); db_drop_table('booking_regn_earlyaccess_codes');
//create new table to store the valid codes //create new table to store the valid codes
@@ -686,6 +683,18 @@ function booking_update_7244() {
_booking_node_create_mysqlview(); _booking_node_create_mysqlview();
} }
/**
* Rename booking_earlyaccess_code back to booking_earlyaccess_code_id in booking_person table
*/
function booking_update_7245() {
$spec = array('type' => 'int', 'length' => '11', 'not null' => FALSE);
db_change_field('booking_person', 'booking_earlyaccess_code', 'booking_earlyaccess_code_id', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/** /**
* Implementation of hook_install(). * Implementation of hook_install().
*/ */
@@ -756,7 +765,7 @@ function booking_schema() {
'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' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), 'booking_earlyaccess_code_id' => array('type' => 'int', 'length' => '11', '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),

View File

@@ -1136,6 +1136,13 @@ function booking_form_submit($form, &$form_state)
$payment_total_price = db_query("SELECT booking_price FROM {booking_price} where pid = :pid", array( $payment_total_price = db_query("SELECT booking_price FROM {booking_price} where pid = :pid", array(
':pid' => $form_state['input']['booking_payment_id'] ':pid' => $form_state['input']['booking_payment_id']
))->fetchObject(); ))->fetchObject();
//lookup the primary key for the early access code, if it is in use
if ((variable_get('booking_enable_earlyaccess_codes', 0) == 1) && (!empty($form_state['input']['booking_earlyaccess_code']))) {
$earlyaccess_query = db_query("SELECT cid FROM {booking_earlyaccess_codes} where booking_earlyaccess_code = :code",
array(':code' => $values['booking_earlyaccess_code']))
->fetchObject();
}
//make a new node object //make a new node object
$node = new stdClass(); $node = new stdClass();
@@ -1248,7 +1255,7 @@ function booking_form_submit($form, &$form_state)
$node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details']; $node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details'];
$node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N'); $node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N');
$node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details']; $node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
$node->booking_earlyaccess_code = empty($values['booking_earlyaccess_code']) ? '' : $values['booking_earlyaccess_code']; $node->booking_earlyaccess_code = empty($values['booking_earlyaccess_code']) ? '' : $earlyaccess_query->cid;
//remove newlines from these fields so the CSV output doesn't get messed up //remove newlines from these fields so the CSV output doesn't get messed up
$medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions']; $medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];