/**
  * {@inheritdoc}
  */
 public function populateForm($form)
 {
     // Appel des évenements de remplissage du formulaire
     $this->dispatch(JLMCommerceEvents::QUOTEVARIANT_FORM_POPULATE, new FormPopulatingEvent($form, $this->getRequest()));
     $quote = $form->get('quote')->getData();
     if (!$quote instanceof Quote) {
         throw new LogicException('$quote is not a Quote object');
     }
     $form->get('vat')->setData(number_format($quote->getVat() * 100, 1, ',', ' '));
     $form->get('vatTransmitter')->setData(number_format($quote->getVatTransmitter() * 100, 1, ',', ' '));
     // On complète avec ce qui reste vide
     $params = array('creation' => new \DateTime(), 'discount' => 0);
     foreach ($params as $key => $value) {
         $param = $form->get($key)->getData();
         if (empty($param)) {
             $form->get($key)->setData($value);
         }
     }
     $lines = $form->get('lines')->getData();
     if (empty($lines)) {
         $l = new QuoteLine();
         $l->setVat($form->get('quote')->getData()->getVat());
         $form->get('lines')->setData(array($l));
     }
     return parent::populateForm($form);
 }
 protected function getFormParam($name, $options = array())
 {
     switch ($name) {
         case 'new':
             return array('method' => 'POST', 'route' => 'jlm_contact_contact_create', 'params' => array('id' => $options['type']), 'label' => 'Créer', 'type' => $this->getFormType($options['type']), 'entity' => null);
         case 'edit':
             return array('method' => 'POST', 'route' => 'jlm_contact_contact_update', 'params' => array('id' => $options['entity']->getId()), 'label' => 'Modifier', 'type' => $this->getFormType($options['type']), 'entity' => $options['entity']);
     }
     return parent::getFormParam($name, $options);
 }
 /**
  * {@inheritdoc}
  */
 protected function getFormParam($name, $options = array())
 {
     switch ($name) {
         case 'edit':
             return array('method' => 'POST', 'route' => 'jlm_product_stock_update', 'params' => array('id' => $options['entity']->getId()), 'label' => 'Modifier', 'type' => new StockType(), 'entity' => $options['entity']);
         case 'inventory':
             return array('method' => 'POST', 'route' => 'jlm_product_stock_inventory', 'params' => array(), 'label' => 'Valider', 'type' => new InventoryType(), 'entity' => $options['entity']);
     }
     return parent::getFormParam($name, $options);
 }
 /**
  * {@inheritdoc}
  */
 protected function getFormParam($name, $options = array())
 {
     switch ($name) {
         case 'new':
             return array('method' => 'POST', 'route' => 'jlm_contact_corporationcontact_create', 'params' => array(), 'label' => 'Créer', 'type' => new CorporationContactType(), 'entity' => null);
         case 'edit':
             return array('method' => 'POST', 'route' => 'jlm_contact_corporationcontact_update', 'params' => array('id' => $options['entity']->getId()), 'label' => 'Modifier', 'type' => new CorporationContactType(), 'entity' => $options['entity']);
         case 'delete':
             return array('method' => 'DELETE', 'route' => 'jlm_contact_corporationcontact_delete', 'params' => array('id' => $options['entity']->getId()), 'label' => 'Supprimer', 'type' => 'form', 'entity' => $options['entity']);
     }
     return parent::getFormParam($name, $options);
 }
 /**
  * {@inheritdoc}
  */
 public function populateForm($form)
 {
     // Appel des évenements de remplissage du formulaire
     $this->dispatch(JLMCommerceEvents::QUOTE_FORM_POPULATE, new FormPopulatingEvent($form, $this->getRequest()));
     // On complète avec ce qui reste vide
     $vat = $this->om->getRepository('JLMCommerceBundle:VAT')->find(1)->getRate();
     $params = array('creation' => new \DateTime(), 'vat' => $vat, 'vatTransmitter' => $vat, 'followerCp' => $this->getUser()->getContact()->getName());
     foreach ($params as $key => $value) {
         $param = $form->get($key)->getData();
         if (empty($param)) {
             $form->get($key)->setData($value);
         }
     }
     return parent::populateForm($form);
 }
 /**
  * {@inheritdoc}
  */
 public function populateForm($form)
 {
     if ($form->getName() == 'jlm_contract_contract') {
         $door = $this->setterFromRequest('door', 'JLMModelBundle:Door');
         if ($door) {
             $form->get('door')->setData($door);
             $form->get('trustee')->setData($door->getSite()->getTrustee());
         }
         $begin = $form->get('begin');
         if (!$begin->getData()) {
             $begin->setData(new \DateTime());
         }
     }
     return parent::populateForm($form);
 }
 /**
  * {@inheritdoc}
  */
 public function populateForm($form)
 {
     // Appel des évenements de remplissage du formulaire
     $this->dispatch(JLMCommerceEvents::BILL_FORM_POPULATE, new FormPopulatingEvent($form, $this->getRequest()));
     // On complète avec ce qui reste vide
     $vat = $this->om->getRepository('JLMCommerceBundle:VAT')->find(1)->getRate();
     $params = array('creation' => new \DateTime(), 'vat' => $vat, 'vatTransmitter' => $vat, 'penalty' => $this->om->getRepository('JLMCommerceBundle:PenaltyModel')->find(1) . '', 'property' => $this->om->getRepository('JLMCommerceBundle:PropertyModel')->find(1) . '', 'earlyPayment' => $this->om->getRepository('JLMCommerceBundle:EarlyPaymentModel')->find(1) . '', 'maturity' => 30, 'discount' => 0);
     foreach ($params as $key => $value) {
         $param = $form->get($key)->getData();
         if (empty($param)) {
             $form->get($key)->setData($value);
         }
     }
     // on met un ligne vide si y en a pas
     $lines = $form->get('lines')->getData();
     if (empty($lines)) {
         $form->get('lines')->setData(array(new BillLine()));
     }
     return parent::populateForm($form);
 }