Example #1
0
 public function ligneSuppSingle(Saison $saison, $arr, $ch, $nbrAdulte, $nbrEnfant, $type)
 {
     $chambre = $this->em->getRepository('BackHotelTunisieBundle:Chambre')->find($ch);
     if ($type == 'enfant' && $saison->getSaisonSupp()->getSuppSingleEnfant() && $nbrAdulte == 0 && $nbrEnfant == 1 || $type == 'adulte' && ($nbrAdulte == 1 && $nbrEnfant == 0 || $nbrEnfant == 1 && $nbrAdulte == 1 && $saison->getHotel()->getFicheTechnique()->getSuppSingle1Adulte1EnfantChDouble() || $nbrEnfant == 2 && $nbrAdulte == 1 && $saison->getHotel()->getFicheTechnique()->getSuppSingle1Adulte2EnfantChDouble())) {
         return array('code' => 'SUPP-SINGLE', 'name' => 'Supp single', 'achat' => $saison->getSaisonSupp()->getSuppSingleAchat($arr), 'vente' => $saison->getSaisonSupp()->getSuppSingleVente($arr));
     }
 }
Example #2
0
 public function supplementAction(Saison $saison)
 {
     $em = $this->getDoctrine()->getManager();
     $session = $this->getRequest()->getSession();
     if ($saison->getSaisonSupp() == NULL) {
         $saisonSupp = new SaisonSupp();
     } else {
         $saisonSupp = $saison->getSaisonSupp();
     }
     $form = $this->createForm(new SaisonSuppType(), $saisonSupp);
     $request = $this->getRequest();
     if ($request->isMethod('POST')) {
         $form->submit($request);
         if ($form->isValid()) {
             $saisonSupp = $form->getData();
             $em->persist($saisonSupp);
             $em->persist($saison->setSaisonSupp($saisonSupp));
             $em->flush();
             $session->getFlashBag()->add('success', " Votre saison de base a été modifié avec succées ");
             return $this->redirect($this->generateUrl("SupplementSaison", array('id' => $saison->getId())));
         }
     }
     return $this->render("BackHotelTunisieBundle:Saisons:supplement.html.twig", array('hotel' => $saison->getHotel(), 'saison' => $saison, 'form' => $form->createView()));
 }