//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['dateOperation'])) {
        $dateOperation = htmlentities($_POST['dateOperation']);
        $designation = htmlentities($_POST['designation']);
        $beneficiaire = htmlentities($_POST['beneficiaire']);
        $numeroCheque = htmlentities($_POST['numeroCheque']);
        $montant = htmlentities($_POST['montant']);
        $idSociete = htmlentities($_POST['idSociete']);
        $idProjet = htmlentities($_POST['idProjet']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $chargesCommuns = new ChargesCommuns(array('dateOperation' => $dateOperation, 'designation' => $designation, 'beneficiaire' => $beneficiaire, 'numeroCheque' => $numeroCheque, 'montant' => $montant, 'idSociete' => $idSociete, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $chargesCommunsManager->add($chargesCommuns);
        $actionMessage = "Opération Valide : ChargesCommuns Ajouté(e) avec succès.";
        $typeMessage = "success";
    } else {
        $actionMessage = "Erreur Ajout chargesCommuns : Vous devez remplir le champ 'dateOperation'.";
        $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']);