From 845ade5267a2256dcd4e20435531c146e92c410e Mon Sep 17 00:00:00 2001 From: vgreb Date: Thu, 3 Sep 2026 00:37:51 +0200 Subject: [PATCH] compta: bascule du journal sur Doctrine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passage des appelants du journal aux entités Doctrine Transaction et InvoicingPeriod, et suppression des modèles et repositories Ting correspondants. Les champs du formulaire suivent désormais les noms des propriétés de l'entité (operationId -> operation, accountId -> compte, amount -> montant, ...), d'où les renommages dans les gabarits et les scénarios Behat. TransactionType passe de ChoiceType sur des identifiants à EntityType sur les entités. Les associations operation, categorie et compte étant non nullables — leurs colonnes sont NOT NULL —, les résultats de find() sont désormais gardés : un identifiant qui ne désigne aucune ligne lève une exception au lieu d'écrire silencieusement une référence vide. ListInvoiceAction et ListQuotationAction ne basculent ici que pour la partie période ; leur partie facturation suit avec la migration d'Invoicing. La section accounting de ting.yaml reste en place : Model/Repository contient encore les repositories de facturation. --- phpstan-baseline.php | 372 +----------------- .../Accounting/Form/InvoicingPeriodType.php | 8 +- .../Accounting/Form/TransactionType.php | 133 +++---- .../Accounting/Model/InvoicingPeriod.php | 72 ---- .../Repository/InvoicingPeriodRepository.php | 94 ----- .../Repository/TransactionRepository.php | 244 ------------ .../Accounting/Model/Transaction.php | 357 ----------------- .../Accounting/TransactionModification.php | 25 +- sources/AppBundle/Compta/CsvExtractor.php | 69 ++-- .../Accounting/Invoice/ListInvoiceAction.php | 10 +- .../Journal/AddTransactionAction.php | 11 +- .../Accounting/Journal/AllocateAction.php | 56 ++- .../Admin/Accounting/Journal/DeleteAction.php | 6 +- .../Journal/DownloadAttachmentAction.php | 10 +- .../Journal/DownloadAttachmentsAction.php | 6 +- .../Journal/EditTransactionAction.php | 16 +- .../Admin/Accounting/Journal/ExportAction.php | 8 +- .../Admin/Accounting/Journal/ListAction.php | 8 +- .../Accounting/Journal/UpdateInfoAction.php | 18 +- .../Journal/UploadAttachmentAction.php | 16 +- .../Quotation/ListQuotationAction.php | 10 +- .../admin/accounting/journal/form.html.twig | 32 +- .../admin/accounting/journal/list.html.twig | 2 +- .../journal/vat_calculation.js.twig | 10 +- .../features/Admin/Tresorerie/Journal.feature | 40 +- .../Admin/Tresorerie/JournalImport.feature | 8 +- 26 files changed, 277 insertions(+), 1364 deletions(-) delete mode 100644 sources/AppBundle/Accounting/Model/InvoicingPeriod.php delete mode 100644 sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php delete mode 100644 sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php delete mode 100644 sources/AppBundle/Accounting/Model/Transaction.php diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 2eb8c8980..ec4d37484 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -325,36 +325,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Form\\\\TransactionType\\:\\:buildAccountChoice\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Form\\\\TransactionType\\:\\:buildCategoryChoice\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Form\\\\TransactionType\\:\\:buildEventChoice\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Form\\\\TransactionType\\:\\:buildOperationTypeChoice\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Form\\\\TransactionType\\:\\:buildPaymentTypeChoice\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Form/TransactionType.php', -]; $ignoreErrors[] = [ 'message' => '#^Class AppBundle\\\\Accounting\\\\Form\\\\TransactionsImportType extends generic class Symfony\\\\Component\\\\Form\\\\AbstractType but does not specify its types\\: TData$#', 'identifier' => 'missingType.generics', @@ -445,30 +415,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingDetailRepository.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\InvoicingPeriodRepository\\:\\:getCurrentPeriod\\(\\) should return AppBundle\\\\Accounting\\\\Model\\\\InvoicingPeriod but returns AppBundle\\\\Accounting\\\\Model\\\\InvoicingPeriod\\|null\\.$#', - 'identifier' => 'return.type', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\InvoicingPeriodRepository\\:\\:initMetadata\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\InvoicingPeriodRepository\\:\\:initMetadata\\(\\) should return M of CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata but returns CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\\\.$#', - 'identifier' => 'return.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$databaseName of method CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\\\:\\:setDatabase\\(\\) expects string, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot access offset \'next_index\' on mixed\\.$#', 'identifier' => 'offsetAccess.nonOffsetAccessible', @@ -517,42 +463,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/InvoicingRepository.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method format\\(\\) on DateTime\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\TransactionRepository\\:\\:getEntriesPerInvoicingPeriod\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\TransactionRepository\\:\\:getNextTransaction\\(\\) should return AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null but returns mixed\\.$#', - 'identifier' => 'return.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\TransactionRepository\\:\\:initMetadata\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\TransactionRepository\\:\\:initMetadata\\(\\) should return M of CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata but returns CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\\\.$#', - 'identifier' => 'return.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$databaseName of method CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\\\:\\:setDatabase\\(\\) expects string, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot cast mixed to int\\.$#', 'identifier' => 'cast.int', @@ -560,8 +470,8 @@ 'path' => __DIR__ . '/sources/AppBundle/Accounting/TransactionModification.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$comment of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setComment\\(\\) expects string\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$commentaire \\(string\\|null\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Accounting/TransactionModification.php', ]; @@ -2126,74 +2036,50 @@ 'path' => __DIR__ . '/sources/AppBundle/Command/VideosDataCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$amount of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAmount\\(\\) expects float, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$amountTva0 of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAmountTva0\\(\\) expects float\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$amountTva10 of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAmountTva10\\(\\) expects float\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$amountTva20 of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAmountTva20\\(\\) expects float\\|null, mixed given\\.$#', + 'message' => '#^Parameter \\#1 \\$datetime of class DateTime constructor expects string, mixed given\\.$#', 'identifier' => 'argument.type', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$amountTva5_5 of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAmountTva55\\(\\) expects float\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$description \\(string\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$attachmentRequired of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setAttachmentRequired\\(\\) expects bool, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$categoryId of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setCategoryId\\(\\) expects int\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$justificatifRequis \\(bool\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 2, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$datetime of class DateTime constructor expects string, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$montant \\(float\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$description of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setDescription\\(\\) expects string, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$montantTva0 \\(float\\|null\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$eventId of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setEventId\\(\\) expects int\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 2, + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$montantTva10 \\(float\\|null\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', + 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$operationId of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setOperationId\\(\\) expects int\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$montantTva20 \\(float\\|null\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$paymentTypeId of method AppBundle\\\\Accounting\\\\Model\\\\Transaction\\:\\:setPaymentTypeId\\(\\) expects int\\|null, mixed given\\.$#', - 'identifier' => 'argument.type', + 'message' => '#^Property AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\:\\:\\$montantTva5_5 \\(float\\|null\\) does not accept mixed\\.$#', + 'identifier' => 'assign.propertyType', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Compta/CsvExtractor.php', ]; @@ -2335,90 +2221,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Invoice/SendInvoiceEmailAction.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getAccountId\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getAccountingDate\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getAmount\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getComment\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getDescription\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getNumber\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getOperationId\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getOperationNumber\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getPaymentDate\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getPaymentTypeId\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getTvaIntra\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getVendorName\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method setAmount\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$entity of method CCMBenchmark\\\\Ting\\\\Repository\\\\Repository\\\\:\\:save\\(\\) expects AppBundle\\\\Accounting\\\\Model\\\\Transaction, AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot call method format\\(\\) on DateTime\\|null\\.$#', 'identifier' => 'method.nonObject', @@ -2438,149 +2240,17 @@ 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentsAction.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getId\\(\\) on AppBundle\\\\Accounting\\\\Model\\\\Transaction\\|null\\.$#', - 'identifier' => 'method.nonObject', + 'message' => '#^Cannot access property \\$id on AppBundle\\\\Accounting\\\\Entity\\\\Transaction\\|null\\.$#', + 'identifier' => 'property.nonObject', 'count' => 2, 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$transactionId of method AppBundle\\\\Accounting\\\\Model\\\\Repository\\\\TransactionRepository\\:\\:getNextTransaction\\(\\) expects int, int\\|null given\\.$#', + 'message' => '#^Parameter \\#1 \\$transactionId of method AppBundle\\\\Accounting\\\\Entity\\\\Repository\\\\TransactionRepository\\:\\:getNextTransaction\\(\\) expects int, int\\|null given\\.$#', 'identifier' => 'argument.type', 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#', - 'identifier' => 'foreach.nonIterable', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'attachment_filename\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'attachment_required\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'categorie\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'comment\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'date_ecriture\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'description\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'evenement\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'idoperation\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_ht\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_ht_0\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_ht_10\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_ht_20\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_ht_5_5\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_tva\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_tva_10\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_tva_20\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'montant_tva_5_5\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'nom_compte\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'reglement\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'tva_zone\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot call method format\\(\\) on DateTime\\|null\\.$#', 'identifier' => 'method.nonObject', diff --git a/sources/AppBundle/Accounting/Form/InvoicingPeriodType.php b/sources/AppBundle/Accounting/Form/InvoicingPeriodType.php index 05659f941..103b1f5af 100644 --- a/sources/AppBundle/Accounting/Form/InvoicingPeriodType.php +++ b/sources/AppBundle/Accounting/Form/InvoicingPeriodType.php @@ -4,8 +4,7 @@ namespace AppBundle\Accounting\Form; -use AppBundle\Accounting\Model\InvoicingPeriod; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -18,9 +17,8 @@ public function __construct(private readonly InvoicingPeriodRepository $invoicin public function buildForm(FormBuilderInterface $builder, array $options): void { $periods = []; - /** @var InvoicingPeriod $period */ - foreach ($this->invoicingPeriodRepository->getAll() as $period) { - $periods["{$period->getStartDate()->format('d/m/Y')} - {$period->getEndDate()->format('d/m/Y')}"] = $period->getId(); + foreach ($this->invoicingPeriodRepository->findAll() as $period) { + $periods["{$period->dateDebut->format('d/m/Y')} - {$period->dateFin->format('d/m/Y')}"] = $period->id; } $builder->add('periodId', ChoiceType::class, [ diff --git a/sources/AppBundle/Accounting/Form/TransactionType.php b/sources/AppBundle/Accounting/Form/TransactionType.php index b616e6121..f4f744cfc 100644 --- a/sources/AppBundle/Accounting/Form/TransactionType.php +++ b/sources/AppBundle/Accounting/Form/TransactionType.php @@ -4,17 +4,21 @@ namespace AppBundle\Accounting\Form; +use AppBundle\Accounting\Entity\Account; +use AppBundle\Accounting\Entity\Category; use AppBundle\Accounting\Entity\Event; +use AppBundle\Accounting\Entity\Operation; +use AppBundle\Accounting\Entity\Payment; use AppBundle\Accounting\Entity\Repository\AccountRepository; use AppBundle\Accounting\Entity\Repository\CategoryRepository; use AppBundle\Accounting\Entity\Repository\EventRepository; use AppBundle\Accounting\Entity\Repository\OperationRepository; use AppBundle\Accounting\Entity\Repository\PaymentRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\Accounting\TvaZone; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\MoneyType; @@ -37,44 +41,52 @@ public function __construct( public function buildForm(FormBuilderInterface $builder, array $options): void { - $builder->add('operationId', ChoiceType::class, [ + $builder->add('operation', EntityType::class, [ 'label' => 'Type d\'opération', - 'choices' => $this->buildOperationTypeChoice(), + 'class' => Operation::class, + 'choices' => $this->operationRepository->findAll(), + 'choice_label' => 'name', 'placeholder' => '', 'constraints' => [ new Assert\NotBlank(message: "Type d'opération manquant"), ], ]) - ->add('accountId', ChoiceType::class, [ + ->add('compte', EntityType::class, [ 'label' => 'Compte', - 'choices' => $this->buildAccountChoice(), + 'class' => Account::class, + 'choices' => $this->accountRepository->getAllSortedByName(), + 'choice_label' => 'name', 'placeholder' => '', 'constraints' => [ new Assert\NotBlank(), ], ]) - ->add('eventId', ChoiceType::class, [ + ->add('evenement', EntityType::class, [ 'label' => 'Évènement', - 'choices' => $this->buildEventChoice(), + 'class' => Event::class, + 'choices' => $this->eventRepository->getAllSortedByName(), + 'choice_label' => 'name', 'placeholder' => '', 'constraints' => [ new Assert\NotBlank(message: "Évènement manquant"), ], ]) - ->add('accountingDate', DateType::class, [ + ->add('dateEcriture', DateType::class, [ 'label' => 'Date saisie', 'widget' => 'single_text', 'required' => false, ]) - ->add('categoryId', ChoiceType::class, [ + ->add('categorie', EntityType::class, [ 'label' => 'categorie', + 'class' => Category::class, 'placeholder' => '', - 'choices' => $this->buildCategoryChoice(), + 'choices' => $this->categoryRepository->getAllSortedByName(), + 'choice_label' => 'name', 'constraints' => [ new Assert\NotBlank(message: "Catégorie manquante"), ], ]) - ->add('vendorName', TextType::class, [ + ->add('nomFournisseur', TextType::class, [ 'label' => 'Nom fournisseurs ', 'required' => false, 'empty_data' => '', @@ -83,7 +95,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'TVA intracommunautaire (facture)', 'required' => false, ]) - ->add('number', TextType::class, [ + ->add('numero', TextType::class, [ 'label' => 'Numero facture', 'required' => false, 'empty_data' => '', @@ -93,7 +105,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'required' => false, 'empty_data' => '', ]) - ->add('amount', MoneyType::class, [ + ->add('montant', MoneyType::class, [ 'label' => 'Montant', 'currency' => '', 'constraints' => [ @@ -101,26 +113,26 @@ public function buildForm(FormBuilderInterface $builder, array $options): void new Assert\NotEqualTo(value: 0, message: "Montant manquant"), ], ]) - ->add('comment', TextType::class, [ + ->add('commentaire', TextType::class, [ 'label' => 'Commentaire', 'required' => false, ]) - ->add('amountTva5_5', MoneyType::class, [ + ->add('montantTva5_5', MoneyType::class, [ 'label' => 'Montant HT soumis à TVA 5.5%', 'required' => false, 'currency' => '', ]) - ->add('amountTva10', MoneyType::class, [ + ->add('montantTva10', MoneyType::class, [ 'label' => 'Montant HT soumis à TVA 10%', 'required' => false, 'currency' => '', ]) - ->add('amountTva20', MoneyType::class, [ + ->add('montantTva20', MoneyType::class, [ 'label' => 'Montant HT soumis à TVA 20%', 'required' => false, 'currency' => '', ]) - ->add('amountTva0', MoneyType::class, [ + ->add('montantTva0', MoneyType::class, [ 'label' => 'Montant HT non soumis à TVA', 'required' => false, 'currency' => '', @@ -134,17 +146,20 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'choice_label' => fn(TvaZone $choice, string $key, mixed $value): string => $choice->getLabel(), ]) - ->add('paymentTypeId', ChoiceType::class, [ + ->add('modeReglement', EntityType::class, [ 'label' => 'Réglement', + 'class' => Payment::class, 'required' => false, - 'choices' => $this->buildPaymentTypeChoice(), + 'placeholder' => '', + 'choices' => $this->paymentRepository->getAllSortedByName(), + 'choice_label' => 'name', ]) - ->add('paymentDate', DateType::class, [ + ->add('dateReglement', DateType::class, [ 'label' => 'Date', 'widget' => 'single_text', 'required' => false, ]) - ->add('paymentComment', TextType::class, [ + ->add('commentaireReglement', TextType::class, [ 'label' => 'Info réglement', 'required' => false, 'empty_data' => '', @@ -171,24 +186,24 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]); } - $builder->get('amount')->resetViewTransformers(); - $builder->get('amount')->addViewTransformer( + $builder->get('montant')->resetViewTransformers(); + $builder->get('montant')->addViewTransformer( new MoneyToLocalizedStringTransformer(2, false, null, null, 'en'), ); - $builder->get('amountTva0')->resetViewTransformers(); - $builder->get('amountTva0')->addViewTransformer( + $builder->get('montantTva0')->resetViewTransformers(); + $builder->get('montantTva0')->addViewTransformer( new MoneyToLocalizedStringTransformer(2, false, null, null, 'en'), ); - $builder->get('amountTva5_5')->resetViewTransformers(); - $builder->get('amountTva5_5')->addViewTransformer( + $builder->get('montantTva5_5')->resetViewTransformers(); + $builder->get('montantTva5_5')->addViewTransformer( new MoneyToLocalizedStringTransformer(2, false, null, null, 'en'), ); - $builder->get('amountTva10')->resetViewTransformers(); - $builder->get('amountTva10')->addViewTransformer( + $builder->get('montantTva10')->resetViewTransformers(); + $builder->get('montantTva10')->addViewTransformer( new MoneyToLocalizedStringTransformer(2, false, null, null, 'en'), ); - $builder->get('amountTva20')->resetViewTransformers(); - $builder->get('amountTva20')->addViewTransformer( + $builder->get('montantTva20')->resetViewTransformers(); + $builder->get('montantTva20')->addViewTransformer( new MoneyToLocalizedStringTransformer(2, false, null, null, 'en'), ); } @@ -204,56 +219,4 @@ public function configureOptions(OptionsResolver $resolver): void 'nextTransaction' => null, ]); } - - private function buildOperationTypeChoice(): array - { - $choices = []; - foreach ($this->operationRepository->findAll() as $operation) { - $choices[$operation->name] = $operation->id; - } - - return $choices; - } - - private function buildAccountChoice(): array - { - $choices = []; - foreach ($this->accountRepository->getAllSortedByName() as $account) { - $choices[$account->name] = $account->id; - } - - return $choices; - } - - private function buildEventChoice(): array - { - $choices = []; - /** @var Event $event */ - foreach ($this->eventRepository->getAllSortedByName() as $event) { - $choices[$event->name] = $event->id; - } - - return $choices; - } - - private function buildCategoryChoice(): array - { - $choices = []; - foreach ($this->categoryRepository->getAllSortedByName() as $category) { - $choices[$category->name] = $category->id; - } - - return $choices; - } - - private function buildPaymentTypeChoice(): array - { - $choices = []; - $choices[''] = 0; - foreach ($this->paymentRepository->getAllSortedByName() as $paymentType) { - $choices[$paymentType->name] = $paymentType->id; - } - - return $choices; - } } diff --git a/sources/AppBundle/Accounting/Model/InvoicingPeriod.php b/sources/AppBundle/Accounting/Model/InvoicingPeriod.php deleted file mode 100644 index 35bb300a4..000000000 --- a/sources/AppBundle/Accounting/Model/InvoicingPeriod.php +++ /dev/null @@ -1,72 +0,0 @@ -id; - } - - public function setId(?int $id): self - { - $this->id = $id; - $this->propertyChanged('id', $this->id, $id); - - return $this; - } - - public function getStartDate(): ?DateTime - { - return $this->startDate; - } - - public function setStartDate(?DateTime $startDate): self - { - $this->startDate = $startDate; - $this->propertyChanged('startdate', $this->startDate, $startDate); - - return $this; - } - - public function getEndDate(): ?DateTime - { - return $this->endDate; - } - - public function setEndDate(?DateTime $endDate): self - { - $this->endDate = $endDate; - $this->propertyChanged('endDate', $this->endDate, $endDate); - - return $this; - } - - public function getLocked(): ?bool - { - return $this->locked; - } - - public function setLocked(?bool $locked): self - { - $this->locked = $locked; - $this->propertyChanged('locked', $this->locked, $locked); - - return $this; - } -} diff --git a/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php b/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php deleted file mode 100644 index f88f12664..000000000 --- a/sources/AppBundle/Accounting/Model/Repository/InvoicingPeriodRepository.php +++ /dev/null @@ -1,94 +0,0 @@ - - */ -class InvoicingPeriodRepository extends Repository implements MetadataInitializer -{ - public function getCurrentPeriod(?int $periodId = null): InvoicingPeriod - { - if ($periodId !== null) { - return $this->get($periodId); - } - - $startDate = new DateTime(date("Y") . "-01-01"); - $endDate = new DateTime(date("Y") . "-12-31"); - $period = $this->getOneBy([ - 'startDate' => $startDate->format('Y-m-d'), - 'endDate' => $endDate->format('Y-m-d'), - ]); - - if (!$period instanceof InvoicingPeriod) { - $period = new InvoicingPeriod(); - $period->setStartDate($startDate); - $period->setEndDate($endDate); - $this->save($period); - $period = $this->getOneBy([ - 'startDate' => $startDate->format('Y-m-d'), - 'endDate' => $endDate->format('Y-m-d'), - ]); - } - - return $period; - } - - public static function initMetadata(SerializerFactoryInterface $serializerFactory, array $options = []) - { - $metadata = new Metadata($serializerFactory); - - $metadata->setEntity(InvoicingPeriod::class); - $metadata->setConnectionName('main'); - $metadata->setDatabase($options['database']); - $metadata->setTable('compta_periode'); - - $metadata - ->addField([ - 'columnName' => 'id', - 'fieldName' => 'id', - 'primary' => true, - 'autoincrement' => true, - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'date_debut', - 'fieldName' => 'startDate', - 'type' => 'datetime', - 'serializer' => \CCMBenchmark\Ting\Serializer\DateTime::class, - 'serializer_options' => [ - 'serialize' => ['format' => 'Y-m-d'], - 'unserialize' => ['format' => 'Y-m-d', 'unSerializeUseFormat' => true], - ], - ]) - ->addField([ - 'columnName' => 'date_fin', - 'fieldName' => 'endDate', - 'type' => 'datetime', - 'serializer' => \CCMBenchmark\Ting\Serializer\DateTime::class, - 'serializer_options' => [ - 'serialize' => ['format' => 'Y-m-d'], - 'unserialize' => ['format' => 'Y-m-d', 'unSerializeUseFormat' => true], - ], - ]) - ->addField([ - 'columnName' => 'verouiller', - 'fieldName' => 'locked', - 'type' => 'bool', - 'serializer' => Boolean::class, - ]) - ; - - return $metadata; - } -} diff --git a/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php b/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php deleted file mode 100644 index 799be5219..000000000 --- a/sources/AppBundle/Accounting/Model/Repository/TransactionRepository.php +++ /dev/null @@ -1,244 +0,0 @@ - - */ -class TransactionRepository extends Repository implements MetadataInitializer -{ - public function getNextTransaction(int $transactionId): ?Transaction - { - $query = $this->getQuery('SELECT * FROM compta WHERE (idcategorie = :undeterminedCategoryId OR idevenement = :undeterminedEventId) AND id > :transactionId ORDER BY id ASC LIMIT 1'); - $query->setParams(['transactionId' => $transactionId, 'undeterminedCategoryId' => AutoQualifier::DEFAULT_CATEGORIE, 'undeterminedEventId' => AutoQualifier::DEFAULT_EVENEMENT]); - $collection = $query->query($this->getCollection(new HydratorSingleObject())); - if ($collection->count() > 0) { - return $collection->first(); - } - - return null; - } - - public function getEntriesPerInvoicingPeriod(InvoicingPeriod $period, bool $onlyUnclasifedEntries, int $operationType = 0) - { - - $filtre = $operationType === 1 || $operationType === 2 ? 'AND compta.idoperation =\'' . $operationType . '\' ' : ""; - - $requete = 'SELECT '; - $requete .= 'compta.date_ecriture, compta.description, compta.montant, compta.idoperation,compta.id as idtmp, '; - $requete .= 'compta.comment, compta.attachment_required, compta.attachment_filename, '; - $requete .= 'compta_reglement.reglement, '; - $requete .= 'compta_evenement.evenement, '; - $requete .= 'compta_categorie.categorie, '; - $requete .= 'compta_compte.nom_compte, '; - $requete .= '(COALESCE(compta.montant_ht_soumis_tva_0,0) + COALESCE(compta.montant_ht_soumis_tva_5_5,0) + COALESCE(compta.montant_ht_soumis_tva_10, 0) + COALESCE(compta.montant_ht_soumis_tva_20, 0)) as montant_ht, '; - $requete .= '((COALESCE(compta.montant_ht_soumis_tva_5_5, 0)*0.055) + (COALESCE(compta.montant_ht_soumis_tva_10, 0)*0.1) + (COALESCE(compta.montant_ht_soumis_tva_20, 0)*0.2)) as montant_tva, '; - $requete .= 'compta.montant_ht_soumis_tva_0 as montant_ht_0, '; - $requete .= 'compta.montant_ht_soumis_tva_5_5 as montant_ht_5_5, '; - $requete .= 'compta.montant_ht_soumis_tva_5_5*0.055 as montant_tva_5_5, '; - $requete .= 'compta.montant_ht_soumis_tva_10 as montant_ht_10, '; - $requete .= 'compta.montant_ht_soumis_tva_10*0.1 as montant_tva_10, '; - $requete .= 'compta.montant_ht_soumis_tva_20 as montant_ht_20, '; - $requete .= 'compta.montant_ht_soumis_tva_20*0.2 as montant_tva_20, '; - $requete .= 'compta.tva_zone '; - $requete .= 'FROM '; - $requete .= 'compta '; - $requete .= 'LEFT JOIN '; - $requete .= 'compta_categorie on compta_categorie.id=compta.idcategorie '; - $requete .= 'LEFT JOIN '; - $requete .= 'compta_reglement on compta_reglement.id=compta.idmode_regl '; - $requete .= 'LEFT JOIN '; - $requete .= 'compta_evenement on compta_evenement.id=compta.idevenement '; - $requete .= 'LEFT JOIN '; - $requete .= 'compta_compte on compta_compte.id=compta.idcompte '; - $requete .= 'WHERE '; - $requete .= ' compta.date_ecriture >= \'' . $period->getStartDate()->format('Y-m-d') . '\' '; - $requete .= 'AND compta.date_ecriture <= \'' . $period->getEndDate()->format('Y-m-d') . '\' '; - $requete .= $filtre; - if (true === $onlyUnclasifedEntries) { - $requete .= ' AND ( - compta_evenement.evenement = "A déterminer" - OR - compta_categorie.categorie = "A déterminer" - OR - compta_reglement.reglement = "A déterminer" - OR - (compta.attachment_required = 1 AND compta.attachment_filename IS NULL) - ) '; - } - $requete .= 'ORDER BY '; - $requete .= 'compta.date_ecriture, numero_operation'; - - $query = $this->getQuery($requete); - - return $query->query($this->getCollection(new HydratorArray())); - } - - public static function initMetadata(SerializerFactoryInterface $serializerFactory, array $options = []) - { - $metadata = new Metadata($serializerFactory); - - $metadata->setEntity(Transaction::class); - $metadata->setConnectionName('main'); - $metadata->setDatabase($options['database']); - $metadata->setTable('compta'); - - $metadata - ->addField([ - 'columnName' => 'id', - 'fieldName' => 'id', - 'primary' => true, - 'autoincrement' => true, - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'idclef', - 'fieldName' => 'idKey', - 'type' => 'string', - ]) - - ->addField([ - 'columnName' => 'idoperation', - 'fieldName' => 'operationId', - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'idcategorie', - 'fieldName' => 'categoryId', - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'date_ecriture', - 'fieldName' => 'accountingDate', - 'type' => 'date', - 'serializer' => DateTime::class, - 'serializer_options' => [ - 'serialize' => ['format' => 'Y-m-d'], - 'unserialize' => ['format' => 'Y-m-d', 'unSerializeUseFormat' => true], - ], - ]) - ->addField([ - 'columnName' => 'numero_operation', - 'fieldName' => 'operationNumber', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'nom_frs', - 'fieldName' => 'vendorName', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'tva_intra', - 'fieldName' => 'tvaIntra', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'tva_zone', - 'fieldName' => 'tvaZone', - 'type' => 'enum', - 'serializer' => BackedEnum::class, - 'serializer_options' => [ - 'unserialize' => ['enum' => TvaZone::class], - ], - ]) - ->addField([ - 'columnName' => 'montant', - 'fieldName' => 'amount', - 'type' => 'float', - ]) - ->addField([ - 'columnName' => 'description', - 'fieldName' => 'description', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'comment', - 'fieldName' => 'comment', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'attachment_required', - 'fieldName' => 'attachmentRequired', - 'type' => 'booleab', - 'default' => false, - ]) - ->addField([ - 'columnName' => 'attachment_filename', - 'fieldName' => 'attachmentFilename', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'numero', - 'fieldName' => 'number', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'idmode_regl', - 'fieldName' => 'paymentTypeId', - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'date_regl', - 'fieldName' => 'paymentDate', - 'type' => 'date', - 'serializer' => DateTime::class, - 'serializer_options' => [ - 'serialize' => ['format' => 'Y-m-d'], - 'unserialize' => ['format' => 'Y-m-d', 'unSerializeUseFormat' => true], - ], - ]) - ->addField([ - 'columnName' => 'obs_regl', - 'fieldName' => 'paymentComment', - 'type' => 'string', - ]) - ->addField([ - 'columnName' => 'idevenement', - 'fieldName' => 'eventId', - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'idcompte', - 'fieldName' => 'accountId', - 'type' => 'int', - ]) - ->addField([ - 'columnName' => 'montant_ht_soumis_tva_20', - 'fieldName' => 'amountTva20', - 'type' => 'flaot', - ]) - ->addField([ - 'columnName' => 'montant_ht_soumis_tva_10', - 'fieldName' => 'amountTva10', - 'type' => 'flaot', - ]) - ->addField([ - 'columnName' => 'montant_ht_soumis_tva_5_5', - 'fieldName' => 'amountTva5_5', - 'type' => 'flaot', - ]) - ->addField([ - 'columnName' => 'montant_ht_soumis_tva_0', - 'fieldName' => 'amountTva0', - 'type' => 'flaot', - ]) - ; - - return $metadata; - } -} diff --git a/sources/AppBundle/Accounting/Model/Transaction.php b/sources/AppBundle/Accounting/Model/Transaction.php deleted file mode 100644 index 979923049..000000000 --- a/sources/AppBundle/Accounting/Model/Transaction.php +++ /dev/null @@ -1,357 +0,0 @@ -accountingDate = new DateTime(); - $this->paymentDate = new DateTime(); - } - - public function getId(): ?int - { - return $this->id; - } - - public function setId(int $id): self - { - $this->propertyChanged('id', $this->id, $id); - $this->id = $id; - return $this; - } - - public function getIdKey(): ?string - { - return $this->idKey; - } - - public function setIdKey(?string $idKey): self - { - $this->propertyChanged('name', $this->idKey, $idKey); - $this->idKey = $idKey; - - return $this; - } - - public function getOperationId(): ?int - { - return $this->operationId; - } - - public function setOperationId(?int $operationId): self - { - $this->propertyChanged('operationId', $this->operationId, $operationId); - $this->operationId = $operationId; - - return $this; - } - - public function getCategoryId(): ?int - { - return $this->categoryId; - } - - public function setCategoryId(?int $categoryId): self - { - $this->propertyChanged('categoryId', $this->categoryId, $categoryId); - $this->categoryId = $categoryId; - - return $this; - } - - public function getAccountingDate(): ?DateTime - { - return $this->accountingDate; - } - - public function setAccountingDate(?DateTime $accountingDate): self - { - $this->propertyChanged('accountingDate', $this->accountingDate, $accountingDate); - $this->accountingDate = $accountingDate; - - return $this; - } - - public function getOperationNumber(): ?string - { - return $this->operationNumber; - } - - public function setOperationNumber(?string $operationNumber): self - { - $this->propertyChanged('operationNumber', $this->operationNumber, $operationNumber); - $this->operationNumber = $operationNumber; - - return $this; - } - - public function getVendorName(): string - { - return $this->vendorName; - } - - public function setVendorName(string $vendorName): self - { - $this->propertyChanged('vendorName', $this->vendorName, $vendorName); - $this->vendorName = $vendorName; - - return $this; - } - - public function getTvaIntra(): ?string - { - return $this->tvaIntra; - } - - public function setTvaIntra(?string $tvaIntra): self - { - $this->propertyChanged('tvaIntra', $this->tvaIntra, $tvaIntra); - $this->tvaIntra = $tvaIntra; - - return $this; - } - - public function getTvaZone(): ?TvaZone - { - return $this->tvaZone; - } - - public function setTvaZone(?TvaZone $tvaZone): self - { - $this->propertyChanged('tvaZone', $this->tvaZone, $tvaZone); - $this->tvaZone = $tvaZone; - - return $this; - } - - public function getAmount(): float - { - return $this->amount; - } - - public function setAmount(float $amount): self - { - $this->propertyChanged('amount', $this->amount, $amount); - $this->amount = $amount; - - return $this; - } - - public function getDescription(): string - { - return $this->description; - } - - public function setDescription(string $description): self - { - $this->propertyChanged('description', $this->description, $description); - $this->description = $description; - - return $this; - } - - public function getComment(): ?string - { - return $this->comment; - } - - public function setComment(?string $comment): self - { - $this->propertyChanged('comment', $this->comment, $comment); - $this->comment = $comment; - - return $this; - } - - public function isAttachmentRequired(): bool - { - return $this->attachmentRequired; - } - - public function setAttachmentRequired(bool $attachmentRequired): self - { - $this->propertyChanged('attachmentRequired', $this->attachmentRequired, $attachmentRequired); - $this->attachmentRequired = $attachmentRequired; - - return $this; - } - - public function getAttachmentFilename(): ?string - { - return $this->attachmentFilename; - } - - public function setAttachmentFilename(?string $attachmentFilename): self - { - $this->propertyChanged('attachmentFilename', $this->attachmentFilename, $attachmentFilename); - $this->attachmentFilename = $attachmentFilename; - - return $this; - } - - public function getNumber(): string - { - return $this->number; - } - - public function setNumber(string $number): self - { - $this->propertyChanged('number', $this->number, $number); - $this->number = $number; - - return $this; - } - - public function getPaymentTypeId(): ?int - { - return $this->paymentTypeId; - } - - public function setPaymentTypeId(?int $paymentTypeId): self - { - $this->propertyChanged('paymentTypeId', $this->paymentTypeId, $paymentTypeId); - $this->paymentTypeId = $paymentTypeId; - - return $this; - } - - public function getPaymentDate(): ?DateTime - { - return $this->paymentDate; - } - - public function setPaymentDate(?DateTime $paymentDate): self - { - $this->propertyChanged('paymentDate', $this->paymentDate, $paymentDate); - $this->paymentDate = $paymentDate; - - return $this; - } - - public function getPaymentComment(): ?string - { - return $this->paymentComment; - } - - public function setPaymentComment(?string $paymentComment): self - { - $this->propertyChanged('paymentComment', $this->paymentComment, $paymentComment); - $this->paymentComment = $paymentComment; - - return $this; - } - - public function getEventId(): ?int - { - return $this->eventId; - } - - public function setEventId(?int $eventId): self - { - $this->propertyChanged('eventId', $this->eventId, $eventId); - $this->eventId = $eventId; - - return $this; - } - - public function getAccountId(): ?int - { - return $this->accountId; - } - - public function setAccountId(?int $accountId): self - { - $this->propertyChanged('accountId', $this->accountId, $accountId); - $this->accountId = $accountId; - - return $this; - } - - public function getAmountTva20(): ?float - { - return $this->amountTva20; - } - - public function setAmountTva20(?float $amountTva20): self - { - $this->propertyChanged('amountTva20', $this->amountTva20, $amountTva20); - $this->amountTva20 = $amountTva20; - - return $this; - } - - public function getAmountTva10(): ?float - { - return $this->amountTva10; - } - - public function setAmountTva10(?float $amountTva10): self - { - $this->propertyChanged('amountTva10', $this->amountTva10, $amountTva10); - $this->amountTva10 = $amountTva10; - - return $this; - } - - public function getAmountTva55(): ?float - { - return $this->amountTva5_5; - } - - public function setAmountTva55(?float $amountTva5_5): self - { - $this->propertyChanged('amountTva5_5', $this->amountTva5_5, $amountTva5_5); - $this->amountTva5_5 = $amountTva5_5; - - return $this; - } - - public function getAmountTva0(): ?float - { - return $this->amountTva0; - } - - public function setAmountTva0(?float $amountTva0): self - { - $this->propertyChanged('amountTva0', $this->amountTva0, $amountTva0); - $this->amountTva0 = $amountTva0; - - return $this; - } -} diff --git a/sources/AppBundle/Accounting/TransactionModification.php b/sources/AppBundle/Accounting/TransactionModification.php index f2fc252b9..00201b803 100644 --- a/sources/AppBundle/Accounting/TransactionModification.php +++ b/sources/AppBundle/Accounting/TransactionModification.php @@ -4,7 +4,10 @@ namespace AppBundle\Accounting; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\CategoryRepository; +use AppBundle\Accounting\Entity\Repository\EventRepository; +use AppBundle\Accounting\Entity\Repository\PaymentRepository; +use AppBundle\Accounting\Entity\Transaction; enum TransactionModification: string { @@ -14,14 +17,20 @@ enum TransactionModification: string case Comment = 'comment'; case RequiredAttachment = 'requiredAttachment'; - public function setValue(Transaction $transaction, mixed $value): void - { + public function setValue( + Transaction $transaction, + mixed $value, + CategoryRepository $categoryRepository, + PaymentRepository $paymentRepository, + EventRepository $eventRepository, + ): void { match ($this) { - self::Category => $transaction->setCategoryId((int) $value), - self::PaymentType => $transaction->setPaymentTypeId((int) $value), - self::Event => $transaction->setEventId((int) $value), - self::Comment => $transaction->setComment($value), - self::RequiredAttachment => $transaction->setAttachmentRequired((bool) $value), + self::Category => $transaction->categorie = $categoryRepository->find((int) $value) + ?? throw new \InvalidArgumentException('Catégorie introuvable'), + self::PaymentType => $transaction->modeReglement = $paymentRepository->find((int) $value), + self::Event => $transaction->evenement = $eventRepository->find((int) $value), + self::Comment => $transaction->commentaire = $value, + self::RequiredAttachment => $transaction->justificatifRequis = (bool) $value, }; } diff --git a/sources/AppBundle/Compta/CsvExtractor.php b/sources/AppBundle/Compta/CsvExtractor.php index 9c5a7187a..106cfb4cc 100644 --- a/sources/AppBundle/Compta/CsvExtractor.php +++ b/sources/AppBundle/Compta/CsvExtractor.php @@ -4,9 +4,14 @@ namespace AppBundle\Compta; +use AppBundle\Accounting\Entity\Repository\AccountRepository; +use AppBundle\Accounting\Entity\Repository\CategoryRepository; +use AppBundle\Accounting\Entity\Repository\EventRepository; +use AppBundle\Accounting\Entity\Repository\OperationRepository; +use AppBundle\Accounting\Entity\Repository\PaymentRepository; use AppBundle\Accounting\Entity\Repository\RuleRepository; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\Compta\Importer\AutoQualifier; use AppBundle\Compta\Importer\Importer; @@ -15,6 +20,11 @@ class CsvExtractor public function __construct( private readonly RuleRepository $ruleRepository, private readonly TransactionRepository $transactionRepository, + private readonly OperationRepository $operationRepository, + private readonly AccountRepository $accountRepository, + private readonly CategoryRepository $categoryRepository, + private readonly PaymentRepository $paymentRepository, + private readonly EventRepository $eventRepository, ) {} public function extract(Importer $importer): bool @@ -29,43 +39,48 @@ public function extract(Importer $importer): bool foreach ($importer->extract() as $operation) { $numero_operation = $operation->numeroOperation; // On vérife si l'enregistrement existe déjà - $enregistrement = $this->transactionRepository->getOneBy(['operationNumber' => $numero_operation]); + $enregistrement = $this->transactionRepository->findOneBy(['numeroOperation' => $numero_operation]); $operationQualified = $qualifier->qualify($operation); if (!$enregistrement instanceof Transaction) { $transaction = new Transaction(); - $transaction->setOperationId($operationQualified['idoperation']) - ->setAccountId($importer->getCompteId()) - ->setCategoryId($operationQualified['categorie']) - ->setAccountingDate(new \DateTime($operationQualified['date_ecriture'])) - ->setVendorName('') - ->setTvaIntra('') - ->setAmount($operationQualified['montant']) - ->setDescription($operationQualified['description']) - ->setNumber('') - ->setPaymentTypeId($operationQualified['idModeReglement']) - ->setPaymentComment('') - ->setEventId($operationQualified['evenement']) - ->setOperationNumber($numero_operation) - ->setAttachmentRequired($operationQualified['attachmentRequired']) - ->setAmountTva0($operationQualified['montant_ht_soumis_tva_0']) - ->setAmountTva55($operationQualified['montant_ht_soumis_tva_5_5']) - ->setAmountTva10($operationQualified['montant_ht_soumis_tva_10']) - ->setAmountTva20($operationQualified['montant_ht_soumis_tva_20']); + $transaction->operation = $this->operationRepository->find($operationQualified['idoperation']) + ?? throw new \RuntimeException(sprintf("Type d'opération introuvable pour l'opération %s", $numero_operation)); + $transaction->compte = $this->accountRepository->find($importer->getCompteId()) + ?? throw new \RuntimeException(sprintf('Compte %d introuvable', $importer->getCompteId())); + $transaction->categorie = $this->categoryRepository->find($operationQualified['categorie']) + ?? throw new \RuntimeException(sprintf("Catégorie introuvable pour l'opération %s", $numero_operation)); + $transaction->dateEcriture = new \DateTime($operationQualified['date_ecriture']); + $transaction->nomFournisseur = ''; + $transaction->tvaIntra = ''; + $transaction->montant = $operationQualified['montant']; + $transaction->description = $operationQualified['description']; + $transaction->numero = ''; + $transaction->modeReglement = $this->paymentRepository->find($operationQualified['idModeReglement']); + $transaction->commentaireReglement = ''; + $transaction->evenement = $this->eventRepository->find($operationQualified['evenement']); + $transaction->numeroOperation = $numero_operation; + $transaction->justificatifRequis = $operationQualified['attachmentRequired']; + $transaction->montantTva0 = $operationQualified['montant_ht_soumis_tva_0']; + $transaction->montantTva5_5 = $operationQualified['montant_ht_soumis_tva_5_5']; + $transaction->montantTva10 = $operationQualified['montant_ht_soumis_tva_10']; + $transaction->montantTva20 = $operationQualified['montant_ht_soumis_tva_20']; $this->transactionRepository->save($transaction); } else { $modifier = false; - if ($enregistrement->getCategoryId() == AutoQualifier::DEFAULT_CATEGORIE && $operationQualified['categorie'] != AutoQualifier::DEFAULT_CATEGORIE) { - $enregistrement->setCategoryId($operationQualified['categorie']); + if ($enregistrement->categorie->id === AutoQualifier::DEFAULT_CATEGORIE && $operationQualified['categorie'] != AutoQualifier::DEFAULT_CATEGORIE) { + $enregistrement->categorie = $this->categoryRepository->find($operationQualified['categorie']) + ?? throw new \RuntimeException(sprintf("Catégorie introuvable pour l'opération %s", $numero_operation)); $modifier = true; } - if ($enregistrement->getEventId() == AutoQualifier::DEFAULT_EVENEMENT && $operationQualified['evenement'] != AutoQualifier::DEFAULT_EVENEMENT) { - $enregistrement->setEventId($operationQualified['evenement']); + if ($enregistrement->evenement?->id === AutoQualifier::DEFAULT_EVENEMENT && $operationQualified['evenement'] != AutoQualifier::DEFAULT_EVENEMENT) { + $enregistrement->evenement = $this->eventRepository->find($operationQualified['evenement']); $modifier = true; } if ($modifier) { - $enregistrement->setAccountId($importer->getCompteId()) - ->setAttachmentRequired($operationQualified['attachmentRequired']); + $enregistrement->compte = $this->accountRepository->find($importer->getCompteId()) + ?? throw new \RuntimeException(sprintf('Compte %d introuvable', $importer->getCompteId())); + $enregistrement->justificatifRequis = $operationQualified['attachmentRequired']; $this->transactionRepository->save($enregistrement); } } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Invoice/ListInvoiceAction.php b/sources/AppBundle/Controller/Admin/Accounting/Invoice/ListInvoiceAction.php index 484557269..0559731d6 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Invoice/ListInvoiceAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Invoice/ListInvoiceAction.php @@ -5,11 +5,11 @@ namespace AppBundle\Controller\Admin\Accounting\Invoice; use Afup\Site\Utils\Vat; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; use AppBundle\Accounting\Form\InvoicingPeriodType; use AppBundle\Accounting\InvoicingPaymentStatus; use AppBundle\Accounting\Model\Invoicing; use AppBundle\Accounting\Model\Repository\InvoicingRepository; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -31,8 +31,8 @@ public function __invoke(Request $request): Response $direction = $request->query->get('direction', 'desc'); $sort = $request->query->get('sort', 'date'); - $invoices = $this->invoiceRepository->getInvoicesByPeriodId($period->getId(), $sort, $direction); - $periods = $this->invoicingPeriodRepository->getAll(); + $invoices = $this->invoiceRepository->getInvoicesByPeriodId($period->id, $sort, $direction); + $periods = $this->invoicingPeriodRepository->findAll(); $totalHt = 0; @@ -48,12 +48,12 @@ public function __invoke(Request $request): Response return new Response($this->twig->render('admin/accounting/invoice/list.html.twig', [ 'lines' => $invoices, 'periods' => $periods, - 'periodId' => $period->getId(), + 'periodId' => $period->id, 'formPeriod' => $formPeriod->createView(), 'direction' => $direction, 'sort' => $sort, 'totalHt' => $totalHt, - 'isSubjectedToVat' => Vat::isSubjectedToVat($period->getEndDate()), + 'isSubjectedToVat' => Vat::isSubjectedToVat($period->dateFin), ])); } } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/AddTransactionAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/AddTransactionAction.php index 1953a7a18..163618caa 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/AddTransactionAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/AddTransactionAction.php @@ -4,9 +4,10 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; +use AppBundle\Accounting\Entity\Repository\AccountRepository; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\Accounting\Form\TransactionType; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; use AppBundle\AuditLog\Audit; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -16,20 +17,22 @@ class AddTransactionAction extends AbstractController { public function __construct( private readonly TransactionRepository $transactionRepository, + private readonly AccountRepository $accountRepository, private readonly Audit $audit, ) {} public function __invoke(Request $request): Response { $transaction = new Transaction(); - $transaction->setAccountId(1); // Compte courant + $transaction->compte = $this->accountRepository->find(1) // Compte courant + ?? throw new \RuntimeException('Compte courant introuvable'); $form = $this->createForm(TransactionType::class, $transaction); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->transactionRepository->save($transaction); $this->audit->log("Ajout d'une écriture"); $this->addFlash('notice', "L'écriture a été ajoutée"); - return $this->redirect('/admin/accounting/journal/list#L' . $transaction->getId()); + return $this->redirect('/admin/accounting/journal/list#L' . $transaction->id); } 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 2c3710545..c7d1d178d 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/AllocateAction.php @@ -4,48 +4,62 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\CategoryRepository; +use AppBundle\Accounting\Entity\Repository\EventRepository; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; +use AppBundle\Compta\Importer\AutoQualifier; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; class AllocateAction extends AbstractController { - public function __construct(private readonly TransactionRepository $transactionRepository) {} + public function __construct( + private readonly TransactionRepository $transactionRepository, + private readonly CategoryRepository $categoryRepository, + private readonly EventRepository $eventRepository, + ) {} public function __invoke(Request $request, int $id): RedirectResponse { - $transaction = $this->transactionRepository->get($id); + $transaction = $this->transactionRepository->find($id); + if (!$transaction instanceof Transaction) { + throw $this->createNotFoundException(); + } + $amountToallocate = $request->query->get('amount'); $totalAmount = 0; + $undeterminedCategory = $this->categoryRepository->find(AutoQualifier::DEFAULT_CATEGORIE) + ?? throw new \RuntimeException('Catégorie « à déterminer » introuvable'); + $undeterminedEvent = $this->eventRepository->find(AutoQualifier::DEFAULT_EVENEMENT); + $lastId = null; foreach (explode(';', (string) $amountToallocate) as $amount) { $amount = (float) $amount; $newTransaction = new Transaction(); - $newTransaction->setOperationId($transaction->getOperationId()) - ->setAccountId($transaction->getAccountId()) - ->setCategoryId(26) // A déterminer - ->setAmount($amount) - ->setAccountingDate($transaction->getAccountingDate()) - ->setVendorName($transaction->getVendorName()) - ->setTvaIntra($transaction->getTvaIntra()) - ->setAmount($amount) - ->setDescription($transaction->getDescription()) - ->setNumber($transaction->getNumber()) - ->setPaymentTypeId($transaction->getPaymentTypeId()) - ->setPaymentDate($transaction->getPaymentDate()) - ->setComment($transaction->getComment()) - ->setEventId(8) // A déterminer - ->setOperationNumber($transaction->getOperationNumber()); + $newTransaction->operation = $transaction->operation; + $newTransaction->compte = $transaction->compte; + $newTransaction->categorie = $undeterminedCategory; + $newTransaction->montant = $amount; + $newTransaction->dateEcriture = $transaction->dateEcriture; + $newTransaction->nomFournisseur = $transaction->nomFournisseur; + $newTransaction->tvaIntra = $transaction->tvaIntra; + $newTransaction->description = $transaction->description; + $newTransaction->numero = $transaction->numero; + $newTransaction->modeReglement = $transaction->modeReglement; + $newTransaction->dateReglement = $transaction->dateReglement; + $newTransaction->commentaire = $transaction->commentaire; + $newTransaction->evenement = $undeterminedEvent; + $newTransaction->numeroOperation = $transaction->numeroOperation; $this->transactionRepository->save($newTransaction); - $lastId = $newTransaction->getId(); + $lastId = $newTransaction->id; $totalAmount += $amount; } - $transaction->setAmount($transaction->getAmount() - $totalAmount); + $transaction->montant -= $totalAmount; $this->transactionRepository->save($transaction); $this->addFlash('notice', "L'écriture a été ventilée"); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php index 65ab0014a..2c5eac9e3 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/DeleteAction.php @@ -4,8 +4,8 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\AuditLog\Audit; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -20,7 +20,7 @@ public function __construct( public function __invoke(Request $request, int $id): Response { - $accounting = $this->transactionRepository->get($id); + $accounting = $this->transactionRepository->find($id); if (!$accounting instanceof Transaction) { $this->addFlash('error', "Une erreur est survenue lors de la suppression de l'écriture"); return $this->redirectToRoute('admin_accounting_journal_list'); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentAction.php index 338aa0d4b..4938d3e79 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentAction.php @@ -4,8 +4,8 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Transaction; -use AppBundle\Accounting\Model\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\BinaryFileResponse; @@ -22,13 +22,13 @@ public function __construct( public function __invoke(Request $request, int $id): Response { - $accounting = $this->accountingRepository->get($id); + $accounting = $this->accountingRepository->find($id); if (!$accounting instanceof Transaction) { throw $this->createNotFoundException(); } - $path = $this->uploadDir . $accounting->getAttachmentFilename(); - if ($accounting->getAttachmentFilename() === null || !is_file($path)) { + $path = $this->uploadDir . $accounting->nomJustificatif; + if ($accounting->nomJustificatif === null || !is_file($path)) { throw $this->createNotFoundException('No attachment found'); } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentsAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentsAction.php index 39175dc84..5f579488b 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentsAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/DownloadAttachmentsAction.php @@ -4,7 +4,7 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; use DateInterval; use DatePeriod; use RuntimeException; @@ -26,7 +26,7 @@ public function __invoke(Request $request): Response { $periodId = $request->query->has('periodId') && $request->query->get('periodId') ? (int) $request->query->get('periodId') : null; $period = $this->invoicingPeriodRepository->getCurrentPeriod($periodId); - $year = $period->getStartDate()->format('Y'); + $year = $period->dateDebut->format('Y'); // Create the zip $zipFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'afup_justificatifs-' . $year . '.zip'; @@ -36,7 +36,7 @@ public function __invoke(Request $request): Response throw new RuntimeException("Impossible to open the Zip archive."); } - $datePeriod = new DatePeriod($period->getStartDate(), new DateInterval('P1M'), $period->getEndDate()); + $datePeriod = new DatePeriod($period->dateDebut, new DateInterval('P1M'), $period->dateFin); /** @var \DateTime $month */ foreach ($datePeriod as $month) { $directory = $year . $month->format('m'); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php index fe3c04a33..52eb50b56 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/EditTransactionAction.php @@ -4,9 +4,9 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\Accounting\Form\TransactionType; -use AppBundle\Accounting\Model\Repository\TransactionRepository; use AppBundle\AuditLog\Audit; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\SubmitButton; @@ -23,11 +23,11 @@ public function __construct( public function __invoke(Request $request, int $id): Response { - $transaction = $this->transactionRepository->get($id); + $transaction = $this->transactionRepository->find($id); if (!$transaction instanceof Transaction) { throw new NotFoundHttpException(); } - $nextTransaction = $this->transactionRepository->getNextTransaction($transaction->getId()); + $nextTransaction = $this->transactionRepository->getNextTransaction($transaction->id); $form = $this->createForm(TransactionType::class, $transaction, ['operation' => 'edit', 'nextTransaction' => $nextTransaction]); @@ -36,18 +36,18 @@ public function __invoke(Request $request, int $id): Response $passButton = $form->has('pass') ? $form->get('pass') : null; if ($passButton instanceof SubmitButton && $passButton->isClicked()) { $this->addFlash('notice', 'L\'écriture n\'a pas été modifiée'); - return $this->redirectToRoute('admin_accounting_journal_edit', ['id' => $nextTransaction->getId()]); + return $this->redirectToRoute('admin_accounting_journal_edit', ['id' => $nextTransaction->id]); } $this->transactionRepository->save($transaction); - $this->audit->log("Modification d'une écriture ({$transaction->getId()})"); + $this->audit->log("Modification d'une écriture ({$transaction->id})"); $this->addFlash('notice', 'L\'écriture a été modifiée'); $submitAndPassButton = $form->has('submitAndPass') ? $form->get('submitAndPass') : null; if ($submitAndPassButton instanceof SubmitButton && $submitAndPassButton->isClicked()) { - return $this->redirectToRoute('admin_accounting_journal_edit', ['id' => $nextTransaction->getId()]); + return $this->redirectToRoute('admin_accounting_journal_edit', ['id' => $nextTransaction->id]); } else { - return $this->redirect('/admin/accounting/journal/list#L' . $transaction->getId()); + return $this->redirect('/admin/accounting/journal/list#L' . $transaction->id); } } return $this->render('admin/accounting/journal/edit.html.twig', [ diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php index ca2729052..1f53e6f08 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/ExportAction.php @@ -4,8 +4,8 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; use AppBundle\Accounting\TvaZone; use SplFileObject; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -33,8 +33,8 @@ public function __invoke(Request $request): Response $csvFilename = sprintf( 'AFUP_%s_journal_from-%s_to-%s.csv', date('Y-M-d'), - $period->getStartDate()->format('Y-m-d'), - $period->getEndDate()->format('Y-m-d'), + $period->dateDebut->format('Y-m-d'), + $period->dateFin->format('Y-m-d'), ); $tmpFile = tempnam(sys_get_temp_dir(), $csvFilename); $file = new SplFileObject($tmpFile, 'w'); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php index 2a7810baa..1a67ef05f 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php @@ -6,10 +6,10 @@ use AppBundle\Accounting\Entity\Repository\CategoryRepository; use AppBundle\Accounting\Entity\Repository\EventRepository; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; use AppBundle\Accounting\Entity\Repository\PaymentRepository; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; use AppBundle\Accounting\Form\InvoicingPeriodType; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; -use AppBundle\Accounting\Model\Repository\TransactionRepository; use AppBundle\Accounting\OperationType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -30,7 +30,7 @@ public function __invoke(Request $request): Response $periodId = $request->query->has('periodId') ? $request->query->getInt('periodId') : null; $period = $this->invoicingPeriodRepository->getCurrentPeriod($periodId); $formPeriod = $this->createForm(InvoicingPeriodType::class, $period); - $periods = $this->invoicingPeriodRepository->getAll(); + $periods = $this->invoicingPeriodRepository->findAll(); $withReconciled = $request->query->getBoolean('with_reconciled'); $type = OperationType::tryfrom($request->query->getInt('type')); @@ -38,7 +38,7 @@ public function __invoke(Request $request): Response return $this->render('admin/accounting/journal/list.html.twig', [ 'periods' => $periods, - 'periodId' => $period->getId(), + 'periodId' => $period->id, 'formPeriod' => $formPeriod->createView(), 'withReconciled' => $withReconciled, 'type' => $type, diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/UpdateInfoAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/UpdateInfoAction.php index 3ddfa2d23..04173c711 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/UpdateInfoAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/UpdateInfoAction.php @@ -4,8 +4,11 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\CategoryRepository; +use AppBundle\Accounting\Entity\Repository\EventRepository; +use AppBundle\Accounting\Entity\Repository\PaymentRepository; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use AppBundle\Accounting\TransactionModification; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -14,14 +17,19 @@ class UpdateInfoAction extends AbstractController { - public function __construct(private readonly TransactionRepository $transactionRepository) {} + public function __construct( + private readonly TransactionRepository $transactionRepository, + private readonly CategoryRepository $categoryRepository, + private readonly PaymentRepository $paymentRepository, + private readonly EventRepository $eventRepository, + ) {} public function __invoke( Request $request, int $id, TransactionModification $modification, ): JsonResponse { - $transaction = $this->transactionRepository->get($id); + $transaction = $this->transactionRepository->find($id); if (!$transaction instanceof Transaction) { throw $this->createNotFoundException(); } @@ -32,7 +40,7 @@ public function __invoke( throw new \InvalidArgumentException(sprintf('Value cannot be empty for "%s"', $modification->value)); } - $modification->setValue($transaction, $value); + $modification->setValue($transaction, $value, $this->categoryRepository, $this->paymentRepository, $this->eventRepository); $this->transactionRepository->save($transaction); } catch (\InvalidArgumentException $e) { return new JsonResponse(['error' => $e->getMessage()], Response::HTTP_BAD_REQUEST); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/UploadAttachmentAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/UploadAttachmentAction.php index 046db6b2b..bb88076ba 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/UploadAttachmentAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/UploadAttachmentAction.php @@ -4,8 +4,8 @@ namespace AppBundle\Controller\Admin\Accounting\Journal; -use AppBundle\Accounting\Model\Repository\TransactionRepository; -use AppBundle\Accounting\Model\Transaction; +use AppBundle\Accounting\Entity\Repository\TransactionRepository; +use AppBundle\Accounting\Entity\Transaction; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -24,7 +24,7 @@ public function __construct( public function __invoke(Request $request, int $id): Response { - $transaction = $this->transactionRepository->get($id); + $transaction = $this->transactionRepository->find($id); if (!$transaction instanceof Transaction) { throw $this->createNotFoundException(); } @@ -33,7 +33,7 @@ public function __invoke(Request $request, int $id): Response return new Response('No file uploaded', 400); } - $directory = $transaction->getAccountingDate()->format('Ym') . DIRECTORY_SEPARATOR; + $directory = $transaction->dateEcriture->format('Ym') . DIRECTORY_SEPARATOR; $targetDir = $this->uploadDir . $directory; if (!is_dir($targetDir)) { mkdir($targetDir, 0750, true); @@ -49,19 +49,19 @@ public function __invoke(Request $request, int $id): Response } $filename = sprintf('%s.%s', - $transaction->getAccountingDate()->format('Y-m-d') . '_' . $transaction->getId() . '_' . substr(sha1_file($file->getPathname()), 0, 6), + $transaction->dateEcriture->format('Y-m-d') . '_' . $transaction->id . '_' . substr(sha1_file($file->getPathname()), 0, 6), $file->guessExtension(), ); $file->move($targetDir, $filename); - if (!empty($transaction->getAttachmentFilename())) { - $oldFilename = $this->uploadDir . $transaction->getAttachmentFilename(); + if (!empty($transaction->nomJustificatif)) { + $oldFilename = $this->uploadDir . $transaction->nomJustificatif; if (is_file($oldFilename)) { unlink($oldFilename); } } - $transaction->setAttachmentFilename($directory . $filename); + $transaction->nomJustificatif = $directory . $filename; $this->transactionRepository->save($transaction); return new Response(); diff --git a/sources/AppBundle/Controller/Admin/Accounting/Quotation/ListQuotationAction.php b/sources/AppBundle/Controller/Admin/Accounting/Quotation/ListQuotationAction.php index 34218afc5..f4316f493 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Quotation/ListQuotationAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Quotation/ListQuotationAction.php @@ -5,9 +5,9 @@ namespace AppBundle\Controller\Admin\Accounting\Quotation; use Afup\Site\Utils\Vat; +use AppBundle\Accounting\Entity\Repository\InvoicingPeriodRepository; use AppBundle\Accounting\Form\InvoicingPeriodType; use AppBundle\Accounting\Model\Repository\InvoicingRepository; -use AppBundle\Accounting\Model\Repository\InvoicingPeriodRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -29,17 +29,17 @@ public function __invoke(Request $request): Response $direction = $request->query->get('direction', 'desc'); $sort = $request->query->get('sort', 'date'); - $quotations = $this->invoiceRepository->getQuotationsByPeriodId($period->getId(), $sort, $direction); - $periods = $this->invoicingPeriodRepository->getAll(); + $quotations = $this->invoiceRepository->getQuotationsByPeriodId($period->id, $sort, $direction); + $periods = $this->invoicingPeriodRepository->findAll(); return new Response($this->twig->render('admin/accounting/quotation/list.html.twig', [ 'lines' => $quotations, 'periods' => $periods, - 'periodId' => $period->getId(), + 'periodId' => $period->id, 'formPeriod' => $formPeriod->createView(), 'direction' => $direction, 'sort' => $sort, - 'isSubjectedToVat' => Vat::isSubjectedToVat($period->getEndDate()), + 'isSubjectedToVat' => Vat::isSubjectedToVat($period->dateFin), ])); } } diff --git a/templates/admin/accounting/journal/form.html.twig b/templates/admin/accounting/journal/form.html.twig index d2b5d5e72..e91619037 100644 --- a/templates/admin/accounting/journal/form.html.twig +++ b/templates/admin/accounting/journal/form.html.twig @@ -6,9 +6,9 @@

Sélectionner un Journal

- {{ form_row(form.operationId) }} - {{ form_row(form.accountId) }} - {{ form_row(form.eventId) }} + {{ form_row(form.operation) }} + {{ form_row(form.compte) }} + {{ form_row(form.evenement) }}
@@ -16,14 +16,14 @@

Détail Facture

- {{ form_row(form.accountingDate) }} - {{ form_row(form.categoryId) }} - {{ form_row(form.vendorName) }} + {{ form_row(form.dateEcriture) }} + {{ form_row(form.categorie) }} + {{ form_row(form.nomFournisseur) }} {{ form_row(form.tvaIntra) }} - {{ form_row(form.number) }} + {{ form_row(form.numero) }} {{ form_row(form.description) }} - {{ form_row(form.amount) }} - {{ form_row(form.comment) }} + {{ form_row(form.montant) }} + {{ form_row(form.commentaire) }}
@@ -31,7 +31,7 @@

TVA

- {{ form_row(form.amountTva5_5) }} + {{ form_row(form.montantTva5_5) }}
- {{ form_row(form.amountTva10) }} + {{ form_row(form.montantTva10) }} - {{ form_row(form.amountTva20) }} + {{ form_row(form.montantTva20) }} - {{ form_row(form.amountTva0) }} + {{ form_row(form.montantTva0) }}
@@ -71,9 +71,9 @@

Réglement

- {{ form_row(form.paymentTypeId) }} - {{ form_row(form.paymentDate) }} - {{ form_row(form.paymentComment) }} + {{ form_row(form.modeReglement) }} + {{ form_row(form.dateReglement) }} + {{ form_row(form.commentaireReglement) }}
diff --git a/templates/admin/accounting/journal/list.html.twig b/templates/admin/accounting/journal/list.html.twig index f4349ce0e..b56c17725 100644 --- a/templates/admin/accounting/journal/list.html.twig +++ b/templates/admin/accounting/journal/list.html.twig @@ -56,7 +56,7 @@
- {% if transactions.count > 0 %} + {% if transactions|length > 0 %} diff --git a/templates/admin/accounting/journal/vat_calculation.js.twig b/templates/admin/accounting/journal/vat_calculation.js.twig index f25aed039..4d47355ba 100644 --- a/templates/admin/accounting/journal/vat_calculation.js.twig +++ b/templates/admin/accounting/journal/vat_calculation.js.twig @@ -1,14 +1,14 @@