Fix #51: Dezimalkomma in Brutto-Suche wird in Dezimalpunkt umgewandelt

This commit is contained in:
fds2610-bot 2026-04-26 12:02:25 +02:00
parent 308895419e
commit 7de93f14b8
2 changed files with 7 additions and 2 deletions

View file

@ -21,7 +21,8 @@ class Beleg
OR (SELECT CAST(SUM(bk2s.betrag_brutto) AS CHAR) FROM bookings bk2s
WHERE bk2s.beleg_id = b.id AND bk2s.is_reversal = 0) LIKE ?)';
$s = '%' . $filter['search'] . '%';
$params = array_merge($params, [$s, $s, $s, $s, $s, $s, $s, $s, $s]);
$sBrutto = '%' . str_replace(',', '.', $filter['search']) . '%';
$params = array_merge($params, [$s, $s, $s, $s, $s, $s, $s, $s, $sBrutto]);
}
if (!empty($filter['year'])) {
$where[] = '(YEAR(b.beleg_datum) = ? OR b.beleg_datum IS NULL)';

View file

@ -88,7 +88,11 @@ class BelegSucheErweitertTest extends TestCase
// 299 * 1.19 = 355.81
$res = \Steuerkram\Models\Beleg::all(['search' => '355.81'], 1, 50);
$found = $this->containsBeleg($res['rows'], $belegId);
$this->assert($found, 'Suche nach Bruttobetrag findet den Beleg');
$this->assert($found, 'Suche nach Bruttobetrag findet den Beleg (Dezimalpunkt)');
$res = \Steuerkram\Models\Beleg::all(['search' => '355,81'], 1, 50);
$found = $this->containsBeleg($res['rows'], $belegId);
$this->assert($found, 'Suche nach Bruttobetrag findet den Beleg (Dezimalkomma)');
// ── Bestehende Felder funktionieren noch ──────────────────────────
$res = \Steuerkram\Models\Beleg::all(['search' => $belegNr], 1, 50);