Admin business: optional fields such as withholdingTaxCompanyId can't be cleared

オープン
#5,254 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
postgresql, typescript
領域
backend, database

調査の方向性

Start with packages/server/src/modules/financial-entities/providers/admin-businesses.provider.ts and compare its update query with the tax-representation handling added in #5230. Read packages/server/src/modules/financial-entities/helpers/admin-businesses.helper.ts and the existing update integration test; first decide whether cleared array fields should be NULL or empty arrays. Done means each nullable field supports keep, clear and set, required fields retain their constraint with an explanatory comment, and the integration test covers those cases.

索引モデルが issue の本文から書いたものです。

説明

Several optional admin-business fields can be set but never cleared. The update query in packages/server/src/modules/financial-entities/providers/admin-businesses.provider.ts writes them as COALESCE($param, column). A null therefore means "keep", and there is no value that empties the column. Affected:

  • company_tax_id (withholdingTaxCompanyId)
  • business_registration_start_date
  • advance_tax_rates
  • tax_advances_ids
  • social_security_employer_ids
  • withholding_tax_annual_ids

Once one of these holds a value, a user who empties it in the admin business settings gets the old value back.

The three tax-representation fields added in #5230 already work differently:

  • tax_assessing_office, tax_representative_name, tax_representative_license
  • An omitted field keeps its value; '' or null clears it.
  • Implementation: a CASE WHEN $x::TEXT IS NULL THEN column ELSE NULLIF($x, '') END in the SQL, plus toClearableText in packages/server/src/modules/financial-entities/helpers/admin-businesses.helper.ts.
  • Covered by providers/__tests__/admin-businesses-update.integration.test.ts.

Done when

  • Each nullable field above can be cleared from the UI, and an omitted field still keeps its value.
  • The array fields need a decision: is "cleared" NULL or an empty array?
  • Fields that must never be empty (for example company_tax_id, if required) stay as they are, with a comment saying why.
  • The integration test covers keep, clear and set for the changed fields.
主要言語
TypeScript
スター
30
フォーク
10
平均マージ
2日 12時間
マージ済み PR(30日)
276

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Urigo/accounter-fullstack のほかの issue

Urigo/accounter-fullstack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。