diff --git a/booking.admin.inc b/booking.admin.inc index e1b4836..7715605 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -1,481 +1,549 @@ 'fieldset', - '#title' => 'Email Addresses', - ); - - $form['email']['booking_from_email'] = array ( - '#type' => 'textfield', - '#title' => t('Sender Email Address'), - '#description' => t("The email address used as the source of outbound emails."), - '#size' => 60, - '#maxlength' => 150, - '#required' => TRUE, - '#default_value' => variable_get('booking_from_email',variable_get('site_mail', ini_get('sendmail_from'))), - ); - - $form['email']['booking_notify_email'] = array ( - '#type' => 'textfield', - '#title' => t('Notification Email Address(es)'), - '#description' => t("The email addresses to which registration notifications are sent."), - '#size' => 60, - '#maxlength' => 200, - '#required' => TRUE, - '#default_value' => variable_get('booking_notify_email',variable_get('site_mail', ini_get('sendmail_from'))), - ); - - $form['email']['booking_contact_email'] = array ( - '#type' => 'textfield', - '#title' => t('Contact Email Address'), - '#description' => t("The email address attendees are instructed to contact for additional information."), - '#size' => 60, - '#maxlength' => 150, - '#required' => TRUE, - '#default_value' => variable_get('booking_contact_email',variable_get('site_mail', ini_get('sendmail_from'))), - ); - - $form['email']['booking_logistics_email'] = array ( - '#type' => 'textfield', - '#title' => t('Logistics Email Address'), - '#description' => t("The email address used for logistics information."), - '#size' => 60, - '#maxlength' => 150, - '#required' => TRUE, - '#default_value' => variable_get('booking_logistics_email',variable_get('site_mail', ini_get('sendmail_from'))), - ); - $form['email']['booking_custom_email_count'] = array ( - '#type' => 'textfield', - '#title' => t('Number of custom email definitions'), - '#description' => t("Set to the number of custom email definitions to use."), - '#size' => 3, - '#maxlength' => 3, - '#default_value' => variable_get('booking_custom_email_count','5'), - ); - - $form['attendee'] = array ( - '#type' => 'fieldset', - '#title' => 'Attendee restrictions', - ); - - $form['attendee']['booking_max_dob'] = array ( - '#type' => 'date_select', - '#title' => t('Maximum Date of Birth'), - '#description' => t("The youngest date of birth you wish to allow into the event."), - '#default_value' => variable_get('booking_max_dob','1995-04-15 00:00:00'), - '#date_format' => 'd/m/Y', - '#date_label_position' => 'within', - '#date_year_range' => '-60:-10' - ); - - $form['attendee']['booking_enable_min_age_restriction'] = array ( - '#type' => 'radios', - '#title' => t('Enable old age restriction?'), - '#description' => t('Set this to Yes if you wish to prevent people over the age defined below from registering.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_min_age_restriction', 1), - ); - - $form['attendee']['booking_min_dob'] = array ( - '#type' => 'date_select', - '#title' => t('Minimum Date of Birth'), - '#description' => t("The oldest date of birth you wish to allow into the event. Note that only the year is taken into account."), - '#default_value' => variable_get('booking_min_dob','1995-04-15 00:00:00'), - '#date_format' => 'd/m/Y', - '#date_label_position' => 'within', - '#date_year_range' => '-60:-10' - ); - - $form['attendee']['booking_regn_limit'] = array ( - '#type' => 'textfield', - '#title' => t('Registration limit'), - '#description' => t("Total number of attendees permitted."), - '#size' => 5, - '#maxlength' => 5, - '#required' => TRUE, - '#default_value' => variable_get('booking_regn_limit','500'), - ); - - $form['paypal'] = array ( - '#type' => 'fieldset', - '#title' => 'Paypal Settings', - ); - $form['paypal']['booking_use_paypal'] = array ( - '#type' => 'radios', - '#title' => t('Use Paypal?'), - '#description' => t('Select whether to use paypal for automatic payment handling, or process payments manually.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_use_paypal', 0), - ); - $form['paypal']['booking_paypal_account'] = array ( - '#type' => 'textfield', - '#title' => t('Specify Paypal Account Address'), - '#default_value' => variable_get('booking_paypal_account', ''), - '#description' => '(email address)', - ); - $form['paypal']['booking_paypal_sandbox'] = array ( - '#type' => 'radios', - '#title' => t('Sandbox/Development mode'), - '#description' => t('When in development mode, the payment gateway will point at sandbox.paypal.com for testing purposes. Leave this as off unless doing testing.'), - '#options' => array (0 => t('Off'), t('On')), - '#default_value' => variable_get('booking_paypal_sandbox', 0), - ); - $form['paypal']['booking_paypal_transaction_fee_fixedcost'] = array ( - '#type' => 'textfield', - '#title' => t('Paypal fixed cost transaction fee'), - '#default_value' => variable_get('booking_paypal_transaction_fee_fixedcost', '0.3'), - '#field_prefix' => '$', - '#size' => 5, - '#description' => 'Transaction fee is currently $0.3 AUD and is added before the percentage fee is applied.', - ); - $form['paypal']['booking_paypal_transaction_fee_percentage'] = array ( - '#type' => 'textfield', - '#title' => t('Paypal Percentage Transaction Fee'), - '#default_value' => variable_get('booking_paypal_transaction_fee_percentage', '2.6'), - '#field_prefix' => '%', - '#size' => 5, - '#description' => 'Percentage of transaction charged as paypal fee, currently 2.6% in Australia', - ); - $form['paypal']['booking_paypal_transaction_fee_percentage_intl'] = array ( - '#type' => 'textfield', - '#title' => t('Paypal Percentage Transaction Fee (International)'), - '#default_value' => variable_get('booking_paypal_transaction_fee_percentage_intl', '3.6'), - '#field_prefix' => '%', - '#size' => 5, - '#description' => 'Percentage of transaction charged as paypal fee for transactions that include currency conversion, currently 3.6% in Australia', - ); - - $form['features'] = array ( - '#type' => 'fieldset', - '#title' => 'Enable/Disable Features', - ); - $form['features']['booking_enable_roomallocations'] = array ( - '#type' => 'radios', - '#title' => t('Enable room allocations?'), - '#description' => t('Select whether to enable the management and allocation of rooms.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_roomallocations', 0), - ); - $form['features']['booking_enable_travelform'] = array ( - '#type' => 'radios', - '#title' => t('Enable travel details form?'), - '#description' => t('Select whether to enable the form that allows attendees to enter their travel details.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_travelform', 0), - ); - $form['features']['booking_enable_studygroups'] = array ( - '#type' => 'radios', - '#title' => t('Enable study group calculations?'), - '#description' => t('Select whether to enable the creation and management of study groups.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_studygroups', 0), - ); - /* - //deprecated now, this information is set in the db table - $form['features']['booking_readinggroup_id'] = array ( - '#type' => 'textfield', - '#title' => t('Studygroup ID for the reading group'), - '#description' => t("Set the ID for the studygroup that corresponds with the reading group. " - . " This option is only applicable if study groups are enabled. Set to zero if reading groups aren't in use. " - . " If in doubt, leave as zero."), - '#size' => 3, - '#maxlength' => 3, - '#default_value' => variable_get('booking_readinggroup_id','0'), - ); - */ - $form['features']['booking_enable_variety_sessions'] = array ( - '#type' => 'radios', - '#title' => t('Enable variety session form?'), - '#description' => t('Note that this feature is still under development and cannot yet be used.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_variety_sessions', 0), - ); - - $form['features']['booking_publish_readinggroups'] = array ( - '#type' => 'radios', - '#title' => t('Display reading group colours on the Who\'s Coming page?'), - '#description' => t('Select whether to publish reading group colours. This option is only applicable if study groups are enabled.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_publish_readinggroups', 0), - ); - - $form['misc'] = array ( - '#type' => 'fieldset', - '#title' => 'Configuration Options', - ); - - $form['misc']['booking_auto_confirm_email'] = array ( - '#type' => 'radios', - '#title' => t('Send An Automatic Registration Email?'), - '#description' => t('Automatically send a confirmation email to a user when they\'ve registered for an event? Set this to No if using paypal and only showing on the "whos coming" page once a person has paid. Or set to Yes if "Show on lists once booked in" is set to No and paypal is not being used. If set to No, a registration confirmation email will be sent to a user when their registration status changes to Paid, either manually or via paypal plugin. '), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_auto_confirm_email', 0), - ); - $form['misc']['booking_auto_workflow_email'] = array ( - '#type' => 'radios', - '#title' => t('Send An Automatic Workflow Email?'), - '#description' => t('Automatically send workflow emails to attendee on events such as status changes, travel details received, etc'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_auto_workflow_email', 0), - ); - $form['misc']['booking_bcc_notify_email_workflow'] = array ( - '#type' => 'radios', - '#title' => t('Include notification email address on outgoing workflow emails?'), - '#description' => t('Send a BCC of any workflow email generated to the notification email address as well'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_bcc_notify_email_workflow', 0), - ); - $form['misc']['booking_auto_show_on_lists'] = array ( - '#type' => 'radios', - '#title' => t('Show on lists once booked in?'), - '#description' => t('Immediately appear on bookedin/waiting lists even before payment is received?'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_auto_show_on_lists', 0), - ); - - $form['misc']['booking_enable_combined_pricing'] = array ( - '#type' => 'radios', - '#title' => t('Use Combined Pricing?'), - '#description' => t('Select whether to combine pricing for married couples (Yes) or have each spouse pay separately (No).'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_combined_pricing', 0), - ); - - $form['regn_options'] = array ( - '#type' => 'fieldset', - '#title' => 'Registration Form Configuration', - ); - - $form['regn_options']['booking_default_country'] = array ( - '#type' => 'select', - '#title' => t('Select Default Country'), - '#description' => t('Select default country for residential address.'), - '#options' => _booking_country_options(), - '#default_value' => variable_get('booking_default_country', 'Australia'), - ); - $form['regn_options']['booking_default_state'] = array ( - '#type' => 'select', - '#title' => t('Select Default State'), - '#description' => t('Select default state for residential address. Select the last value (blank) in most cases, to ensure attendees choose a value for this field'), - '#options' => _booking_state_options(), - '#default_value' => variable_get('booking_default_state', 'NSW'), - ); - - $form['regn_options']['booking_default_gender'] = array ( - '#type' => 'select', - '#title' => t('Select Default Gender'), - '#description' => t('Select default gender for booking form.'), - '#options' => _booking_gender_options(), - '#default_value' => variable_get('booking_default_gender', 'M'), - ); - - $form['regn_options']['booking_allow_couples'] = array ( - '#type' => 'radios', - '#title' => t('Allow married couples?'), - '#description' => t('Select whether to cater for married couples in the registration form'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_allow_couples', 0), - ); - $form['regn_options']['booking_ask_dependant_children'] = array ( - '#type' => 'radios', - '#title' => t('Ask whether a couple has dependant children attending?'), - '#description' => t('Select whether to ask about dependant children of married couples in the registration form'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_ask_dependant_children', 0), - ); - $form['regn_options']['booking_dependant_children_text_definition'] = array ( - '#type' => 'textfield', - '#title' => t('Text to display about dependant children'), - '#default_value' => variable_get('booking_dependant_children_text_definition', 'Please note that only one dependant child under the age of two is allowed.'), - '#description' => 'Text to use on registration form if married couple has said they are bringing children.', - '#size' => 150, - '#maxlength' => 1000, - '#states' => array( - // Only show this field when the 'booking_enable_dietary' radio option is set to No - 'visible' => array( - ':input[name="booking_ask_dependant_children"]' => array('value' => 1), - ), - ), - ); - - $form['regn_options']['booking_dependant_children_text'] = array ( - '#type' => 'radios', - '#title' => t('Ask whether a couple has dependant children attending?'), - '#description' => t('Select whether to ask about dependant children of married couples in the registration form'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_ask_dependant_children', 0), - ); - - $form['regn_options']['booking_enable_medicare'] = array ( - '#type' => 'radios', - '#title' => t('Enable Medicare requirement?'), - '#description' => t('Select whether to include medicare details on registration form.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_medicare', 1), - ); - $form['regn_options']['booking_enforce_medicare_verification'] = array ( - '#type' => 'radios', - '#title' => t('Force Medicare verification?'), - '#description' => t('Prevent people from registering if they do not enter a valid medicare card? (Only applies if medicare details are enabled).'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enforce_medicare_verification', 1), - ); - $form['regn_options']['booking_tshirts_text_definition'] = array ( - '#type' => 'textfield', - '#title' => t('Clothes Sizing Text Definition'), - '#default_value' => variable_get('booking_tshirts_text_definition', 'Preferred t-shirt size'), - '#description' => 'Text to use on registration form to request clothing size (eg t-shirt or hoodie).', - '#size' => 150, - '#maxlength' => 2000, - ); - $form['regn_options']['booking_enable_tshirts'] = array ( - '#type' => 'radios', - '#title' => t('Enable sizing information?'), - '#description' => t('Select whether to include clothe sizing in the booking form.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_tshirts', 0), - ); - - $form['regn_options']['booking_enable_passport'] = array ( - '#type' => 'radios', - '#title' => t('Enable passport information?'), - '#description' => t('Select whether to include passport details in the booking form.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_passport', 0), - ); - $form['regn_options']['booking_enable_helpareas'] = array ( - '#type' => 'radios', - '#title' => t('Enable help area questions?'), - '#description' => t('Select whether to include questions about areas people are willing to help with in the booking form.'), - '#options' => array (0 => t('No'), 1 => t('Yes')), - '#default_value' => variable_get('booking_enable_helpareas', 0), - ); - $form['regn_options']['booking_enabled_helparea_options'] = array ( - '#type' => 'select', - '#multiple' => TRUE, - '#title' => t('Select help areas to enable'), - '#description' => t('Select which questions to include in the booking form. Ensure you hold down control/command when selecting multiple options.'), - '#options' => _booking_get_help_areas(), - '#default_value' => variable_get('booking_enabled_helparea_options', ''), - '#states' => array( - // Only show this field when the 'booking_enable_helpareas' radio option is set to true - 'visible' => array( - ':input[name="booking_enable_helpareas"]' => array('value' => 1), - ), - ), - ); - $form['regn_options']['booking_enable_skills'] = array ( - '#type' => 'radios', - '#title' => t('Enable special skills information?'), - '#description' => t('Select whether to include questions about special skills people have in the booking form.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_skills', 0), - ); - $form['regn_options']['booking_enable_roommate'] = array ( - '#type' => 'radios', - '#title' => t('Enable room-mate selection?'), - '#description' => t('Select whether to allow attendees to list a preferred room-mate in the booking form.'), - '#options' => array (0 => t('No'), t('Yes')), - '#default_value' => variable_get('booking_enable_roommate', 0), - ); - $form['regn_options']['booking_enable_dietary'] = array ( - '#type' => 'radios', - '#title' => t('Allow attendee to specify dietary requirements?'), - '#description' => t('If set to No, the following text definition will be used instead.'), - '#options' => array (0 => t('No'), 1 => t('Yes')), - '#default_value' => variable_get('booking_enable_dietary', 0), - ); - $form['regn_options']['booking_dietary_text_definition'] = array ( - '#type' => 'textfield', - '#title' => t('Dietary Requirements Text Definition'), - '#default_value' => variable_get('booking_dietary_text_definition', 'Please use the contact us form to indicate what dietary requirements you have.'), - '#description' => 'Text to use on registration form if attendee may not specify dietary requirements.', - '#size' => 150, - '#maxlength' => 2000, - '#states' => array( - // Only show this field when the 'booking_enable_dietary' radio option is set to No - 'visible' => array( - ':input[name="booking_enable_dietary"]' => array('value' => 0), - ), - ), - ); - $form['regn_options']['booking_enable_medcond'] = array ( - '#type' => 'radios', - '#title' => t('Allow attendee to specify medical conditions?'), - '#description' => t('If set to No, the following text definition will be used instead.'), - '#options' => array (0 => t('No'), 1 => t('Yes')), - '#default_value' => variable_get('booking_enable_medcond', 0), - ); - $form['regn_options']['booking_medcond_text_definition'] = array ( - '#type' => 'textfield', - '#title' => t('Medical Condition Text Definition'), - '#default_value' => variable_get('booking_medcond_text_definition', 'Please use the contact us form to indicate what medical condition you have.'), - '#description' => 'Text to use on registration form if attendee may not specify a medical condition.', - '#size' => 150, - '#maxlength' => 2000, - '#states' => array( - // Only show this field when the 'booking_enable_medcond' radio option is set to No - 'visible' => array( - ':input[name="booking_enable_medcond"]' => array('value' => 0), - ), - ), - ); - - $form['management'] = array ( - '#type' => 'fieldset', - '#title' => 'Data Management Options', - ); - $form['management']['booking_csv_exclude_fields'] = array ( - '#type' => 'textfield', - '#title' => t('Fields to exclude from CSV report'), - '#default_value' => variable_get('booking_csv_exclude_fields', ''), - '#description' => 'Separate each field with a semi-colon. Field names as per database schema.', - '#size' => 150, - '#maxlength' => 2000, - ); - $form['management']['booking_import_include_fields'] = array ( - '#type' => 'textfield', - '#title' => t('Fields to import from an uploaded CSV file'), - '#default_value' => variable_get('booking_import_include_fields', ''), - '#description' => 'Separate each field with a semi-colon. Field names as per database schema, case sensitive. Nid and booking_status fields compulsory.', - '#size' => 150, - '#maxlength' => 2000, - ); - return system_settings_form($form); +function booking_admin() +{ + //regenerate all our menu hooks when loading this form + menu_rebuild(); + + $form = array(); + + $form['email'] = array( + '#type' => 'fieldset', + '#title' => 'Email Addresses' + ); + + $form['email']['booking_from_email'] = array( + '#type' => 'textfield', + '#title' => t('Sender Email Address'), + '#description' => t("The email address used as the source of outbound emails."), + '#size' => 60, + '#maxlength' => 150, + '#required' => TRUE, + '#default_value' => variable_get('booking_from_email', variable_get('site_mail', ini_get('sendmail_from'))) + ); + + $form['email']['booking_notify_email'] = array( + '#type' => 'textfield', + '#title' => t('Notification Email Address(es)'), + '#description' => t("The email addresses to which registration notifications are sent."), + '#size' => 60, + '#maxlength' => 200, + '#required' => TRUE, + '#default_value' => variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from'))) + ); + + $form['email']['booking_contact_email'] = array( + '#type' => 'textfield', + '#title' => t('Contact Email Address'), + '#description' => t("The email address attendees are instructed to contact for additional information."), + '#size' => 60, + '#maxlength' => 150, + '#required' => TRUE, + '#default_value' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from'))) + ); + + $form['email']['booking_logistics_email'] = array( + '#type' => 'textfield', + '#title' => t('Logistics Email Address'), + '#description' => t("The email address used for logistics information."), + '#size' => 60, + '#maxlength' => 150, + '#required' => TRUE, + '#default_value' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from'))) + ); + $form['email']['booking_custom_email_count'] = array( + '#type' => 'textfield', + '#title' => t('Number of custom email definitions'), + '#description' => t("Set to the number of custom email definitions to use."), + '#size' => 3, + '#maxlength' => 3, + '#default_value' => variable_get('booking_custom_email_count', '5') + ); + + $form['attendee'] = array( + '#type' => 'fieldset', + '#title' => 'Attendee restrictions' + ); + + $form['attendee']['booking_max_dob'] = array( + '#type' => 'date_select', + '#title' => t('Maximum Date of Birth'), + '#description' => t("The youngest date of birth you wish to allow into the event."), + '#default_value' => variable_get('booking_max_dob', '1995-04-15 00:00:00'), + '#date_format' => 'd/m/Y', + '#date_label_position' => 'within', + '#date_year_range' => '-60:-10' + ); + + $form['attendee']['booking_enable_min_age_restriction'] = array( + '#type' => 'radios', + '#title' => t('Enable old age restriction?'), + '#description' => t('Set this to Yes if you wish to prevent people over the age defined below from registering.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_min_age_restriction', 1) + ); + + $form['attendee']['booking_min_dob'] = array( + '#type' => 'date_select', + '#title' => t('Minimum Date of Birth'), + '#description' => t("The oldest date of birth you wish to allow into the event. Note that only the year is taken into account."), + '#default_value' => variable_get('booking_min_dob', '1995-04-15 00:00:00'), + '#date_format' => 'd/m/Y', + '#date_label_position' => 'within', + '#date_year_range' => '-60:-10' + ); + + $form['attendee']['booking_regn_limit'] = array( + '#type' => 'textfield', + '#title' => t('Registration limit'), + '#description' => t("Total number of attendees permitted."), + '#size' => 5, + '#maxlength' => 5, + '#required' => TRUE, + '#default_value' => variable_get('booking_regn_limit', '500') + ); + + $form['paypal'] = array( + '#type' => 'fieldset', + '#title' => 'Paypal Settings' + ); + $form['paypal']['booking_use_paypal'] = array( + '#type' => 'radios', + '#title' => t('Use Paypal?'), + '#description' => t('Select whether to use paypal for automatic payment handling, or process payments manually.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_use_paypal', 0) + ); + $form['paypal']['booking_paypal_account'] = array( + '#type' => 'textfield', + '#title' => t('Specify Paypal Account Address'), + '#default_value' => variable_get('booking_paypal_account', ''), + '#description' => '(email address)' + ); + $form['paypal']['booking_paypal_sandbox'] = array( + '#type' => 'radios', + '#title' => t('Sandbox/Development mode'), + '#description' => t('When in development mode, the payment gateway will point at sandbox.paypal.com for testing purposes. Leave this as off unless doing testing.'), + '#options' => array( + 0 => t('Off'), + t('On') + ), + '#default_value' => variable_get('booking_paypal_sandbox', 0) + ); + $form['paypal']['booking_paypal_transaction_fee_fixedcost'] = array( + '#type' => 'textfield', + '#title' => t('Paypal fixed cost transaction fee'), + '#default_value' => variable_get('booking_paypal_transaction_fee_fixedcost', '0.3'), + '#field_prefix' => '$', + '#size' => 5, + '#description' => 'Transaction fee is currently $0.3 AUD and is added before the percentage fee is applied.' + ); + $form['paypal']['booking_paypal_transaction_fee_percentage'] = array( + '#type' => 'textfield', + '#title' => t('Paypal Percentage Transaction Fee'), + '#default_value' => variable_get('booking_paypal_transaction_fee_percentage', '2.6'), + '#field_prefix' => '%', + '#size' => 5, + '#description' => 'Percentage of transaction charged as paypal fee, currently 2.6% in Australia' + ); + $form['paypal']['booking_paypal_transaction_fee_percentage_intl'] = array( + '#type' => 'textfield', + '#title' => t('Paypal Percentage Transaction Fee (International)'), + '#default_value' => variable_get('booking_paypal_transaction_fee_percentage_intl', '3.6'), + '#field_prefix' => '%', + '#size' => 5, + '#description' => 'Percentage of transaction charged as paypal fee for transactions that include currency conversion, currently 3.6% in Australia' + ); + + $form['features'] = array( + '#type' => 'fieldset', + '#title' => 'Enable/Disable Features' + ); + $form['features']['booking_enable_roomallocations'] = array( + '#type' => 'radios', + '#title' => t('Enable room allocations?'), + '#description' => t('Select whether to enable the management and allocation of rooms.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_roomallocations', 0) + ); + $form['features']['booking_enable_travelform'] = array( + '#type' => 'radios', + '#title' => t('Enable travel details form?'), + '#description' => t('Select whether to enable the form that allows attendees to enter their travel details.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_travelform', 0) + ); + $form['features']['booking_enable_studygroups'] = array( + '#type' => 'radios', + '#title' => t('Enable study group calculations?'), + '#description' => t('Select whether to enable the creation and management of study groups.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_studygroups', 0) + ); + $form['features']['booking_enable_variety_sessions'] = array( + '#type' => 'radios', + '#title' => t('Enable variety session form?'), + '#description' => t('Note that this feature is still under development and cannot yet be used.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_variety_sessions', 0) + ); + + $form['features']['booking_publish_readinggroups'] = array( + '#type' => 'radios', + '#title' => t('Display reading group colours on the Who\'s Coming page?'), + '#description' => t('Select whether to publish reading group colours. This option is only applicable if study groups are enabled.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_publish_readinggroups', 0) + ); + + $form['misc'] = array( + '#type' => 'fieldset', + '#title' => 'Configuration Options' + ); + + $form['misc']['booking_auto_confirm_email'] = array( + '#type' => 'radios', + '#title' => t('Send An Automatic Registration Email?'), + '#description' => t('Automatically send a confirmation email to a user when they\'ve registered for an event? Set this to No if using paypal and only showing on the "whos coming" page once a person has paid. Or set to Yes if "Show on lists once booked in" is set to No and paypal is not being used. If set to No, a registration confirmation email will be sent to a user when their registration status changes to Paid, either manually or via paypal plugin. '), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_auto_confirm_email', 0) + ); + $form['misc']['booking_auto_workflow_email'] = array( + '#type' => 'radios', + '#title' => t('Send An Automatic Workflow Email?'), + '#description' => t('Automatically send workflow emails to attendee on events such as status changes, travel details received, etc'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_auto_workflow_email', 0) + ); + $form['misc']['booking_bcc_notify_email_workflow'] = array( + '#type' => 'radios', + '#title' => t('Include notification email address on outgoing workflow emails?'), + '#description' => t('Send a BCC of any workflow email generated to the notification email address as well'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_bcc_notify_email_workflow', 0) + ); + $form['misc']['booking_auto_show_on_lists'] = array( + '#type' => 'radios', + '#title' => t('Show on lists once booked in?'), + '#description' => t('Immediately appear on bookedin/waiting lists even before payment is received?'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_auto_show_on_lists', 0) + ); + + $form['misc']['booking_enable_combined_pricing'] = array( + '#type' => 'radios', + '#title' => t('Use Combined Pricing?'), + '#description' => t('Select whether to combine pricing for married couples (Yes) or have each spouse pay separately (No).'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_combined_pricing', 0) + ); + + $form['regn_options'] = array( + '#type' => 'fieldset', + '#title' => 'Registration Form Configuration' + ); + + $form['regn_options']['booking_default_country'] = array( + '#type' => 'select', + '#title' => t('Select Default Country'), + '#description' => t('Select default country for residential address.'), + '#options' => _booking_country_options(), + '#default_value' => variable_get('booking_default_country', 'Australia') + ); + $form['regn_options']['booking_default_state'] = array( + '#type' => 'select', + '#title' => t('Select Default State'), + '#description' => t('Select default state for residential address. Select the last value (blank) in most cases, to ensure attendees choose a value for this field'), + '#options' => _booking_state_options(), + '#default_value' => variable_get('booking_default_state', 'NSW') + ); + + $form['regn_options']['booking_default_gender'] = array( + '#type' => 'select', + '#title' => t('Select Default Gender'), + '#description' => t('Select default gender for booking form.'), + '#options' => _booking_gender_options(), + '#default_value' => variable_get('booking_default_gender', 'M') + ); + + $form['regn_options']['booking_allow_couples'] = array( + '#type' => 'radios', + '#title' => t('Allow married couples?'), + '#description' => t('Select whether to cater for married couples in the registration form'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_allow_couples', 0) + ); + $form['regn_options']['booking_ask_dependant_children'] = array( + '#type' => 'radios', + '#title' => t('Ask whether a couple has dependant children attending?'), + '#description' => t('Select whether to ask about dependant children of married couples in the registration form'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_ask_dependant_children', 0) + ); + $form['regn_options']['booking_dependant_children_text_definition'] = array( + '#type' => 'textfield', + '#title' => t('Text to display about dependant children'), + '#default_value' => variable_get('booking_dependant_children_text_definition', 'Please note that only one dependant child under the age of two is allowed.'), + '#description' => 'Text to use on registration form if married couple has said they are bringing children.', + '#size' => 150, + '#maxlength' => 1000, + '#states' => array( + // Only show this field when the 'booking_enable_dietary' radio option is set to No + 'visible' => array( + ':input[name="booking_ask_dependant_children"]' => array( + 'value' => 1 + ) + ) + ) + ); + + $form['regn_options']['booking_dependant_children_text'] = array( + '#type' => 'radios', + '#title' => t('Ask whether a couple has dependant children attending?'), + '#description' => t('Select whether to ask about dependant children of married couples in the registration form'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_ask_dependant_children', 0) + ); + + $form['regn_options']['booking_enable_medicare'] = array( + '#type' => 'radios', + '#title' => t('Enable Medicare requirement?'), + '#description' => t('Select whether to include medicare details on registration form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_medicare', 1) + ); + $form['regn_options']['booking_enforce_medicare_verification'] = array( + '#type' => 'radios', + '#title' => t('Force Medicare verification?'), + '#description' => t('Prevent people from registering if they do not enter a valid medicare card? (Only applies if medicare details are enabled).'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enforce_medicare_verification', 1) + ); + $form['regn_options']['booking_tshirts_text_definition'] = array( + '#type' => 'textfield', + '#title' => t('Clothes Sizing Text Definition'), + '#default_value' => variable_get('booking_tshirts_text_definition', 'Preferred t-shirt size'), + '#description' => 'Text to use on registration form to request clothing size (eg t-shirt or hoodie).', + '#size' => 150, + '#maxlength' => 2000 + ); + $form['regn_options']['booking_enable_tshirts'] = array( + '#type' => 'radios', + '#title' => t('Enable sizing information?'), + '#description' => t('Select whether to include clothe sizing in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_tshirts', 0) + ); + + $form['regn_options']['booking_enable_passport'] = array( + '#type' => 'radios', + '#title' => t('Enable passport information?'), + '#description' => t('Select whether to include passport details in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_passport', 0) + ); + $form['regn_options']['booking_enable_helpareas'] = array( + '#type' => 'radios', + '#title' => t('Enable help area questions?'), + '#description' => t('Select whether to include questions about areas people are willing to help with in the booking form.'), + '#options' => array( + 0 => t('No'), + 1 => t('Yes') + ), + '#default_value' => variable_get('booking_enable_helpareas', 0) + ); + $form['regn_options']['booking_enabled_helparea_options'] = array( + '#type' => 'select', + '#multiple' => TRUE, + '#title' => t('Select help areas to enable'), + '#description' => t('Select which questions to include in the booking form. Ensure you hold down control/command when selecting multiple options.'), + '#options' => _booking_get_help_areas(), + '#default_value' => variable_get('booking_enabled_helparea_options', ''), + '#states' => array( + // Only show this field when the 'booking_enable_helpareas' radio option is set to true + 'visible' => array( + ':input[name="booking_enable_helpareas"]' => array( + 'value' => 1 + ) + ) + ) + ); + $form['regn_options']['booking_enable_skills'] = array( + '#type' => 'radios', + '#title' => t('Enable special skills information?'), + '#description' => t('Select whether to include questions about special skills people have in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_skills', 0) + ); + $form['regn_options']['booking_enable_roommate'] = array( + '#type' => 'radios', + '#title' => t('Enable room-mate selection?'), + '#description' => t('Select whether to allow attendees to list a preferred room-mate in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_roommate', 0) + ); + $form['regn_options']['booking_enable_dietary'] = array( + '#type' => 'radios', + '#title' => t('Allow attendee to specify dietary requirements?'), + '#description' => t('If set to No, the following text definition will be used instead.'), + '#options' => array( + 0 => t('No'), + 1 => t('Yes') + ), + '#default_value' => variable_get('booking_enable_dietary', 0) + ); + $form['regn_options']['booking_dietary_text_definition'] = array( + '#type' => 'textfield', + '#title' => t('Dietary Requirements Text Definition'), + '#default_value' => variable_get('booking_dietary_text_definition', 'Please use the contact us form to indicate what dietary requirements you have.'), + '#description' => 'Text to use on registration form if attendee may not specify dietary requirements.', + '#size' => 150, + '#maxlength' => 2000, + '#states' => array( + // Only show this field when the 'booking_enable_dietary' radio option is set to No + 'visible' => array( + ':input[name="booking_enable_dietary"]' => array( + 'value' => 0 + ) + ) + ) + ); + $form['regn_options']['booking_enable_medcond'] = array( + '#type' => 'radios', + '#title' => t('Allow attendee to specify medical conditions?'), + '#description' => t('If set to No, the following text definition will be used instead.'), + '#options' => array( + 0 => t('No'), + 1 => t('Yes') + ), + '#default_value' => variable_get('booking_enable_medcond', 0) + ); + $form['regn_options']['booking_medcond_text_definition'] = array( + '#type' => 'textfield', + '#title' => t('Medical Condition Text Definition'), + '#default_value' => variable_get('booking_medcond_text_definition', 'Please use the contact us form to indicate what medical condition you have.'), + '#description' => 'Text to use on registration form if attendee may not specify a medical condition.', + '#size' => 150, + '#maxlength' => 2000, + '#states' => array( + // Only show this field when the 'booking_enable_medcond' radio option is set to No + 'visible' => array( + ':input[name="booking_enable_medcond"]' => array( + 'value' => 0 + ) + ) + ) + ); + + $form['management'] = array( + '#type' => 'fieldset', + '#title' => 'Data Management Options' + ); + $form['management']['booking_csv_exclude_fields'] = array( + '#type' => 'textfield', + '#title' => t('Fields to exclude from CSV report'), + '#default_value' => variable_get('booking_csv_exclude_fields', ''), + '#description' => 'Separate each field with a semi-colon. Field names as per database schema.', + '#size' => 150, + '#maxlength' => 2000 + ); + $form['management']['booking_import_include_fields'] = array( + '#type' => 'textfield', + '#title' => t('Fields to import from an uploaded CSV file'), + '#default_value' => variable_get('booking_import_include_fields', ''), + '#description' => 'Separate each field with a semi-colon. Field names as per database schema, case sensitive. Nid and booking_status fields compulsory.', + '#size' => 150, + '#maxlength' => 2000 + ); + return system_settings_form($form); } -function booking_admin_validate($form, $form_state) { - //TODO: put back in when using booking start and end dates - /* -$booking_start = $form_state['values']['booking_start']; -$booking_end = $form_state['values']['booking_end']; - - -//create timestamps for comparison -$booking_start_ts = _date_to_ts( $booking_start ); -$booking_end_ts = _date_to_ts( $booking_end ); - - -//validate main conference start and end dates -if ($booking_start_ts > $booking_end_ts) { -form_set_error('booking_date_endbeforestart', t('You have selected a Conference end date that is before the Conference start date.')); -} else { -variable_set('booking_conference_dates', _date_range_to_string($booking_start, $booking_end)); -drupal_set_message( t('Conference date range: "!date"', array ('!date' => _date_range_to_string($booking_start, $booking_end)))); +function booking_admin_validate($form, $form_state) +{ + //TODO: put back in when using booking start and end dates + /* + $booking_start = $form_state['values']['booking_start']; + $booking_end = $form_state['values']['booking_end']; + + + //create timestamps for comparison + $booking_start_ts = _date_to_ts( $booking_start ); + $booking_end_ts = _date_to_ts( $booking_end ); + + + //validate main conference start and end dates + if ($booking_start_ts > $booking_end_ts) { + form_set_error('booking_date_endbeforestart', t('You have selected a Conference end date that is before the Conference start date.')); + } else { + variable_set('booking_conference_dates', _date_range_to_string($booking_start, $booking_end)); + drupal_set_message( t('Conference date range: "!date"', array ('!date' => _date_range_to_string($booking_start, $booking_end)))); + } + */ } -*/ -} - diff --git a/booking.module b/booking.module index c54875f..80b8c80 100644 --- a/booking.module +++ b/booking.module @@ -13,13 +13,10 @@ /** * Load module includes */ - - //TODO: Dynamic event IDs instead of hard coding it here. Also defined in booking.install -define('EVENTID', 1); + define('BOOKING_PAYPAL_SUBMIT_URL', 'https://www.paypal.com/cgi-bin/webscr'); define('BOOKING_PAYPAL_SUBMIT_URL_SANDBOX', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn'); -define('BOOKING_DEFAULT_STATE', 'NSW'); // Load the include for various constants module_load_include('inc', 'booking', 'booking.constants');