コード例 #1
0
 /**
  * @name delete($pId)
  * @param IdAchatVO
  * @desc Supprime un achat
  */
 public function delete($pId)
 {
     $lAchatValid = new NAMESPACE_CLASSE\NAMESPACE_VALIDATEUR\MOD_SERVICE\AchatValid();
     if (!is_null($pId) && $lAchatValid->select($pId)) {
         $lAchatActuel = $this->select($pId);
         $lOperationService = new OperationService();
         // Suppression des opérations
         if (!is_null($lAchatActuel->getRechargement())) {
             // Rechargement
             $lOperationService->delete($lAchatActuel->getRechargement()->getId());
         }
         $lIdCompte = 0;
         $lIdMarche = 0;
         $lIdOperationAchat = 0;
         if (!is_null($lAchatActuel->getOperationAchat())) {
             // Achat avec Ope Zeybu
             $lIdOperationAchat = $lAchatActuel->getOperationAchat()->getId();
             $lOperationService->delete($lAchatActuel->getOperationAchat()->getId());
             $lOperationAchatChampComp = $lAchatActuel->getOperationAchat()->getChampComplementaire();
             $lOperationService->delete($lOperationAchatChampComp[8]->getValeur());
             $lIdCompte = $lAchatActuel->getOperationAchat()->getIdCompte();
             $lIdMarche = $lOperationAchatChampComp[1]->getValeur();
         }
         $lIdOperationAchatSolidaire = 0;
         if (!is_null($lAchatActuel->getOperationAchatSolidaire())) {
             // Achat solidaire avec ope zeybu
             $lIdOperationAchatSolidaire = $lAchatActuel->getOperationAchatSolidaire()->getId();
             $lOperationService->delete($lAchatActuel->getOperationAchatSolidaire()->getId());
             $lOperationAchatSolidaireChampComp = $lAchatActuel->getOperationAchatSolidaire()->getChampComplementaire();
             $lOperationService->delete($lOperationAchatSolidaireChampComp[8]->getValeur());
             $lIdCompte = $lAchatActuel->getOperationAchatSolidaire()->getIdCompte();
             $lIdMarche = $lOperationAchatSolidaireChampComp[1]->getValeur();
         }
         // Suppression de l'ensemble des lignes de produit
         DetailAchatManager::delete($lIdOperationAchat, $lIdOperationAchatSolidaire);
         $lDetailOperationService = new DetailOperationService();
         $lStockService = new StockService();
         foreach ($lAchatActuel->getProduits() as $lProduitInital) {
             $lStockService->delete($lProduitInital->getIdStock());
             $lDetailOperationService->delete($lProduitInital->getIdDetailOperation());
             $lStockService->delete($lProduitInital->getIdStockSolidaire());
             $lDetailOperationService->delete($lProduitInital->getIdDetailOperationSolidaire());
         }
         // Suppression de la réservation
         $lReservationService = new ReservationService();
         $lIdReservation = new IdReservationVO();
         $lIdReservation->setIdCompte($lIdCompte);
         $lIdReservation->setIdCommande($lIdMarche);
         $lReservationService->delete($lIdReservation);
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * @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;
     }
 }
コード例 #3
0
 /**
  * @name supprimerReservation($pParam)
  * @return ListeReservationCommandeVR
  * @desc Met à jour une réservation
  */
 public function supprimerReservation($pParam)
 {
     $lVr = CommandeReservationValid::validDelete($pParam);
     if ($lVr->getValid()) {
         $lReservationService = new ReservationService();
         $lIdReservation = new IdReservationVO();
         $lIdReservation->setIdCompte($pParam["id_compte"]);
         $lIdReservation->setIdCommande($pParam["id_commande"]);
         $lReservationService->delete($lIdReservation);
     }
     return $lVr;
 }
コード例 #4
0
 /**
  * @name supprimerReservation($pParam)
  * @return ListeReservationCommandeVR
  * @desc Supprime une réservation
  */
 public function supprimerReservation($pParam)
 {
     $pParam['idCompte'] = $_SESSION[ID_COMPTE];
     $lVr = ReservationMarcheValid::validDelete($pParam);
     if ($lVr->getValid()) {
         $lReservationService = new ReservationService();
         $lIdReservation = new IdReservationVO();
         $lIdReservation->setIdCompte($pParam['idCompte']);
         $lIdReservation->setIdCommande($pParam["id_commande"]);
         $lReservationService->delete($lIdReservation);
         // Repositionne une réservations sur les abonnements
         $lAbonnementService = new AbonnementService();
         $lAbonnementService->ajoutReservation($pParam['idCompte'], $pParam["id_commande"]);
     }
     return $lVr;
 }