tweak debug messages for editing a person's studygroups
This commit is contained in:
@@ -500,9 +500,10 @@ function booking_studygroups_edit_form($node, &$form_state, $nid) {
|
|||||||
function booking_studygroups_edit_form_submit($form, &$form_state) {
|
function booking_studygroups_edit_form_submit($form, &$form_state) {
|
||||||
global $event;
|
global $event;
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
$checkboxes = $form_state['values']['table'];
|
//$checkboxes = $form_state['values']['table'];
|
||||||
$studygroup_ids = $form_state['values']['booking_assign_sessionid'];
|
$studygroup_ids = $form_state['values']['booking_assign_sessionid'];
|
||||||
$values = $form_state['input'];
|
$values = $form_state['input'];
|
||||||
|
$update_messages = array();
|
||||||
|
|
||||||
//check that $values['personid'] is a number
|
//check that $values['personid'] is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $values['personid'])) {
|
if (! preg_match('/^[0-9]+$/', $values['personid'])) {
|
||||||
@@ -536,7 +537,7 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
//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') {
|
||||||
watchdog('booking', "Removing an existing Study Group session id: @id from group @group.\n<pre>@info</pre>",
|
$update_messages[] = t("Removing an existing Study Group session id: @id from group @group.\n<pre>@info</pre>",
|
||||||
array('@id' => $value, '@group' => $key, '@info' => print_r( $person_groups[$key], true)));
|
array('@id' => $value, '@group' => $key, '@info' => print_r( $person_groups[$key], true)));
|
||||||
|
|
||||||
$num_deleted = db_delete('booking_studygroup_mapping')
|
$num_deleted = db_delete('booking_studygroup_mapping')
|
||||||
@@ -545,7 +546,7 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
//check for an existing study group mapping to change
|
//check for an existing study group mapping to change
|
||||||
elseif ((!empty($person_groups[$key])) && $person_groups[$key]->booking_session_id != $value) {
|
elseif ((!empty($person_groups[$key])) && $person_groups[$key]->booking_session_id != $value) {
|
||||||
watchdog('booking', "Updating Study Group session from: @key to @value for id @id",
|
$update_messages[] = t( "Updating Study Group session from: @key to @value for id @id",
|
||||||
array('@key' => $person_groups[$key]->booking_session_id, '@value' => $value, '@id' => $nid));
|
array('@key' => $person_groups[$key]->booking_session_id, '@value' => $value, '@id' => $nid));
|
||||||
|
|
||||||
db_update('booking_studygroup_mapping')
|
db_update('booking_studygroup_mapping')
|
||||||
@@ -567,12 +568,12 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
//found this entry already, so no change needed
|
//found this entry already, so no change needed
|
||||||
elseif ((!empty($person_groups[$key])) && $person_groups[$key]->booking_session_id == $value) {
|
elseif ((!empty($person_groups[$key])) && $person_groups[$key]->booking_session_id == $value) {
|
||||||
watchdog('booking', "Study Group @group session already set to @session.",
|
$update_messages[] = t("Study Group @group session already set to @session.",
|
||||||
array('@group' => $key, '@session' => $value));
|
array('@group' => $key, '@session' => $value));
|
||||||
}
|
}
|
||||||
//no previously defined value, so add a new entry to the mapping table
|
//no previously defined value, so add a new entry to the mapping table
|
||||||
else {
|
else {
|
||||||
watchdog('booking', "Adding Study Group session id: @id for group @group.", array('@id' => $value, '@group' => $key));
|
$update_messages[] = t("Adding Study Group session id: @id for group @group.", array('@id' => $value, '@group' => $key));
|
||||||
|
|
||||||
db_insert('booking_studygroup_mapping')
|
db_insert('booking_studygroup_mapping')
|
||||||
->fields(array(
|
->fields(array(
|
||||||
@@ -593,8 +594,12 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
} //end new value check
|
} //end new value check
|
||||||
} //end valid data check
|
} //end valid data check
|
||||||
} //end checkbox loop
|
} //end select dropdown loop
|
||||||
}
|
//output messages to watchdog
|
||||||
|
$final_message = t('Finished processing study groups for person id !id.', array('!id' => $nid));
|
||||||
|
drupal_set_message($final_message);
|
||||||
|
watchdog('booking', "<pre>" . $final_message . "\n" . implode("\n", $update_messages) . "</pre>");
|
||||||
|
} //end function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for calculating who belongs to which study group
|
* Function for calculating who belongs to which study group
|
||||||
|
Reference in New Issue
Block a user