diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-18 08:38:33 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-18 08:38:33 +0200 |
| commit | 702d9327e5f979deff392dceeced2dd16d1203e1 (patch) | |
| tree | a07e73525be134bbd0c92f7128e5501306660232 /src | |
| parent | 2a98cce8434f7ea27f777d9e6422a1eb92ba8be7 (diff) | |
| download | bokf-0.1.7.tar.gz bokf-0.1.7.zip | |
bokftui: Företagsuppgifter screen; org.update dry-runv0.1.7
- owner-editable company details form (read-only for other roles)
- org.update honors dry_run; covered in tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/commands.c b/src/commands.c index 948c42c..64212f7 100644 --- a/src/commands.c +++ b/src/commands.c @@ -704,6 +704,28 @@ static yyjson_mut_val *h_org_update(struct req *r) strcmp(framework, "K3") != 0) return fail(r, "INVALID_ARGS", "framework must be K2 or K3"); + static const char *const keys[9] = { "name", "org_nr", "vat_nr", + "address", "postal_code", "city", + "country", "email", "phone" }; + const char *texts[9] = { name, org_nr, vat_nr, address, postal, + city, country, email, phone }; + + if (r->dry_run) { + yyjson_mut_val *o = yyjson_mut_obj(r->rdoc); + for (int i = 0; i < 9; i++) + if (texts[i]) + yyjson_mut_obj_add_strcpy(r->rdoc, o, keys[i], texts[i]); + if (fy_month) + yyjson_mut_obj_add_int(r->rdoc, o, "fiscal_year_start_month", + fy_month); + if (moms) + yyjson_mut_obj_add_strcpy(r->rdoc, o, "moms_period", moms); + if (framework) + yyjson_mut_obj_add_strcpy(r->rdoc, o, "framework", framework); + yyjson_mut_obj_add_bool(r->rdoc, o, "dry_run", true); + return o; + } + sqlite3_stmt *st = NULL; if (sqlite3_prepare_v2( r->db, @@ -721,8 +743,6 @@ static yyjson_mut_val *h_org_update(struct req *r) -1, &st, NULL) != SQLITE_OK) return fail(r, "INTERNAL", "database error"); sqlite3_bind_int64(st, 1, r->org_id); - const char *texts[9] = { name, org_nr, vat_nr, address, postal, - city, country, email, phone }; for (int i = 0; i < 9; i++) { if (texts[i]) sqlite3_bind_text(st, i + 2, texts[i], -1, SQLITE_TRANSIENT); |
