diff --git a/booking.admin.inc b/booking.admin.inc index f33b053..7bd1204 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -298,6 +298,7 @@ function booking_manual_email() //see http://www.jaypan.com/blog/themeing-drupal-7-forms-tables-checkboxes-or-radios $form = array (); $options = array (); + $group_text = ""; $prefix = t("
Send a manual email to people registered for this event.
"); $email_options_array = array(); $email_options_array['registration'] = 'Manual Registration'; @@ -338,6 +339,7 @@ function booking_manual_email() $header = array( 'booking_nid' => array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'), 'booking_name' => array('data' => t('Name'), 'field' => 'booking_lastname'), + 'booking_gender' => array('data' => t('Gender'), 'field' => 'booking_gender'), 'booking_email' => array('data' => t('Email'), 'field' => 'booking_email'), 'booking_state' => array('data' => t('State'), 'field' => 'booking_state'), 'booking_status' => array('data' => t('Status'), 'field' => 'booking_status'), @@ -348,6 +350,14 @@ function booking_manual_email() 'travel_form' => array('data' => t('Travel Submitted?'), 'field' => 'tid'), ); + if (variable_get('booking_enable_studygroups', 0) == 1) + { + //select entries from the study groups mapping table + $group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid)); + $group_mapping = $group_mapping_query->fetchAllAssoc('sid'); + $header['group_roles'] = array('data' => t('Group Role')); + } + $query = db_select('booking_person', 'p'); $query->join('booking_price', 'pr', 'pr.pid = p.booking_payment_id'); $query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid'); @@ -365,11 +375,13 @@ function booking_manual_email() foreach($result as $data) { + $group_text = ""; $paid = _booking_amount_owing($data); //$paid = _booking_amount_owing($data->nid); $options[$data->nid] = array ( 'booking_nid' => l(t('!id', array('!id' => $data->nid)), t('node/!id', array('!id' => $data->nid))), - 'booking_name' => $data->booking_firstname . " " . $data->booking_lastname, + 'booking_name' => $data->booking_firstname . " " . $data->booking_lastname, + 'booking_gender' => $data->booking_gender == 'M' ? 'Male' : 'Female', 'booking_email' => $data->booking_email, 'booking_state' => $data->booking_state, 'booking_status' => _booking_status_generate($data->booking_status), @@ -379,6 +391,22 @@ function booking_manual_email() 'welfare_required' => $data->booking_welfare_required == 'Y' ? 'Yes' : 'No', 'travel_form' => $data->tid > 0 ? 'Yes' : 'No', ); + + if (variable_get('booking_enable_studygroups', 0) == 1) + { + foreach ($group_mapping as $group) + { + $role = $group->booking_studygroup_role; + + if ($group->booking_node_id == $data->nid && $role > 0) + { + $text = _booking_studygroup_role_lookup($role); + $group_text .= "" . $text . " group " . $group->booking_studygroup_id . " #" . $group->booking_session_id . "; "; + } + } + $options[$data->nid]['group_roles'] = $group_text; + } + //$values[$data->nid] = ($paid == 0 || $data->booking_status != 1) ? FALSE : TRUE; } diff --git a/booking.constants.inc b/booking.constants.inc index d2b0f4b..c44dfd1 100644 --- a/booking.constants.inc +++ b/booking.constants.inc @@ -100,7 +100,7 @@ function _booking_room_location_lookup($input = NULL) { $location = array(); $location[] = ''; - $location[] = t('Elpis Israel House'); + $location[] = t('Elpis Israel House Rooms 1-16'); $location[] = t('Elpis Israel Ground Floor'); $location[] = t('Golan'); $location[] = t('Ramoth'); @@ -109,6 +109,8 @@ function _booking_room_location_lookup($input = NULL) $location[] = t('Hebron'); $location[] = t('Shechem'); $location[] = t('Kedesh'); + $location[] = t('Elpis Israel House Rooms 17-33'); + $location[] = t('Elpis Israel House Rooms 34-51'); if ($input != NULL) return $location[$input]; diff --git a/booking.helper.inc b/booking.helper.inc index fe44c36..ba2efc8 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -1281,6 +1281,8 @@ function _booking_leader_helper_email_summary($node) { $sessionid = "session" . $i; $roleid = $sessionid . "_role"; $otherperson_name = "TBA"; + $otherperson_email = ""; + $otherperson_phone = ""; //check that this study group session has been defined for this attendee and that they if (!empty($node->$sessionid) && $node->$roleid > 0) @@ -1309,7 +1311,7 @@ function _booking_leader_helper_email_summary($node) { } //find the other person - $otherperson_query = db_query("SELECT m.*, p.booking_firstname, p.booking_lastname FROM {booking_studygroup_mapping} m " . + $otherperson_query = db_query("SELECT m.*, p.* FROM {booking_studygroup_mapping} m " . " INNER JOIN {booking_person} p on m.booking_node_id = p.nid " . " WHERE booking_eventid = :eid " . " AND booking_studygroup_id = :group AND booking_studygroup_role = :role AND booking_session_id = :session", @@ -1323,12 +1325,13 @@ function _booking_leader_helper_email_summary($node) { foreach ($otherperson as $other) { $otherperson_name = $other->booking_firstname . ' ' . $other->booking_lastname; + $otherperson_email = $other->booking_email; + $otherperson_phone = $other->booking_mobile; } - - $rows[] = t('!role for !descrip (section !id). Your !otherrole is !other.', + $rows[] = t('!role for !descrip (section !id). Your !otherrole is !other. You can contact them on !phone or !email.', array('!role' => $role, '!id' => $studygroups[$i]->sid, '!descrip' => $studygroups[$i]->booking_studygroup_descrip, - '!otherrole' => $otherrole, '!other' => $otherperson_name, + '!otherrole' => $otherrole, '!other' => $otherperson_name, '!phone' => $otherperson_phone, '!email' => $otherperson_email, )); } diff --git a/booking.register.inc b/booking.register.inc index 7e61f71..e0966f5 100644 --- a/booking.register.inc +++ b/booking.register.inc @@ -335,7 +335,6 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'hidden', '#value' => 1, ); - $form['your-details']['booking_barcode'] = array( '#type' => 'textfield', @@ -345,6 +344,15 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#required' => FALSE, '#default_value' => !empty($data->booking_barcode) ? $data->booking_barcode : '' ); + + $form['your-details']['booking_luckynum'] = array( + '#type' => 'textfield', + '#title' => t('Lucky Number'), + '#maxlength' => 30, + '#size' => 30, + '#required' => FALSE, + '#default_value' => !empty($data->booking_luckynum) ? $data->booking_luckynum : '' + ); $form['your-details']['booking_readinggroup'] = array( '#type' => 'textfield', @@ -975,6 +983,8 @@ function booking_form_submit($form, &$form_state) { $node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare']; //fields that may or may not have been present in the initial form + $node->booking_barcode = empty($values['booking_barcode']) ? '' : $values['booking_barcode']; + $node->booking_luckynum = empty($values['booking_luckynum']) ? 0 : $values['booking_luckynum']; $node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N'); $node->booking_committee_member = empty($values['booking_committee_member']) ? 'N' : ($values['booking_committee_member'] == 1 ? 'Y' : 'N'); $node->booking_refund_processed = empty($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N'); @@ -1168,6 +1178,8 @@ function _booking_insert($node) { 'booking_firstname' => $node->booking_firstname, 'booking_lastname' => $node->booking_lastname, 'booking_dob' => $node->booking_dob, + 'booking_barcode' => $node->booking_barcode, + 'booking_luckynum' => $node->booking_luckynum, 'booking_passport_num' => $node->booking_passport_num, 'booking_passport_issue_location' => $node->booking_passport_issue_location, 'booking_passport_issue_name' => $node->booking_passport_issue_name, @@ -1253,7 +1265,9 @@ function _booking_update($node) { 'booking_firstname' => $node->booking_firstname, 'booking_lastname' => $node->booking_lastname, 'booking_dob' => _date_to_ts($node->booking_dob), - 'booking_passport_num' => $node->booking_passport_num, + 'booking_barcode' => $node->booking_barcode, + 'booking_luckynum' => $node->booking_luckynum, + 'booking_passport_num' => $node->booking_passport_num, 'booking_passport_issue_location' => $node->booking_passport_issue_location, 'booking_passport_issue_name' => $node->booking_passport_issue_name, 'booking_passport_expiry_date' => _date_to_ts($node->booking_passport_expiry_date), diff --git a/booking.reports.inc b/booking.reports.inc index 7781d58..87792f1 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -13,6 +13,7 @@ function booking_report_summary() { $notpaid_counter = 0; $waiting_counter = 0; $notcoming_counter = 0; + $hosts_counter = 0; $male_count = 0; $female_count = 0; $baptised_count = 0; @@ -103,8 +104,8 @@ function booking_report_summary() { $table_sort = $query->extend('TableSort')->orderbyHeader($header); $result = $table_sort->execute(); - foreach ($result as $person) { - + foreach ($result as $person) + { //$amount_owing = _booking_amount_owing($person->nid, 0, FALSE); $amount_owing = _booking_amount_owing($person, 0, FALSE); @@ -120,22 +121,22 @@ function booking_report_summary() { //define the row for this person $rows[] = array( - l(t('View !id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))), - l(t('!first !last', array('!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))), - t('node/!id/edit', array('!id' => $person->nid)) - ), - _booking_status_generate($person->booking_status), - l(t('Groups'), t('admin/booking/!id/edit-studygroup', array('!id' => $person->nid))), - l(t('Room'), t('admin/booking/!id/edit-room', array('!id' => $person->nid))), - $travel_link, - t('!email', array('!email' => $person->booking_email)), - t('!payment', array('!payment' => $person->booking_amount_paid)), - t('!payment', array('!payment' => $amount_owing == 0 ? $person->booking_total_pay_reqd : _booking_total_due($person))), - t('!fullypaid', array('!fullypaid' => $amount_owing == 0 ? 'Yes' : 'No')), - t('!reqd', array('!reqd' => $person->booking_refund_processed == 'Y' ? 'Yes' : 'No')), - t('!payment', array('!payment' => $person->booking_refund_due)), - t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'), - t($person->booking_committee_member == 'Y' ? 'Yes' : 'No'), + l(t('View !id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))), + l(t('!first !last', array('!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))), + t('node/!id/edit', array('!id' => $person->nid)) + ), + _booking_status_generate($person->booking_status), + l(t('Groups'), t('admin/booking/!id/edit-studygroup', array('!id' => $person->nid))), + l(t('Room'), t('admin/booking/!id/edit-room', array('!id' => $person->nid))), + $travel_link, + t('!email', array('!email' => $person->booking_email)), + t('!payment', array('!payment' => $person->booking_amount_paid)), + t('!payment', array('!payment' => $amount_owing == 0 ? $person->booking_total_pay_reqd : _booking_total_due($person))), + t('!fullypaid', array('!fullypaid' => $amount_owing == 0 ? 'Yes' : 'No')), + t('!reqd', array('!reqd' => $person->booking_refund_processed == 'Y' ? 'Yes' : 'No')), + t('!payment', array('!payment' => $person->booking_refund_due)), + t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'), + t($person->booking_committee_member == 'Y' ? 'Yes' : 'No'), ); //add up the total paid $total_paid += $person->booking_amount_paid; @@ -158,6 +159,8 @@ function booking_report_summary() { $bookedin_counter++; elseif ($person->booking_status == 2) $waiting_counter++; + elseif ($person->booking_status == 5) + $hosts_counter++; else $notcoming_counter++; @@ -210,10 +213,10 @@ function booking_report_summary() { '!femaleaverage' => _booking_avg_age($female_dob_total, $female_count, $event->booking_event_start) )); $output .= t("There are !bookedin registrations currently booked in, !waiting on waiting list, !notpaid haven't paid, " . + $output .= t("
There are !bookedin registrations currently booked in, !waiting on waiting list, !notpaid haven't paid, !hosts are hosts, " . "and !notcoming are no longer coming, which comes to a total of !total people who have filled in the registration form. !travel people have filled in their travel form.
", array('!bookedin' => $bookedin_counter, '!waiting' => $waiting_counter, '!notpaid' => $notpaid_counter, '!total' => $person_count, '!travel' => $travelform_count, - '!notcoming' => $notcoming_counter)); + '!notcoming' => $notcoming_counter, '!hosts' => $hosts_counter)); $output .= t("There are !welfare people with special financial consideration approved, and !committee people on the committee. " . "!fullypaid people have completed their payments.
", diff --git a/booking.rooms.inc b/booking.rooms.inc index 5a9c989..3d2a4c4 100644 --- a/booking.rooms.inc +++ b/booking.rooms.inc @@ -148,7 +148,7 @@ function booking_room_edit_form($node, &$form_state, $nid) { //person must exist in database, load all the bits $person = node_load($nid); - $prefix = t("Manually assign/update room allocation for !first !last.
Note: Still under testing!
Manually assign/update room allocation for !first !last.
Manually assign/update study group sessions for !first !last.
If updating an existing session ID, this will also copy any role assigned (leader, helper, etc).
Note: Still under testing!
", array('!first' => $person->booking_firstname, '!last' => $person->booking_lastname)); + $prefix = t("Manually assign/update study group sessions for !first !last.
If updating an existing session ID, this will also copy any role assigned (leader, helper, etc).