Ejemplo n.º 1
0
     } else {
         $app->getError();
         logit(DEBUG, "Got error in getMessages: uRec: {$app->uRec} ERR: {$app->errorMessageText}");
         $resp["error"] = "ERROR: " . $app->errorMessageText;
     }
     break;
 case $command == "saveAppt":
     $app->setAuthToken($_POST["authToken"]);
     if ($app->getUrec()) {
         $appt = new Appointments();
         $user = new User();
         $user->getUser($app->uRec);
         $appt->setUser($app->uRec);
         $appt->setappointmentUrec($app->uRec);
         $appt->setdescription($_POST["payload"]["apptDesc"]);
         $appt->setnotes($_POST["payload"]["notes"]);
         $appt->setdatetime($_POST["payload"]["apptDateLocal"]);
         $appt->setalertHoursBefore($_POST["payload"]["apptAlert"]);
         //$appt->setsms($_POST["payload"]["sms"]); //valid = yes/no
         //for now email is always on.
         $appt->setemail("yes");
         //valid = yes/no
         //is this an edit?
         if (is_numeric($_POST["payload"]["apptId"])) {
             $appt->setappId($_POST["payload"]["apptId"]);
         }
         if ($appt->saveAppointment()) {
             $resp["content"] = "OK";
             $resp["appId"] = $appt->appId;
         } else {
             $resp["error"] = "Sorry there was a system error. Please try again later.";