Exemplo n.º 1
0
        $numeroOperation = htmlentities($_POST['numeroOperation']);
        $dateOperation = htmlentities($_POST['dateOperation']);
        $dateReglement = htmlentities($_POST['dateReglement']);
        $compteBancaire = htmlentities($_POST['compteBancaire']);
        $status = 0;
        $idContrat = htmlentities($_POST['idContrat']);
        $idClient = htmlentities($_POST['idClient']);
        $client = $clientManager->getClientById($idClient);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        $url = "";
        if (file_exists($_FILES['urlCheque']['tmp_name']) || is_uploaded_file($_FILES['urlCheque']['tmp_name'])) {
            $url = imageProcessing($_FILES['urlCheque'], '/pieces/pieces_reglements/');
        }
        $operation = new Operation(array('date' => $dateOperation, 'dateReglement' => $dateReglement, 'status' => $status, 'montant' => $montant, 'compteBancaire' => $compteBancaire, 'observation' => $observation, 'reference' => $reference, 'modePaiement' => $modePaiement, 'idContrat' => $idContrat, 'numeroCheque' => $numeroOperation, 'url' => $url, 'createdBy' => $createdBy, 'created' => $created));
        $operationManager->add($operation);
        //get contrat details
        $contrat = $contratManager->getContratById($idContrat);
        $projet = $projetManager->getProjetById($contrat->idProjet());
        $nomProjet = $projet->nom();
        //add History data
        $history = new History(array('action' => "Ajout", 'target' => "Table des paiements clients ", 'description' => "Ajout 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 Ajouté avec succès.";
        $typeMessage = "success";
    } else {
        $actionMessage = "<strong>Erreur Ajout Paiement Client</strong> : Vous devez remplir les champs <strong>Montant</strong> et <strong>Numéro Opération</strong>.";
        $typeMessage = "error";
    }
} else {