From 8b15260bde3be625da4365d2b1fdadb3f1949441 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 18 Jun 2021 20:59:50 +0200 Subject: [PATCH] Ms Office Export patent author as inventor Fixes #7830 --- CHANGELOG.md | 1 + src/main/java/org/jabref/logic/msbib/MSBibConverter.java | 6 +++++- .../java/org/jabref/model/openoffice/uno/UnoCrossRef.java | 4 ++-- .../resources/org/jabref/logic/exporter/MsBibPatent.xml | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd16ad07ef..d603acb423a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Changed +- The export to MS Office XML now exports the author field as `Inventor` if the bibtex entry type is `patent` [#7830](https://github.com/JabRef/jabref/issues/7830) - We changed the EndNote importer to import the field `label` to the corresponding bibtex field `endnote-label` [forum#2734](https://discourse.jabref.org/t/importing-endnote-label-field-to-jabref-from-xml-file/2734) - The keywords added via "Manage content selectors" are now displayed in alphabetical order. [#3791](https://github.com/JabRef/jabref/issues/3791) - We improved the "Find unlinked files" dialog to show import results for each file. [#7209](https://github.com/JabRef/jabref/pull/7209) diff --git a/src/main/java/org/jabref/logic/msbib/MSBibConverter.java b/src/main/java/org/jabref/logic/msbib/MSBibConverter.java index 5b282296c0e..45f24cd8bc1 100644 --- a/src/main/java/org/jabref/logic/msbib/MSBibConverter.java +++ b/src/main/java/org/jabref/logic/msbib/MSBibConverter.java @@ -111,7 +111,11 @@ public static MSBibEntry convert(BibEntry entry) { result.publicationTitle = entry.getLatexFreeField(StandardField.TITLE).orElse(null); } - entry.getField(StandardField.AUTHOR).ifPresent(authors -> result.authors = getAuthors(entry, authors, StandardField.AUTHOR)); + if (entry.getType().equals(IEEETranEntryType.Patent)) { + entry.getField(StandardField.AUTHOR).ifPresent(authors -> result.inventors = getAuthors(entry, authors, StandardField.AUTHOR)); + } else { + entry.getField(StandardField.AUTHOR).ifPresent(authors -> result.authors = getAuthors(entry, authors, StandardField.AUTHOR)); + } entry.getField(StandardField.EDITOR).ifPresent(editors -> result.editors = getAuthors(entry, editors, StandardField.EDITOR)); entry.getField(StandardField.TRANSLATOR).ifPresent(translator -> result.translators = getAuthors(entry, translator, StandardField.EDITOR)); diff --git a/src/main/java/org/jabref/model/openoffice/uno/UnoCrossRef.java b/src/main/java/org/jabref/model/openoffice/uno/UnoCrossRef.java index 37dc580a1fb..f5d20a1de4f 100644 --- a/src/main/java/org/jabref/model/openoffice/uno/UnoCrossRef.java +++ b/src/main/java/org/jabref/model/openoffice/uno/UnoCrossRef.java @@ -62,7 +62,7 @@ public static void insertReferenceToPageNumberOfReferenceMark(XTextDocument doc, try { // specify that the source is a reference mark (could also be a footnote, // bookmark or sequence field) - xFieldProps.setPropertyValue("ReferenceFieldSource", Short.valueOf​(ReferenceFieldSource.REFERENCE_MARK)); + xFieldProps.setPropertyValue("ReferenceFieldSource", Short.valueOf(ReferenceFieldSource.REFERENCE_MARK)); } catch (UnknownPropertyException ex) { throw new java.lang.IllegalStateException("The created GetReference does not have property" + " 'ReferenceFieldSource'"); @@ -72,7 +72,7 @@ public static void insertReferenceToPageNumberOfReferenceMark(XTextDocument doc, try { // We want the reference displayed as page number - xFieldProps.setPropertyValue("ReferenceFieldPart", Short.valueOf​(ReferenceFieldPart.PAGE)); + xFieldProps.setPropertyValue("ReferenceFieldPart", Short.valueOf(ReferenceFieldPart.PAGE)); } catch (UnknownPropertyException ex) { throw new java.lang.IllegalStateException("The created GetReference does not have property" + " 'ReferenceFieldPart'"); diff --git a/src/test/resources/org/jabref/logic/exporter/MsBibPatent.xml b/src/test/resources/org/jabref/logic/exporter/MsBibPatent.xml index c5acba75d8d..7e20b72b868 100644 --- a/src/test/resources/org/jabref/logic/exporter/MsBibPatent.xml +++ b/src/test/resources/org/jabref/logic/exporter/MsBibPatent.xml @@ -7,14 +7,14 @@ The Vampire hunter Lincoln1978 - + Lincoln Abraham - + 12345677