commit a342cb3546ee4777e9457eb385137e63e87f4890
parent 091326b7e608fb751d2dffe4c7200266f5d90dd3
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 17 Feb 2011 04:06:18 +0000
Always favor PDF attachments over non-PDF attachments
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -3279,8 +3279,8 @@ Zotero.Item.prototype.getBestAttachment = function() {
/*
* Looks for attachment in the following order: oldest PDF attachment matching parent URL,
- * oldest non-PDF attachment matching parent URL, oldest PDF attachment not matching URL,
- * old non-PDF attachment not matching URL
+ * oldest PDF attachment not matching parent URL, oldest non-PDF attachment matching parent URL,
+ * old non-PDF attachment not matching parent URL
*
* @return {Array} itemIDs for attachments
*/
@@ -3296,7 +3296,7 @@ Zotero.Item.prototype.getBestAttachments = function() {
+ "LEFT JOIN itemDataValues IDV ON (ID.valueID=IDV.valueID) "
+ "WHERE sourceItemID=? AND linkMode NOT IN (?) "
+ "AND IA.itemID NOT IN (SELECT itemID FROM deletedItems) "
- + "ORDER BY value=? DESC, mimeType='application/pdf' DESC, dateAdded ASC";
+ + "ORDER BY mimeType='application/pdf' DESC, value=? DESC, dateAdded ASC";
return Zotero.DB.columnQuery(sql, [this.id, Zotero.Attachments.LINK_MODE_LINKED_URL, url]);
}