$typeMessage = "error";
        }
        if (isset($_POST['source']) and $_POST['source'] == "commande-mois-annee-iaaza") {
            $redirectLink = "Location:../commande-mois-annee-iaaza.php?mois=" . $mois . "&annee=" . $annee;
        } else {
            if (isset($_POST['source']) and $_POST['source'] == "commande-details-iaaza") {
                $redirectLink = "Location:../commande-details-iaaza.php?codeCommande=" . $codeCommande . "&mois=" . $mois . "&annee=" . $annee;
            }
        }
    } else {
        if ($action == "delete") {
            $idCommande = htmlentities($_POST['idCommande']);
            $codeCommande = htmlentities($_POST['codeCommande']);
            $mois = $_POST['mois'];
            $annee = $_POST['annee'];
            //delete commande and its details
            $commandeDetailsManager = new CommandeDetailManager($pdo);
            $commandeDetailsManager->deleteCommande($idCommande);
            $commandeManager->delete($idCommande);
            $actionMessage = "Opération Valide : Commande supprimé(e) avec succès.";
            $typeMessage = "success";
            if (isset($_POST['source']) and $_POST['source'] == "commande-mois-annee-iaaza") {
                $redirectLink = "Location:../commande-mois-annee-iaaza.php?mois=" . $mois . "&annee=" . $annee;
            }
        }
    }
}
//Action Delete Processing End
$_SESSION['commande-action-message'] = $actionMessage;
$_SESSION['commande-type-message'] = $typeMessage;
header($redirectLink);