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

Can set the document name in an invoice, but it will not be written into the XML. #605

Open
haba-beton opened this issue Dec 6, 2024 · 2 comments

Comments

@haba-beton
Copy link

Invoice invoice = new Invoice();
invoice.setDocumentName("RECHNUNG");

XML generation inside of ZUGFeRD2PullProvider: Line 385

	xml +=
		"<ram:GuidelineSpecifiedDocumentContextParameter>"
			+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
			+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
			+ "</rsm:ExchangedDocumentContext>"
			+ "<rsm:ExchangedDocument>"
			+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
			// + "<ram:Name>RECHNUNG</ram:Name>"
			// + "<ram:TypeCode>380</ram:TypeCode>"
			+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
			+ "<ram:IssueDateTime>"
			+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
			+ buildNotes(trans)
			+ "</rsm:ExchangedDocument>"
			+ "<rsm:SupplyChainTradeTransaction>";

should be like:

	xml +=
		"<ram:GuidelineSpecifiedDocumentContextParameter>"
			+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
			+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
			+ "</rsm:ExchangedDocumentContext>"
			+ "<rsm:ExchangedDocument>"
			+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>";
	if (trans.getDocumentName() != null) { // !!! documentName by default is "RECHNUNG" should by null
		xml += "<ram:Name>RECHNUNG</ram:Name>";
	}
	xml +=
		"<ram:TypeCode>" + typecode + "</ram:TypeCode>"
			+ "<ram:IssueDateTime>"
			+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
			+ buildNotes(trans)
			+ "</rsm:ExchangedDocument>"
			+ "<rsm:SupplyChainTradeTransaction>";

best regards
franz

@langfr
Copy link
Contributor

langfr commented Dec 7, 2024

Providing a document name seem to be (no longer) valid.
After activating the commented out name, errors are generated within the mustangproject validator tests, warnings when uploading the generated document to a test site:
image

@haba-beton
Copy link
Author

I found out, that "Name" only? exists in the factur-x EXTENDED Spezifications.

grafik

When exporting with the EXTENDED Profile, like
zugFeRD2PullProvider.setProfile(Profiles.getByName("EXTENDED"));
then there should be no validation error/warning.

So i think the follwoing could by right?
if (profile == Profiles.getByName("EXTENDED") && trans.getDocumentName() != null) {
xml += "ram:Name"+trans.getDocumentName()+"</ram:Name>";
}

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

No branches or pull requests

2 participants