diff --git a/delivery_parse.go b/delivery_parse.go index 181f94e..e1a5f06 100644 --- a/delivery_parse.go +++ b/delivery_parse.go @@ -63,7 +63,9 @@ func (ui *Invoice) goblAddDelivery(out *bill.Invoice) error { } } - if ui.DeliveryTerms != nil { + // Terms with no ID carry only free text, and an identity with no code fails + // validation. + if ui.DeliveryTerms != nil && ui.DeliveryTerms.ID != "" { d.Identities = []*org.Identity{ { Code: cbc.Code(ui.DeliveryTerms.ID), diff --git a/party_parse.go b/party_parse.go index 86ee1c3..3d88fa8 100644 --- a/party_parse.go +++ b/party_parse.go @@ -57,17 +57,23 @@ func goblParty(party *Party, o *options) *org.Party { if party.Contact != nil { if party.Contact.Telephone != nil { - p.Telephones = []*org.Telephone{ - { - Number: cleanString(*party.Contact.Telephone), - }, + number := cleanString(*party.Contact.Telephone) + if number != "" { + p.Telephones = []*org.Telephone{ + { + Number: number, + }, + } } } if party.Contact.ElectronicMail != nil { - p.Emails = []*org.Email{ - { - Address: cleanString(*party.Contact.ElectronicMail), - }, + address := cleanString(*party.Contact.ElectronicMail) + if address != "" { + p.Emails = []*org.Email{ + { + Address: address, + }, + } } } }