Skip to content

Commit

Permalink
fix cash: allows multiple cash-accounts with correct saldo checking
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-staab committed Jun 25, 2024
1 parent 2bf2e0a commit 9ec07d7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions legacy/lib/forms/RestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace forms;

use App\Exceptions\LegacyDieException;
use App\Models\Legacy\BankTransaction;
use booking\BookingTableManager;
use booking\HHPHandler;
use booking\konto\FintsConnectionHandler;
Expand Down Expand Up @@ -181,15 +182,10 @@ public function saveNewKasseEntry(): void
if ($fields['id'] === '1') {
DBConnector::getInstance()->dbInsert('konto', $fields);
} else {
$last = DBConnector::getInstance()->dbFetchAll(
'konto',
[DBConnector::FETCH_ASSOC],
[],
[
'konto_id' => 0,
'id' => $fields['id'] - 1,
]
)[0];
$last = BankTransaction::where('konto_id', '=', $fields['konto_id'])
->orderBy('id', 'desc')
->first()?->toArray();

if (abs($last['saldo'] + $fields['value'] - $fields['saldo']) < 0.01) {
DBConnector::getInstance()->dbInsert('konto', $fields);
} else {
Expand Down

0 comments on commit 9ec07d7

Please sign in to comment.