src/Controller/SendMailController.php line 176

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by Mediterranean Develup Solutions
  4.  * User: jorge.defreitas@develup.solutions
  5.  * Date: 17/01/2018
  6.  * Time: 18:52
  7.  */
  8. namespace App\Controller;
  9. use App\Entity\Client;
  10. use App\Entity\ClientContact;
  11. use App\Entity\ClientGroupContact;
  12. use App\Entity\SendMail;
  13. use App\Entity\Supplier;
  14. use App\Entity\User;
  15. use App\Form\SendMailType;
  16. use App\MDS\EventsBundle\Entity\Proposal;
  17. use App\MDS\EventsBundle\Entity\ProposalAgents;
  18. use App\MDS\EventsBundle\Entity\ProposalTracing;
  19. use Swift_Mailer;
  20. use Swift_Message;
  21. use Swift_SmtpTransport;
  22. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  23. use Symfony\Component\Routing\Annotation\Route;
  24. use Symfony\Component\HttpFoundation\Request;
  25. use Symfony\Contracts\Translation\TranslatorInterface;
  26. class SendMailController extends AbstractController
  27. {
  28.     private $translator;
  29.     public function __construct(TranslatorInterface $translator) {
  30.         $this->translator $translator;
  31.     }
  32.     
  33.     /*
  34.     * ATENCION LAS RAIZ DE @Route POR DEFECTO DEL BUNDLE: EventsBundle ES  /events/, NO PONERLO EN LA @Route("")
  35.     *
  36.     * */
  37.     /**
  38.      * @Route("/mail/invoice/{id}",  name="proposal_mail_Invoice_form")
  39.      */
  40.     public function Invoiceaction($idRequest $request)
  41.     {
  42.         $mail = new SendMail();
  43.         $mail->setProposalId($id);
  44.         $mail->setType('Invoice');
  45.         $form $this->createProposalMailCreateForm($mail);
  46.         $em $this->getDoctrine()->getManager();
  47.         $proposal $em->getRepository(Proposal::class)->findOneById($id);
  48.         $clientcontact $em->getRepository(ClientContact::class)->findOneById($proposal->getContactId());
  49.             $data_contact[] = array(
  50.                 'name' => $clientcontact->getName(),
  51.                 'lastname' => $clientcontact->getLastName(),
  52.                 'email' => $clientcontact->getEmail()
  53.             );
  54.         $client $em->getRepository(Client::class)->findOneById($proposal->getClientId());
  55.         $grupo_contact $em->getRepository(ClientGroupContact::class)->findByGroupId($client->getGroupId());
  56.         $data_groupContact = array();
  57.         foreach($grupo_contact as $grupocontact){
  58.             $data_groupContact[] = array(
  59.                 'name' => $grupocontact->getName(),
  60.                 'lastname' => $grupocontact->getLastName(),
  61.                 'email' => $grupocontact->getEmail()
  62.             );
  63.         }
  64.         $data_agents $this->findMailsAgentsProposal($id);
  65.         $data_correos array_merge($data_contact$data_groupContact$data_agents);
  66.         return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig',
  67.             array(
  68.                 'id' => $id,
  69.                 'token' => $proposal->getAccessKey(),
  70.                 'subjectAndMessage' => $proposal->getId().' - '.$proposal->getTitle(),
  71.                 'correos' => $data_correos,
  72.                 'mcp' => $proposal->getMcp(),
  73.                 'form' => $form->createView()
  74.             )
  75.         );
  76.     }
  77.     /**
  78.      * @Route("/mail/proforma/{id}",  name="proposal_mail_proforma_form")
  79.      */
  80.     public function Proformaction($idRequest $request)
  81.     {
  82.         $mail = new SendMail();
  83.         $mail->setProposalId($id);
  84.         $mail->setType('Proforma');
  85.         $form $this->createProposalMailCreateForm($mail);
  86.         $em $this->getDoctrine()->getManager();
  87.         $proposal $em->getRepository(Proposal::class)->findOneById($id);
  88.         $clientcontact $em->getRepository(ClientContact::class)->findOneById($proposal->getContactId());
  89.             $data_contact[] = array(
  90.                 'name' => $clientcontact->getName(),
  91.                 'lastname' => $clientcontact->getLastName(),
  92.                 'email' => $clientcontact->getEmail()
  93.             );
  94.         $client $em->getRepository(Client::class)->findOneById($proposal->getClientId());
  95.         $grupo_contact $em->getRepository(ClientGroupContact::class)->findByGroupId($client->getGroupId());
  96.         $data_groupContact = array();
  97.         foreach($grupo_contact as $grupocontact){
  98.             $data_groupContact[] = array(
  99.                 'name' => $grupocontact->getName(),
  100.                 'lastname' => $grupocontact->getLastName(),
  101.                 'email' => $grupocontact->getEmail()
  102.             );
  103.         }
  104.         $data_agents $this->findMailsAgentsProposal($id);
  105.         $data_correos array_merge($data_contact$data_groupContact$data_agents);
  106.         return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig',
  107.             array(
  108.                 'id' => $id,
  109.                 'token' => $proposal->getAccessKey(),
  110.                 'correos' => $data_correos,
  111.                 'mcp' => $proposal->getMcp(),
  112.                 'subjectAndMessage' => $proposal->getId().' - '.$proposal->getTitle(),
  113.                 'form' => $form->createView()
  114.             )
  115.         );
  116.     }
  117.     /**
  118.      * @Route("/mail/presentation/{id}",  name="proposal_mail_presentation_form")
  119.      */
  120.     public function Presentationaction($idRequest $request)
  121.     {
  122.         $mail = new SendMail();
  123.         $mail->setProposalId($id);
  124.         $mail->setType('Presentation');
  125.         $form $this->createProposalMailCreateForm($mail);
  126.         $em $this->getDoctrine()->getManager();
  127.         $proposal $em->getRepository(Proposal::class)->findOneById($id);
  128.         $clientcontact $em->getRepository(ClientContact::class)->findOneById($proposal->getContactId());
  129.             $data_contact[] = array(
  130.                 'name' => $clientcontact->getName(),
  131.                 'lastname' => $clientcontact->getLastName(),
  132.                 'email' => $clientcontact->getEmail()
  133.             );
  134.         $client $em->getRepository(Client::class)->findOneById($proposal->getClientId());
  135.         $grupo_contact $em->getRepository(ClientGroupContact::class)->findByGroupId($client->getGroupId());
  136.         $data_groupContact = array();
  137.         foreach($grupo_contact as $grupocontact){
  138.             $data_groupContact[] = array(
  139.                 'name' => $grupocontact->getName(),
  140.                 'lastname' => $grupocontact->getLastName(),
  141.                 'email' => $grupocontact->getEmail()
  142.             );
  143.         }
  144.         $data_agents $this->findMailsAgentsProposal($id);
  145.         $data_correos array_merge($data_contact$data_groupContact$data_agents);
  146.         return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig',
  147.             array(
  148.                 'id' => $id,
  149.                 'token' => $proposal->getAccessKey(),
  150.                 'correos' => $data_correos,
  151.                 'subjectAndMessage' => $proposal->getId().' - '.$proposal->getTitle(),
  152.                 'mcp' => $proposal->getMcp(),
  153.                 'form' => $form->createView()
  154.             )
  155.         );
  156.     }
  157.     /**
  158.      * @Route("/mail/normal/{id}",  name="proposal_mail_form")
  159.      */
  160.     public function NormalAction($idRequest $request)
  161.     {
  162.         $mail = new SendMail();
  163.         $mail->setProposalId($id);
  164.         $mail->setType('Normal');
  165.         $form $this->createProposalMailCreateForm($mail);
  166.         $em $this->getDoctrine()->getManager();
  167.         $proposal $em->getRepository(Proposal::class)->findOneById($id);
  168.         $clientcontact $em->getRepository(ClientContact::class)->findOneById($proposal->getContactId());
  169.             $data_contact[] = array(
  170.                 'name' => $clientcontact->getName(),
  171.                 'lastname' => $clientcontact->getLastName(),
  172.                 'email' => $clientcontact->getEmail()
  173.             );
  174.         $client $em->getRepository(Client::class)->findOneById($proposal->getClientId());
  175.         $grupo_contact $em->getRepository(ClientGroupContact::class)->findByGroupId($client->getGroupId());
  176.         $data_groupContact = array();
  177.         foreach($grupo_contact as $grupocontact){
  178.             $data_groupContact[] = array(
  179.                 'name' => $grupocontact->getName(),
  180.                 'lastname' => $grupocontact->getLastName(),
  181.                 'email' => $grupocontact->getEmail()
  182.             );
  183.         }
  184.         $data_agents $this->findMailsAgentsProposal($id);
  185.         $data_correos array_merge($data_contact$data_groupContact$data_agents);
  186.         return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig',
  187.             array(
  188.                 'id' => $id,
  189.                 'token' => $proposal->getAccessKey(),
  190.                 'subjectAndMessage' => $proposal->getId().' - '.$proposal->getTitle(),
  191.                 'correos' => $data_correos,
  192.                 'mcp' => $proposal->getMcp(),
  193.                 'form' => $form->createView()
  194.             )
  195.         );
  196.     }
  197.     private function createProposalMailCreateForm(SendMail $entity)
  198.     {
  199.         $form $this->createForm(SendMailType::class, $entity, array(
  200.             'action' => $this->generateUrl('proposal_mail_create'),
  201.             'method' => 'PUT'));
  202.         return $form;
  203.     }
  204.     /**
  205.      * @Route("/mail/create", name="proposal_mail_create")
  206.      */
  207.     public function createProposalMailAction(Request $request, \Swift_Mailer $mailer)
  208.     {
  209.         $proposalsendmail $request->request->get('sendmail');
  210.         $proposalsendmail_mail $request->request->get('sendmail_mail')['mail'];
  211.         $proposalsendmail_admail $request->request->get('sendmail_admail')['mail'];
  212.         $arraysendmail_admail explode(","$proposalsendmail_admail);
  213.         foreach ($arraysendmail_admail as $key => $value) {
  214.             if (empty($value)) {
  215.                 unset($arraysendmail_admail[$key]);
  216.             }
  217.         }
  218.         if(empty($proposalsendmail['body'])){ $proposalsendmail['body'] = $proposalsendmail['subject']; }
  219.         $mail = new SendMail();
  220.         $form $this->createProposalMailCreateForm($mail);
  221.         $form->handleRequest($request);
  222.         $em $this->getDoctrine()->getManager();
  223.         if($form->isValid())
  224.         {
  225.             $proposal $em->getRepository(Proposal::class)->findOneById($proposalsendmail['proposalId']);
  226.             $proposal->setSent('Yes');
  227.             $em->persist($proposal);
  228.             $agent $em->getRepository(User::class)->findOneById($proposal->getAgentId());
  229.             $mailAgent[] = $agent->getEmail();
  230.             $agentMail $agent->getEmail();
  231.             $passGmail $agent->getPassGmail();
  232.             $firmGmail $agent->getFirmGmail();
  233.             $mailAgentSent = array(
  234.                 $agent->getEmail() => $agent->getName().' '$agent->getLastName()
  235.             );
  236.             $data = array();
  237.             if ($proposalsendmail['type'] == "Normal" ){
  238.                 $data = array(
  239.                     'body' => $proposalsendmail['body'],
  240.                     'firm' => $firmGmail,
  241.                 );
  242.             }elseif ($proposalsendmail['type'] == "Proforma" ){
  243.                 $data = array(
  244.                     'body' => $proposalsendmail['body'],
  245.                     'nameurl' => "Proforma, Proposal: ".$proposal->getTitle(),
  246.                     'urlPdf' => "http://inout.mante.solutions/pdf/pro/".$proposal->getId(),
  247.                     'firm' => $firmGmail,
  248.                 );
  249.             }elseif ($proposalsendmail['type'] == "Invoice" ){
  250.                 $data = array(
  251.                     'body' => $proposalsendmail['body'],
  252.                     'nameurl' => "Factura, Proposal: ".$proposal->getTitle(),
  253.                     'urlPdf' => "http://inout.mante.solutions/pdf/inv/".$proposal->getId(),
  254.                     'firm' => $firmGmail,
  255.                 );
  256.             }elseif ($proposalsendmail['type'] == "Presentation" ){
  257.                 $data = array(
  258.                     'body' => $proposalsendmail['body'],
  259.                     'nameurl' => "Presentación, Proposal: ".$proposal->getTitle(),
  260.                     'urlPdf' => "http://inout.mante.solutions/presentation/home/".$proposal->getAccessKey(),
  261.                     'firm' => $firmGmail,
  262.                 );
  263.                 // Guardo en historico de seguimiento
  264.                 $textHistory $this->translator->trans('Send Mail Presentation');
  265.                 $history $this->TracingHistoryOperations($proposal->getId(), $textHistory);
  266.             }elseif ($proposalsendmail['type'] == "Available" ){
  267.                 $data = array(
  268.                     'body' => $proposalsendmail['body'],
  269.                     'firm' => $firmGmail,
  270.                 );
  271.             }
  272.             // Buscamos los correos de los administradores
  273.             $emailarray = array();
  274.             $usermails $em->getRepository(User::class)->findByRole('ROLE_ADMIN');
  275.             foreach($usermails as $usermail){
  276.                 $emailarray[] = $usermail->getEmail();
  277.             }
  278. //            $mailpruebas[] = '';
  279. //            $mailpruebas[] = 'jorge.defreitas@develup.solutions';
  280.             if (is_null($proposalsendmail_mail)){
  281. //                $mailTodos = array_merge($emailarray, $mailAgent, $proposalsendmail_mail, $arraysendmail_admail);
  282.                 $mailTodos array_merge($mailAgent,  $arraysendmail_admail);
  283.             }else{
  284. //                $mailTodos = array_merge($emailarray, $mailAgent, $proposalsendmail_mail);
  285.                 $mailTodos array_merge($mailAgent$proposalsendmail_mail$arraysendmail_admail);
  286.             }
  287.             $transporter = new Swift_SmtpTransport();
  288.             $transporter->setHost('smtp.gmail.com')
  289.                 ->setEncryption('ssl'//ssl / tls
  290.                 ->setPort(465// 465 / 587
  291.                 ->setUsername($agentMail)
  292.                 ->setPassword($passGmail);
  293.             $mailer = new Swift_Mailer($transporter);
  294. //            $message = (new \Swift_Message())
  295.             $message = new Swift_Message();
  296.             $message->setSubject($proposalsendmail['subject'])
  297. //                ->setFrom(array("desarrollo@develup.solutions" => "Prueba"))
  298.                 ->setSender($agentMail)
  299.                 ->setFrom($mailAgentSent)
  300.                 ->setReplyTo($mailAgentSent)
  301.                 ->setTo($mailTodos)
  302.                 ->setBody(
  303.                     $this->renderView(
  304.                         'mail/structure-mail.html.twig',
  305.                         array('data' => $data)
  306.                     ),
  307.                     'text/html'
  308.                 )
  309.             ;
  310.             $mailer->send($message);
  311.             $mailTodos implode(","$mailTodos);
  312.             $mail->setMail($mailTodos);
  313.             $mail->setBody($proposalsendmail['body']);
  314.             /* Obtengo usuario logueado */
  315.             $user_logueado $this->get('security.token_storage')->getToken()->getUser();
  316.             $user_id $user_logueado->getId();
  317.             $mail->setCreatedId($user_id);
  318.             $mail->setUpdatedId($user_id);
  319.             $em->persist($mail);
  320.             $em->flush();
  321.             $event 'Sent the mail and registered.';
  322.             $successMessage $this->translator->trans($event);
  323.             $this->addFlash('mensajeMailSend'$successMessage);
  324.             return $this->redirectToRoute('list_SentMail_Proposal',
  325.                 array(
  326.                     'id' => $mail->getProposalId(),
  327.                 )
  328.             );
  329.         }else{
  330.             $errorMessagebase $this->translator->trans('Error, some fields are empty');
  331.             $errorMessage $errorMessagebase;
  332.             $this->addFlash('mensajeMailSenderror'$errorMessage);
  333.         }
  334.         $proposal $em->getRepository(Proposal::class)->findOneById($mail->getProposalId());
  335.         return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig', array(
  336.                 'id' => $mail->getProposalId(),
  337.                 'token' => $proposal->getAccessKey(),
  338.                 'subjectAndMessage' => $proposal->getId().' - '.$proposal->getTitle(),
  339.                 'correos' => null,
  340.                 'mcp' => $proposal->getMcp(),
  341.                 'form' => $form->createView()
  342.             )
  343.         );
  344.     }
  345.     /**
  346.      * @Route("/mail/searchcreate", name="proposal_mail_create_search")
  347.      */
  348.     public function createProposalMailSearchAction(Request $request, \Swift_Mailer $mailer)
  349.     {
  350.         $proposalsendmail $request->request->get('sendmail');
  351.         $em $this->getDoctrine()->getManager();
  352.         $proposal $em->getRepository(Proposal::class)->findOneById($proposalsendmail['proposalId']);
  353.         $proposalsendmail_mail $request->request->get('sendmail_mail')['mail'];
  354.         $mailnew = new SendMail();
  355.         $form $this->createProposalMailCreateForm($mailnew);
  356.         $form->handleRequest($request);
  357.         if($form->isValid())
  358.         {
  359.             $proposal $em->getRepository(Proposal::class)->findOneById($proposalsendmail['proposalId']);
  360.             $proposal->setSent('Yes');
  361.             $em->persist($proposal);
  362.             $agent $em->getRepository(User::class)->findOneById($proposal->getAgentId());
  363.             $mailAgent[] = $agent->getEmail();
  364.             $agentMail $agent->getEmail();
  365.             $passGmail $agent->getPassGmail();
  366.             $firmGmail $agent->getFirmGmail();
  367.             $mailAgentSent = array(
  368.                 $agent->getEmail() => $agent->getName().' '$agent->getLastName()
  369.             );
  370.             $data = array(
  371.                 'body' => $proposalsendmail['body'],
  372.                 'firm' => $firmGmail,
  373.             );
  374.             // Buscamos los correos de los administradores
  375.             $emailarray = array();
  376.             $usermails $em->getRepository(User::class)->findByRole('ROLE_ADMIN');
  377.             foreach($usermails as $usermail){
  378.                 $emailarray[] = $usermail->getEmail();
  379.             }
  380.             foreach($proposalsendmail_mail as $key => $proposalsendmailmail){
  381.                     $supplier $em->getRepository(Supplier::class)->findOneById($key);
  382.                     $supplierName $supplier->getName();
  383.                     $subject $proposalsendmail['subject']." / ".$supplierName;
  384.                     $mailTodos array_merge($mailAgent$proposalsendmailmail);
  385. //                d($subject, $mailTodos);
  386.                     $transporter = new Swift_SmtpTransport();
  387.                     $transporter->setHost('smtp.gmail.com')
  388.                         ->setEncryption('ssl'//ssl / tls
  389.                         ->setPort(465// 465 / 587
  390.                         ->setUsername($agentMail)
  391.                         ->setPassword($passGmail);
  392.                     $mailer = new Swift_Mailer($transporter);
  393.                     $message = new Swift_Message();
  394.                     $message->setSubject($subject)
  395.                         ->setSender($agentMail)
  396.                         ->setFrom($mailAgentSent)
  397.                         ->setReplyTo($mailAgentSent)
  398.                         ->setTo($mailTodos)
  399.                         ->setBody(
  400.                             $this->renderView(
  401.                                 'mail/structure-mail.html.twig',
  402.                                 array('data' => $data)
  403.                             ),
  404.                             'text/html'
  405.                         )
  406.                     ;
  407.                     $mailer->send($message);
  408.                     $mail = new SendMail();
  409.                     $mailTodos implode(","$mailTodos);
  410.                     $mail->setMail($mailTodos);
  411.                     $mail->setType('Available');
  412.                     $mail->setProposalId($proposalsendmail['proposalId']);
  413.                     $mail->setSubject($subject);
  414.                     $mail->setBody($proposalsendmail['body']);
  415.                     /* Obtengo usuario logueado */
  416.                     $user_logueado $this->get('security.token_storage')->getToken()->getUser();
  417.                     $user_id $user_logueado->getId();
  418.                     $mail->setCreatedId($user_id);
  419.                     $mail->setUpdatedId($user_id);
  420.                     $em->persist($mail);
  421.                     $em->flush();
  422.                     $event 'Sent the mail and registered. / '.$subject;
  423.                     $successMessage $this->translator->trans($event);
  424.                     $this->addFlash('mensajesenmail'$successMessage);
  425.             }
  426.             // Guardo en historico de seguimiento
  427.             $textHistory $this->translator->trans('Send mail request hotels');
  428.             $history $this->TracingHistoryOperations($proposal->getId(), $textHistory);
  429. //            return $this->redirectToRoute('list_SentMail_Proposal',
  430. //                array(
  431. //                    'id' => $mail->getProposalId(),
  432. //                )
  433. //            );
  434.         }else{
  435.             $errorMessagebase $this->translator->trans('Error, some fields are empty');
  436.             $errorMessage $errorMessagebase;
  437.             $this->addFlash('mensajesenmailerror'$errorMessage);
  438.         }
  439.         return $this->redirectToRoute('list_SentMail_Proposal',
  440.             array(
  441.                 'id' => $proposal->getId(),
  442.             )
  443.         );
  444. //        return $this->render('MDS/EventsBundle/proposal/send-mail.html.twig', array(
  445. //                'id' => $proposal->getId(),
  446. //                'token' => $proposal->getAccessKey(),
  447. //                'mcp' => $proposal->getMcp(),
  448. //                'form' => $form->createView()
  449. //            )
  450. //        );
  451.     }
  452.     // Funcion para insertar historico de seguimiento
  453.     // $textHistory = $this->translator->trans('');
  454.     // $history = $this->TracingHistoryOperations($proposal->getId(), $text);
  455.     private function TracingHistoryOperations($id$text)
  456.     {
  457.         $em $this->getDoctrine()->getManager();
  458.         /* Obtengo usuario logueado */
  459.         $user_logueado $this->get('security.token_storage')->getToken()->getUser();
  460.         $user_id $user_logueado->getId();
  461.         $history = new ProposalTracing();
  462.         $history->setDateAt(new \DateTime('now'));
  463.         $history->setText($text);
  464.         $history->setAgentId($user_id);
  465.         $history->setProposalId($id);
  466.         $history->setViewed('no');
  467.         $history->setCreatedId($user_id);
  468.         $history->setUpdatedId($user_id);
  469.         $em->persist($history);
  470.         $em->flush();
  471.         $success 'success';
  472.         return $success;
  473.     }
  474.     private function findMailsAgentsProposal($id)
  475.     {
  476.         // INCIO: Buscamos los agentes del proposal para que todos esten informados
  477.         $em $this->getDoctrine()->getManager();
  478.         $prop_agents $em->getRepository(ProposalAgents::class)->findOneByIdProp($id);
  479.         $data = array();
  480.         if (($prop_agents->getAgOne() !=0) and !empty($prop_agents->getAgOne())) {
  481.             $agent $em->getRepository(User::class)->findOneById($prop_agents->getAgOne());
  482.             $data[] = array(
  483.                 'name' => $agent->getName(),
  484.                 'lastname' => $agent->getLastName(),
  485.                 'email' => $agent->getEmail()
  486.             );
  487.         }
  488.         if (($prop_agents->getAgTwo() !=0) and !empty($prop_agents->getAgTwo())) {
  489.             $agent $em->getRepository(User::class)->findOneById($prop_agents->getAgTwo());
  490.             $data[] = array(
  491.                 'name' => $agent->getName(),
  492.                 'lastname' => $agent->getLastName(),
  493.                 'email' => $agent->getEmail()
  494.             );
  495.         }
  496.         if (($prop_agents->getAgThree() !=0) and !empty($prop_agents->getAgThree())) {
  497.             $agent $em->getRepository(User::class)->findOneById($prop_agents->getAgThree());
  498.             $data[] = array(
  499.                 'name' => $agent->getName(),
  500.                 'lastname' => $agent->getLastName(),
  501.                 'email' => $agent->getEmail()
  502.             );
  503.         }
  504.         if (($prop_agents->getAgFour() !=0) and !empty($prop_agents->getAgFour())) {
  505.             $agent $em->getRepository(User::class)->findOneById($prop_agents->getAgFour());
  506.             $data[] = array(
  507.                 'name' => $agent->getName(),
  508.                 'lastname' => $agent->getLastName(),
  509.                 'email' => $agent->getEmail()
  510.             );
  511.         }
  512.         // FIN: Buscamos los agentes del proposal para que todos esten informados
  513.         return $data;
  514.     }
  515. }