Fixes #1696, Group item reported missing from Zotero library on next citation edit

Was breaking when libraryID!=groupID
This commit is contained in:
Dan Stillman 2010-07-26 17:43:58 +00:00
parent d7ff547e2f
commit c7f025519b

View file

@ -168,12 +168,12 @@ Zotero.URI = new function () {
if (itemURI.indexOf(localUserURI) == 0) { if (itemURI.indexOf(localUserURI) == 0) {
itemURI = itemURI.substr(localUserURI.length); itemURI = itemURI.substr(localUserURI.length);
var libraryType = 'user'; var libraryType = 'user';
var libraryID = null; var id = null;
} }
} }
*/ */
var libraryType = 'user'; var libraryType = 'user';
var libraryID = null; var id = null;
} }
// If not found, try global URI // If not found, try global URI
@ -188,7 +188,7 @@ Zotero.URI = new function () {
throw ("Invalid library URI '" + itemURI + "' in Zotero.URI.getURIItem()"); throw ("Invalid library URI '" + itemURI + "' in Zotero.URI.getURIItem()");
} }
var libraryType = matches[1].substr(0, matches[1].length-1); var libraryType = matches[1].substr(0, matches[1].length-1);
var libraryID = matches[2]; var id = matches[2];
itemURI = itemURI.replace(typeRE, ''); itemURI = itemURI.replace(typeRE, '');
} }
@ -204,10 +204,10 @@ Zotero.URI = new function () {
} }
if (libraryType == 'group') { if (libraryType == 'group') {
if (!Zotero.Libraries.exists(libraryID)) { if (!Zotero.Groups.get(id)) {
return false; return false;
} }
var libraryID = Zotero.Groups.getLibraryIDFromGroupID(libraryID); var libraryID = Zotero.Groups.getLibraryIDFromGroupID(id);
return Zotero.Items.getByLibraryAndKey(libraryID, itemKey); return Zotero.Items.getByLibraryAndKey(libraryID, itemKey);
} }
} }