Example #1
0
 public function __construct()
 {
     $this->garantie = new \Doctrine\Common\Collections\ArrayCollection();
     $this->pays_postal = $this->pays_facturation = ListCountries::getDefault();
 }
 public function configure()
 {
     parent::configure();
     $this->jsSettingsJson(array('client' => array('nature_du_client' => $this->getClient()->getNatureDuClient()->getName(), 'pays_code' => $this->getClient()->getPaysPostal()->getCode(), 'country_eu' => ListCountries::getCountryEU())));
 }
 /**
  * @param $object
  * @param null $id
  * @param string $template
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function _action($object, $id = null, $template = 'standard_layout_client')
 {
     $client = null;
     if ($id) {
         $client = $this->getDoctrine()->getManager()->getRepository('ApplicationSonataClientBundle:Client')->find($id);
     }
     $this->jsSettingsJson(array('country_eu' => ListCountries::getCountryEU(), 'niveau_dobligation' => $this->admin->getNiveauDobligationIdListHelp()));
     return $this->render('ApplicationSonataClientBundle::' . $template . '.html.twig', array('client_id' => $id, 'current_client' => $client, 'active_tab' => 'client', 'content' => $object->getContent(), 'js_settings_json' => $this->_jsSettingsJson));
 }
Example #4
0
 public function __construct()
 {
     $this->pays = ListCountries::getDefault();
 }
Example #5
0
 /**
  * @param \Application\Sonata\ClientBundle\Entity\Client $object
  */
 protected function _setupAlerts($object)
 {
     /* @var $doctrine \Doctrine\Bundle\DoctrineBundle\Registry */
     $doctrine = \AppKernel::getStaticContainer()->get('doctrine');
     /* @var $em \Doctrine\ORM\EntityManager */
     $em = $doctrine->getManager();
     /* @var $tab \Application\Sonata\ClientBundle\Entity\ListClientTabs */
     $tab = $em->getRepository('ApplicationSonataClientBundle:ListClientTabs')->findOneByAlias('general');
     $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->createQueryBuilder('c')->delete()->andWhere('c.client = :client')->andWhere('c.tabs = :tab')->setParameter(':client', $object)->setParameter(':tab', $tab)->getQuery()->execute();
     if ($object) {
         $value = $object->getSiret();
         if (!$value) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(true);
             $alert->setText('Manque SIRET');
             $em->persist($alert);
         }
         $value = $object->getNTVAFR();
         if (!$value) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(true);
             $alert->setText('Manque N° TVA FR');
             $em->persist($alert);
         }
         $value = $object->getNumDossierFiscal();
         if (!$value && $object->getNatureDuClient() && $object->getNatureDuClient()->getId() == 1) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(false);
             $alert->setText('Manque Dossier fiscal');
             $em->persist($alert);
         }
         $value = $object->getNiveauDobligationId();
         if (is_null($value)) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(true);
             $alert->setText('Clôture Manque Niveau Obligation DEB');
             $em->persist($alert);
         } else {
             $alert = $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->findOneBy(array('client' => $object, 'text' => 'Clôture Manque Niveau Obligation DEB'));
             if ($alert) {
                 $this->delete($alert);
             }
         }
         $value = $object->getPeriodiciteCA3();
         if (!$value) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(true);
             $alert->setText('Clôture Manque périodicité CA3');
             $em->persist($alert);
         }
         $value = $object->getActivite();
         if (!$value) {
             $alert = new ClientAlert();
             $alert->setClient($object);
             $alert->setTabs($tab);
             $alert->setIsBlocked(false);
             $alert->setText('Manque Activité');
             $em->persist($alert);
         }
         $value = $object->getNumDossierFiscal();
         if ($value) {
             $explode = explode('/', $value);
             if (!isset($explode[1]) || $explode[1] == '00') {
                 $alert = new ClientAlert();
                 $alert->setClient($object);
                 $alert->setTabs($tab);
                 $alert->setIsBlocked(false);
                 $alert->setText('Numéro de dossier fiscal incomplet');
                 $em->persist($alert);
             }
         }
         /**
          * If Nature du client =  6e and Pays IN European Union
          * If no document type  = "Mandat"  create the alert   "Pas de Mandat"
          */
         if ($object->getNatureDuClient() && $object->getPaysPostal() && $object->getNatureDuClient()->getId() == ListNatureDuClients::sixE && in_array($object->getPaysPostal()->getCode(), ListCountries::getCountryEUCode())) {
             $doctrine = \AppKernel::getStaticContainer()->get('doctrine');
             /* @var $em \Doctrine\ORM\EntityManager */
             $em = $doctrine->getManager();
             $docs = $em->getRepository('ApplicationSonataClientBundle:Document')->findBy(array('type_document' => \Application\Sonata\ClientBundle\Entity\ListTypeDocuments::Mandat, 'client' => $object->getId()));
             if (count($docs) == 0) {
                 $alert = new ClientAlert();
                 $alert->setClient($object);
                 $alert->setTabs($tab);
                 $alert->setIsBlocked(false);
                 $alert->setText('Pas de Mandat');
                 $em->persist($alert);
             }
         }
         /**
          * If Nature du client =  Client DEB
          * If no document type  = "Mandat"  create the alert   "Pas de Mandat"
          */
         if ($object->getNatureDuClient() && $object->getNatureDuClient()->getId() == ListNatureDuClients::DEB) {
             $doctrine = \AppKernel::getStaticContainer()->get('doctrine');
             /* @var $em \Doctrine\ORM\EntityManager */
             $em = $doctrine->getManager();
             $docs = $em->getRepository('ApplicationSonataClientBundle:Document')->findBy(array('type_document' => \Application\Sonata\ClientBundle\Entity\ListTypeDocuments::Mandat, 'client' => $object->getId()));
             if (count($docs) == 0) {
                 $alert = new ClientAlert();
                 $alert->setClient($object);
                 $alert->setTabs($tab);
                 $alert->setIsBlocked(false);
                 $alert->setText('Pas de Mandat');
                 $em->persist($alert);
             }
         }
         $em->flush();
     }
 }
 /**
  * @return array|null
  */
 protected function getListCountryEU()
 {
     if (!$this->_country_eu) {
         $this->_country_eu = \Application\Sonata\ClientBundle\Entity\ListCountries::getCountryEUCode();
     }
     return $this->_country_eu;
 }