details:   https://code.openbravo.com/erp/devel/pi/rev/a9ab0578b4ec
changeset: 22122:a9ab0578b4ec
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Fri Feb 21 00:46:21 2014 +0530
summary:   Fixes Issue 0025781: download all attachments fail

When downloading all attachments older method of retrieving attachments was 
always used.
Called the appropriate method to determine the attachment model and download 
accordingly.

diffstat:

 src/org/openbravo/erpCommon/businessUtility/TabAttachments.java |  16 ++++++---
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 7ad2c259cf46 -r a9ab0578b4ec 
src/org/openbravo/erpCommon/businessUtility/TabAttachments.java
--- a/src/org/openbravo/erpCommon/businessUtility/TabAttachments.java   Thu Feb 
20 18:02:40 2014 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/TabAttachments.java   Fri Feb 
21 00:46:21 2014 +0530
@@ -264,8 +264,10 @@
       attachmentFiles.list().toArray();
       HashMap<String, Integer> writtenFiles = new HashMap<String, Integer>();
       for (Attachment attachmentFile : attachmentFiles.list()) {
-        final File file = new File(globalParameters.strFTPDirectory + "/" + 
tableId + "-"
-            + attachmentFile.getRecord(), attachmentFile.getName());
+        String attachmentDirectory = 
TabAttachments.getAttachmentDirectory(tableId, recordIds,
+            attachmentFile.getName());
+        final File file = new File(globalParameters.strFTPDirectory + "/" + 
attachmentDirectory,
+            attachmentFile.getName());
         String zipName = "";
         if (!writtenFiles.containsKey(file.getName())) {
           zipName = file.getName();
@@ -391,11 +393,13 @@
       try {
         FileUtility f = new FileUtility();
         // FIXME: Get the directory separator from Java runtime
-        final File file = new File(globalParameters.strFTPDirectory + "/" + 
data[0].adTableId + "-"
-            + data[0].adRecordId, data[0].name);
+        String attachmentDirectory = 
TabAttachments.getAttachmentDirectory(data[0].adTableId,
+            data[0].adRecordId, data[0].name);
+        final File file = new File(globalParameters.strFTPDirectory + "/" + 
attachmentDirectory,
+            data[0].name);
         if (file.exists())
-          f = new FileUtility(globalParameters.strFTPDirectory + "/" + 
data[0].adTableId + "-"
-              + data[0].adRecordId, data[0].name, false);
+          f = new FileUtility(globalParameters.strFTPDirectory + "/" + 
attachmentDirectory,
+              data[0].name, false);
         else
           f = new FileUtility(globalParameters.strFTPDirectory, 
strFileReference, false);
         if (!f.deleteFile()) {

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to