MODS Translator bug: creator roles not imported correctly

I've just noticed that when importing MODS XML the creator type always appears in Zotero as author no matter what role is in the MODS roleTerm tags. I've had a look at the translator in Scaffold and the problem seems to be somewhere in this loop, but I can't tell what is wrong:

for(var role in name.m::role.m::roleTerm) {
if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") {
creator.creatorType = "editor";
} else if(role == "ctb") {
creator.creatorType = "contributor";
} else if(role == "trl") {
creator.creatorType = "translator";
}
}
}

At the end of the loop creator.creatorType is never set. For example if you replace

if(!creator.creatorType) creator.creatorType = "author";

with

if(!creator.creatorType) creator.creatorType = "editor";

then creator type will always be set to editor no matter what the roleTerm code in the XML actually is.

I'd be grateful if someone could look into this asap as I have over 1,000 records to import using MODS. I've tried to fix it myself but can't work it out.
  • Fixed it! Wasn't that difficult in the end. Some of the changes might not be necessary but this code works:

    for each(var roleTerm in name.m::role.m::roleTerm) {
    if(roleTerm.@type == "code" && roleTerm.@authority == "marcrelator") {
    if(roleTerm.text().toString() == "edt") {
    creator.creatorType = "editor";
    } else if(roleTerm.text().toString() == "ctb") {
    creator.creatorType = "contributor";
    } else if(roleTerm.text().toString() == "trl") {
    creator.creatorType = "translator";
    }
    }
    }
Sign In or Register to comment.