delete invoices (#1652)

* include all meta fields as template variables
* support invoice preview via command
* support deletion of generated invoices
This commit is contained in:
Kevin Papst
2020-04-23 12:19:07 +02:00
committed by GitHub
parent cfe0724620
commit 711139ad4c
20 changed files with 206 additions and 36 deletions

View File

@@ -189,11 +189,26 @@ final class InvoiceController extends AbstractController
{
try {
$this->service->changeInvoiceStatus($invoice, $status);
} catch (\InvalidArgumentException $ex) {
throw $this->createNotFoundException($ex->getMessage());
$this->flashSuccess('action.update.success');
} catch (\Exception $ex) {
$this->flashError('action.update.error');
}
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('admin_invoice_list');
}
/**
* @Route(path="/delete/{id}", name="admin_invoice_delete", methods={"GET"})
* @Security("is_granted('history_invoice')")
*/
public function deleteInvoiceAction(Invoice $invoice): Response
{
try {
$this->service->deleteInvoice($invoice);
$this->flashSuccess('action.delete.success');
} catch (\Exception $ex) {
$this->flashError('action.delete.error');
}
return $this->redirectToRoute('admin_invoice_list');
}