From 7df9904aaf6c0b068ebf7e5752cd59d4eb8a77d6 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 29 Jun 2017 16:19:49 +1000 Subject: [PATCH] add node id to earlyaccess codes table --- booking.install | 11 +++++++++++ booking.regn_form.inc | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/booking.install b/booking.install index 1caeff6..5fcfd4b 100644 --- a/booking.install +++ b/booking.install @@ -673,6 +673,7 @@ function booking_update_7244() { 'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'), 'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE), 'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE), + 'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'), ), 'primary key' => array('cid'), ); @@ -693,6 +694,15 @@ function booking_update_7245() { _booking_node_create_mysqlview(); } +/** +* Add node id to booking_earlyaccess_codes table +*/ +function booking_update_7246() { + $spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'); + db_add_field('booking_earlyaccess_codes', 'booking_earlyaccess_code_nid', $spec); + //update the view to match the new table definition + _booking_node_create_mysqlview(); +} /** @@ -1086,6 +1096,7 @@ function booking_schema() { 'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'), 'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE), 'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE), + 'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'), ), 'primary key' => array('cid'), ); diff --git a/booking.regn_form.inc b/booking.regn_form.inc index 5982dc4..c8a2657 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -1308,7 +1308,8 @@ function _booking_form_submit_post_triggers($node) //update the database to mark the code as being unavailable db_update('booking_earlyaccess_codes')->fields(array( - 'booking_earlyaccess_code_avail' => 'N' + 'booking_earlyaccess_code_avail' => 'N', + 'booking_earlyaccess_code_nid' => $node->nid, ))->condition('cid', $node->booking_earlyaccess_code_id)->execute(); }