From a9cb13710c5455d50c540ea68a35ab8a5da1b669 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 11 Dec 2006 01:49:49 +0000 Subject: [PATCH] Fix error changing item type when fields don't exist in new type --- chrome/content/zotero/xpcom/data_access.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index bf8ed6e95..771f23a92 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -180,12 +180,12 @@ Zotero.Item.prototype.setType = function(itemTypeID){ // And reset custom creator types to the default var creators = this.getCreators(); if (creators){ - for each(var creator in creators){ - if (!Zotero.CreatorTypes.isValidForItemType(creator['creatorTypeID'], itemTypeID)) + for (var i in creators){ + if (!Zotero.CreatorTypes.isValidForItemType(creators[i].creatorTypeID, itemTypeID)) { // Reset to contributor (creatorTypeID 2), which exists in all - this.setCreator(orderIndex, creator['firstName'], - creator['lastName'], 2, creator['fieldMode']); + this.setCreator(i, creators[i].firstName, + creators[i].lastName, 2, creators[i].fieldMode); } } }