Fixed issue 19026. Images will be read correctly when the role doesn't have access to the Image window.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Thu, 10 Nov 2011 16:11:30 +0100
changeset 14218 38db7358cec3
parent 14217 44b45f23dd11
child 14219 71e92ccfe04e
Fixed issue 19026. Images will be read correctly when the role doesn't have access to the Image window.
src/org/openbravo/erpCommon/utility/Utility.java
--- a/src/org/openbravo/erpCommon/utility/Utility.java	Thu Nov 10 12:54:07 2011 +0100
+++ b/src/org/openbravo/erpCommon/utility/Utility.java	Thu Nov 10 16:11:30 2011 +0100
@@ -2419,7 +2419,12 @@
       if (img == null) {
         imageByte = getBlankImage();
       } else {
-        imageByte = img.getBindaryData();
+        OBContext.setAdminMode(true);
+        try {
+          imageByte = img.getBindaryData();
+        } finally {
+          OBContext.restorePreviousMode();
+        }
       }
     } catch (Exception e) {
       log4j.error("Could not load image from database: " + id, e);
@@ -2560,7 +2565,12 @@
         bout.close();
         imageByte = bout.toByteArray();
       } else {
-        imageByte = img.getBindaryData();
+        OBContext.setAdminMode(true);
+        try {
+          imageByte = img.getBindaryData();
+        } finally {
+          OBContext.restorePreviousMode();
+        }
       }
 
     } catch (Exception e) {