Skip to content

Commit

Permalink
Fixed SQL error in revenueAndProfits view if a year has no invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterZydra committed Oct 3, 2024
1 parent 1fddc9b commit d0fabeb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Types of changes: `Added`, `Changed`, `Deprecate`, `Removed`, `Fixed`, `Secruity

## [Unreleased]

## v2.6.1 - 03.10.2024 - Bugfix in 'Revenue and Profits' view

### Fixed
- Fixed SQL error in revenueAndProfits view if a year has no invoices

## v2.6.0 - 19.04.2024 - Added support for SQLite

### Added
Expand Down
10 changes: 7 additions & 3 deletions app/Http/Controllers/FinancialRevenueProfitStatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ private function calculate(int $year): array

$invoiceIds = array_map(fn(Invoice $invoice): int => $invoice->getId(), $invoices);

$deliveryNotes = DeliveryNote::all(DeliveryNote::getQueryBuilder()
->where(ColType::Int, 'invoiceId', Condition::In, $invoiceIds)
);
$deliveryNotes = [];
if (count($invoiceIds) > 0) {
// TODO Where IN -> if array is empty, some condition that is always false?
$deliveryNotes = DeliveryNote::all(
DeliveryNote::getQueryBuilder()->where(ColType::Int, 'invoiceId', Condition::In, $invoiceIds)
);
}

$revenue = 0.0;
$payouts = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion resources/Views/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<table class="scrollable">
<tr>
<td>Bio-Manager Version</td>
<td class="right">2.6.0</td>
<td class="right">2.6.1</td>
</tr>
<tr>
<td><?= __('Developer') ?></td>
Expand Down

1 comment on commit d0fabeb

@MasterZydra
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #63

Please sign in to comment.