function test_retrieve_RoomReservationActivity_byRequestId($roomReservationRequestId)
{
    $reservation = retrieve_RoomReservationActivity_byRequestId($roomReservationRequestId);
    if ($reservation == false) {
        echo "</br>" . "No Reservations were Found." . "</br></br></br>";
    } else {
        echo "</br>" . "Records Found:" . "</br>";
        //  foreach ($reservations as $reservation)
        //   {
        display_reservation($reservation);
        //   }
    }
}
                    $messages['profile_updated'] = "Family Profile has been updated with the approved changes";
                } else {
                    $errors['failed_update'] = "Cannot update family profile";
                }
            }
            //if no errors were present, send the email:
            if (empty($errors)) {
                /*=============== email the users ===========*/
            }
        } else {
            $errors['update_profile_failed'] = 'Cannot update activity status';
        }
    } else {
        if ($requestType == 'reservation') {
            error_log("in activity_handler, will update reservation status");
            $resActivity = retrieve_RoomReservationActivity_byRequestId($requestId);
            $resActivity->set_rmhStaffProfileId($rmhStaffProfileId);
            $resActivity->set_rmhDateStatusSubmitted(date("Y-m-d H:i:s"));
            $resActivity->set_status($statuses[$status]);
            error_log("in activity handler, status is {$statuses[$status]}");
            $updateReservation = update_status_RoomReservationActivity($resActivity);
            if ($updateReservation) {
                //email can be sent here
                $messages['status_changed'] = "Reservation activity status changed successfuly";
            } else {
                $errors['update_res_failed'] = 'Cannot update reservation';
            }
        }
    }
} else {
    if (isset($_POST['form_token']) && !validateTokenField($_POST)) {
include '../header.php';
include_once ROOT_DIR . '/domain/Reservation.php';
include_once ROOT_DIR . '/domain/UserProfile.php';
include_once ROOT_DIR . '/domain/Family.php';
include_once ROOT_DIR . '/database/dbReservation.php';
include_once ROOT_DIR . '/database/dbUserProfile.php';
include_once ROOT_DIR . '/database/dbFamilyProfile.php';
//include_once(ROOT_DIR .'/mail/functions.php');
$showForm = false;
$showResult = false;
$message = array();
// the first time the site is visited
if (isset($_GET['id'])) {
    $idChosen = $_GET['id'];
    error_log("in editReservation, request id is {$idChosen}");
    $informationroom = retrieve_RoomReservationActivity_byRequestId($idChosen);
    $beginDate = new DateTime($informationroom->get_beginDate());
    $endDate = new DateTime($informationroom->get_endDate());
    $formattedBeginDate = $beginDate->format('Y-m-d');
    $formattedEndDate = $endDate->format('Y-m-d');
    $showForm = true;
    unset($_SESSION['RequestID']);
    // so that we won't go through the retrieval steps after the first time
}
// end stuff that is done the first time the form is visited
//process the editing form
if (isset($_POST['form_token']) && validateTokenField($_POST)) {
    error_log("will process the edit form");
    $informationroom = readFormData();
    error_log('social worker id is ' . $informationroom->get_socialWorkerProfileId());
    error_log('rmh staff id is ' . $informationroom->get_rmhStaffProfileId());
function searchForReservations()
{
    $type = $_POST['searchType'];
    if ($type == "Select Search Type") {
        echo "Please choose what you're searching for from the drop down menu below.";
    } else {
        if ($type == "Request ID") {
            $roomReservationRequestId = $_POST["searchParam"];
            error_log("searching  by request id = " . $roomReservationRequestId);
            $Reservation = retrieve_RoomReservationActivity_byRequestId($roomReservationRequestId);
            // retrieval routine returns just one reservation, so return an array consisting of one record
            if (!$Reservation) {
                error_log("retrieve_RoomReservationActivity_byRequestID returned false");
                $Reservations = false;
            } else {
                $Reservations = array();
                $Reservations[] = $Reservation;
            }
            return $Reservations;
            /*   if (!$Reservations) {
                     echo ("No reservations found! Try entering your search again.");
                 } */
        } else {
            if ($type == "Social Worker (Last Name)") {
                $socialWorkerLastName = $_POST["searchParam"];
                //  $Reservations = array();
                $Reservations = retrieve_SocialWorkerLastName_RoomReservationActivity($socialWorkerLastName);
                return $Reservations;
                /*   if (!$Reservations) {
                         echo ("No reservations found! Try entering your search again.");
                     } */
            } else {
                if ($type == "Staff Approver (Last Name)") {
                    $rmhStaffLastName = $_POST["searchParam"];
                    //   $Reservations = array();
                    $Reservations = retrieve_RMHStaffLastName_RoomReservationActivity($rmhStaffLastName);
                    return $Reservations;
                    /*   if (!$Reservations) {
                             echo ("No reservations found! Try entering your search again.");
                         } */
                } else {
                    if ($type == "Family (Last Name)") {
                        $parentLastName = $_POST["searchParam"];
                        $Reservations = retrieve_FamilyLastName_RoomReservationActivity($parentLastName);
                        return $Reservations;
                    } else {
                        if ($type == "Status") {
                            $status = $_POST["searchParam"];
                            $Reservations = retrieve_RoomReservationActivity_byStatus($status);
                            return $Reservations;
                        } else {
                            if ($type == "Last Activity") {
                                $activity = $_POST["searchParam"];
                                $Reservations = retrieve_RoomReservationActivity_byLastActivity($activity);
                                return $Reservations;
                            }
                        }
                    }
                }
            }
        }
    }
}