details:   https://code.openbravo.com/erp/devel/pi/rev/774fb449cb26
changeset: 15162:774fb449cb26
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Jan 17 12:11:21 2012 +0100
summary:   Fixed issue 18186. Attachments audit info (updated and updatedby) 
will be updated when a file is replaced.

diffstat:

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

diffs (29 lines):

diff -r a981465ccebf -r 774fb449cb26 
src/org/openbravo/erpCommon/businessUtility/TabAttachments.java
--- a/src/org/openbravo/erpCommon/businessUtility/TabAttachments.java   Tue Jan 
17 03:00:17 2012 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/TabAttachments.java   Tue Jan 
17 12:11:21 2012 +0100
@@ -281,6 +281,7 @@
   private OBError insert(VariablesSecureApp vars, String strFileReference, 
String tableId,
       String key, String strDataType, String strText) throws IOException, 
ServletException {
 
+    String cFileId = strFileReference;
     OBError myMessage = null;
     myMessage = new OBError();
     myMessage.setTitle("");
@@ -310,12 +311,16 @@
       for (TabAttachmentsData data : files) {
         if (data.name.equals(strName)) {
           fileExists = true;
+          cFileId = data.cFileId;
         }
       }
       if (!fileExists) {
         // We only insert a new record if there is no record for this file
-        TabAttachmentsData.insert(conn, this, strFileReference, 
vars.getClient(), vars.getOrg(),
+        TabAttachmentsData.insert(conn, this, cFileId, vars.getClient(), 
vars.getOrg(),
             vars.getUser(), tableId, key, strDataType, strText, strName);
+      } else {
+        // We update the existing record
+        TabAttachmentsData.update(this, vars.getUser(), strDataType, strText, 
cFileId);
       }
       try {
         // FIXME: Get the directory separator from Java runtime

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to