Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: PL regime #215

Merged
merged 6 commits into from
Dec 21, 2023
Merged

Draft: PL regime #215

merged 6 commits into from
Dec 21, 2023

Conversation

Risers
Copy link

@Risers Risers commented Nov 9, 2023

No description provided.

Comment on lines +62 to +73
validation.Field(&obj.Name,
validation.When(
len(obj.People) == 0,
validation.Required,
),
),
validation.Field(&obj.People[0].Name,
validation.When(
obj.Name == "",
validation.Required,
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work as expected. Firstly and empty People array will cause a nil panic. An "org.Party" without a name will also not pass validation, so in effect the People array will never be checked.
I'm guessing the use-case here is for selling to individuals with tax details as opposed to companies. My proposal would be to just assume that the name is filled out, and optionally use the first "org.Person" from the people list, if available.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged this BTW with the https://github.com/invopop/gobl/tree/Risers-regime-pl branch, which you should now be able to access directly.

@samlown samlown merged commit 8990fe5 into invopop:main Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants