diff --git a/booking.install b/booking.install index af3e96c..5b723a6 100644 --- a/booking.install +++ b/booking.install @@ -248,6 +248,13 @@ function booking_update_7206() { db_add_field( 'booking_studygroup_mapping', 'booking_session_id', $spec); } +/** +* Add field to support welfare required flag +*/ +function booking_update_7207() { + $spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE); + db_add_field( 'booking_person', 'booking_welfare_required', $spec); +} /** * Implementation of hook_install(). @@ -353,7 +360,8 @@ function booking_schema() { 'booking_event_id' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), 'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE), 'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'), - 'booking_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), + 'booking_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), + 'booking_welfare_required' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), 'booking_barcode' => array('type' => 'varchar', 'length' => '8', 'not null' => FALSE), 'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE), 'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE), diff --git a/booking.reports.inc b/booking.reports.inc index 795e9e9..4716643 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -23,7 +23,17 @@ function booking_report_summary() { $person_count = 0; $stats_attributes = array('style' => 'max-width:30%'); - $header = array('Id', 'Name', 'Email', 'Payment To Date', 'Total Payment Required'); + + //define sorting information with the header + //as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7 + $header = array( + array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'), + array('data' => t('Name'), 'field' => 'booking_lastname', 'sort' => 'asc'), + array('data' => t('Email'), 'field' => 'booking_email', 'sort' => 'asc'), + array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid', 'sort' => 'asc'), + array('data' => t('Total Payment Required'), 'field' => 'booking_total_pay_reqd', 'sort' => 'asc'), + ); + $rows = array(); $state_header = array('State', 'Count'); $state_rows = array(); @@ -93,8 +103,13 @@ function booking_report_summary() { } //more detailed summary - $result = db_query("SELECT * FROM {booking_person} p WHERE p.booking_event_id = :eid", - array(':eid' => $event->eid)); + //allow user-selectable sorting of columns as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7 + $query = db_select('booking_person', 'p') + ->fields('p') + ->condition('p.booking_event_id', $event->eid, '='); + $table_sort = $query->extend('TableSort')->orderbyHeader($header); + $result = $table_sort->execute(); + foreach ($result as $person) { $rows[] = array( l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))), @@ -130,7 +145,7 @@ function booking_report_summary() { $output .= t("