$actionMessage = "<strong>Opération Valide</strong> : Paiement client validé avec succès."; $typeMessage = "success"; } else { if ($action == "cancel") { $idOperation = $_POST['idOperation']; $operation = $operationManager->getOperationById($idOperation); $contrat = $contratManager->getContratById($operation->idContrat()); $client = $clientManager->getClientById($contrat->idClient()); $projet = $projetManager->getProjetById($contrat->idProjet()); $nomProjet = $projet->nom(); $montant = $operation->montant(); $observation = $operation->observation(); $compteBancaire = $operation->compteBancaire(); $modePaiement = $operation->modePaiement(); $numeroOperation = $operation->numeroCheque(); $operationManager->cancel($idOperation, 0); //add History data $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Annulation", 'target' => "Table des paiements clients", 'description' => "Annulation d'une opération paiement client, pour " . ucfirst($client->nom()) . " d'un montant de {$montant} - N° Contrat : {$idContrat} - Projet : {$nomProjet} - N° Opération : {$numeroOperation} - Mode Paiement : {$modePaiement} - Compte Bancaire : {$compteBancaire} - Obersvation : {$observation}", 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); $actionMessage = "<strong>Opération Valide</strong> : Paiement client annulé avec succès."; $typeMessage = "success"; } else { if ($action == "hide") { $idOperation = $_POST['idOperation']; $operation = $operationManager->getOperationById($idOperation); $contrat = $contratManager->getContratById($operation->idContrat()); $client = $clientManager->getClientById($contrat->idClient()); $projet = $projetManager->getProjetById($contrat->idProjet());