diff --git a/booking.regn_node.inc b/booking.regn_node.inc index 9fada96..0f8fdf2 100644 --- a/booking.regn_node.inc +++ b/booking.regn_node.inc @@ -34,6 +34,12 @@ function _booking_node_create_mysqlview() $query = db_select('booking_person', 'p'); //add price info $query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid'); + + //add the join for earlyaccess code if enabled + if (variable_get('booking_enable_earlyaccess_codes', 0) == 1) { + $query->leftJoin('booking_earlyaccess_codes', 'c', 'p.nid = c.booking_earlyaccess_code_nid'); + } + //add travel form info if it exists $query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid'); @@ -43,7 +49,7 @@ function _booking_node_create_mysqlview() $query->leftJoin('booking_room_definition', 'r', 'rm.booking_roomid = r.rid'); $query->leftJoin('booking_room_locations', 'l', 'l.lid = r.booking_room_location_id'); } - + //add the joins to flatten out study groups into columns if (variable_get('booking_enable_studygroups', 0) == 1) { //get details of the study groups defined for this event @@ -65,6 +71,10 @@ function _booking_node_create_mysqlview() $query->fields('p') ->fields('t') ->fields('pr', array('booking_price', 'booking_price_descrip','booking_late_price')); + + if (variable_get('booking_enable_earlyaccess_codes', 0) == 1) { + $query->fields('c', array('cid', 'booking_earlyaccess_code')); + } if (variable_get('booking_enable_roomallocations', 0) == 1) { $query->fields('rm', array('booking_room_bedtype'))