diff --git a/api/additional_methods.py b/api/additional_methods.py index 1c2c262..65169d7 100644 --- a/api/additional_methods.py +++ b/api/additional_methods.py @@ -37,8 +37,7 @@ def get_tenant_with_saldo(user, token_info): return dbGetMany(user, token_info, { "statement": """ SELECT t.id, t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo - FROM tenant_t t, account_entry_t a - WHERE a.account = t.account + FROM tenant_t t LEFT OUTER JOIN account_entry_t a ON a.account = t.account GROUP BY t.id, t.firstname, t.lastname, t.address1 """, "params": () diff --git a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts index e5f0427..5c6d3c5 100644 --- a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts +++ b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts @@ -90,11 +90,18 @@ export class TenantDetailsComponent implements OnInit { async getTenant(): Promise { try { const id = +this.route.snapshot.paramMap.get('id') + this.messageService.add(`getTenant, id=${id}`) if (id != 0) { + this.messageService.add("getTenant, not-0-branch") this.tenantId = id this.tenant = await this.tenantService.getTenant(id) this.account = await this.accountService.getAccount(this.tenant.account) this.getTenancies() + } else { + this.messageService.add("getTenant, 0-branch") + this.tenant = NULL_Tenant + this.account = NULL_Account + this.tenancies = [] } } catch (err) { this.messageService.add(JSON.stringify(err, undefined, 4))