From 8170cf09dee86540dc4e3b4c73451c9c695f33c6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 26 Feb 2020 14:45:48 -0500 Subject: [PATCH] Fix Editor sorting with >1 editor Follow-up to eec0f00784 --- chrome/content/zotero/xpcom/data/items.js | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/items.js b/chrome/content/zotero/xpcom/data/items.js index 891b407d60..e2cfa7a273 100644 --- a/chrome/content/zotero/xpcom/data/items.js +++ b/chrome/content/zotero/xpcom/data/items.js @@ -1420,6 +1420,30 @@ Zotero.Items = function() { + "SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID}` + ") " + + "WHEN 2 THEN (" + + "SELECT " + + "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} ` + + "ORDER BY orderIndex LIMIT 1)" + + " || ' ' || " + + "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} ` + + "ORDER BY orderIndex LIMIT 1,1) " + + ") " + + "ELSE (" + + "SELECT " + + "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} ` + + "ORDER BY orderIndex LIMIT 1)" + + " || ' ' || " + + "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} ` + + "ORDER BY orderIndex LIMIT 1,1)" + + " || ' ' || " + + "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators " + + `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} ` + + "ORDER BY orderIndex LIMIT 2,1)" + + ") " + "END, " // Then try contributors