Exemplo n.º 1
0
 if ($action == "revendre") {
     $idContrat = $_POST['idContrat'];
     $idBien = $_POST['idBien'];
     $typeBien = $_POST['typeBien'];
     $montantRevente = $_POST['montantRevente'];
     if ($typeBien == "appartement") {
         $appartementManager = new AppartementManager($pdo);
         $appartementManager->updateMontantRevente($montantRevente, $idBien);
     } else {
         $locauxManager = new LocauxManager($pdo);
         $locauxManager->updateMontantRevente($montantRevente, $idBien);
     }
     $contrat = $contratManager->getContratById($idContrat);
     //Change status of the old contrat Bien from "Vendu" to "Disponible"
     if ($contrat->revendre() == 0) {
         $contratManager->updateRevendre($idContrat, 1);
     } else {
         if ($contrat->revendre() == 1) {
             $contratManager->updateRevendre($idContrat, 0);
         }
     }
     //add history data to db
     $createdBy = $_SESSION['userMerlaTrav']->login();
     $created = date('Y-m-d h:i:s');
     $history = new History(array('action' => "Modification Status Revendre", 'target' => "Table des contrats", 'description' => "Modification de status Revendement du contrat dont l'identifiant est : " . $idContrat . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
     //add it to db
     $historyManager->add($history);
     $actionMessage = "<strong>Opération valide : </strong>Le contrat est modifié avec succès.";
     $typeMessage = "success";
     $redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet;
     if (isset($_POST["source"]) and $_POST["source"] == "clients-search") {