ZUGFeRD-csharp: AddTradeLineCommentItem creates invalid LineExtensionAmount element in UBL output

When using AddTradeLineCommentItem to add a comment line, the resulting TradeLineItem has LineTotalAmount = null, which is written by the UBL writer like this:

<cbc:LineExtensionAmount currencyID="EUR"></cbc:LineExtensionAmount>

The missing value causes the following two validation errors:

  1. ‘’ is not a valid value for ‘decimal’.
  2. Element ‘cbc:LineExtensionAmount’ must have no element [children], and the value must be valid.

Suggested solution: Just like GrossUnitPrice and a few other nullable members of TradeLineItem, LineTotalAmount could be initialized with 0m in AddTradeLineCommentItem.

I reproduced the bug in version 16.1.0, but I’ve checked the current code and the problem should exist in the latest version as well.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, I’m ok with that.

Thank you very much!

@ufoch : can you please check 25d6240

Almost working, just the call of Writer.WriteValue() with the note contents was forgotten. Currently this creates just an empty element.

jap: https://github.com/stephanstapel/ZUGFeRD-csharp/commit/ef5707baff1f1d66935441071da9651b2786b7dd that should do it.