branch waiting list with update
This commit is contained in:
+11
-5
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once('include/headscript.php');
|
||||
require_once __DIR__ . '/class/mailer.php';
|
||||
require_once('include/waitinglist.php');
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
@@ -53,12 +54,15 @@ $stmt->bind_param("i", $idpreviousbooking);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
// Inserisci la nuova prenotazione (pending)
|
||||
// Decide lo stato: pending se c'è posto, waiting se la classe è piena
|
||||
$bookingStatus = decideBookingStatus($conn, $idnewbooking);
|
||||
|
||||
// Inserisci la nuova prenotazione
|
||||
$stmt = $conn->prepare(
|
||||
"INSERT INTO bookingclass (idserviceschedule, iduser, prevbookingstart, idprevserviceschedule, idservice, idorder, bookingstart, status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, 'pending')"
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
$stmt->bind_param("iisiiss", $idnewbooking, $iduser, $prevBookingStart, $idPrevServiceSchedule, $idservicenew, $globalidorder, $newtime);
|
||||
$stmt->bind_param("iisiisss", $idnewbooking, $iduser, $prevBookingStart, $idPrevServiceSchedule, $idservicenew, $globalidorder, $newtime, $bookingStatus);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
@@ -83,9 +87,11 @@ $stmtUser->close();
|
||||
|
||||
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
|
||||
|
||||
$redirectFlag = ($bookingStatus === 'waiting') ? 'waiting=Y' : 'reprogram=Y';
|
||||
|
||||
// Se manca l'email, completa comunque il flusso senza inviare
|
||||
if ($emailuser === '') {
|
||||
header("Location: userpanel.php?reprogram=Y");
|
||||
header("Location: userpanel.php?$redirectFlag");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -138,5 +144,5 @@ try {
|
||||
error_log("Errore invio mail riprogrammazione (iduser $iduser): " . $mail->ErrorInfo);
|
||||
}
|
||||
|
||||
header("Location: userpanel.php?reprogram=Y");
|
||||
header("Location: userpanel.php?$redirectFlag");
|
||||
exit();
|
||||
|
||||
Reference in New Issue
Block a user