diff --git a/booking.emails.inc b/booking.emails.inc index 80eb8e3..0c14c51 100644 --- a/booking.emails.inc +++ b/booking.emails.inc @@ -143,15 +143,19 @@ function booking_manual_email() function booking_manual_email_submit($form, &$form_state) { $counter = 0; + $update_messages = array(); $checkboxes = $form_state['values']['table']; //$values['booking_price_active']; //watchdog('booking', 'Formstate when setting buttons: @info', array ('@info' => var_export($form_state['values'], TRUE))); //watchdog('booking', 'Checkboxes when setting buttons: @info', array ('@info' => var_export($checkboxes, TRUE))); foreach($checkboxes as $key => $value) { + $message = ""; + + //do a sanity check on the key => value pair from the form submission if (is_numeric($key) && $value != 0) { - //check if they exist in the database first + //check the person exists in the database $person = db_query("SELECT person.nid " . "FROM {booking_person} person " . "WHERE nid = :nid", @@ -162,50 +166,63 @@ function booking_manual_email_submit($form, &$form_state) { { if ($form_state['values']['email-type'] == 'registration') { - watchdog('booking', 'Processing a manual registration email to id @info', array ('@info' => $key)); + $message = t('Processing a manual registration email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual registration email to id @info', array ('@info' => $key)); _booking_registration_email($key, false, true); } elseif ($form_state['values']['email-type'] == 'travelrequired') { - watchdog('booking', 'Processing a manual travel form request email to id @info', array ('@info' => $key)); + $message = t('Processing a manual travel form request email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual travel form request email to id @info', array ('@info' => $key)); _booking_travelform_request_email($key); } elseif ($form_state['values']['email-type'] == 'balance') { - watchdog('booking', 'Processing a manual outstanding balance email to id @info', array ('@info' => $key)); + $message = t('Processing a manual outstanding balance email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual outstanding balance email to id @info', array ('@info' => $key)); _booking_balance_payment_email($key); } elseif ($form_state['values']['email-type'] == 'complete') { - watchdog('booking', 'Processing a manual registration complete email to id @info', array ('@info' => $key)); + $message = t('Processing a manual registration complete email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual registration complete email to id @info', array ('@info' => $key)); _booking_registration_email($key, true, true); } elseif ($form_state['values']['email-type'] == 'travelcomplete') { - watchdog('booking', 'Processing a manual travelform complete email to id @info', array ('@info' => $key)); + $message = t('Processing a manual travelform complete email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual travelform complete email to id @info', array ('@info' => $key)); _booking_travelform_confirmation_email($key); } elseif ($form_state['values']['email-type'] == 'withdrawal') { - watchdog('booking', 'Processing a manual withdrawal email to id @info', array ('@info' => $key)); + $message = t('Processing a manual withdrawal email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual withdrawal email to id @info', array ('@info' => $key)); _booking_demoted_to_notcoming_email($key); } elseif ($form_state['values']['email-type'] == 'missedpayment') { - watchdog('booking', 'Processing a manual missedpayment email to id @info', array ('@info' => $key)); + $message = t('Processing a manual missedpayment email to id @info', array ('@info' => $key)); + //watchdog('booking', 'Processing a manual missedpayment email to id @info', array ('@info' => $key)); _booking_missedpayment_email($key); } elseif (strpos($form_state['values']['email-type'], 'custom') !== false) { - watchdog('booking', 'Processing a @custom type email to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key)); + $message = t('Processing a @custom type email to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key)); + //watchdog('booking', 'Processing a @custom type email to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key)); _booking_custom_email($key, $form_state['values']['email-type']); } //increase the counter of people we've emailed $counter++; + //store info about the email + $update_messages[] = $message; + } } } - drupal_set_message("Sent manual email for $counter people.", 'status', FALSE); + $final_message = "Sent manual email for $counter people."; + drupal_set_message($final_message, 'status', FALSE); + watchdog('booking', "
" . $final_message . "\n" . implode("\n", $update_messages) . ""); //watchdog('booking', "Sent manual email for $counter people."); } diff --git a/booking.helper.inc b/booking.helper.inc index 2aa9e88..a0f167f 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -105,8 +105,7 @@ function _valid_australian_mobile_number($input) { if (preg_match('/^\s*(?:\+61|61|0061|0)(\d{3})\s*(\d{3})\s*(\d{3})\s*$/', $input, $matches)) { - watchdog('booking', 'Australian Mobile Number "!passnum" validates since it passed our regexp', - array('!passnum' => $input)); + //watchdog('booking', 'Australian Mobile Number "!passnum" validates since it passed our regexp', array('!passnum' => $input)); return TRUE; } else @@ -126,14 +125,14 @@ function _booking_check_bookings_full() //check the number of people registered against the defined max if ($waitinglist_query->num_ppl >= variable_get('booking_regn_limit', 350)) { - watchdog('booking', 'There are !num people booked in, which is greater than or equal to the limit of !limit.', - array('!num' => $waitinglist_query->num_ppl, '!limit' => variable_get('booking_regn_limit', 350) )); + //watchdog('booking', 'There are !num people booked in, which is greater than or equal to the limit of !limit.', + // array('!num' => $waitinglist_query->num_ppl, '!limit' => variable_get('booking_regn_limit', 350) )); return true; } else { - watchdog('booking', 'There are !num people booked in, which is less than the limit of !limit.', - array('!num' => $waitinglist_query->num_ppl, '!limit' => variable_get('booking_regn_limit', 350) )); + //watchdog('booking', 'There are !num people booked in, which is less than the limit of !limit.', + // array('!num' => $waitinglist_query->num_ppl, '!limit' => variable_get('booking_regn_limit', 350) )); return false; } } diff --git a/booking.install b/booking.install index 98a402e..678b1fd 100644 --- a/booking.install +++ b/booking.install @@ -515,6 +515,14 @@ function booking_update_7230() { db_add_field('booking_person', 'booking_dependant_children', $spec); } +/** +* Add comment field to registration record +*/ +function booking_update_7231() { + $spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE); + db_add_field('booking_person', 'booking_comment_field', $spec); +} + /** * Implementation of hook_install(). */ @@ -600,6 +608,7 @@ function booking_schema() { 'booking_dietary' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE), 'booking_medical_conditions' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE), 'booking_random_facts' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE), + 'booking_comment_field' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE), //address details 'booking_street' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE), diff --git a/booking.regn_form.inc b/booking.regn_form.inc index 50125a6..cfe4127 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -164,6 +164,18 @@ function booking_form($node, &$form_state, $inserting = FALSE) { // The status field should not be visible unless this registration is being updated...i.e. not at actual registration time... if ($inserting != TRUE) { + + $form['your-details']['booking_comment_field'] = array( + '#type' => 'textarea', + '#title' => t('Comments relating to this registration. Internal only.'), + '#cols' => 60, + '#rows' => 5, + '#resizable' => TRUE, + '#required' => FALSE, + '#attributes' => array('maxlength' => 1000), + '#default_value' => !empty($data->booking_comment_field) ? $data->booking_comment_field : '', + ); + $form['your-details']['booking_status'] = array( '#type' => 'select', '#title' => t('Registration Status'), @@ -219,9 +231,9 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 10, '#required' => FALSE, '#default_value' => !empty($data->booking_refund_due) ? $data->booking_refund_due : '0.00' - ); + ); - } //end inserting check for booking status + } //end inserting check for admin-only fields //tshirts if (variable_get('booking_enable_tshirts', 0) == 1) @@ -1348,7 +1360,8 @@ function booking_form_submit($form, &$form_state) { $node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details']; $node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N'); $node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details']; - + $node->booking_comment_field = empty($values['booking_comment_field']) ? '' : $values['booking_comment_field']; + //potential fields for future //$node->booking_payment_method = $payment_method; $node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1']; diff --git a/booking.regn_node.inc b/booking.regn_node.inc index d0f0e3c..3028d17 100644 --- a/booking.regn_node.inc +++ b/booking.regn_node.inc @@ -237,6 +237,7 @@ function booking_insert($node) { 'booking_refund_processed' => $node->booking_refund_processed, 'booking_committee_member' => $node->booking_committee_member, 'booking_random_facts' => $node->booking_random_facts, + 'booking_comment_field' => $node->booking_comment_field, )) ->execute(); } @@ -344,7 +345,7 @@ function booking_update($node) { 'booking_committee_member' => ($node->booking_committee_member == 1 ? 'Y' : 'N'), 'booking_random_facts' => $node->booking_random_facts, 'booking_status' => $node->booking_status, - + 'booking_comment_field' => $node->booking_comment_field, )) ->condition('nid', $node->nid) ->execute(); @@ -641,6 +642,7 @@ function booking_view($node, $view_mode) { $rows[] = array(t('Name:'), t('!first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname))); $rows[] = array(t('Gender:'), t('!gender', array('!gender' => $node->booking_gender == 'M' ? 'Male' : 'Female'))); $rows[] = array(t('Status:'), t('!status', array('!status' => _booking_status_generate($node->booking_status)))); + $rows[] = array(t('Internal comments on this registration:'), $node->booking_comment_field); $rows[] = array(t('Committee Member:'), t('!ans', array('!ans' => ($node->booking_committee_member == 'Y' ? 'Yes' : 'No')))); $rows[] = array(t('Welfare Required:'), $node->booking_welfare_required == 'Y' ? 'Yes' : 'No'); $rows[] = array(t('Barcode:'), t('!id', array('!id' => $node->booking_barcode)));