/**
 * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
 * it is preferred to instead use _update_attendee_registration_form_new() which
 * also better handles form validation. Exits
 * @param EE_Admin_Page $admin_page
 * @return void
 */
function ee_deprecated_update_attendee_registration_form_old($admin_page)
{
    //check if the old hooks are in use. If not, do the default
    if (!ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() || !$admin_page instanceof EE_Admin_Page) {
        return;
    }
    $req_data = $admin_page->get_request_data();
    $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE;
    $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE;
    $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
    if (!$REG_ID || !$qstns) {
        EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
    }
    $success = TRUE;
    // allow others to get in on this awesome fun   :D
    do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
    // loop thru questions... FINALLY!!!
    foreach ($qstns as $QST_ID => $qstn) {
        //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
        if (!is_array($qstn)) {
            $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
            continue;
        }
        foreach ($qstn as $ANS_ID => $ANS_value) {
            //get answer
            $query_params = array(0 => array('ANS_ID' => $ANS_ID, 'REG_ID' => $REG_ID, 'QST_ID' => $QST_ID));
            $answer = EEM_Answer::instance()->get_one($query_params);
            //this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
            if (!$answer instanceof EE_Answer) {
                $set_values = array('QST_ID' => $QST_ID, 'REG_ID' => $REG_ID, 'ANS_value' => $qstn);
                $success = EEM_Answer::instance()->insert($set_values);
                continue 2;
            }
            $answer->set('ANS_value', $ANS_value);
            $success = $answer->save();
        }
    }
    $what = __('Registration Form', 'event_espresso');
    $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
    $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
    exit;
}