diff --git a/booking.admin.inc b/booking.admin.inc index 7715605..e5a1260 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -429,6 +429,7 @@ function booking_admin() ) ) ); + $form['regn_options']['booking_enable_skills'] = array( '#type' => 'radios', '#title' => t('Enable special skills information?'), @@ -522,6 +523,16 @@ function booking_admin() '#size' => 150, '#maxlength' => 2000 ); + + $form['management']['booking_import_include_fields_dynamic'] = array( + '#type' => 'select', + '#multiple' => TRUE, + '#title' => t('Select database fields'), + '#description' => t('Select database fields to import from an uploaded CSV file. Ensure you hold down control/command when selecting multiple options.'), + '#options' => _booking_get_person_fields(), + '#default_value' => variable_get('booking_import_include_fields_dynamic', ''), + ); + return system_settings_form($form); } diff --git a/booking.helper.inc b/booking.helper.inc index 64a53fd..ba90650 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -1315,6 +1315,19 @@ function _booking_paypal_form_builder($node, &$form_state, $person, $invoiceid, return $form; } +/** + * Helper function to provide a list of columns in the booking_person table + * This will be used to select which fields to import/export to/from a CSV + */ +function _booking_get_person_fields() { + $query = db_query('SHOW COLUMNS FROM {booking_person}'); + $list_of_columns = new stdClass(); + while ($res = db_fetch_array($query)) { + $list_of_columns->$res['Field'] = $res['Field']; + } + return $list_of_columns; +} + /** * Helper function to format registrations details for summary in the confirmation email