fixed failing tests
This commit is contained in:
@@ -116,7 +116,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
protected int ZFVersion = DefaultZUGFeRDVersion;
|
protected int ZFVersion = DefaultZUGFeRDVersion;
|
||||||
private boolean attachZUGFeRDHeaders = true;
|
private boolean attachZUGFeRDHeaders = true;
|
||||||
|
|
||||||
// Specific metaData version in case of XRechnung. We need it to be settable
|
// Specific metaData version in case of XRechnung. We need it to be settable
|
||||||
// by the caller if necessary.
|
// by the caller if necessary.
|
||||||
protected String XRechnungVersion = null; // Default XRechnung as of late 2021 is 2p0
|
protected String XRechnungVersion = null; // Default XRechnung as of late 2021 is 2p0
|
||||||
|
|
||||||
@@ -169,11 +169,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
public String getNamespaceForVersion(int ver) {
|
public String getNamespaceForVersion(int ver) {
|
||||||
// In the case of XRechnung, it is the same as Factur-X
|
// In the case of XRechnung, it is the same as Factur-X
|
||||||
if ((ver >= 2) && (this.profile != null) &&
|
if ((ver >= 2) && (this.profile != null) &&
|
||||||
this.profile.getName().equalsIgnoreCase(Profiles.getByName("XRECHNUNG").getName()))
|
this.profile == Profiles.getByName("XRECHNUNG")) {
|
||||||
{
|
return "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
|
||||||
return "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
|
} else if (isFacturX) {
|
||||||
} else
|
|
||||||
if (isFacturX) {
|
|
||||||
return "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
|
return "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#";
|
||||||
} else if (ver == 1) {
|
} else if (ver == 1) {
|
||||||
return "urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#";
|
return "urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#";
|
||||||
@@ -191,12 +189,10 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
*/
|
*/
|
||||||
public String getPrefixForVersion(int ver) {
|
public String getPrefixForVersion(int ver) {
|
||||||
// In the case of XRechnung, it is the same as Factur-X
|
// In the case of XRechnung, it is the same as Factur-X
|
||||||
if ((ver >= 2) && (this.profile != null) &&
|
if ((this.profile != null) &&
|
||||||
this.profile.getName().equalsIgnoreCase(Profiles.getByName("XRECHNUNG").getName()))
|
this.profile == Profiles.getByName("XRECHNUNG")) {
|
||||||
{
|
|
||||||
return "fx";
|
return "fx";
|
||||||
} else
|
} else if (isFacturX) {
|
||||||
if (isFacturX) {
|
|
||||||
return "fx";
|
return "fx";
|
||||||
} else {
|
} else {
|
||||||
return "zf";
|
return "zf";
|
||||||
@@ -211,21 +207,19 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
* @return the filename of the file to be embedded
|
* @return the filename of the file to be embedded
|
||||||
*/
|
*/
|
||||||
public String getFilenameForVersion(int ver, Profile profile) {
|
public String getFilenameForVersion(int ver, Profile profile) {
|
||||||
boolean isXRechnung =
|
boolean isXRechnung = (this.profile != null) &&
|
||||||
(ver >= 2) && (this.profile != null) &&
|
this.profile == Profiles.getByName("XRECHNUNG");
|
||||||
this.profile.getName().equalsIgnoreCase(Profiles.getByName("XRECHNUNG").getName());
|
|
||||||
|
|
||||||
if (isFacturX && (!isXRechnung)) {
|
if (isFacturX) {
|
||||||
return "factur-x.xml";
|
return "factur-x.xml";
|
||||||
|
} else if (isXRechnung) {
|
||||||
|
return "xrechnung.xml";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (ver == 1) {
|
if (ver == 1) {
|
||||||
return "ZUGFeRD-invoice.xml";
|
return "ZUGFeRD-invoice.xml";
|
||||||
} else {
|
} else {
|
||||||
if (isXRechnung) {
|
return "zugferd-invoice.xml";
|
||||||
return "xrechnung.xml";
|
|
||||||
} else {
|
|
||||||
return "zugferd-invoice.xml";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,10 +244,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
*
|
*
|
||||||
* @param XRechnungVersion the XRechnung version
|
* @param XRechnungVersion the XRechnung version
|
||||||
*/
|
*/
|
||||||
public void setXRechnungSpecificVersion(String XRechnungVersion)
|
public void setXRechnungSpecificVersion(String XRechnungVersion) {
|
||||||
{
|
this.XRechnungVersion = XRechnungVersion;
|
||||||
this.XRechnungVersion = XRechnungVersion;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -520,14 +513,13 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
*/
|
*/
|
||||||
protected void addXMP(XMPMetadata metadata) {
|
protected void addXMP(XMPMetadata metadata) {
|
||||||
|
|
||||||
String metaDataVersion = null; // default will be used
|
String metaDataVersion = null; // default will be used
|
||||||
|
|
||||||
// The XRechnung version may be settable from outside.
|
// The XRechnung version may be settable from outside.
|
||||||
if ((this.XRechnungVersion != null) && (this.profile != null) &&
|
if ((this.XRechnungVersion != null) && (this.profile != null) &&
|
||||||
this.profile.getName().equalsIgnoreCase(Profiles.getByName("XRECHNUNG").getName()))
|
this.profile.getName().equalsIgnoreCase(Profiles.getByName("XRECHNUNG").getName())) {
|
||||||
{
|
metaDataVersion = this.XRechnungVersion;
|
||||||
metaDataVersion = this.XRechnungVersion;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (attachZUGFeRDHeaders) {
|
if (attachZUGFeRDHeaders) {
|
||||||
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, ZFVersion, isFacturX, xmlProvider.getProfile(),
|
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, ZFVersion, isFacturX, xmlProvider.getProfile(),
|
||||||
@@ -543,8 +535,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeCidSet(PDDocumentCatalog catalog, PDDocument doc)
|
private void removeCidSet(PDDocumentCatalog catalog, PDDocument doc)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
// https://github.com/ZUGFeRD/mustangproject/issues/249
|
// https://github.com/ZUGFeRD/mustangproject/issues/249
|
||||||
|
|
||||||
COSName cidSet = COSName.getPDFName("CIDSet");
|
COSName cidSet = COSName.getPDFName("CIDSet");
|
||||||
@@ -631,18 +622,16 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
xmlProvider.generateXML(trans);
|
xmlProvider.generateXML(trans);
|
||||||
String filename = getFilenameForVersion(ZFVersion, xmlProvider.getProfile());
|
String filename = getFilenameForVersion(ZFVersion, xmlProvider.getProfile());
|
||||||
|
|
||||||
String relationship = "Alternative";
|
String relationship = "Alternative";
|
||||||
// ZUGFeRD 2.1.1 Technical Supplement | Part A | 2.2.2. Data Relationship
|
// ZUGFeRD 2.1.1 Technical Supplement | Part A | 2.2.2. Data Relationship
|
||||||
// See documentation ZUGFeRD211_EN/Documentation/ZUGFeRD-2.1.1 - Specification_TA_Part-A.pdf
|
// See documentation ZUGFeRD211_EN/Documentation/ZUGFeRD-2.1.1 - Specification_TA_Part-A.pdf
|
||||||
// https://www.ferd-net.de/standards/zugferd-2.1.1/index.html
|
// https://www.ferd-net.de/standards/zugferd-2.1.1/index.html
|
||||||
if (ZFVersion >= 2)
|
if (ZFVersion >= 2) {
|
||||||
{
|
if (this.profile == Profiles.getByName("MINIMUM") ||
|
||||||
if (this.profile.getName().equalsIgnoreCase(Profiles.getByName("MINIMUM").getName()) ||
|
this.profile == Profiles.getByName("BASICWL")) {
|
||||||
this.profile.getName().equalsIgnoreCase(Profiles.getByName("BASICWL").getName()))
|
relationship = "Data";
|
||||||
{
|
}
|
||||||
relationship = "Data";
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PDFAttachGenericFile(doc, filename, relationship,
|
PDFAttachGenericFile(doc, filename, relationship,
|
||||||
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
||||||
@@ -660,8 +649,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
* Otherwise creates XMPMetadata.
|
* Otherwise creates XMPMetadata.
|
||||||
*/
|
*/
|
||||||
protected XMPMetadata getXmpMetadata()
|
protected XMPMetadata getXmpMetadata()
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
PDMetadata meta = doc.getDocumentCatalog().getMetadata();
|
PDMetadata meta = doc.getDocumentCatalog().getMetadata();
|
||||||
if ((meta != null) && (meta.getLength() > 0)) {
|
if ((meta != null) && (meta.getLength() > 0)) {
|
||||||
try {
|
try {
|
||||||
@@ -803,8 +791,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
* Adds an OutputIntent and the sRGB color profile if no OutputIntent exist
|
* Adds an OutputIntent and the sRGB color profile if no OutputIntent exist
|
||||||
*/
|
*/
|
||||||
protected void addSRGBOutputIntend()
|
protected void addSRGBOutputIntend()
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
if (!doc.getDocumentCatalog().getOutputIntents().isEmpty()) {
|
if (!doc.getDocumentCatalog().getOutputIntents().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user