diff --git a/app/config/packages/backoffice_menu.yaml b/app/config/packages/backoffice_menu.yaml index 86a668798..2f03f1fee 100644 --- a/app/config/packages/backoffice_menu.yaml +++ b/app/config/packages/backoffice_menu.yaml @@ -226,10 +226,13 @@ parameters: - admin_accounting_invoices_list compta_journal: nom: 'Journal' + url: '/admin/accounting/journal/list' niveau: 'ROLE_ADMIN' extra_routes: + - admin_accounting_journal_list - admin_accounting_journal_add - admin_accounting_journal_edit + - admin_accounting_journal_import compta_conf_evenement: nom: 'Configuration' niveau: 'ROLE_ADMIN' diff --git a/app/config/routing/admin_accounting/journal.yml b/app/config/routing/admin_accounting/journal.yml index fee0ba74c..061668a38 100644 --- a/app/config/routing/admin_accounting/journal.yml +++ b/app/config/routing/admin_accounting/journal.yml @@ -1,3 +1,8 @@ +admin_accounting_journal_list: + path: /list + defaults: + _controller: AppBundle\Controller\Admin\Accounting\Journal\ListAction + admin_accounting_journal_delete: path: /delete/{id} defaults: diff --git a/sources/AppBundle/Accounting/OperationType.php b/sources/AppBundle/Accounting/OperationType.php new file mode 100644 index 000000000..349230b55 --- /dev/null +++ b/sources/AppBundle/Accounting/OperationType.php @@ -0,0 +1,12 @@ +isSubmitted() && $form->isValid()) { $this->transactionRepository->save($transaction); $this->audit->log("Ajout d'une écriture"); - $_SESSION['flash']['message'] = "l'écriture a été ajoutée"; - $_SESSION['flash']['error'] = false; - $this->addFlash('notice', "l'écriture a été ajoutée"); - return $this->redirect('/pages/administration/index.php?page=compta_journal&action=lister#L' . $transaction->getId()); + $this->addFlash('notice', "L'écriture a été ajoutée"); + return $this->redirect('/admin/accounting/journal/list#L' . $transaction->getId()); } return $this->render('admin/accounting/journal/add.html.twig', [ diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php index 1706eb129..c14ba1828 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php @@ -50,9 +50,7 @@ public function __invoke(Request $request, int $id): RedirectResponse $transaction->setAmount($transaction->getAmount() - $totalAmount); $this->transactionRepository->save($transaction); - $_SESSION['flash'] = "L'écriture a été ventilée"; - $_SESSION['erreur'] = false; $this->addFlash('notice', "L'écriture a été ventilée"); - return $this->redirect('/pages/administration/index.php?page=compta_journal#journal-ligne-' . $lastId); + return $this->redirect('/admin/accounting/journal/list#journal-ligne-' . $lastId); } } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php index d2bbc9a7d..65ab0014a 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php @@ -22,17 +22,13 @@ public function __invoke(Request $request, int $id): Response { $accounting = $this->transactionRepository->get($id); if (!$accounting instanceof Transaction) { - $_SESSION['flash'] = "Une erreur est survenue lors de la suppression de l'écriture"; - $_SESSION['erreur'] = true; $this->addFlash('error', "Une erreur est survenue lors de la suppression de l'écriture"); - return $this->redirect('/pages/administration/index.php?page=compta_journal'); + return $this->redirectToRoute('admin_accounting_journal_list'); } $this->transactionRepository->delete($accounting); $this->audit->log("Suppression de l'écriture {$id}"); - $_SESSION['flash'] = "L'écriture a été supprimée"; - $_SESSION['erreur'] = false; $this->addFlash('notice', "L'écriture a été supprimée"); - return $this->redirect('/pages/administration/index.php?page=compta_journal'); + return $this->redirectToRoute('admin_accounting_journal_list'); } } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php index 4ef3889fd..c32e52a56 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php @@ -46,7 +46,7 @@ public function __invoke(Request $request, int $id): Response if ($submitAndPassButton instanceof SubmitButton && $submitAndPassButton->isClicked()) { return $this->redirectToRoute('admin_accounting_journal_edit', ['id' => $nextTransaction->getId()]); } else { - return $this->redirect('/pages/administration/index.php?page=compta_journal&action=lister#L' . $transaction->getId()); + return $this->redirect('/admin/accounting/journal/list#L' . $transaction->getId()); } } return $this->render('admin/accounting/journal/edit.html.twig', [ diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/ImportAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/ImportAction.php index c99983be5..db81f3aac 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/ImportAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/ImportAction.php @@ -36,16 +36,12 @@ public function __invoke(Request $request): Response $importer = $this->importerFactory->create($this->uploadDir . 'banque.csv', $form->get('bankAccount')->getData()); if ($this->compta->extraireComptaDepuisCSVBanque($importer)) { $this->audit->log('Chargement fichier banque'); - $_SESSION['flash'] = "Le fichier a été importé"; - $_SESSION['erreur'] = false; $this->addFlash('notice', "Le fichier a été importé"); } else { - $_SESSION['flash'] = "Le fichier n'a pas été importé. Le format est-il valide ?"; - $_SESSION['erreur'] = true; $this->addFlash('error', "Le fichier n'a pas été importé. Le format est-il valide ?"); } unlink($this->uploadDir . 'banque.csv'); - return $this->redirect('/pages/administration/index.php?page=compta_journal&&action=lister'); + return $this->redirectToRoute('admin_accounting_journal_list'); } } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php new file mode 100644 index 000000000..1933428af --- /dev/null +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php @@ -0,0 +1,51 @@ +query->has('periodId') ? $request->query->getInt('periodId') : null; + $period = $this->invoicingPeriodRepository->getCurrentPeriod($periodId); + $formPeriod = $this->createForm(InvoicingPeriodType::class, $period); + $periods = $this->invoicingPeriodRepository->getAll(); + $withReconciled = $request->query->getBoolean('with_reconciled'); + $type = OperationType::from($request->query->getInt('type')); + + $transactions = $this->transactionRepository->getEntriesPerInvoicingPeriod($period, !$withReconciled, $type->value); + + return $this->render('admin/accounting/journal/list.html.twig', [ + 'periods' => $periods, + 'periodId' => $period->getId(), + 'formPeriod' => $formPeriod->createView(), + 'withReconciled' => $withReconciled, + 'type' => $type, + 'categories' => $this->categoryRepository->getAllSortedByName(), + 'events' => $this->eventRepository->getAllSortedByName(), + 'paymentTypes' => $this->paymentRepository->getAllSortedByName(), + 'transactions' => $transactions, + ]); + } +} diff --git a/templates/admin/accounting/invoicing-period.form.html.twig b/templates/admin/accounting/invoicing-period.form.html.twig index 71d447bfb..20925f975 100644 --- a/templates/admin/accounting/invoicing-period.form.html.twig +++ b/templates/admin/accounting/invoicing-period.form.html.twig @@ -1,5 +1,5 @@
| Date | +Compte | +Evenement | +Catégorie | +Description | +Debit | +Crédit | +Reglement | +Justif ? | ++ | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ line.date_ecriture|format_date('short') }} | +{{ line.nom_compte }} | +
+ {% if line.evenement == 'A déterminer' %}
+
+
+
+ {% else %}
+ {{ line.evenement }}
+ {% endif %}
+ |
+
+ {% if line.categorie == 'A déterminer' %}
+
+
+
+ {% else %}
+ {{ line.categorie }}
+ {% endif %}
+ |
+ + {{ line.description }} + | + {% if line.idoperation == 1 %} +-{{ line.montant|number_format(2, ',', ' ') }} | ++ {% else %} + | + | +{{ line.montant|number_format(2, ',', ' ') }} | + {% endif %} + +
+ {% if line.reglement == 'A déterminer'%}
+
+
+
+ {% else %}
+ {{ line.reglement }}
+ {% endif %}
+ |
+ + + + + + + | ++ + + + + + + + + + + + + + + + + | +