Skip to content

Commit

Permalink
Merge branch 'regime-pl' of github.com:Risers/gobl into Risers-regime-pl
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Dec 7, 2023
2 parents 7ac1196 + 814a977 commit 8990fe5
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions regimes/pl/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func (v *invoiceValidator) validate() error {
// Rectification state determined by Preceding value.
validation.Field(&inv.Type, validation.In(
bill.InvoiceTypeStandard,
bill.InvoiceTypeCorrective,
bill.InvoiceTypeProforma,
// bill.InvoiceTypeCorrective,
)),
// validation.Field(&inv.Preceding,
// validation.Each(validation.By(v.preceding)),
Expand Down Expand Up @@ -59,7 +58,18 @@ func (v *invoiceValidator) supplier(value interface{}) error {
tax.RequireIdentityCode,
validation.By(validatePolishTaxIdentity),
),
// TODO check if name exists
validation.Field(&obj.Name,
validation.When(
len(obj.People) == 0,
validation.Required,
),
),
validation.Field(&obj.People[0].Name,
validation.When(
obj.Name == "",
validation.Required,
),
),
)
}

Expand All @@ -79,7 +89,18 @@ func (v *invoiceValidator) commercialCustomer(value interface{}) error {
obj.TaxID.Country.In(l10n.PL),
validation.By(validatePolishTaxIdentity),
), // TODO check if id is valid when other entity
// TODO check if name exists
),
validation.Field(&obj.Name,
validation.When(
len(obj.People) == 0,
validation.Required,
),
),
validation.Field(&obj.People[0].Name,
validation.When(
obj.Name == "",
validation.Required,
),
),
)
}
Expand Down

0 comments on commit 8990fe5

Please sign in to comment.