wip
This commit is contained in:
@@ -372,7 +372,8 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
//iterate over the sessions for that role type
|
||||
foreach ($values[$type] as $session_id => $person) {
|
||||
//get the previous value
|
||||
$previous_value = _booking_studygroup_leadhelp_edit_get_previous_value($form, $type, $session_id);
|
||||
$previous_value = _booking_studygroup_leadhelp_edit_get_previous_value($form, $type, $type . '[' . $session_id . ']');
|
||||
watchdog('booking_debug', "<pre>Studygroup assignment previous value:\n@info</pre>", array('@info' => print_r( $previous_value, true)));
|
||||
//compare it against $person
|
||||
//if $person is now empty, do a delete query
|
||||
//if $person is now different, run an update query
|
||||
@@ -383,11 +384,11 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
/**
|
||||
* look through the previous form data and return the matching element
|
||||
*/
|
||||
function _booking_studygroup_leadhelp_edit_get_previous_value(&$form, $type, $session_id) {
|
||||
function _booking_studygroup_leadhelp_edit_get_previous_value(&$form, $type, $name) {
|
||||
foreach($form['form']['studygroups']['#rows'] as $key => $value) {
|
||||
watchdog('booking_debug', "<pre>Studygroup assignment checker for type !type in session !session:\n@info</pre>",
|
||||
array('!session' => $session_id, '!type' => $type, '@info' => print_r( $value, true)));
|
||||
return;
|
||||
//watchdog('booking_debug', "<pre>Studygroup assignment checker for type !type in session !name:\n@info</pre>",
|
||||
// array('!session' => $name, '!type' => $type, '@info' => print_r( $value, true)));
|
||||
//return;
|
||||
if ((!empty($value[$type]['data']['#value'])) && ($value[$type]['data']['#name'] == $name)) {
|
||||
//found the correct element, extract the node id
|
||||
$person = $value[$type]['data']['#value'];
|
||||
|
Reference in New Issue
Block a user