Example #1
0
    $montant = htmlentities($_POST['montant']);
    $numeroCheque = htmlentities($_POST['numeroCheque']);
    $designationSociete = htmlentities($_POST['designationSociete']);
    $designationPersonne = htmlentities($_POST['designationPersonne']);
    $dateCheque = htmlentities($_POST['dateCheque']);
    $idProjet = htmlentities($_POST['idProjet']);
    $createdBy = $_SESSION['userMerlaTrav']->login();
    $created = date('d/m/Y h:m');
    $statut = htmlentities($_POST['statut']);
    /*$url = "";
            if(file_exists($_FILES['urlCheque']['tmp_name']) || is_uploaded_file($_FILES['url']['tmp_name'])) {
    			$url = imageProcessing($_FILES['urlCheque'], '/pieces/pieces_cheque/');
    		}*/
    $cheque = new Cheque(array('id' => $idCheque, 'numero' => $numeroCheque, 'montant' => $montant, 'designationSociete' => $designationSociete, 'designationPersonne' => $designationPersonne, 'dateCheque' => $dateCheque, 'idProjet' => $idProjet, 'createdBy' => $createdBy, 'created' => $created, 'statut' => $statut, 'url' => $url));
    $chequeManager = new ChequeManager($pdo);
    $chequeManager->update($cheque);
    $_SESSION['cheque-update-success'] = "<strong>Opération valide : </strong>Le chèque est modifié avec succès.";
    //add history data to db
    $historyManager = new HistoryManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $cheque = $chequeManager->getChequeById($idCheque);
    $projet = $projetManager->getProjetById($cheque->idProjet());
    $createdBy = $_SESSION['userMerlaTrav']->login();
    $created = date('Y-m-d h:i:s');
    $history = new History(array('action' => "Modification", 'target' => "Table des chèques", 'description' => "Modification du chèque - ID : " . $idCheque . " - N° : " . $cheque->numero() . " - Montant : " . $cheque->montant() . " - Compte : " . $cheque->compteBancaire() . " - Designation : " . $cheque->designationSociete() . "/" . $cheque->designationPersonne() . " - Projet : " . $projet->nom(), 'created' => $created, 'createdBy' => $createdBy));
    //add it to db
    $historyManager->add($history);
} else {
    $_SESSION['cheque-update-error'] = "<strong>Erreur Modification Chèque : </strong>Vous devez remplir au moins les champs 'Montant', 'Numéro chèque' et 'Désignation Société'.";
}
header('Location:../company-cheques.php?idSociete=' . $idSociete);