From 3918adf21a2990b87be746602862b42577d59d44 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Thu, 19 Feb 2015 04:36:52 -0600 Subject: [PATCH] Hyphenate ISBN when writing to DB Only hyphenate if we're very confident that it's a list of unhyphenated ISBNs --- chrome/content/zotero/xpcom/data/item.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 40fd22af0..2563840a9 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -821,6 +821,24 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) { value = value.replace(/[\r\n]+/g, " ");; } + if (fieldID == Zotero.ItemFields.getID('ISBN')) { + // Hyphenate ISBNs, but only if everything is in expected format and valid + let isbns = ('' + value).trim().split(/\s*[,;]\s*|\s+/), + newISBNs = '', + failed = false; + for (let i=0; i