/** * @EXT\Route( * "/ask/invoice/{invoice}", * name="invoice_ask" * ) * * @return Response */ public function askInvoiceAction(Invoice $invoice) { $user = $this->tokenStorage->getToken()->getUser(); if ($invoice->getChart()->getOwner() !== $user && !$this->authorization->isGranted('ROLE_ADMIN')) { throw new AccessDeniedException(); } $this->invoiceManager->ask($invoice); $this->get('request')->getSession()->getFlashBag()->add('success', $this->get('translator')->trans('invoice_request_done', array(), 'invoice')); return new RedirectResponse($this->get('router')->generate('claro_desktop_open')); }
public function ask(Invoice $invoice) { $body = "L'utilisateur {$invoice->getChart()->getOwner()->getUsername()} ({$invoice->getChart()->getOwner()->getMail()})\n a demandé une facture pour la commande {$invoice->getInvoiceNumber()}"; $this->mailManager->send('Demande de facture', $body, array(), null, array('to' => array('*****@*****.**'))); }