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

Đang mở
#5,254 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, typescript
Lĩnh vực
backend, database

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
30
Fork
10
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
276

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Urigo/accounter-fullstack

Tất cả issue của Urigo/accounter-fullstack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.