From 94f79e245b5a19210dc4e3233e20d0d4043ac1bd Mon Sep 17 00:00:00 2001 From: vgreb Date: Sat, 17 Jan 2026 23:07:43 +0100 Subject: [PATCH] =?UTF-8?q?Refonte=20-=20Tr=C3=A9sorerie=20-=20Journal=20-?= =?UTF-8?q?=20List?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/packages/backoffice_menu.yaml | 3 + .../routing/admin_accounting/journal.yml | 5 + .../administration/images/ajax-loader.gif | Bin 0 -> 2545 bytes .../AppBundle/Accounting/OperationType.php | 12 + .../Compta/Importer/CreditMutuel.php | 1 + .../AppBundle/Compta/Importer/Operation.php | 2 + .../Compta/Importer/OperationType.php | 11 - .../Journal/AddTransactionAction.php | 6 +- .../Accounting/Journal/AllocateAction.php | 4 +- .../Admin/Accounting/Journal/DeleteAction.php | 8 +- .../Journal/EditTransactionAction.php | 2 +- .../Admin/Accounting/Journal/ImportAction.php | 6 +- .../Admin/Accounting/Journal/ListAction.php | 51 +++ .../invoicing-period.form.html.twig | 2 +- .../admin/accounting/journal/list.html.twig | 386 ++++++++++++++++++ .../features/Admin/Tresorerie/Journal.feature | 2 +- .../Admin/Tresorerie/JournalImport.feature | 24 +- 17 files changed, 481 insertions(+), 44 deletions(-) create mode 100644 htdocs/templates/administration/images/ajax-loader.gif create mode 100644 sources/AppBundle/Accounting/OperationType.php delete mode 100644 sources/AppBundle/Compta/Importer/OperationType.php create mode 100644 sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php create mode 100644 templates/admin/accounting/journal/list.html.twig 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/htdocs/templates/administration/images/ajax-loader.gif b/htdocs/templates/administration/images/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..8b2420cc59666336604af02fa48c05e6458c8407 GIT binary patch literal 2545 zcma*pSx^&c9suyB@9uOr9Z?2Z)(M?PLKbEM0Txk76cPw{fH*KJDj>+Aawtjy>=;OZ zkb_GOLC|ohV4(;ou%003;5aJdjH_1d){LVMi?c_$I}hVl?YbS^t=b2+YQBel>aXkj zegC8Xu{v$Usthl{3-}Rmt+#LADijJBhF7duv1!vLPfyRHqN4Ed@XXB2l`B`Kq@+Ye zMNt%Gu~_tay;iGjYioPA?`J)H--)6y#e>FYPFbGE0T}?)(-YauFt2nmidn6B#w{aFA8S$?pZvmimiTsaWYBWY+Nv%2 zjqToBnqLe&}Z!&N+DT?c6O2oLUjg|w4tYiIIs=KTOAiQ zR&X{cXXkD?OxXbP!j=&wMOA{+u{sq^J-Byi;0Ql+{REn?^j(Z_(M6b22n5*R)2|rl zE0*-VuqXD<_oa%Q9s%5HCtm!iW!FPICQQ+|q_&25Y*`bh6#I^_78KbRBrag_45Oq; zHk(&7(UxW86V(Q^G~FCuYmt(aa8y+-ZGchQ=4h}q7q-@&%&9p^gVf&27BlQ0QG2W$ zK>eeEqV#;A;4(K1kRg-hE$Mo&5zRMT3kAXH=)keizKKFLk9Yq@E65)``3?pHMb;>>hOB3h>ugpd^}+4@n&PIV`j|x5l5sQbBQup40LCF z{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#Cy^VI-2e(+OrDsnIDU0hisSubmitted() && $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 @@
-{{ form_start(form) }} +{{ form_start(form, {'name': 'periodId_selector'}) }}
diff --git a/templates/admin/accounting/journal/list.html.twig b/templates/admin/accounting/journal/list.html.twig new file mode 100644 index 000000000..92608f9b0 --- /dev/null +++ b/templates/admin/accounting/journal/list.html.twig @@ -0,0 +1,386 @@ +{% extends 'admin/base_with_header.html.twig' %} + +{% block content %} +

Journal

+ + + + {% include 'admin/accounting/invoicing-period.form.html.twig' with {form: formPeriod, url: path('admin_accounting_quotations_list')} %} + +
+ +
+ + + + + +
+ {% if transactions.count > 0 %} + + + + + + + + + + + + + + + + + {% for line in transactions %} + + + + + + + {% if line.idoperation == 1 %} + + + {% else %} + + + {% endif %} + + + + + + {% endfor %} + +
DateCompteÉvènementCatégorieDescriptionDébitCréditRèglementJustif ? 
{{ 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 }} + -{{ line.montant|number_format(2, ',', ' ') }}+{{ line.montant|number_format(2, ',', ' ') }} + {% if line.reglement == 'A déterminer'%} +
+ +
+ {% else %} + {{ line.reglement }} + {% endif %} +
+ + + + +
+ +
+
+ + + + + + + + + + + + + + + + +
+ {% else %} +
+
+ + Aucune ecriture +
+
+ {% if withReconciled == false %} + Afficher aussi les entrées pointées + {% endif %} + +
+
+
+ {% endif %} + + + + + +{% endblock %} + +{% block javascript %} +{{ parent() }} + +{% endblock %} diff --git a/tests/behat/features/Admin/Tresorerie/Journal.feature b/tests/behat/features/Admin/Tresorerie/Journal.feature index 4e1d8548b..d9902a629 100644 --- a/tests/behat/features/Admin/Tresorerie/Journal.feature +++ b/tests/behat/features/Admin/Tresorerie/Journal.feature @@ -105,7 +105,7 @@ Feature: Administration - Trésorerie - Journal @reloadDbWithTestData Scenario: Compte journal Suppression d'une transaction Given I am logged in as admin and on the Administration - When I am on "/pages/administration/index.php?page=compta_journal&id_periode=15" + When I am on "/admin/accounting/journal/list?periodId=15" And I follow the button of tooltip "Supprimer la fiche de PRLV SEPA ONLINE SAS SCW SCALEWAY " Then I should see "L'écriture a été supprimée" diff --git a/tests/behat/features/Admin/Tresorerie/JournalImport.feature b/tests/behat/features/Admin/Tresorerie/JournalImport.feature index 802857094..ad759c912 100644 --- a/tests/behat/features/Admin/Tresorerie/JournalImport.feature +++ b/tests/behat/features/Admin/Tresorerie/JournalImport.feature @@ -6,13 +6,13 @@ Feature: Administration - Trésorerie - Journal import When I follow "Journal" Then the ".content h2" element should contain "Journal" # On vérifie qu'on a aucune entrée pour la période - When I select "2019-01-01 - 2019-12-31" from "id_periode" - And I submit the form with name "forum" - Then the current URL should match "/id_periode=13/" - When I check "also_display_classifed_entries" + When I select "01/01/2019 - 31/12/2019" from "periodId" + And I submit the form with name "periodId_selector" + Then the current URL should match "/periodId=13/" + When I check "with_reconciled" And I press "Filtrer" - Then the current URL should match "/id_periode=13/" - And the current URL should match "/also_display_classifed_entries=on/" + Then the current URL should match "/periodId=13/" + And the current URL should match "/with_reconciled=on/" And I should see " Aucune ecriture" # On importe le fichier sur le crédit mutuel When I follow "Importer un fichier CSV" @@ -22,13 +22,13 @@ Feature: Administration - Trésorerie - Journal import And I press "Soumettre" Then I should see "Le fichier a été importé" # On vérifie que l'import s'est bien passé - When I select "2019-01-01 - 2019-12-31" from "id_periode" - And I submit the form with name "forum" - Then the current URL should match "/id_periode=13/" - When I check "also_display_classifed_entries" + When I select "01/01/2019 - 31/12/2019" from "periodId" + And I submit the form with name "periodId_selector" + Then the current URL should match "/periodId=13/" + When I check "with_reconciled" And I press "Filtrer" - Then the current URL should match "/id_periode=13/" - And the current URL should match "/also_display_classifed_entries=on/" + Then the current URL should match "/periodId=13/" + And the current URL should match "/with_reconciled=on/" And I should not see " Aucune ecriture" # Test meetup When I follow the button of tooltip "Modifier la ligne CB MEETUP ORG SUB FACT 190323 DONT FRAIS DE COMM. 1,89 EUR"