/**
  * @param ListMapper $listMapper
  */
 protected function configureListFields(ListMapper $listMapper)
 {
     parent::configureListFields($listMapper);
     $listMapper->remove('_action');
     $listMapper->addIdentifier('id', null);
     $label = 'list.' . $this->_prefix_label . '.';
     $listMapper->add('tabs.name', null, array('label' => $label . 'tabs'))->add('text', null, array('label' => $label . 'text'));
 }
 /**
  * @param string $name
  *
  * @return null|string
  */
 public function getTemplate($name)
 {
     switch ($name) {
         case 'create':
         case 'edit':
             return $this->_bundle_name . ':CRUD:edit_client_invoicing.html.twig';
     }
     return parent::getTemplate($name);
 }
 /**
  * @param ErrorElement $errorElement
  * @param mixed $object
  */
 public function validate(ErrorElement $errorElement, $object)
 {
     parent::validate($errorElement, $object);
     $this->validateNDeTVA($errorElement, $object);
     if (is_null($object->getId()) && $object->getDateDeVerification()) {
         $date = $object->getDateDeVerification();
         if ($date->format('Ymd') > date('Ymd')) {
             $errorElement->with('date_de_verification')->addViolation('La date ne peut pas être postérieure à la date du jour.')->end();
         }
     }
 }
 /**
  * @param ErrorElement $errorElement
  * @param mixed|\Application\Sonata\ClientBundle\Entity\AbstractCompteEntity $object
  */
 public function validate(ErrorElement $errorElement, $object)
 {
     $this->_autofixeuroformat($object);
     parent::validate($errorElement, $object);
     $user = \AppKernel::getStaticContainer()->get('security.context')->getToken()->getUser();
     /* @var $value \DateTime */
     $value = $object->getDate();
     if ($value && !$this->getValidateImport() && !$user->hasGroup('Superviseur')) {
         if ($value->getTimestamp() < strtotime('-10 days')) {
             $errorElement->with('date')->addViolation('La "date" ne doit pas dépasser les 10 jours dans le passé')->end();
         }
     }
 }
 /**
  * @param ListMapper $listMapper
  */
 protected function configureListFields(ListMapper $listMapper)
 {
     parent::configureListFields($listMapper);
     $listMapper->add('type_garantie.name', null, array('label' => $this->getFieldLabel('type_garantie')))->add('montant', 'money', array('label' => $this->getFieldLabel('montant'), 'template' => 'ApplicationSonataClientBundle:CRUD:list_garantie_montant.html.twig'))->add('date_decheance', 'date', array('label' => $this->getFieldLabel('date_decheance'), 'template' => 'ApplicationSonataClientBundle:CRUD:list_date_decheance.html.twig'))->add('nom_de_la_banques_id', null, array('label' => $this->getFieldLabel('nom_de_la_banques_id'), 'template' => 'ApplicationSonataClientBundle:CRUD:list_banques.html.twig'));
 }
Example #6
0
 /**
  * @param ErrorElement $errorElement
  * @param mixed $object
  */
 public function validate(ErrorElement $errorElement, $object)
 {
     /* @var $object \Application\Sonata\ClientBundle\Entity\Tarif */
     parent::validate($errorElement, $object);
     $this->_setupAlerts($errorElement, $object);
 }
 /**
  * @param RouteCollection $collection
  */
 protected function configureRoutes(RouteCollection $collection)
 {
     parent::configureRoutes($collection);
     $collection->add('sortable');
 }
 /**
  * @param ListMapper $listMapper
  */
 protected function configureListFields(ListMapper $listMapper)
 {
     parent::configureListFields($listMapper);
     $label = 'list.' . $this->_prefix_label . '.';
     $listMapper->add('date', null, array('label' => $label . 'date', 'template' => 'ApplicationSonataClientBundle:CRUD:list_date.html.twig'))->add('categorie.name', null, array('label' => $label . 'categorie'))->add('note', null, array('label' => $label . 'note'));
 }