/**
 * function that inserts a Family Profile based on the FamilyProfileID, FamilyProfileStatus, ParentFirstName, ParentLastName, Email
 * Phone1, Phone2, Address, City, State, ZipCode, Country, PatientFirstName, PatientLastName, PatientRelation
 * PatientDateOfBirth, FormPDF, and Notes provided. 
 * Note: if calling function insert_FamilyProfileDetail make -1 as a placeholder for familyProfileId. 
 *
 * @author Linda Shek 
 */
function insert_FamilyProfileDetail($familyProfileId, $familyProfileStatus, $parentFirstName, $parentLastName, $parentEmail, $parentPhone1, $parentPhone2, $parentAddress, $parentCity, $parentState, $parentZIP, $parentCountry, $patientFirstName, $patientLastName, $patientRelation, $patientDateOfBirth, $patientFormPdf, $patientNotes)
{
    $family = new Family($familyProfileId, $familyProfileStatus, $parentFirstName, $parentLastName, $parentEmail, $parentPhone1, $parentPhone2, $parentAddress, $parentCity, $parentState, $parentZIP, $parentCountry, $patientFirstName, $patientLastName, $patientRelation, $patientDateOfBirth, $patientFormPdf, $patientNotes);
    return insert_FamilyProfile($family);
}
     $patientNote = $_POST['PatientNote'];
 } else {
     $patientNote = "";
     // this field is optional
 }
 if (isset($_POST['swNote']) && $_POST['swNote'] != "") {
     $profileActityNotes = $_POST['swNote'];
 } else {
     $profileActityNotes = "";
     // this field is optional
 }
 // there were no input errors in the form, so proceed with database inserts
 if (empty($message)) {
     // the family profile id is 0, but a real one will be generated while doing the insert
     $temporaryFamilyProfile = new Family(0, "Pending", $parentFirstName, $parentLastName, $parentEmail, $phone1, $phone2, $address, $city, $state, $zip, $country, $patientFirstName, $patientLastName, $patientRelation, date($patientDateOfBirth), $patientFormPDF, $patientNote);
     if (insert_FamilyProfile($temporaryFamilyProfile)) {
         //Get generated familyProfileID from the familyProfile object.
         $results = retrieve_FamilyProfileByName($temporaryFamilyProfile->get_parentfname(), $temporaryFamilyProfile->get_parentlname());
     }
     $resultsFamily = $results[0];
     $temporaryFamilyProfileID = $resultsFamily->get_familyProfileId();
     //create profile activity object
     $current_activity = new ProfileActivity(0, 0, $temporaryFamilyProfileID, $sw_id, 'NULL', $dateSubmit, 'NULL', $activityType, $profileActitivityStatus, $parentFirstName, $parentLastName, $parentEmail, $phone1, $phone2, $address, $city, $state, $zip, $country, $patientFirstName, $patientLastName, $patientRelation, $patientDateOfBirth, $patientFormPDF, $patientNote, $profileActityNotes);
     // check if insert function returns true, then insert profileactivity
     if (insert_ProfileActivity($current_activity)) {
         $taskFinished = TRUE;
         //            //if profileActivity is inserted, send the email to rmh approver
         //            $profileID = $current_activity->get_profileActivityId();
         //            NewFamilyProfile($profileID);
     }
 }