Allow item types to be passed by name in Item constructor -- don't know why I never did this before, since they're cached
Feel free to remove redundant calls to ItemTypes.getID() (I actually see a whole bunch of calls to the constructor using type names in scrapers, but presumably those are converted to itemTypeIDs in translate.js, since they seem to have been working just fine...)
This commit is contained in:
parent
7271ec6e43
commit
b7a261d3da
|
@ -30,7 +30,7 @@ Zotero.Item = function(){
|
|||
|
||||
// Accept itemTypeID in constructor
|
||||
if (arguments.length){
|
||||
this.setType(arguments[0]);
|
||||
this.setType(Zotero.ItemTypes.getID(arguments[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,6 +268,11 @@ Zotero.Item.prototype.getCreators = function(){
|
|||
|
||||
/*
|
||||
* Set or update the creator at the specified position
|
||||
*
|
||||
* _orderIndex_: the position of this creator in the item (from 0)
|
||||
* _fieldMode_: 0 for double-field, 1 for single-field mode
|
||||
*
|
||||
* If single-field mode, _firstName_ is ignored
|
||||
*/
|
||||
Zotero.Item.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID, fieldMode){
|
||||
if (this.getID() && !this._creatorsLoaded){
|
||||
|
|
Loading…
Reference in New Issue
Block a user