add some error handling for studygroup csv report
This commit is contained in:
@@ -19,8 +19,7 @@ function booking_studygroups_csv_report($group_id) {
|
|||||||
array(':eid' => $event->eid, ':sid' => $group_id))
|
array(':eid' => $event->eid, ':sid' => $group_id))
|
||||||
->fetchObject();
|
->fetchObject();
|
||||||
|
|
||||||
if (! $group)
|
if (! $group) {
|
||||||
{
|
|
||||||
drupal_set_message("Error: Could not find matching study group ID. Unable to view group membership.", 'error', FALSE);
|
drupal_set_message("Error: Could not find matching study group ID. Unable to view group membership.", 'error', FALSE);
|
||||||
drupal_goto('admin/booking/studygroups');
|
drupal_goto('admin/booking/studygroups');
|
||||||
return "";
|
return "";
|
||||||
@@ -66,10 +65,15 @@ function booking_studygroups_csv_report($group_id) {
|
|||||||
}
|
}
|
||||||
//add the spaces and put this element in the right array
|
//add the spaces and put this element in the right array
|
||||||
$data[$member->booking_session_id][] = implode(' ', $text);
|
$data[$member->booking_session_id][] = implode(' ', $text);
|
||||||
|
|
||||||
}
|
}
|
||||||
//watchdog('booking_debug', "<pre>Study Group CSV Report\n@info</pre>", array('@info' => print_r( $data_array, true)));
|
//watchdog('booking_debug', "<pre>Study Group CSV Report\n@info</pre>", array('@info' => print_r( $data_array, true)));
|
||||||
|
|
||||||
|
// Check if we had no data added, that means there were no people in this study group
|
||||||
|
if (empty($data)) {
|
||||||
|
drupal_set_message("Error: Study group $group_id has no people assigned.", 'error', FALSE);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
//calculate the CSV layout
|
//calculate the CSV layout
|
||||||
$header_array = array_keys($data);
|
$header_array = array_keys($data);
|
||||||
$maximums = array();
|
$maximums = array();
|
||||||
|
Reference in New Issue
Block a user