/** * @name getListeBanque() * @return ListeResponse * @desc Recherche la liste des banques actives */ public function getListeBanque() { $lBanqueService = new BanqueService(); $lResponse = new ListeResponse(); $lResponse->setListe($lBanqueService->getAllActif()); return $lResponse; }
/** * @name getListePaiement() * @desc Donne liste des paiements non enregistrés */ public function getListePaiement() { $lOperationService = new OperationService(); $lResponse = new ListePaiementResponse(); $lResponse->setListeCheque($lOperationService->getListeChequeAssociationNonEnregistre()); $lResponse->setListeEspece($lOperationService->getListeEspeceAssociationNonEnregistre()); $lBanqueService = new BanqueService(); $lResponse->setBanques($lBanqueService->getAllActif()); $lTypePaiementService = new TypePaiementService(); $lResponse->setTypePaiement($lTypePaiementService->selectVisible()); return $lResponse; }
/** * @name getInfoRechargement($pParam) * @return InfoRechargementResponse * @desc Retourne les infos pour le rechargement d'un compte */ public function getInfoRechargement($pParam) { $lVr = RechargerCompteValid::validInfo($pParam); if ($lVr->getValid()) { $lResponse = new InfoRechargementResponse(); $lAdherentService = new AdherentService(); $lAdherent = $lAdherentService->get($pParam['id']); $lResponse->setNumero($lAdherent->getAdhNumero()); $lResponse->setIdCompte($lAdherent->getAdhIdCompte()); $lResponse->setCompte($lAdherent->getCptLabel()); $lResponse->setPrenom($lAdherent->getAdhPrenom()); $lResponse->setNom($lAdherent->getAdhNom()); $lResponse->setSolde($lAdherent->getCptSolde()); $lBanqueService = new BanqueService(); $lResponse->setBanques($lBanqueService->getAllActif()); return $lResponse; } return $lVr; }
/** * @name getInfoOperation($pParam) * @return InfoOperationResponse * @desc Retourne les infos pour l'ajout d'une opération */ public function getInfoOperation() { $lTypePaiementService = new TypePaiementService(); $lBanqueService = new BanqueService(); return new InfoOperationResponse($lTypePaiementService->selectVisible(), $lBanqueService->getAllActif()); }
/** * @name getInfoAchatMarche($pParam) * @return InfoAchatCommandeResponse * @desc Retourne les infos de réservation d'un adhérent */ public function getInfoAchatMarche($pParam) { $lVr = AchatValid::validInfoAchatMarche($pParam); if ($lVr->getValid()) { $lResponse = new InfoAchatCommandeResponse(); $lProduitsAchat = array(); $lIdMarche = 0; $lIdCompte = 0; if (!empty($pParam["id_commande"])) { $lIdMarche = $pParam["id_commande"]; } if (!empty($pParam["id"])) { $lAchatService = new AchatService(); $lAchat = $lAchatService->get($pParam["id"]); $lProduitsAchat = $lAchat->getProduits(); $lResponse->setAchats($lAchat); // L'achat if (!is_null($lAchat->getOperationAchat())) { $lIdCompte = $lAchat->getOperationAchat()->getIdCompte(); $lChcp = $lAchat->getOperationAchat()->getChampComplementaire(); if (isset($lChcp[1])) { $lIdMarche = $lChcp[1]->getValeur(); } } if (!is_null($lAchat->getOperationAchatSolidaire())) { $lIdCompte = $lAchat->getOperationAchatSolidaire()->getIdCompte(); $lChcp = $lAchat->getOperationAchatSolidaire()->getChampComplementaire(); if (isset($lChcp[1])) { $lIdMarche = $lChcp[1]->getValeur(); } } } if ($pParam["id_adherent"] > 0) { // Si c'est un compte adhérent $lData = $lVr->getData(); $lIdCompte = $lData['adherent']->getAdhIdCompte(); $lResponse->setAdherent($lData['adherent']); $lAdhesionService = new AdhesionService(); $lResponse->setNbAdhesionEnCours($lAdhesionService->getNbAdhesionEnCoursSurAdherent($pParam["id_adherent"])); } $lStockService = new StockService(); $lStockProduitsDisponible = $lStockService->getProduitsDisponible(); $lStock = array(); $lProduitsMarche = array(); if ($lIdMarche != 0) { // Si ce n'est pas la caisse permanente $lMarcheService = new MarcheService(); $lMarche = $lMarcheService->get($lIdMarche); $lProduitsMarche = $lMarche->getProduits(); $lResponse->setMarche($lMarche); // Les informations du marché } // Fusion des stocks $lLotsProduits = array(); foreach ($lStockProduitsDisponible as $lProduitStock) { $lAjout = true; foreach ($lProduitsMarche as $lProduitMarche) { if ($lProduitStock->getIdNom() == $lProduitMarche->getIdNom() && $lProduitStock->getUnite() == $lProduitMarche->getUnite()) { $lAjout = false; } } if ($lAjout) { if (!isset($lStock[$lProduitStock->getCproNom()])) { $lStock[$lProduitStock->getCproNom()] = array("cproId" => $lProduitStock->getIdCategorie(), "cproNom" => $lProduitStock->getCproNom(), "produits" => array()); } $lUnite = !is_null($lProduitStock->getUnite()) ? $lProduitStock->getUnite() : $lProduitStock->getUniteSolidaire(); $lStock[$lProduitStock->getCproNom()]["produits"][$lProduitStock->getNom() . $lProduitStock->getUnite()] = new ProduitDetailAchatAfficheVO($lProduitStock->getIdNom(), null, null, null, null, null, null, null, null, null, $lUnite, null, $lUnite, null, null, $lProduitStock->getIdCategorie(), $lProduitStock->getCproNom(), null, $lProduitStock->getNom()); $lLotsProduits[$lProduitStock->getIdNom() . $lProduitStock->getUnite()] = array("nom" => $lProduitStock->getNom(), "type" => "modele", "lots" => $lProduitStock->getLots()); } } foreach ($lProduitsMarche as $lProduitMarche) { if (!isset($lStock[$lProduitMarche->getCproNom()])) { $lStock[$lProduitMarche->getCproNom()] = array("cproId" => $lProduitMarche->getIdCategorie(), "cproNom" => $lProduitMarche->getCproNom(), "produits" => array()); } $lUnite = !is_null($lProduitMarche->getUnite()) ? $lProduitMarche->getUnite() : $lProduitMarche->getUniteSolidaire(); $lStock[$lProduitMarche->getCproNom()]["produits"][$lProduitMarche->getNom() . $lProduitMarche->getUnite()] = new ProduitDetailAchatAfficheVO($lProduitMarche->getIdNom(), null, null, null, null, null, null, null, null, null, $lUnite, null, $lUnite, null, null, $lProduitMarche->getIdCategorie(), $lProduitMarche->getCproNom(), null, $lProduitMarche->getNom()); $lLotsProduits[$lProduitMarche->getIdNom() . $lProduitMarche->getUnite()] = array("nom" => $lProduitMarche->getNom(), "type" => "marche", "lots" => $lProduitMarche->getLots()); } foreach ($lProduitsAchat as $lProduitAchat) { $lUnite = !is_null($lProduitAchat->getUnite()) ? $lProduitAchat->getUnite() : $lProduitAchat->getUniteSolidaire(); if (!is_null($lUnite)) { if (isset($lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite])) { $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdStock($lProduitAchat->getIdStock()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdStockSolidaire($lProduitAchat->getIdStockSolidaire()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdDetailCommande($lProduitAchat->getIdDetailCommande()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdModeleLot($lProduitAchat->getIdModeleLot()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdDetailCommandeSolidaire($lProduitAchat->getIdDetailCommandeSolidaire()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdModeleLotSolidaire($lProduitAchat->getIdModeleLotSolidaire()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setQuantite($lProduitAchat->getQuantite()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setQuantiteSolidaire($lProduitAchat->getQuantiteSolidaire()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setMontant($lProduitAchat->getMontant()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setMontantSolidaire($lProduitAchat->getMontantSolidaire()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdDetailOperation($lProduitAchat->getIdDetailOperation()); $lStock[$lProduitAchat->getCproNom()][$lProduitAchat->getNproNom()][$lUnite]->setIdDetailOperationSolidaire($lProduitAchat->getIdDetailOperationSolidaire()); } else { if (!isset($lStock[$lProduitAchat->getCproNom()])) { $lStock[$lProduitAchat->getCproNom()] = array("cproId" => $lProduitAchat->getCproId(), "cproNom" => $lProduitAchat->getCproNom(), "produits" => array()); } $lProduitAchat->setUnite($lUnite); $lProduitAchat->setUniteSolidaire($lUnite); $lStock[$lProduitAchat->getCproNom()]["produits"][$lProduitAchat->getNproNom() . $lUnite] = $lProduitAchat; // Ajout des lots $lModelesLot = ModeleLotManager::selectByIdNomProduit($lProduitAchat->getIdNomProduit()); // Récupère même les lots supprimés car il y a peut être eu un achat sur ce lot précédemment $lLots = array(); foreach ($lModelesLot as $lModeleLot) { $lLot = new DetailMarcheVO(); $lLot->setId($lModeleLot->getId()); $lLot->setTaille($lModeleLot->getQuantite()); $lLot->setPrix($lModeleLot->getPrix()); $lLots[$lModeleLot->getId()] = $lLot; } $lLotsProduits[$lProduitAchat->getIdNomProduit() . $lUnite] = array("nom" => $lProduitAchat->getNproNom(), "type" => "modele", "lots" => $lLots); } } } ksort($lStock); $lResponse->setStock($lStock); // Stock de produit disponible $lResponse->setLots($lLotsProduits); // Lots des produits $lBanqueService = new BanqueService(); $lTypePaiementService = new TypePaiementService(); $lResponse->setTypePaiement($lTypePaiementService->selectVisible()); // Type de paiment $lResponse->setBanques($lBanqueService->getAllActif()); // Liste des banques $lResponse->setIdRequete(uniqid()); return $lResponse; } return $lVr; }
/** * @name getFacture($pParam) * @return FactureResponse * @desc Retourne la facture */ public function getFacture($pParam) { $lVr = FactureValid::validDelete($pParam); if ($lVr->getValid()) { $lBanqueService = new BanqueService(); $lTypePaiementService = new TypePaiementService(); $lFermeService = new FermeService(); $lData = $lVr->getData(); $lFermes = $lFermeService->getByIdCompte($lData['facture']->getId()->getIdCompte()); $lFerme = $lFermes[0]; return new FactureResponse($lData['facture'], $lBanqueService->getAllActif(), $lTypePaiementService->selectVisible(), $lFerme, ListeNomProduitViewManager::select($lFerme->getId())); } return $lVr; }
/** * @name getInfoModificationAdhesionAdherent($pParam) * @return InfoModificationAdhesionAdherentResponse * @desc Retourne les informations sur l'adhésion d'un adhérent à une adhésion */ public function getInfoModificationAdhesionAdherent($pParam) { $lVr = AdhesionAdherentValid::validDelete($pParam); if ($lVr->getValid()) { $lAdhesionService = new AdhesionService(); $lTypePaiementService = new TypePaiementService(); $lBanqueService = new BanqueService(); $lAdhesionAdherent = $lAdhesionService->getAdhesionAdherent($pParam['id']); $lAdhesion = $lAdhesionAdherent->getAdhesionDetail(); $lPerimetre = $lAdhesionService->getTypeAdhesion($lAdhesionAdherent->getAdhesionAdherent()->getIdTypeAdhesion())->getIdPerimetre(); if ($lPerimetre == 1) { // Si seul adhérent sur le compte ne propose pas les adhésions sur périmètre adhérent $lFiltrePerimetre = 1; } else { // Si plusieurs adhérents uniquement les types adhésion compte $lFiltrePerimetre = 2; } $lTypes = array(); foreach ($lAdhesion->getTypes() as $i => $lType) { if ($lType->getPerId() == $lFiltrePerimetre) { array_push($lTypes, $lType); } } $lAdhesion->setTypes($lTypes); return new InfoAjoutAdhesionAdherentResponse($lAdhesion, $lTypePaiementService->selectVisible(), $lBanqueService->getAllActif(), $lAdhesionAdherent); } return $lVr; }