function test_insert_RoomReservationActivity($reservation) { $ActivityType = $reservation->get_ActivityType(); $retVal = insert_RoomReservationActivity($reservation); if ($retVal > 0) { echo "</br> Insert succeeded </br>"; } else { echo "</br> Insert failed </br>"; } if ($ActivityType == "Apply") { echo "Apply" . "</br>"; echo "RoomReservationActivityID: " . $reservation->get_roomReservationActivityID() . "</br>"; echo "RoomReservationRequestID: " . $reservation->get_roomReservationRequestID() . "</br>"; } else { echo "Modify or Cancel" . "</br>"; echo "RoomReservationActivityID: <b>" . $reservation->get_roomReservationActivityID() . "</br></b>"; echo "RoomReservationRequestID: <b>" . $reservation->get_roomReservationRequestID() . "</br></b>"; } }
$newEndDate = $sanitize($_POST["EndDate"]); } if (isset($_POST["PatientDiagnosis"])) { $newPatientDiagnosis = $sanitize($_POST["PatientDiagnosis"]); } if (isset($_POST["Notes"])) { $newNotes = $sanitize($_POST["Notes"]); } if (isset($_POST["ParentLastName"])) { $newParentLastName = $sanitize($_POST["ParentLastName"]); } if (isset($_POST["ParentFirstName"])) { $newParentFirstName = $sanitize($_POST["ParentFirstName"]); } $myReservation = new Reservation($roomReservationActivityID, $roomReservationRequestID, $socialWorkerProfileId, $rmhStaffProfileId, $familyProfileId, $activityType, $status, $swDateStatusSubmitted, $rmhDateStatusSubmitted, $beginDate, $endDate, $patientDiagnosis, $roomnote); $myReservation = insert_RoomReservationActivity(); } //end if( $_POST['submit'] == "submit" ) } else { if (isset($_POST['form_token']) && !validateTokenField($_POST)) { $referralform = false; //if the security validation failed. display/store the error: //'The request could not be completed: security check failed!' } else { $referralform = false; //there was no POST DATA } } $errorMessage = ""; //check that the fields are not blank and tell the user to fill them in if (empty($newBeginDate)) {
function cancelReservation(Reservation $informationroom) { error_log("will do the actual insert to the database"); //retrieves the sw, and gets id, firstname and lastname $currentUser = getUserProfileID(); // if the person doing the edit is a social worker, add their name and id to the reservation // activity record if (getUserAccessLevel() == 1) { $sw = retrieve_UserProfile_SW($currentUser); $swObject = current($sw); // there is only one record in the returned array, so get it // consider changing this code $informationroom->set_socialWorkerProfileId($swObject->get_swProfileId()); $informationroom->set_swFirstName($swObject->get_swFirstName()); $informationroom->set_swLastName($swObject->get_swLastName()); $informationroom->set_swDateStatusSubmitted(date("Y-m-d H:i:s")); $informationroom->set_status("Unconfirmed"); } else { if (getUserAccessLevel() == 2) { $rmhStaff = retrieve_UserProfile_RMHApprover_OBJ($currentUser); $informationroom->set_rmhStaffProfileId($rmhStaff->get_rmhStaffProfileId()); $informationroom->set_rmhStaffFirstName($rmhStaff->get_rmhStaffFirstName()); $informationroom->set_rmhStaffLastName($rmhStaff->get_rmhStaffLastName()); $informationroom->set_rmhDateStatusSubmitted(date("Y-m-d H:i:s")); $informationroom->set_status("Confirmed"); } } $informationroom->set_activityType("Cancel"); // insert a new activity record with a Cancel status // because we keep track of all changes, never update // the current activity record. instead, insert a new one // with the same request id but new activity id $retval = insert_RoomReservationActivity($informationroom); return $retval; }
$swObject = current($sw); $informationroom->set_socialWorkerProfileId($swObject->get_swProfileId()); $informationroom->set_swFirstName($swObject->get_swFirstName()); $informationroom->set_swLastName($swObject->get_swLastName()); $informationroom->set_activityType("Cancel"); $informationroom->set_status("Unconfirmed"); $informationroom->set_swDateStatusSubmitted(date("Y-m-d H:i:s")); $rmhStaffProfileId = $informationroom->get_rmhStaffProfileId(); // if the request has never been approved, the rmh staff id will // still be null // need to make sure it goes back into the DB as a database null if (is_null($rmhStaffProfileId)) { error_log("rmhStaffProfileId is null"); $informationroom->set_rmhStaffProfileId('NULL'); } // we don't remove the reservation record when cancelling. // we insert a new activity record with an activity type of "cancel" and status of "unconfirmed" // the RMH staff will have to confirm the cancellation $retval = insert_RoomReservationActivity($informationroom); echo '<div id="content" style="margin-left: 300px; margin-top: 23px;">'; if ($retval == -1) { echo "Could not update the Room Reservation"; } else { echo "Update was successful"; } } include ROOT_DIR . '/footer.php'; ?>
$currentUser = getUserProfileID(); $sw = retrieve_UserProfile_SW($currentUser); $swObject = current($sw); $sw_id = $swObject->get_swProfileId(); $swFirstName = $swObject->get_swFirstName(); $swLastName = $swObject->get_swLastName(); $ActivityType = "Apply"; $Status = "Unconfirmed"; $swDateStatusSubmitted = date("Y-m-d"); $userId = sanitize(getCurrentUser()); } } if (empty($message)) { // RMH staff fields are null because this is a new reservation $currentreservation = new Reservation(0, 0, 0, $_SESSION['familyID'], $newParentLastName, $newParentFirstName, $newPatientLastName, $newPatientFirstName, $sw_id, $swLastName, $swFirstName, 'NULL', 'NULL', 'NULL', $swDateStatusSubmitted, 'NULL', $ActivityType, $Status, $newBeginDate, $newEndDate, $newPatientDiagnosis, $newNotes); $roomReservationRequestID = insert_RoomReservationActivity($currentreservation); echo '<section class="content">'; echo '<p><font color="red">The reservation request has been posted. It will be final once RMH approves it</font></p><br/>'; echo "The referral was made by : " . $userId . "<br>"; echo "The Begin Date is : " . $newBeginDate . "<br>"; echo "The End Date is : " . $newEndDate . "<br>"; echo "The Patient's Diagnosis is : " . $newPatientDiagnosis . "<br>"; echo "Notes on the referral are : " . $newNotes . "<br>"; echo "The Parent's Last name is : " . $newParentLastName . "<br>"; echo "The Parent's First name is : " . $newParentFirstName . "<br>"; echo "The Referral Request currently has a Status of :\r\n" . $Status . "<br>"; echo "Date submitted is : " . $swDateStatusSubmitted . "<br>"; echo '<br>'; echo '<br><br> <table border = "2" cellspacing = "10" cellpadding = "6">'; echo '<thead>