mirror of
https://github.com/zotero/zotero.git
synced 2026-10-11 03:38:25 +00:00
Fix base-mapped fields not being migrated from Extra
https://forums.zotero.org/discussion/comment/505322/#Comment_505322
This commit is contained in:
parent
c37a79e066
commit
e478c89ca0
2 changed files with 11 additions and 1 deletions
|
|
@ -1170,7 +1170,7 @@ Zotero.Utilities.Internal = {
|
|||
// have values
|
||||
if (item) {
|
||||
let fieldID = Zotero.ItemFields.getID(possibleField);
|
||||
if (!Zotero.ItemFields.isValidForType(fieldID, itemTypeID)
|
||||
if (!Zotero.ItemFields.getFieldIDFromTypeAndBase(itemTypeID, fieldID)
|
||||
|| item.getField(fieldID)
|
||||
|| additionalFields.has(possibleField)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -202,6 +202,16 @@ describe("Zotero.Utilities.Internal", function () {
|
|||
assert.strictEqual(extra, '');
|
||||
});
|
||||
|
||||
it("should extract a base-mapped field for a given item", function () {
|
||||
var item = createUnsavedDataObject('item', { itemType: 'book' });
|
||||
var val = 'Foo';
|
||||
var str = `medium: ${val}`;
|
||||
var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str, item);
|
||||
assert.equal(fields.size, 1);
|
||||
assert.equal(fields.get('medium'), val);
|
||||
assert.strictEqual(extra, '');
|
||||
});
|
||||
|
||||
it("should extract a CSL field", function () {
|
||||
var val = '10.1234/abcdef';
|
||||
var str = `container-title: ${val}`;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue