/** * @name getListe() * @return MonMarcheResponse * @desc Retourne la liste des Marchés et réservations en cours */ public function getListe() { $lResponse = new MonMarcheResponse(); $lMarcheService = new MarcheService(); $lResponse->setMarches($lMarcheService->getNonAchatParCompte($_SESSION[ID_COMPTE])); return $lResponse; }
/** * @name delete($pIdAdherent) * @param integer * @return AdherentVO * @desc Supprime un adherent */ public function delete($pIdAdherent) { $lAdherentValid = new NAMESPACE_CLASSE\NAMESPACE_VALIDATEUR\MOD_SERVICE\AdherentValid(); if ($lAdherentValid->delete($pIdAdherent)) { $lAdherent = AdherentManager::select($pIdAdherent); $lCompteService = new CompteService(); $lNbAdherentSurCompte = $lCompteService->getNombreAdherentSurCompte($lAdherent->getIdCompte()); $lAdhesionService = new AdhesionService(); // Suppression des adhésions $lAdhesionService->deleteAdhesionAdherentByIdAdherent($pIdAdherent); // Change l'état à supprimé $lAdherent->setEtat(2); AdherentManager::update($lAdherent); // Désactive l'identification $lIdentification = IdentificationManager::selectByIdType($lAdherent->getId(), 1); $lIdentification = $lIdentification[0]; $lIdentification->setAutorise(0); IdentificationManager::update($lIdentification); //Désinscription de la mailing liste $lMailingListeService = new MailingListeService(); if ($lAdherent->getCourrielPrincipal() != "") { $lMailingListeService->delete($lAdherent->getCourrielPrincipal()); } if ($lAdherent->getCourrielSecondaire() != "") { $lMailingListeService->delete($lAdherent->getCourrielSecondaire()); } // Si c'est le dernier adhérent du compte : suppression des réservations et abonnements if ($lNbAdherentSurCompte < 2) { // Suppression des réservations en cours $lMarcheService = new MarcheService(); $lReservations = $lMarcheService->getNonAchatParCompte($lAdherent->getIdCompte()); if (!is_null($lReservations[0]->getId())) { $lReservationService = new ReservationService(); foreach ($lReservations as $lReservation) { $lIdReservation = new IdReservationVO(); $lIdReservation->setIdCompte($lAdherent->getIdCompte()); $lIdReservation->setIdCommande($lReservation->getId()); $lReservationService->delete($lIdReservation); } } // Suppression des abonnements $lAbonnementService = new AbonnementService(); $lProduits = $lAbonnementService->getProduitsAbonne($lAdherent->getIdCompte()); foreach ($lProduits as $lProduit) { $lAbonnementService->deleteAbonnement($lProduit->getCptAboId()); } } return true; } else { return false; } }