Skip to content

Commit

Permalink
JE-400: Fixed command to recalculate sums for all invoices by first c…
Browse files Browse the repository at this point in the history
…alculating invoice entries
  • Loading branch information
tuj committed Dec 12, 2023
1 parent b7ca0c0 commit 62487d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ See [keep a changelog](https://keepachangelog.com/en/1.0.0/) for information abo

## [Unreleased]

* Fixed command to recalculate sums for all invoices by first calculating invoice entries.

## 1.0.3

* Changed redirect after create a manual invoice entry.
Expand Down
7 changes: 6 additions & 1 deletion src/Command/CalculateSumsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Command;

use App\Entity\Invoice;
use App\Repository\InvoiceRepository;
use App\Service\BillingService;
use Symfony\Component\Console\Attribute\AsCommand;
Expand Down Expand Up @@ -37,9 +38,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$io->progressStart(count($invoices));

/** @var Invoice $invoice */
foreach ($invoices as $invoice) {
$io->progressAdvance();
$this->billingService->updateInvoiceTotalPrice($invoice);

foreach ($invoice->getInvoiceEntries() as $invoiceEntry) {
$this->billingService->updateInvoiceEntryTotalPrice($invoiceEntry);
}
}

$io->progressFinish();
Expand Down

0 comments on commit 62487d9

Please sign in to comment.