Esempio n. 1
0
         }
     }
     //set the redirect link
     $redirectLink = 'Location:../contrats-desistes-list.php?idProjet=' . $idProjet;
     if (isset($_POST["source"]) and $_POST["source"] == "clients-search") {
         $redirectLink = 'Location:../clients-search.php';
     }
 } else {
     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();