update mysql view for variety session registration ids

This commit is contained in:
Nathan Coad
2018-05-03 08:53:10 +10:00
parent 59cbcb9c52
commit 2521a6fd96
3 changed files with 20 additions and 1 deletions

View File

@@ -791,6 +791,13 @@ function booking_update_7254() {
db_rename_table('booking_variety_options', 'booking_variety_sessions');
}
/**
* Fix incorrect field name in booking_variety_regn table
*/
function booking_update_7255() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10');
db_change_field('booking_variety_regn', 'booking_node_id', 'booking_person_nid', $spec);
}
/**
* Implementation of hook_install().
@@ -1087,7 +1094,7 @@ function booking_schema() {
'fields' => array(
'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_ids' => array('type' => 'varchar', 'length' => '1000', 'not null' => TRUE),
'booking_node_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_person_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('rid'),
);

View File

@@ -72,6 +72,11 @@ function _booking_node_create_mysqlview()
}
}
//add the joins for variety session info if enabled
if (variable_get('booking_enable_variety_sessions', 0) == 1) {
$query->leftJoin('booking_variety_regn', 'v', 'p.nid = v.booking_person_nid');
}
//filter the results either by current active event
// @todo is this filter really necessary?
$query->condition('p.booking_eventid', $event->eid, '=');
@@ -102,6 +107,11 @@ function _booking_node_create_mysqlview()
}
}
//add field for variety session registrations if enabled
if (variable_get('booking_enable_variety_sessions', 0) == 1) {
$query->fields('v', array('booking_variety_ids'));
}
//now that we have built the query as a SelectObject, turn it into a string we can use to create a view
$querystring=$query->__toString();
$querystring=str_replace("{",'',$querystring);

View File

@@ -200,4 +200,6 @@ function booking_variety_regn_form_submit($form, &$form_state) {
//use an update query for the regncount field
//based on update booking_variety_sessions set booking_variety_regncount = booking_variety_regncount+1 where vid = 1;
//store the selected variety sessions as a json encoded array of IDs in field booking_variety_ids
}