$typeMessage = "error";
    }
} else {
    if ($action == "update") {
        $idChargesCommuns = htmlentities($_POST['idChargesCommuns']);
        if (!empty($_POST['dateOperation'])) {
            $dateOperation = htmlentities($_POST['dateOperation']);
            $designation = htmlentities($_POST['designation']);
            $beneficiaire = htmlentities($_POST['beneficiaire']);
            $numeroCheque = htmlentities($_POST['numeroCheque']);
            $montant = htmlentities($_POST['montant']);
            $idProjet = htmlentities($_POST['idProjet']);
            $updatedBy = $_SESSION['userMerlaTrav']->login();
            $updated = date('Y-m-d h:i:s');
            $chargesCommuns = new ChargesCommuns(array('id' => $idChargesCommuns, 'dateOperation' => $dateOperation, 'designation' => $designation, 'beneficiaire' => $beneficiaire, 'numeroCheque' => $numeroCheque, 'montant' => $montant, 'idProjet' => $idProjet, 'updated' => $updated, 'updatedBy' => $updatedBy));
            $chargesCommunsManager->update($chargesCommuns);
            $actionMessage = "Opération Valide : ChargesCommuns Modifié(e) avec succès.";
            $typeMessage = "success";
        } else {
            $actionMessage = "Erreur Modification ChargesCommuns : Vous devez remplir le champ 'dateOperation'.";
            $typeMessage = "error";
        }
    } else {
        if ($action == "delete") {
            $idChargesCommuns = htmlentities($_POST['idChargesCommuns']);
            $chargesCommunsManager->delete($idChargesCommuns);
            $actionMessage = "Opération Valide : ChargesCommuns supprimé(e) avec succès.";
            $typeMessage = "success";
        }
    }
}