Revision: 25150
          http://sourceforge.net/p/bibdesk/svn/25150
Author:   hofman
Date:     2020-12-06 15:15:25 +0000 (Sun, 06 Dec 2020)
Log Message:
-----------
Ignore cite key format suggestion when cite key is empty or used by another item

Modified Paths:
--------------
    trunk/bibdesk/BDSKParseFormatCommand.m

Modified: trunk/bibdesk/BDSKParseFormatCommand.m
===================================================================
--- trunk/bibdesk/BDSKParseFormatCommand.m      2020-12-06 07:30:34 UTC (rev 
25149)
+++ trunk/bibdesk/BDSKParseFormatCommand.m      2020-12-06 15:15:25 UTC (rev 
25150)
@@ -44,6 +44,7 @@
 #import "BDSKAppController.h"
 #import "BDSKOwnerProtocol.h"
 #import "BDSKTypeManager.h"
+#import "BDSKPublicationsArray.h"
 #import "NSScriptCommand_BDSKExtensions.h"
 
 @implementation BDSKParseFormatCommand
@@ -192,12 +193,15 @@
         return [BDSKFormatParser parseFormat:formatString forLinkedFile:file 
ofItem:pub];
     
     NSString *suggestion = nil;
-    if ([field isEqualToString:BDSKCiteKeyString])
+    if ([field isEqualToString:BDSKCiteKeyString]) {
         suggestion = [pub citeKey];
-    else if (isFileField)
+        if ([pub hasEmptyOrDefaultCiteKey] || [[[pub owner] publications] 
citeKeyIsUsed:suggestion byItemOtherThan:pub])
+            suggestion = nil;
+    } else if (isFileField) {
         suggestion = [[pub localFileURLForField:field] path];
-    else
+    } else {
         suggestion = [pub valueOfField:field inherit:NO];
+    }
     
        return [BDSKFormatParser parseFormat:formatString forField:field 
ofItem:pub suggestion:suggestion];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to