コード例 #1
0
 /**
  * @param $errorElement
  * @param $object \Application\Sonata\ClientBundle\Entity\Coordonnees
  */
 protected function _setupAlerts($errorElement, $object)
 {
     /** @var $doctrine  \Doctrine\Bundle\DoctrineBundle\Registry */
     $doctrine = $this->getConfigurationPool()->getContainer()->get('doctrine');
     /* @var $em \Doctrine\ORM\EntityManager */
     $em = $doctrine->getManager();
     /* @var $tab \Application\Sonata\ClientBundle\Entity\ListClientTabs */
     $tab = $em->getRepository('ApplicationSonataClientBundle:ListClientTabs')->findOneByAlias('coordinates');
     $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->createQueryBuilder('c')->delete()->where('c.client = :client')->andWhere('c.tabs = :tab')->setParameters(array(':client' => $object->getClient(), ':tab' => $tab))->getQuery()->execute();
     $value = $object->getIBAN();
     if (0) {
         $alert = new ClientAlert();
         $alert->setClient($object->getClient());
         $alert->setTabs($tab);
         $alert->setIsBlocked(false);
         $alert->setText('Manque coordonnées bancaires pour remboursement TVA');
         $em->persist($alert);
     }
 }
コード例 #2
0
 /**
  * @param $errorElement
  * @param $object
  */
 protected function _setupAlerts($errorElement, $object)
 {
     /** @var $doctrine  \Doctrine\Bundle\DoctrineBundle\Registry */
     $doctrine = $this->getConfigurationPool()->getContainer()->get('doctrine');
     /* @var $em \Doctrine\ORM\EntityManager */
     $em = $doctrine->getManager();
     /* @var $tab \Application\Sonata\ClientBundle\Entity\ListClientTabs */
     $tab = $em->getRepository('ApplicationSonataClientBundle:ListClientTabs')->findOneByAlias('tarif');
     $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->createQueryBuilder('c')->delete()->where('c.client = :client')->andWhere('c.tabs = :tab')->setParameters(array(':client' => $object->getClient(), ':tab' => $tab))->getQuery()->execute();
     /* @var $object \Application\Sonata\ClientBundle\Entity\Tarif */
     $value = $object->getValuePercentage();
     $value2 = $object->getValue();
     if (empty($value) && empty($value2)) {
         $alert = new ClientAlert();
         $alert->setClient($object->getClient());
         $alert->setTabs($tab);
         $alert->setIsBlocked(true);
         $alert->setText('Aucun tarif sélectionné');
         $em->persist($alert);
     }
 }
コード例 #3
0
 /**
  * @param \Doctrine\ORM\EntityManager $em
  * @param $object \Application\Sonata\ClientBundle\Entity\Contact
  * @param $tab
  */
 protected function saveAffichageFactureAlertMessage(\Doctrine\ORM\EntityManager $em, $object, $tab)
 {
     $alert = new ClientAlert();
     $alert->setClient($object->getClient());
     $alert->setTabs($tab);
     $alert->setIsBlocked(true);
     $alert->setText('Aucun contact pour Facturation');
     $em->persist($alert);
     $em->flush();
 }
コード例 #4
0
 /**
  * @param $em \Doctrine\ORM\EntityManager
  * @param $object \Application\Sonata\ClientBundle\Entity\Document
  * @param $tab
  */
 protected function ifSaveManqueMandatAlertMessage($em, $object, $tab)
 {
     /** @var $client \Application\Sonata\ClientBundle\Entity\Client */
     $client = $this->getClient();
     //ListNatureDuClients::sixE => 6e
     if ($client && $client->getNatureDuClient() && ($client->getNatureDuClient()->getId() == ListNatureDuClients::sixE && in_array($client->getPaysPostal()->getCode(), $this->getListCountryEU())) || $client && ($client->getNatureDuClient()->getId() == ListNatureDuClients::DEB || $client->getNatureDuClient()->getId() == ListNatureDuClients::DES)) {
         $alert = new ClientAlert();
         $alert->setClient($object->getClient());
         $alert->setTabs($tab);
         $alert->setIsBlocked(true);
         $alert->setText('Manque Mandat');
         $em->persist($alert);
     }
 }
コード例 #5
0
 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('numerotva');
     if ($object) {
         $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->createQueryBuilder('c')->delete()->andWhere('c.client = :client')->andWhere('c.tabs = :tab')->setParameter(':client', $this->getClient())->setParameter(':tab', $tab)->getQuery()->execute();
         $nTVA = $em->getRepository('ApplicationSonataClientBundle:NumeroTVA')->findBy(array('date_de_verification' => new \DateTime('2000-01-01'), 'client' => $this->getClient()));
         $nTVANum = count($nTVA);
         if ($nTVANum > 0) {
             $alert = new ClientAlert();
             $alert->setClient($this->getClient());
             $alert->setTabs($tab);
             $alert->setIsBlocked(false);
             $alert->setText("il y a {$nTVANum} N° de TVA clients non vérifiés");
             $em->persist($alert);
             $em->flush();
         }
     }
 }
コード例 #6
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();
     }
 }
コード例 #7
0
 public function frameAjaxAction()
 {
     $request = $this->get('request');
     if ($request->getMethod() == 'POST') {
         $hasMandatSpecifique = false;
         $em = $this->getDoctrine()->getManager();
         $client = $em->getRepository('ApplicationSonataClientBundle:Client')->find($_POST['client_id']);
         $documents = $client->getDocuments();
         if ($documents) {
             foreach ($documents as $doc) {
                 if ($doc->getTypeDocument()->getId() == ListTypeDocuments::Mandat_Specifique) {
                     $hasMandatSpecifique = true;
                     break;
                 }
             }
         }
         //DRESG
         if ($client->getCenterDesImpots()->getId() == 6 && $hasMandatSpecifique === false) {
             /* @var $tab \Application\Sonata\ClientBundle\Entity\ListClientTabs */
             $tab = $em->getRepository('ApplicationSonataClientBundle:ListClientTabs')->findOneByAlias('documents');
             $em->getRepository('ApplicationSonataClientBundle:ClientAlert')->createQueryBuilder('c')->delete()->andWhere('c.client = :client')->andWhere("c.text = 'Pas de Mandat spécifique.'")->andWhere('c.tabs = :tab')->setParameter(':client', $client)->setParameter(':tab', $tab)->getQuery()->execute();
             $alert = new ClientAlert();
             $alert->setClient($client);
             $alert->setTabs($tab);
             $alert->setIsBlocked(false);
             $alert->setText('Pas de Mandat spécifique.');
             $em->persist($alert);
             $em->flush();
             echo 1;
         }
     }
     exit;
 }