/**
  * @name delete($pId)
  * @param integer
  * @desc Met à jour une opération
  */
 public function delete($pId)
 {
     $lOperationValid = new OperationValid();
     if ($lOperationValid->delete($pId)) {
         $lOperation = $this->getDetail($pId);
         // Maj du solde du compte
         $lTypeModificationSolde = array(1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13, 14);
         if (in_array($lOperation->getTypePaiement(), $lTypeModificationSolde)) {
             $lCompteService = new CompteService();
             // Mise à jour du solde
             $lCompte = $lCompteService->get($lOperation->getIdCompte());
             $lCompte->setSolde($lCompte->getSolde() - $lOperation->getMontant());
             $lCompteService->set($lCompte);
         }
         // Si c'est un paiement de facture de producteur il faut mettre à jour les paiements associés
         $lOperationChampComplementaireFacture = OperationChampComplementaireManager::recherche(array(OperationChampComplementaireManager::CHAMP_OPERATIONCHAMPCOMPLEMENTAIRE_CHCP_ID, OperationChampComplementaireManager::CHAMP_OPERATIONCHAMPCOMPLEMENTAIRE_VALEUR), array('=', '='), array(9, $pId), array(), array());
         if (!is_null($lOperationChampComplementaireFacture[0]->getOpeId())) {
             // Suppression de l'operation de facture
             $lOperationFacture = $this->getDetail($lOperationChampComplementaireFacture[0]->getOpeId());
             $this->delete($lOperationFacture->getId());
             // Suppression de l'operation zeybu
             $lOpeFacChampComp = $lOperationFacture->getChampComplementaire();
             $this->delete($lOpeFacChampComp[10]->getValeur());
         }
         switch ($lOperation->getTypePaiement()) {
             case 0:
                 // Annulation de la reservation
             // Annulation de la reservation
             case 16:
             case 22:
                 $lOperation->setTypePaiement(16);
                 return $this->update($lOperation);
                 break;
             case 15:
                 // Réservation non récupérée
                 $lOperation->setTypePaiement(15);
                 return $this->update($lOperation);
                 break;
             case 1:
                 // Annulation achat/dépot
             // Annulation achat/dépot
             case 2:
             case 6:
                 $lOperation->setTypePaiement(18);
                 return $this->update($lOperation);
                 break;
             case 7:
                 $lOperation->setTypePaiement(18);
                 return $this->update($lOperation);
                 break;
             case 8:
                 $lOperation->setTypePaiement(20);
                 return $this->update($lOperation);
                 break;
             default:
                 $lOperation->setDate(StringUtils::dateTimeAujourdhuiDb());
                 $lOperation->setlibelle("Supression");
                 $this->insertHistorique($lOperation);
                 // Ajout historique
                 //$this->insertHistorique($lDetailOperation); // Ajout historique
                 return OperationManager::delete($pId);
                 // delete de l'opération
                 break;
         }
     } else {
         return false;
     }
 }
                        $actionMessage = "<strong>Opération Valide</strong> : Paiement retiré  avec succès.";
                        $typeMessage = "success";
                    } else {
                        if ($action == "delete") {
                            $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->delete($idOperation);
                            //add History data
                            $createdBy = $_SESSION['userMerlaTrav']->login();
                            $created = date('Y-m-d h:i:s');
                            $history = new History(array('action' => "Suppression", 'target' => "Table des paiements clients", 'description' => "Suppression 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 Supprimé avec succès.";
                            $typeMessage = "success";
                        }
                    }
                }
            }
        }
    }
}