From b9a5c7dc3815d52f60e41b38e3e771db04cf453d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 1 Jun 2006 07:29:39 +0000 Subject: [PATCH] Fixed creators not getting inserted into itemCreators on new item save() --- .../content/scholar/xpcom/data_access.js | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js index cbad81a38..77c400bbd 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js +++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -499,40 +499,6 @@ Scholar.Item.prototype.save = function(){ try { Scholar.DB.beginTransaction(); - // - // Creators - // - if (this._changedCreators.length){ - for (orderIndex in this._changedCreators.items){ - var creator = this.getCreator(orderIndex); - - // If empty, skip - if (!creator['firstName'] && !creator['lastName']){ - continue; - } - - // See if this is an existing creator - var creatorID = Scholar.Creators.getID( - creator['firstName'], - creator['lastName'] - ); - - // If not, add it - if (!creatorID){ - creatorID = Scholar.Creators.add( - creator['firstName'], - creator['lastName'] - ); - } - - sql += 'INSERT INTO itemCreators VALUES (' - + itemID + ',' + creatorID + ',' - + creator['creatorTypeID'] + ', ' + orderIndex - + ");\n"; - } - } - - // // itemData fields // @@ -572,6 +538,40 @@ Scholar.Item.prototype.save = function(){ } } + // + // Creators + // + if (this._changedCreators.length){ + for (orderIndex in this._changedCreators.items){ + var creator = this.getCreator(orderIndex); + + // If empty, skip + if (!creator['firstName'] && !creator['lastName']){ + continue; + } + + // See if this is an existing creator + var creatorID = Scholar.Creators.getID( + creator['firstName'], + creator['lastName'] + ); + + // If not, add it + if (!creatorID){ + creatorID = Scholar.Creators.add( + creator['firstName'], + creator['lastName'] + ); + } + + sql = 'INSERT INTO itemCreators VALUES (' + + itemID + ',' + creatorID + ',' + + creator['creatorTypeID'] + ', ' + orderIndex + + ");\n"; + Scholar.DB.query(sql); + } + } + Scholar.DB.commitTransaction(); // Reload collection to update isEmpty,