Minor tweaks

This commit is contained in:
2014-06-30 17:40:26 +10:00
parent 53ea1fd2fe
commit ad131989b5
7 changed files with 91 additions and 35 deletions

View File

@@ -298,6 +298,7 @@ function booking_manual_email()
//see http://www.jaypan.com/blog/themeing-drupal-7-forms-tables-checkboxes-or-radios //see http://www.jaypan.com/blog/themeing-drupal-7-forms-tables-checkboxes-or-radios
$form = array (); $form = array ();
$options = array (); $options = array ();
$group_text = "";
$prefix = t("<p>Send a manual email to people registered for this event.</p>"); $prefix = t("<p>Send a manual email to people registered for this event.</p>");
$email_options_array = array(); $email_options_array = array();
$email_options_array['registration'] = 'Manual Registration'; $email_options_array['registration'] = 'Manual Registration';
@@ -338,6 +339,7 @@ function booking_manual_email()
$header = array( $header = array(
'booking_nid' => array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'), 'booking_nid' => array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'),
'booking_name' => array('data' => t('Name'), 'field' => 'booking_lastname'), '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_email' => array('data' => t('Email'), 'field' => 'booking_email'),
'booking_state' => array('data' => t('State'), 'field' => 'booking_state'), 'booking_state' => array('data' => t('State'), 'field' => 'booking_state'),
'booking_status' => array('data' => t('Status'), 'field' => 'booking_status'), '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'), '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 = db_select('booking_person', 'p');
$query->join('booking_price', 'pr', 'pr.pid = p.booking_payment_id'); $query->join('booking_price', 'pr', 'pr.pid = p.booking_payment_id');
$query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid'); $query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid');
@@ -365,11 +375,13 @@ function booking_manual_email()
foreach($result as $data) foreach($result as $data)
{ {
$group_text = "";
$paid = _booking_amount_owing($data); $paid = _booking_amount_owing($data);
//$paid = _booking_amount_owing($data->nid); //$paid = _booking_amount_owing($data->nid);
$options[$data->nid] = array ( $options[$data->nid] = array (
'booking_nid' => l(t('!id', array('!id' => $data->nid)), t('node/!id', array('!id' => $data->nid))), '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_email' => $data->booking_email,
'booking_state' => $data->booking_state, 'booking_state' => $data->booking_state,
'booking_status' => _booking_status_generate($data->booking_status), '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', 'welfare_required' => $data->booking_welfare_required == 'Y' ? 'Yes' : 'No',
'travel_form' => $data->tid > 0 ? '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 .= "<b>" . $text . "</b> 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; //$values[$data->nid] = ($paid == 0 || $data->booking_status != 1) ? FALSE : TRUE;
} }

View File

@@ -100,7 +100,7 @@ function _booking_room_location_lookup($input = NULL)
{ {
$location = array(); $location = array();
$location[] = ''; $location[] = '';
$location[] = t('Elpis Israel House'); $location[] = t('Elpis Israel House Rooms 1-16');
$location[] = t('Elpis Israel Ground Floor'); $location[] = t('Elpis Israel Ground Floor');
$location[] = t('Golan'); $location[] = t('Golan');
$location[] = t('Ramoth'); $location[] = t('Ramoth');
@@ -109,6 +109,8 @@ function _booking_room_location_lookup($input = NULL)
$location[] = t('Hebron'); $location[] = t('Hebron');
$location[] = t('Shechem'); $location[] = t('Shechem');
$location[] = t('Kedesh'); $location[] = t('Kedesh');
$location[] = t('Elpis Israel House Rooms 17-33');
$location[] = t('Elpis Israel House Rooms 34-51');
if ($input != NULL) if ($input != NULL)
return $location[$input]; return $location[$input];

View File

@@ -1281,6 +1281,8 @@ function _booking_leader_helper_email_summary($node) {
$sessionid = "session" . $i; $sessionid = "session" . $i;
$roleid = $sessionid . "_role"; $roleid = $sessionid . "_role";
$otherperson_name = "TBA"; $otherperson_name = "TBA";
$otherperson_email = "";
$otherperson_phone = "";
//check that this study group session has been defined for this attendee and that they //check that this study group session has been defined for this attendee and that they
if (!empty($node->$sessionid) && $node->$roleid > 0) if (!empty($node->$sessionid) && $node->$roleid > 0)
@@ -1309,7 +1311,7 @@ function _booking_leader_helper_email_summary($node) {
} }
//find the other person //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 " . " INNER JOIN {booking_person} p on m.booking_node_id = p.nid " .
" WHERE booking_eventid = :eid " . " WHERE booking_eventid = :eid " .
" AND booking_studygroup_id = :group AND booking_studygroup_role = :role AND booking_session_id = :session", " 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) foreach ($otherperson as $other)
{ {
$otherperson_name = $other->booking_firstname . ' ' . $other->booking_lastname; $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. You can contact them on !phone or !email.',
$rows[] = t('!role for !descrip (section !id). Your !otherrole is !other.',
array('!role' => $role, '!id' => $studygroups[$i]->sid, '!descrip' => $studygroups[$i]->booking_studygroup_descrip, 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,
)); ));
} }

View File

@@ -336,7 +336,6 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#value' => 1, '#value' => 1,
); );
$form['your-details']['booking_barcode'] = array( $form['your-details']['booking_barcode'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Barcode'), '#title' => t('Barcode'),
@@ -346,6 +345,15 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#default_value' => !empty($data->booking_barcode) ? $data->booking_barcode : '' '#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( $form['your-details']['booking_readinggroup'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Reading Group Allocation'), '#title' => t('Reading Group Allocation'),
@@ -975,6 +983,8 @@ function booking_form_submit($form, &$form_state) {
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare']; $node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
//fields that may or may not have been present in the initial form //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_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_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'); $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_firstname' => $node->booking_firstname,
'booking_lastname' => $node->booking_lastname, 'booking_lastname' => $node->booking_lastname,
'booking_dob' => $node->booking_dob, 'booking_dob' => $node->booking_dob,
'booking_barcode' => $node->booking_barcode,
'booking_luckynum' => $node->booking_luckynum,
'booking_passport_num' => $node->booking_passport_num, 'booking_passport_num' => $node->booking_passport_num,
'booking_passport_issue_location' => $node->booking_passport_issue_location, 'booking_passport_issue_location' => $node->booking_passport_issue_location,
'booking_passport_issue_name' => $node->booking_passport_issue_name, 'booking_passport_issue_name' => $node->booking_passport_issue_name,
@@ -1253,6 +1265,8 @@ function _booking_update($node) {
'booking_firstname' => $node->booking_firstname, 'booking_firstname' => $node->booking_firstname,
'booking_lastname' => $node->booking_lastname, 'booking_lastname' => $node->booking_lastname,
'booking_dob' => _date_to_ts($node->booking_dob), 'booking_dob' => _date_to_ts($node->booking_dob),
'booking_barcode' => $node->booking_barcode,
'booking_luckynum' => $node->booking_luckynum,
'booking_passport_num' => $node->booking_passport_num, 'booking_passport_num' => $node->booking_passport_num,
'booking_passport_issue_location' => $node->booking_passport_issue_location, 'booking_passport_issue_location' => $node->booking_passport_issue_location,
'booking_passport_issue_name' => $node->booking_passport_issue_name, 'booking_passport_issue_name' => $node->booking_passport_issue_name,

View File

@@ -13,6 +13,7 @@ function booking_report_summary() {
$notpaid_counter = 0; $notpaid_counter = 0;
$waiting_counter = 0; $waiting_counter = 0;
$notcoming_counter = 0; $notcoming_counter = 0;
$hosts_counter = 0;
$male_count = 0; $male_count = 0;
$female_count = 0; $female_count = 0;
$baptised_count = 0; $baptised_count = 0;
@@ -103,8 +104,8 @@ function booking_report_summary() {
$table_sort = $query->extend('TableSort')->orderbyHeader($header); $table_sort = $query->extend('TableSort')->orderbyHeader($header);
$result = $table_sort->execute(); $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->nid, 0, FALSE);
$amount_owing = _booking_amount_owing($person, 0, FALSE); $amount_owing = _booking_amount_owing($person, 0, FALSE);
@@ -158,6 +159,8 @@ function booking_report_summary() {
$bookedin_counter++; $bookedin_counter++;
elseif ($person->booking_status == 2) elseif ($person->booking_status == 2)
$waiting_counter++; $waiting_counter++;
elseif ($person->booking_status == 5)
$hosts_counter++;
else else
$notcoming_counter++; $notcoming_counter++;
@@ -210,10 +213,10 @@ function booking_report_summary() {
'!femaleaverage' => _booking_avg_age($female_dob_total, $female_count, $event->booking_event_start) '!femaleaverage' => _booking_avg_age($female_dob_total, $female_count, $event->booking_event_start)
)); ));
$output .= t("<h3>Overall</h3>"); $output .= t("<h3>Overall</h3>");
$output .= t("<p>There are !bookedin registrations currently booked in, !waiting on waiting list, !notpaid haven't paid, " . $output .= t("<p>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.</p>", "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.</p>",
array('!bookedin' => $bookedin_counter, '!waiting' => $waiting_counter, '!notpaid' => $notpaid_counter, '!total' => $person_count, '!travel' => $travelform_count, 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("<h3>Finances</h3>"); $output .= t("<h3>Finances</h3>");
$output .= t("<p>There are !welfare people with special financial consideration approved, and !committee people on the committee. " . $output .= t("<p>There are !welfare people with special financial consideration approved, and !committee people on the committee. " .
"!fullypaid people have completed their payments.</p>", "!fullypaid people have completed their payments.</p>",

View File

@@ -148,7 +148,7 @@ function booking_room_edit_form($node, &$form_state, $nid) {
//person must exist in database, load all the bits //person must exist in database, load all the bits
$person = node_load($nid); $person = node_load($nid);
$prefix = t("<p>Manually assign/update room allocation for !first !last.<br /><b>Note:&nbsp;Still under testing!</b></p>", $prefix = t("<p>Manually assign/update room allocation for !first !last.<br /></p>",
array('!first' => $person->booking_firstname, '!last' => $person->booking_lastname)); array('!first' => $person->booking_firstname, '!last' => $person->booking_lastname));
//***form starts here*** //***form starts here***
@@ -681,7 +681,7 @@ function booking_rooms_allocate_form($node, &$form_state, $location_id) {
$room_mapping = $room_mapping_query->fetchAllAssoc('booking_nodeid'); $room_mapping = $room_mapping_query->fetchAllAssoc('booking_nodeid');
//query for room definitions //query for room definitions
$room_query = db_query("SELECT * FROM {booking_room_definition} WHERE booking_room_location_id = :lid", $room_query = db_query("SELECT * FROM {booking_room_definition} WHERE booking_room_location_id = :lid ORDER BY booking_room_number",
array(':lid' => $location_id)); array(':lid' => $location_id));
//query for attendees //query for attendees
@@ -1055,9 +1055,10 @@ function booking_rooms_view_form($node, &$form_state, $location_id) {
$room_mapping = $room_mapping_query->fetchAllAssoc('booking_nodeid'); $room_mapping = $room_mapping_query->fetchAllAssoc('booking_nodeid');
//query for attendees //query for attendees
//status 1 is coming, status 5 is hosts
$attendees = db_query("SELECT nid, booking_firstname, booking_lastname, booking_gender, booking_dob, booking_partner_id " . $attendees = db_query("SELECT nid, booking_firstname, booking_lastname, booking_gender, booking_dob, booking_partner_id " .
" FROM {booking_person} " . " FROM {booking_person} " .
" WHERE booking_event_id = :eid and booking_status=1 order by booking_lastname, booking_firstname", " WHERE booking_event_id = :eid and (booking_status=1 or booking_status=5) order by booking_lastname, booking_firstname",
array(':eid' => $event->eid))->fetchAllAssoc('nid'); array(':eid' => $event->eid))->fetchAllAssoc('nid');
//define the header //define the header

View File

@@ -436,7 +436,7 @@ function booking_studygroups_edit_form($node, &$form_state, $nid) {
return ""; return "";
} }
$prefix = t("<p>Manually assign/update study group sessions for !first !last.<br />If updating an existing session ID, this will also copy any role assigned (leader, helper, etc).</p><p><b>Note:&nbsp;Still under testing!</b></p>", array('!first' => $person->booking_firstname, '!last' => $person->booking_lastname)); $prefix = t("<p>Manually assign/update study group sessions for !first !last.<br />If updating an existing session ID, this will also copy any role assigned (leader, helper, etc).</p>", array('!first' => $person->booking_firstname, '!last' => $person->booking_lastname));
//select the groups this person is already assigned to, indexed by studygroup id //select the groups this person is already assigned to, indexed by studygroup id
$person_groups_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid AND booking_node_id = :nid", $person_groups_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid AND booking_node_id = :nid",
@@ -580,6 +580,11 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
//check if there is a valid value to process //check if there is a valid value to process
if ($value > 0 || $value == 'Remove') if ($value > 0 || $value == 'Remove')
{ {
//if there was no previous mapping but Remove has been selected anyway, just skip to the next value to look at
if (empty($person_groups[$key]) && $value == 'Remove')
{
continue;
}
//check to see if we need to remove a study group mapping //check to see if we need to remove a study group mapping
if (! empty($person_groups[$key]) && $value == 'Remove') if (! empty($person_groups[$key]) && $value == 'Remove')
{ {
@@ -1329,7 +1334,7 @@ function booking_studygroups_update_form($node, &$form_state, $sid) {
//if the existing session is not the same as our newly calculated session, run an update query //if the existing session is not the same as our newly calculated session, run an update query
if ($mapping->booking_session_id !== $person->session && $group->sid != $reading_group_id) if ($mapping->booking_session_id !== $person->session && $group->sid != $reading_group_id)
{ {
$message = t('Found existing study group session for user !id (!name). Changing old session !old to !session. Role id is !role', $message = t('Suggest changing user !id (!name) from session !old to !session. Role id is !role',
array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session, array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session,
'!role' => $person->booking_studygroup_role, '!name' => $person->booking_firstname . " " . $person->booking_lastname)); '!role' => $person->booking_studygroup_role, '!name' => $person->booking_firstname . " " . $person->booking_lastname));
@@ -1343,7 +1348,7 @@ function booking_studygroups_update_form($node, &$form_state, $sid) {
} }
elseif ($mapping->booking_session_id !== $person->session && $group->sid == $reading_group_id) elseif ($mapping->booking_session_id !== $person->session && $group->sid == $reading_group_id)
{ {
$message = t('Found existing reading group session for user !id (!name). Changing old session !old to !session. Role id is !role', $message = t('Suggest changing user !id (!name) from reading group session !old to !session. Role id is !role',
array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session, array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session,
'!role' => $person->booking_studygroup_role, '!name' => $person->booking_firstname . " " . $person->booking_lastname)); '!role' => $person->booking_studygroup_role, '!name' => $person->booking_firstname . " " . $person->booking_lastname));
@@ -1421,7 +1426,7 @@ function booking_studygroups_update_form($node, &$form_state, $sid) {
); );
$form['result'] = array( $form['result'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => 'Generated Updates', '#title' => 'Suggested Updates',
'#collapsible' => TRUE, '#collapsible' => TRUE,
'#collapsed' => FALSE, '#collapsed' => FALSE,
); );