closes #1098, Edit Citation not working in new document

This commit is contained in:
Simon Kornblith 2008-08-21 21:30:36 +00:00
parent f99d96694d
commit 501d6c6e77
2 changed files with 11 additions and 1 deletions

View file

@ -258,7 +258,7 @@ var Zotero_Citation_Dialog = new function () {
* Sorts the list of citations
*/
function sortCitation() {
io.citation.properties.sort = _sortCheckbox.checked;
io.citation.properties.sort = _sortCheckbox && _sortCheckbox.checked;
if(_sortCheckbox.checked) {
_getCitation();

View file

@ -1088,6 +1088,16 @@ Zotero.Integration.Session.prototype.editCitation = function(index, citation) {
var me = this;
var io = new function() { this.wrappedJSObject = this; }
// if there's already a citation, make sure we have item IDs in addition to keys
if(citation) {
for each(var citationItem in citation.citationItems) {
if(citationItem.key && !citationItem.itemID) {
var item = Zotero.Items.getByKey([citationItem.key]);
if(item) citationItem.itemID = item.itemID;
}
}
}
// create object to hold citation
io.citation = (citation ? citation.clone() : this.style.createCitation());
io.citation.properties.index = parseInt(index, 10);