//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['code'])) {
        $code = htmlentities($_POST['code']);
        $prix = htmlentities($_POST['prix']);
        $superficie = htmlentities($_POST['superficie']);
        $facade = htmlentities($_POST['facade']);
        $mezzanine = htmlentities($_POST['mezzanine']);
        $status = htmlentities($_POST['status']);
        $par = htmlentities($_POST['par']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $locaux = new Locaux(array('nom' => $code, 'prix' => $prix, 'superficie' => $superficie, 'facade' => $facade, 'mezzanine' => $mezzanine, 'idProjet' => $idProjet, 'status' => $status, 'par' => $par, 'createdBy' => $createdBy, 'created' => $created));
        //add it to db
        $locauxManager->add($locaux);
        //add History data
        $history = new History(array('action' => "Ajout", 'target' => "Table des locaux commerciaux", 'description' => "Ajouter un local commercial", 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $historyManager->add($history);
        $actionMessage = "Opération Valide : Local Commercial Ajouté avec succès.";
        $typeMessage = "success";
    } else {
        $actionMessage = "Erreur Ajout Local Commercial : Vous devez remplir le champ <strong>Nom</strong>.";
        $typeMessage = "error";
    }
} else {
    if ($action == "update") {
        if (!empty($_POST['code'])) {
            $id = htmlentities($_POST['idLocaux']);
            $code = htmlentities($_POST['code']);