This commit is contained in:
Nathan Coad
2016-06-03 11:17:32 +10:00
parent 8b31d1bebf
commit fd084499b4
2 changed files with 7 additions and 5 deletions

View File

@@ -284,8 +284,9 @@ function booking_manual_email_form($form, &$form_state, $input_option = "")
$email_options_array['remindertravelrequired'] = 'Reminder Travel Form Required Email'; $email_options_array['remindertravelrequired'] = 'Reminder Travel Form Required Email';
$email_options_array['travelcomplete'] = 'Travel Form Complete Email'; $email_options_array['travelcomplete'] = 'Travel Form Complete Email';
$preselection_options['---'] = "---"; $preselection_options['---'] = "---";
$preselection_options['bookedin'] = 'bookedin'; $preselection_options['bookedin'] = 'Status of Booked In';
$preselection_options['test'] = 'Testing';
//add in the custom email types //add in the custom email types
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++)
{ {
@@ -483,6 +484,9 @@ function _booking_email_get_default_selection_callback($form, $form_state) {
if ($selection == 'bookedin' && $person->booking_status == 1) { if ($selection == 'bookedin' && $person->booking_status == 1) {
$defaults[] = $person->nid; $defaults[] = $person->nid;
} }
elseif ($selection == 'test' && $person->booking_lastname == 'Coad') {
$defaults[] = $person->nid;
}
} }
//set return value via drupal_json_encode($var) //set return value via drupal_json_encode($var)
$replacementform_data['booking-email-default-ids'] = array ( $replacementform_data['booking-email-default-ids'] = array (

View File

@@ -2,13 +2,11 @@
* Special Effects AJAX framework command. * Special Effects AJAX framework command.
*/ */
Drupal.ajax.prototype.commands.bookingEmailIDs = function(ajax, response, status) { Drupal.ajax.prototype.commands.bookingEmailIDs = function(ajax, response, status) {
jQuery(function($) { jQuery(function($) {
var arr = $.parseJSON($('input#booking_email_default_ids').val()) var arr = $.parseJSON($('input#booking_email_default_ids').val())
$('#booking-manual-email-form').find(':checkbox[name^="table"]').each(function () { $('#booking-manual-email-form').find(':checkbox[name^="table"]').each(function () {
//.prop() doesn't exist in Drupal's old version of jQuery so use .attr() instead //.prop() doesn't exist in Drupal's old version of jQuery so use .attr() instead
$(this).attr("checked", ($.inArray($(this).val(), arr) != -1)); $(this).attr("checked", ($.inArray($(this).val(), arr) != -1));
}); });
alert(arr[0]);
}); });
} }