//add history data to db
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Modification", 'target' => "Table des charges communs", 'description' => "Modification de la charge dont l'identifiant est : " . $idCharge . " de type : " . $type . ", le : " . $dateOperation . ", d'un montant de : " . $montant . ", dont la designation est : " . $designation . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
            $actionMessage = "<strong>Opération Valide</strong> : Charge Modifié(e) avec succès.";
            $typeMessage = "success";
        } else {
            $actionMessage = "<strong>Erreur Modification Charge</strong> : Vous devez remplir le champ 'type'.";
            $typeMessage = "error";
        }
    } else {
        if ($action == "delete") {
            $idCharge = htmlentities($_POST['idCharge']);
            $charge = $chargeManager->getChargeById($idCharge);
            $chargeManager->delete($idCharge);
            //add history data to db
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Suppression", 'target' => "Table des charges", 'description' => "Suppression de la charge dont l'identifiant est : " . $idCharge . " de type : " . $charge->type() . ", le : " . $charge->dateOperation() . ", d'un montant de : " . $charge->montant() . ", dont la designation est : " . $charge->designation() . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
            $actionMessage = "<strong>Opération Valide</strong> : Charge supprimé(e) avec succès.";
            $typeMessage = "success";
        }
    }
}
//Action Delete Processing End
$_SESSION['charge-action-message'] = $actionMessage;
$_SESSION['charge-type-message'] = $typeMessage;
            //add history data to db
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Modification", 'target' => "Table des charges communs", 'description' => "Modification de la charge : " . $typeCharge . " de type : " . $type . ", le : " . $dateOperation . ", d'un montant de : " . $montant . ", dont la designation est : " . $designation . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
            $actionMessage = "<strong>Opération Valide</strong> : Charge Modifié(e) avec succès.";
            $typeMessage = "success";
        } else {
            $actionMessage = "<strong>Erreur Modification Charge</strong> : Vous devez remplir le champ 'type'.";
            $typeMessage = "error";
        }
    } else {
        if ($action == "delete") {
            $idCharge = htmlentities($_POST['idCharge']);
            $type = $chargeManager->getChargeById($idCharge)->type();
            $typeCharge = $typeChargeManager->getTypeChargeById($type)->nom();
            $charge = $chargeManager->getChargeById($idCharge);
            $chargeManager->delete($idCharge);
            //add history data to db
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Suppression", 'target' => "Table des charges", 'description' => "Suppression de la charge dont l'identifiant est : " . $idCharge . " de type : " . $typeCharge . ", le : " . $charge->dateOperation() . ", d'un montant de : " . $charge->montant() . ", dont la designation est : " . $charge->designation() . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
            $actionMessage = "<strong>Opération Valide</strong> : Charge supprimé(e) avec succès.";
            $typeMessage = "success";
        }
    }
}
//Action Delete Processing End