feat: widget icons, dark theme tables, breadcrumb removal, bookkeeping rework, personal equipment pages, PDF/order improvements
This commit is contained in:
@@ -413,10 +413,16 @@ async function getRequestById(id: number) {
|
||||
linkedBestellungen = bestellungen.rows;
|
||||
} catch { /* table may not exist */ }
|
||||
|
||||
// Determine im_haus: true if any linked bestellung has status lieferung_pruefen or abgeschlossen
|
||||
const imHaus = (linkedBestellungen as { status: string }[]).some(
|
||||
(b) => b.status === 'lieferung_pruefen' || b.status === 'abgeschlossen',
|
||||
);
|
||||
|
||||
return {
|
||||
anfrage: reqResult.rows[0],
|
||||
positionen: positionenWithEigenschaften,
|
||||
linked_bestellungen: linkedBestellungen,
|
||||
im_haus: imHaus,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1019,12 +1019,12 @@ async function stornoTransaktion(id: number, userId: string) {
|
||||
try {
|
||||
const result = await pool.query(
|
||||
`UPDATE buchhaltung_transaktionen
|
||||
SET status = 'storniert'
|
||||
SET status = 'entwurf'
|
||||
WHERE id = $1 AND status IN ('gebucht', 'freigegeben')
|
||||
RETURNING *`,
|
||||
[id, userId]
|
||||
);
|
||||
if (result.rows[0]) await logAudit(id, 'storniert', {}, userId);
|
||||
if (result.rows[0]) await logAudit(id, 'storniert_zu_entwurf', {}, userId);
|
||||
return result.rows[0] || null;
|
||||
} catch (error) {
|
||||
logger.error('BuchhaltungService.stornoTransaktion failed', { error, id });
|
||||
|
||||
Reference in New Issue
Block a user