lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Add vat number to db to all address tables

Open KingaOrsii opened this issue 11 months ago • 3 comments

The company's VAT number was not displayed at the order details (nor in the generated PDF) on backend, and it should if the order was made by a legal person.

Please check the related issue for more details: https://github.com/lunarphp/lunar/issues/2070 As you suggested I added a new vat number field to the DB to all the 3 address tables.

I also renamed vat_no to vat_number at the customer.

KingaOrsii avatar Feb 14 '25 12:02 KingaOrsii

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 11:51am

vercel[bot] avatar Feb 14 '25 12:02 vercel[bot]

Guys, just a notice, the field that I see in Vercel preview is vat_number. For consistency, I suggest naming it as in Lunar\Models\Customer (vat_no).

SebastianBotez avatar May 11 '25 20:05 SebastianBotez

Guys, just a notice, the field that I see in Vercel preview is vat_number. For consistency, I suggest naming it as in Lunar\Models\Customer (vat_no).

The vat_no is changed to vat_number in the model class too.

KingaOrsii avatar May 12 '25 05:05 KingaOrsii

@KingaOrsii would you be willing to update your PR?

glennjacobs avatar Jul 08 '25 10:07 glennjacobs

@KingaOrsii would you be willing to update your PR?

Yes, I will update it. Sorry for the late reaction.

KingaOrsii avatar Jul 08 '25 10:07 KingaOrsii

I updated the PR: renamed vat number to tax identifier.

KingaOrsii avatar Jul 09 '25 17:07 KingaOrsii

I updated the PR: renamed vat number to tax identifier.

Thank you. I'll give it a good test in the morning.

glennjacobs avatar Jul 09 '25 18:07 glennjacobs

Walkthrough

This update introduces a new tax_identifier field across address and customer models, factories, migrations, and related documentation. It replaces the previous vat_no field, updating all references in code, tests, translations, and documentation. The changes include database migrations, model fillable arrays, form schemas, search indexing, and localization files in multiple languages.

Changes

Files/Paths Change Summary
docs/core/reference/addresses.md, docs/core/reference/carts.md, docs/core/reference/orders.md, docs/core/reference/payments.md Documentation updated to include tax_identifier in address/cart/order models and examples.
docs/core/reference/customers.md Documentation updated: vat_no field renamed to tax_identifier in customer model and examples.
packages/admin/resources/lang/.../customer.php
packages/admin/resources/lang/.../address.php
packages/admin/resources/lang/.../order.php
Translation keys and labels updated/added for tax_identifier in customer, address, and order language files (de, en, es, fr, nl, pl, vi).
packages/admin/resources/views/pdf/order.blade.php Invoice PDF template updated to display tax_identifier for addresses and customer, replacing vat_no.
packages/admin/src/Filament/Resources/CustomerResource.php All references to vat_no replaced with tax_identifier; method renamed accordingly.
packages/admin/src/Filament/Resources/CustomerResource/RelationManagers/AddressRelationManager.php Added tax_identifier to address table columns and form fields in relation manager.
packages/admin/src/Filament/Resources/OrderResource/Concerns/DisplaysOrderAddresses.php Added tax_identifier to order address form and display schema.
packages/core/database/factories/AddressFactory.php
.../CartAddressFactory.php
.../OrderAddressFactory.php
Added tax_identifier field with faker data to address-related factories.
packages/core/database/factories/CustomerFactory.php Renamed factory field from vat_no to tax_identifier.
packages/core/database/migrations/2025_02_14_100000_add_tax_identifier_to_addresses_table.php
.../100010_add_tax_identifier_to_order_addresses_table.php
.../100020_add_tax_identifier_to_cart_addresses_table.php
Migrations add nullable tax_identifier column to addresses, order_addresses, and cart_addresses tables.
packages/core/database/migrations/2025_02_14_100030_rename_vat_no_at_customers_table.php Migration renames vat_no column to tax_identifier in customers table.
packages/core/src/Actions/Carts/AddAddress.php tax_identifier added to fillable attributes for cart address creation.
packages/core/src/Models/Address.php
.../CartAddress.php
.../OrderAddress.php
tax_identifier property annotated and added to $fillable arrays where applicable.
packages/core/src/Models/Customer.php Property annotation renamed from $vat_no to $tax_identifier.
packages/core/src/Search/CustomerIndexer.php Searchable array key changed from vat_no to tax_identifier for customers.
packages/core/src/Search/OrderIndexer.php tax_identifier added to searchable address fields in orders.
tests/core/Unit/Models/CustomerTest.php
tests/core/Unit/Search/CustomerIndexerTest.php
Tests updated to use tax_identifier instead of vat_no for customer attributes and assertions.

📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b33a8b0c7d35c507308ea084c5cd68df65fcae91 and 22b1a9f7ab57bbe054680832250b70b55420a81e.

📒 Files selected for processing (1)
  • docs/core/upgrading.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/core/upgrading.md

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jul 10 '25 11:07 coderabbitai[bot]