$redirectLink = "Location:../clients-modification.php"; } } else { if ($action == "updateObservation") { $idContrat = htmlentities($_POST['idContrat']); $codeContrat = htmlentities($_POST['codeContrat']); $observation = htmlentities($_POST['observation']); $contratManager->updateObservationClient($idContrat, $observation); //after the delete of our contract, we should change the property status to "Disponible" $actionMessage = "<strong>Opération Valide : </strong>Observation ajouté(e) avec succès."; $typeMessage = "success"; $redirectLink = "Location:../contrat.php?codeContrat={$codeContrat}"; } else { if ($action == "delete") { $idContrat = $_POST['idContrat']; $contratManager->hide($idContrat); //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 contrats", 'description' => "Suppression du contrat dont l'identifiant est : " . $idContrat . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); //after the delete of our contract, we should change the property status to "Disponible" $actionMessage = "<strong>Opération Valide : </strong>Contrat Supprimé(e) avec succès."; $typeMessage = "success"; $redirectLink = "Location:../contrats-desistes-list.php?idProjet=" . $idProjet; } else { if ($action == "desister") { $idContrat = $_POST['idContrat']; $contrat = $contratManager->getContratById($idContrat); //Change status of the old contrat Bien from "Vendu" to "Disponible"
$appartementManager->updateStatus("Disponible", $contrat->idBien()); } else { if ($contrat->typeBien() == "localCommercial") { $locauxManager = new LocauxManager($pdo); $locauxManager->updateStatus("Disponible", $contrat->idBien()); } else { if ($contrat->typeBien() == "terrain") { $terrainManager = new TerrainManager($pdo); $terrainManager->updateStatus("Disponible", $contrat->idBien()); } else { if ($contrat->typeBien() == "maison") { $maisonManager = new MaisonManager($pdo); $maisonManager->updateStatus("Disponible", $contrat->idBien()); } } } } $contratManager->hide($contrat->id()); //add history data to db $projetManager = new ProjetManager($pdo); $historyManager = new HistoryManager($pdo); $projet = $projetManager->getProjetById($idProjet); $contrat = $contratManager->getContratById($idContrat); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Cacher", 'target' => "Table des contrats clients", 'description' => "Cacher contrat - Client : " . $contrat->nomClient() . " - CIN : " . $contrat->cin() . " - ID Contrat : " . $contrat->id() . " - Type bien : " . $contrat->typeBien() . " - ID Bien : " . $contrat->idBien() . " - Projet : " . $projet->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); $_SESSION['contrat-delete-success'] = "<strong>Opération valide : </strong>Contrat supprimé avec succès."; $redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete; header($redirectLink);