src/Controller/DefaultController.php line 104

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\MailSecondarieUtenti;
  4. use App\Entity\ModificaNoteAnagrafiche;
  5. use App\Entity\PagineEComponenti;
  6. use App\Entity\User;
  7. use App\Model\Mailer;
  8. use App\Model\Security\ReCaptchaGoogle;
  9. use App\Model\Translating\Translating;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use Psr\Log\LoggerInterface;
  12. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  13. use Symfony\Component\HttpFoundation\Cookie;
  14. use Symfony\Component\HttpFoundation\File\UploadedFile;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\HttpFoundation\Response;
  17. use Symfony\Component\HttpKernel\KernelInterface;
  18. use Symfony\Component\Routing\Annotation\Route;
  19. use Twig\Environment;
  20. /**
  21.  *
  22.  */
  23. class DefaultController extends AbstractController
  24. {
  25.     /** @var LoggerInterface */
  26.     private $logger;
  27.     /** @var ReturnImpostazioniServiceController */
  28.     private $imp;
  29.     /** @var KernelInterface */
  30.     private $kernel;
  31.     /** @var ServiziController */
  32.     private $servizi;
  33.     /** @var Environment */
  34.     private $twig;
  35.     /** @var Translating */
  36.     private $translating;
  37.     /** @var Mailer */
  38.     private $mailer;
  39.     /**
  40.      * DefaultController constructor.
  41.      * @param LoggerInterface $logger
  42.      * @param ReturnImpostazioniServiceController $imp
  43.      * @param KernelInterface $kernel
  44.      * @param ServiziController $servizi
  45.      * @param Environment $twig
  46.      * @param Translating $translating
  47.      * @param Mailer $mailer
  48.      */
  49.     public function __construct(LoggerInterface $loggerReturnImpostazioniServiceController $impKernelInterface $kernelServiziController $serviziEnvironment $twigTranslating $translatingMailer $mailer)
  50.     {
  51.         $this->logger $logger;
  52.         $this->imp $imp;
  53.         $this->kernel $kernel;
  54.         $this->servizi $servizi;
  55.         $this->twig $twig;
  56.         $this->translating $translating;
  57.         $this->mailer $mailer;
  58.     }
  59.     /**
  60.      * @Route("/", name="homepage")
  61.      */
  62.     public function indexAction(Request $request)
  63.     {
  64.         $customHomePage $this->imp->ritornaImpostazioneDaNome("CustomHomepage");
  65.         if ($customHomePage != ''){
  66.             /** @var PagineEComponenti $pagina */
  67.             $pagina $this->servizi->doctrine->getRepository(PagineEComponenti::class)->find($customHomePage);
  68.             if ($pagina){
  69.                 $response =  $this->render('ZZ_front_end/pagine_secondarie/pagine_secondarie_render.html.twig', array(
  70.                     'pagina' => $pagina
  71.                 ));
  72.                 return $response;
  73.             }else{
  74.                 $response = new Response(""'404');
  75.                 return $response;
  76.             }
  77.         }else {
  78.             /** @var User $user */
  79.             $user $this->servizi->OttieniUtenteCorrente();
  80.             if ($user) {
  81.                 if ($user->getUtenteComune()) {
  82.                     $response $this->redirectToRoute('home_shop_comune');
  83.                 } else
  84.                     $response $this->redirectToRoute('home_shop');
  85.             } else {
  86.                 $response $this->redirectToRoute('home_shop_comune');
  87.             }
  88.             return $response;
  89.         }
  90.     }
  91.     /**
  92.      * @Route("/products/home", name="home_prodotti")
  93.      */
  94.     public function productsAction(Request $request)
  95.     {
  96.         /** @var User $user */
  97.         $user $this->servizi->OttieniUtenteCorrente();
  98.         if ($user) {
  99.             if ($user->getUtenteComune()) {
  100.                 return $this->redirectToRoute('home_shop_comune');
  101.             } else
  102.                 return $this->redirectToRoute('home_shop');
  103.         } else {
  104.             if ($this->imp->ritornaImpostazioneDaNome('AbilitaB2C') != '1'){
  105.                 return $this->redirectToRoute('home_login');
  106.             }
  107.             return $this->redirectToRoute('home_shop_comune');
  108.         }
  109.     }
  110.     /**
  111.      * @Route("/admin/uploadFileAsset", name="admin_upload_file_asset", options={"expose"=true})
  112.      */
  113.     public function uploadFileInAsset(Request $request)
  114.     {
  115.         $pathStore $this->kernel->getProjectDir()  . DIRECTORY_SEPARATOR "public" DIRECTORY_SEPARATOR "uploads" DIRECTORY_SEPARATOR;
  116.         $pathRitorno DIRECTORY_SEPARATOR ."uploads" DIRECTORY_SEPARATOR;
  117.         $listaFile $request->files;
  118.         /**
  119.          * @var  $key string
  120.          */
  121.         foreach ($listaFile as $value){
  122.             /** @var  $file UploadedFile */
  123.             $file $value[0];
  124.             $nome time() . "-" $file->getClientOriginalName();
  125.             $file->move($pathStore$nome);
  126.         }
  127.         return new Response("");
  128.     }
  129.     /**
  130.      * @Route("/esportaRelazioniAgenti", name="esportaRelazioniAgenti")
  131.      */
  132.     public function caricaNoteAnagraficaAction(Request $request)
  133.     {
  134.         if ($this->servizi->verificaSeIpAutorizzatoChiamateImportExport($request->getClientIp())) {
  135.             /** @var  $elenco ModificaNoteAnagrafiche[] */
  136.             $elenco $this->servizi->doctrine->getRepository(ModificaNoteAnagrafiche::class)->createQueryBuilder('modifica_note_anagrafiche')
  137.                 ->where('modifica_note_anagrafiche.invia = :invia')->setParameter('invia'true)
  138.                 ->andWhere('modifica_note_anagrafiche.trasmesso = :tras')->setParameter('tras'false)
  139.                 ->orderBy('modifica_note_anagrafiche.anagrafica')
  140.                 ->getQuery()->getResult();
  141.             $em $this->getDoctrine()->getManager();
  142.             /** @var  $elencoDaInviare ModificaNoteAnagrafiche[]*/
  143.             $elencoDaInviare = array();
  144.             if (count($elenco) > 0)
  145.             {
  146.                 $this->servizi->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Caricamento note anagrafica: ' count($elenco), null);
  147.                 $this->servizi->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Caricamento note anagrafica: ' count($elenco) . ' - COMPLETATO!'null);
  148.                 $em->flush();
  149.                 try {
  150.                     $from $this->imp->ritornaImpostazioneDaNome("IndirizzoMailFromInvioComunicazioni");
  151.                     $nomeShop $this->imp->ritornaImpostazioneDaNome("NomeShop");
  152.                     $mailCCAgenti $this->imp->ritornaImpostazioneDaNome('MailCCRelazioniAgenti');
  153.                     $esploso = array();
  154.                     $esploso explode(";"$mailCCAgenti);
  155.                     if (!$esploso)
  156.                         $esploso = array();
  157.                     if (count($esploso) == 0)
  158.                         array_push($esploso$mailCCAgenti);
  159.                     $this->mailer->SendMail(
  160.                         "Relazioni agenti - " $nomeShop,
  161.                         $this->renderView(
  162.                             'email/relazioni_agenti/relazione_agenti.html.twig',
  163.                             array(
  164.                                 'lista_relazioni' => $elencoDaInviare,
  165.                             )
  166.                         ),
  167.                         array($from),
  168.                         $esploso,
  169.                         $from,
  170.                         'text/html'
  171.                     );
  172.                 }catch (\Exception $e){
  173.                     $this->get("logger")->addCritical("Errore invio mail: " $e->getMessage());
  174.                     $this->ScriviRegistroAttivita($em$request->getClientIp(), $etrue"Errore invio mail relazioni agenti -- Errore: " $e->getMessage(), null);
  175.                 }
  176.             }
  177.             return new Response("ok");
  178.         }
  179.         else{
  180.             return new Response("ACCESSO_NEGATO");
  181.         }
  182.     }
  183.     /**
  184.      * @Route("/setLocale/{locale}", name="set_locale")
  185.      */
  186.     public function setlocale(Request $request$locale)
  187.     {
  188.         $request->getSession()->set('_locale'$locale);
  189.         $referral $request->server->get('HTTP_REFERER');
  190.         $response $this->redirect($referral);
  191.         $response->headers->setCookie(new Cookie('_locale'$localestrtotime'+1 year' ), '/'));
  192.         return $response;
  193.     }
  194.     /**
  195.      * @param EntityManagerInterface $em
  196.      * @param string $ip
  197.      * @param string $debug
  198.      * @param boolean $esito
  199.      * @param string $messaggio
  200.      * @param User $utente
  201.      */
  202.     function ScriviRegistroAttivita($em$ip$debug$esito$messaggio$utente)
  203.     {
  204.         $this->servizi->ScriviRegistroAttivita($ip$debug$esito$messaggio$utente);
  205.     }
  206.     /**
  207.      * @Route("/contatto/mail", methods={"POST"}, name="contatto_per_mail")
  208.      */
  209.     public function contattoPerMail(Request $request){
  210.         $sendMail = new Mailer($this->imp$this->twig$this->servizi);
  211.         $mailFrom $this->imp->ritornaImpostazioneDaNome('IndirizzoMailFromInvioComunicazioni');
  212.         $oggetto $request->get('ddflt-oggetto');
  213.         $mailInvio $request->get('ddflt-mail-invio');
  214.         $mailInvioCc $request->get('ddflt-mail-invio-cc');
  215.         $traduzione = new Translating($this->servizi->doctrine$this->logger);
  216.         $traduzione->CaricaTraduzioniDaFamiglia('form_contatto'$request->getLocale());
  217.         $parametri $request->request->keys();
  218.         $procedi true;
  219.         if($oggetto != '' && $mailInvio != ''){
  220.             if (array_key_exists('recaptcha'$parametri)){
  221.                 /*
  222.                  * Il captcha deve essere un input con nome = recaptcha e class = re-captcha-v3
  223.                  */
  224.                 $token $parametri['recaptcha'];
  225.                 if (!ReCaptchaGoogle::captchaverify($token$this->imp)){
  226.                     $procedi false;
  227.                     $this->addFlash(
  228.                         'error',
  229.                         $traduzione->OttieniElementoDizionario('form_contatto_captcha_error''form_contatto')->valoreUscita
  230.                     );
  231.                 }
  232.             }
  233.             if($procedi){
  234.                 $testoMail $traduzione->OttieniElementoDizionario('form_contatto_titolo''form_contatto')->valoreUscita '<br /><br />
  235.                     <table class="table table-responsive table-striped">
  236.                     <thead>
  237.                     <tr>
  238.                         <th>' $traduzione->OttieniElementoDizionario('form_contatto_parametro''form_contatto')->valoreUscita '</th>
  239.                         <th>' $traduzione->OttieniElementoDizionario('form_contatto_valore''form_contatto')->valoreUscita '</th>
  240.                     </tr>
  241.                     </thead>
  242.                     <tbody>';
  243.                 foreach ($parametri as $key) {
  244.                     if ($key != ('recaptcha'||'ddflt-mail-invio'||'ddflt-mail-invio-cc'||'ddflt-oggetto')) {
  245.                         $testoMail .= '<tr><td>' $key '</td><td>' $request->request->get($key) . '</td></tr>';
  246.                     }
  247.                 }
  248.                 $testoMail .= '</tbody></table>';
  249.                 $sendMail->SendMail($oggetto$testoMailexplode(';'$mailFrom), explode(';'$mailInvioCc), ''''true);
  250.                 $this->addFlash(
  251.                     'notice',
  252.                     $traduzione->OttieniElementoDizionario('form_contatto_messaggio_inviato''form_contatto')->valoreUscita
  253.                 );
  254.             }
  255.         }else{
  256.             $procedi false;
  257.             $this->addFlash(
  258.                 'error',
  259.                 $traduzione->OttieniElementoDizionario('form_contatto_captcha_error''form_contatto')->valoreUscita
  260.             );
  261.         }
  262.         return $this->redirect($this->servizi->getRefererRoute($request));
  263.     }
  264.     /**
  265.      * @Route("/contact/form", name="contatto_form", methods={"POST"})
  266.      */
  267.     public function contattoDaForm(Request $request){
  268.         $traduzione $this->translating;
  269.         $traduzione->CaricaTraduzioniDaFamiglia('form_contatto'$request->getLocale());
  270.         $mailInvioContatto $this->imp->ritornaImpostazioneDaNome('MailInvioContattiForm');
  271.         $mailFrom $this->imp->ritornaImpostazioneDaNome('IndirizzoMailFromInvioComunicazioni');
  272.         $arrayMail = array();
  273.         if (strpos($mailInvioContatto';') !== false){
  274.             $arrayMail explode(';'$mailInvioContatto);
  275.         }else{
  276.             array_push($arrayMail$mailInvioContatto);
  277.         }
  278.         $sendMail = new Mailer($this->imp$this->twig$this->servizi);
  279.         $parametri $request->request->keys();
  280.         //return new JsonResponse($request->request->keys());
  281.         if (count($parametri) > 0) {
  282.             $procedi true;
  283.             //Verifico se Ã¨ presente un capcha da verificare
  284.             if (array_key_exists('recaptcha'$parametri)){
  285.                 /*
  286.                  * Il captcha deve essere un input con nome = recaptcha e class = re-captcha-v3
  287.                  */
  288.                 $token $parametri['recaptcha'];
  289.                 if (!ReCaptchaGoogle::captchaverify($token$this->imp)){
  290.                     $procedi false;
  291.                     $this->addFlash(
  292.                         'error',
  293.                         $traduzione->OttieniElementoDizionario('form_contatto_captcha_error''form_contatto')->valoreUscita
  294.                     );
  295.                 }
  296.             }
  297.             if ($procedi) {
  298.                 $testoMail $traduzione->OttieniElementoDizionario('form_contatto_titolo''form_contatto')->valoreUscita '<br /><br />
  299.                     <table class="table table-responsive table-striped">
  300.                     <thead>
  301.                     <tr>
  302.                         <th>' $traduzione->OttieniElementoDizionario('form_contatto_parametro''form_contatto')->valoreUscita '</th>
  303.                         <th>' $traduzione->OttieniElementoDizionario('form_contatto_valore''form_contatto')->valoreUscita '</th>
  304.                     </tr>
  305.                     </thead>
  306.                     <tbody>';
  307.                 foreach ($parametri as $key) {
  308.                     if ($key != 'recaptcha') {
  309.                         $testoMail .= '<tr><td>' $key '</td><td>' $request->request->get($key) . '</td></tr>';
  310.                     }
  311.                 }
  312.                 $testoMail .= '</tbody></table>';
  313.                 $sendMail->SendMail('Contatto da form sito'$testoMail$mailFrom$arrayMail''''true);
  314.                 $this->addFlash(
  315.                     'notice',
  316.                     $traduzione->OttieniElementoDizionario('form_contatto_messaggio_inviato''form_contatto')->valoreUscita
  317.                 );
  318.             }
  319.         }
  320.         return $this->redirect($this->servizi->getRefererRoute($request));
  321.     }
  322.     /**
  323.      * @Route("/admin/masterReset_ppp/{psw}/{da}/{a}", name="master_reset_password")
  324.      */
  325.     public function masterResetPassword(Request $request$psw$da 0$a 100)
  326.     {
  327.         ini_set('max_execution_time', -1);
  328.         ini_set('memory_limit', -1);
  329.         $start microtime(true);
  330.         $this->servizi->doctrine->getConnection()->getConfiguration()->setSQLLogger(null);
  331.         $em $this->servizi->doctrine->getManager();
  332.         $contatore 0;
  333.         $row 0;
  334.         $query_eseguite 0;
  335.         $batch_size 1;
  336.         $this->ScriviRegistroAttivita($em$request->getClientIp(),""true"Chiamata effettuata a /admin/masterReset/  Da: " $da " -- A: " $a$this->servizi->OttieniUtenteCorrente());
  337.         $query_eseguite++;
  338.         if ($psw == "180392"){
  339.             $inviaMail $this->imp->ritornaImpostazioneDaNome("InviaMailNuoviClienti");
  340.             $from $this->imp->ritornaImpostazioneDaNome("IndirizzoMailFromInvioComunicazioni");
  341.             $nomeShop $this->imp->ritornaImpostazioneDaNome("NomeShop");
  342.             $ccMail $this->imp->ritornaImpostazioneDaNome("MailCcComunicazioni");
  343.             /** @var  $user User[] */
  344.             $user $this->servizi->doctrine->getRepository(User::class)->findAll();
  345.             $arrayInvioMail = array();
  346.             for ($i $da; ($i <= $a) && ($a count($user)); $i++) {
  347.                 $item $user[$i];
  348.                 $newPass $this->servizi->randomString(8);
  349.                 $item->setPassword($newPass);
  350.                 $em $this->servizi->doctrine->getManager();
  351.                 $em->persist($item);
  352.                 $em->flush();
  353.                 array_push($arrayInvioMail, array($item$newPass));
  354.             }
  355.             foreach ($arrayInvioMail as $valore)
  356.             {
  357.                 $item $valore[0];//utente
  358.                 $listaMailSecondarie $this->servizi->doctrine->getRepository(MailSecondarieUtenti::class)->findBy(array('azienda' => $item'inviaConfermaOrdine' => true));
  359.                 $adresses = array();
  360.                 foreach ($listaMailSecondarie as $ms)
  361.                 {
  362.                     array_push($adresses$ms->getIndirizzoMail());
  363.                 }
  364.                 array_push($adresses$ccMail);
  365.                 try {
  366.                     if ($inviaMail) {
  367.                         $this->mailer->SendMail(
  368.                             "reset password -- " $nomeShop,
  369.                             $this->renderView(
  370.                                 'email/utenti/cambio_password.html.twig',
  371.                                 array(
  372.                                     'utente' => $item,
  373.                                     'password' => $valore[1]
  374.                                 )
  375.                             ),
  376.                             $item->getEmail(),
  377.                             $adresses,
  378.                             $from
  379.                         );
  380.                         $this->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Mail Reset Inviata: ' $item->getId() . '  -  ' .$item->getRagioneSociale() . ' all\'indirizzo ' $item->getEmail(), null);
  381.                         $query_eseguite++;
  382.                     }
  383.                 }catch (\Exception $e){
  384.                     $this->logger->critical("Errore invio mail: " $e->getMessage());
  385.                     $this->ScriviRegistroAttivita($em$request->getClientIp(), $e->getMessage(), true'Errore invio mail reset password ' $item->getCodiceCliente() . '  -  ' .$item->getRagioneSociale() . ' all\'indirizzo ' $item->getEmail() . " --- Errore: " $e->getMessage(), null);
  386.                     $query_eseguite++;
  387.                 }
  388.                 if ($query_eseguite >= $batch_size) {
  389.                     $contatore $contatore $row;
  390.                     $row 1;
  391.                     $query_eseguite 0;
  392.                     $em->flush();
  393.                     $em->clear();
  394.                 }
  395.             }
  396.             $query_eseguite 0;
  397.             $em->flush();
  398.             $em->clear();
  399.             $this->ScriviRegistroAttivita(null$request->getClientIp(), ""true'Reset master password completato in ' $time_elapsed_secs microtime(true) - $start ' seconds ---- ' $contatore '</br>'null);
  400.             return new Response('Reset master password completata in ' $time_elapsed_secs microtime(true) - $start ' seconds ---- ' $contatore '</br>');
  401.         }else{
  402.             return new Response("ERRORE AUTORIZZAZIONE");
  403.         }
  404.     }
  405.     /**
  406.      * @Route("/pulisciRegistroAttivita", name="pulisci_registro_attivita")
  407.      */
  408.     public function pulisciRegistroAttivitaCronAction(Request $request)
  409.     {
  410.         if ($request->getClientIp() == ("127.0.0.1")) {
  411.             $em $this->servizi->doctrine->getManager();
  412.             $stmt $em->getConnection()->prepare("DELETE FROM registro_attivita WHERE data < DATE_SUB(NOW() , INTERVAL 1 WEEK)");
  413.             $ris $stmt->execute();
  414.             $this->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Pulizia registro attività effettuata'null);
  415.             return new Response($ris "TRUE" "FALSE");
  416.         }
  417.         else{
  418.             return new Response("ACCESSO_NEGATO");
  419.         }
  420.     }
  421.     /**
  422.      * @Route("/pulisciCarrelliVecchi", name="pulisci_carrelli_vecchi")
  423.      */
  424.     public function pulisciCarrelliVecchiCronAction(Request $request)
  425.     {
  426.         if ($request->getClientIp() == ("127.0.0.1")) {
  427.             $em $this->servizi->doctrine->getManager();
  428.             $conn $this->servizi->doctrine->getConnection();
  429.             $ris $conn->executeQuery("DELETE FROM righe_carrello where data_modifica < DATE_SUB(NOW(), INTERVAL 3 MONTH);");
  430.             $conn->executeQuery("DELETE FROM carrello where data_modifica < DATE_SUB(NOW(), INTERVAL 3 MONTH);");
  431.             $this->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Pulizia carrelli vecchi effettuata'null);
  432.             return new Response($ris "TRUE" "FALSE");
  433.         }else{
  434.             return new Response('ACCESSO_NEGATO');
  435.         }
  436.     }
  437.     /**
  438.      * @Route("/admin/puliziaTotaleDatabaseArticoli", name="admin_puliza_totale_database_articoli")
  439.      */
  440.     public function puliziaTotaleDatabaseArticoli(Request $request)
  441.     {
  442.         $em $this->servizi->doctrine->getManager();
  443.         $conn $this->servizi->doctrine->getConnection();
  444.         $conn->executeQuery("SET FOREIGN_KEY_CHECKS=0;");
  445.         $conn->executeQuery("TRUNCATE `albero_menu_prodotti`;");
  446.         $conn->executeQuery("TRUNCATE `articoli`;");
  447.         $conn->executeQuery("TRUNCATE `articoli_in_lingua`;");
  448.         $conn->executeQuery("TRUNCATE `associazione_articoli_cliente`;");
  449.         $conn->executeQuery("TRUNCATE `associazione_attributi`;");
  450.         $conn->executeQuery("TRUNCATE `attributi`;");
  451.         $conn->executeQuery("TRUNCATE `attributi_in_lingua`;");
  452.         $conn->executeQuery("TRUNCATE `carrello`;");
  453.         $conn->executeQuery("TRUNCATE `categorie`;");
  454.         $conn->executeQuery("TRUNCATE `categorie_in_lingua`;");
  455.         $conn->executeQuery("TRUNCATE `combinazione_albero_mappa_categorie_articoli`;");
  456.         $conn->executeQuery("TRUNCATE `listini_vendita`;");
  457.         $conn->executeQuery("TRUNCATE `magazzino_secondario_disponibilita`;");
  458.         $conn->executeQuery("TRUNCATE `mappa_categorie_articoli`;");
  459.         $conn->executeQuery("TRUNCATE `ordini`;");
  460.         $conn->executeQuery("TRUNCATE `ordini_righe`;");
  461.         $conn->executeQuery("TRUNCATE `righe_carrello`;");
  462.         $conn->executeQuery("TRUNCATE `statistiche_categorie`;");
  463.         $conn->executeQuery("TRUNCATE `statistiche_click_articoli`;");
  464.         $conn->executeQuery("TRUNCATE `tipologie_preimpostate`;");
  465.         $conn->executeQuery("TRUNCATE `tipologie_preimpostate_lista`;");
  466.         $conn->executeQuery("TRUNCATE `unita_misura`;");
  467.         $conn->executeQuery("TRUNCATE `varianti`;");
  468.         $conn->executeQuery("TRUNCATE `varianti_in_lingua`;");
  469.         $conn->executeQuery("SET FOREIGN_KEY_CHECKS=1;");
  470.         $this->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Pulizia totale database articoli effettuata'$this->servizi->OttieniUtenteCorrente());
  471.         return new Response("TRUE");
  472.     }
  473.     /**
  474.      * @Route("/admin/puliziaTotaleAnagrafiche", name="admin_pulizia_totale_anagrafiche")
  475.      */
  476.     public function puliziaTotaleAnagraficheDatabase(Request $request)
  477.     {
  478.         $em $this->servizi->doctrine->getManager();
  479.         $conn $this->servizi->doctrine->getConnection();
  480.         $conn->executeQuery("SET FOREIGN_KEY_CHECKS=0;");
  481.         $conn->executeQuery("TRUNCATE `anagrafica_opzioni_aggiuntive`;");
  482.         $conn->executeQuery("TRUNCATE `anagrafiche`;");
  483.         $conn->executeQuery("TRUNCATE `anagrafiche_indirizzi`;");
  484.         $conn->executeQuery("TRUNCATE `risorse_anagrafiche_colonne_valori`;");
  485.         $conn->executeQuery("TRUNCATE `risorse_anagrafiche`;");
  486.         $conn->executeQuery("TRUNCATE `risorse_anagrafiche_colonne`;");
  487.         $conn->executeQuery("TRUNCATE `sconti_anagrafiche`;");
  488.         $conn->executeQuery("TRUNCATE `anagrafiche_blocchi`;");
  489.         $conn->executeQuery("SET FOREIGN_KEY_CHECKS=1;");
  490.         $this->ScriviRegistroAttivita($em$request->getClientIp(), ""true'Pulizia totale database anagrafiche effettuata'$this->servizi->OttieniUtenteCorrente());
  491.         return new Response("TRUE");
  492.     }
  493. }