details:   https://code.openbravo.com/erp/devel/pi/rev/a1b63a73a71d
changeset: 33921:a1b63a73a71d
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Fri May 04 11:31:32 2018 +0530
summary:   Fixes Issue 38375: Attribute selector in Task Window has problems
with Role with limited access

Set Admin mode to include piece of code which
accesses AttributeSet objects.

diffstat:

 src/org/openbravo/erpCommon/info/AttributeSetInstance.java |  38 +++++++-------
 1 files changed, 19 insertions(+), 19 deletions(-)

diffs (61 lines):

diff -r f2979bad6889 -r a1b63a73a71d 
src/org/openbravo/erpCommon/info/AttributeSetInstance.java
--- a/src/org/openbravo/erpCommon/info/AttributeSetInstance.java        Mon Apr 
30 14:07:14 2018 +0200
+++ b/src/org/openbravo/erpCommon/info/AttributeSetInstance.java        Fri May 
04 11:31:32 2018 +0530
@@ -149,10 +149,12 @@
       AttributeSetInstanceValue attSetValue = new 
AttributeSetInstanceValue(lotNo, serialNo,
           expiryDate, vars.getStringParameter("inpislocked", "N"),
           vars.getStringParameter("inplockDescription"));
-      AttributeSet attSet = OBDal.getInstance().get(AttributeSet.class, 
strAttributeSet);
       HashMap<String, String> attValues = new HashMap<String, String>();
+      OBError myMessage = null;
       try {
         OBContext.setAdminMode(true);
+        AttributeSet attSet = OBDal.getInstance().get(AttributeSet.class, 
strAttributeSet);
+
         for (AttributeUse attrUse : attSet.getAttributeUseList()) {
           final String elementName = attrUse.getAttribute().getName();
           if (attrUse.isActive() && attrUse.getAttribute().isActive()) {
@@ -165,27 +167,25 @@
             }
           }
         }
+
+        if (StringUtils.isEmpty(lotNo) && StringUtils.isEmpty(serialNo)
+            && StringUtils.isEmpty(expiryDate) && attValues.isEmpty()) {
+          myMessage = new OBError();
+          myMessage.setTitle("");
+          myMessage.setType("Success");
+          myMessage.setMessage(Utility.messageBD(this, "Success", 
vars.getLanguage()));
+        } else {
+          myMessage = attSetValue.setAttributeInstance(this, vars, 
strAttributeSet, strInstance,
+              strWindowId, strIsSOTrx, strProduct, attValues);
+
+          if (myMessage != null && StringUtils.equals("Error", 
myMessage.getType())) {
+            bdErrorGeneralPopUp(request, response, 
OBMessageUtils.messageBD("Error"),
+                myMessage.getMessage());
+          }
+        }
       } finally {
         OBContext.restorePreviousMode();
       }
-
-      OBError myMessage = null;
-      if (StringUtils.isEmpty(lotNo) && StringUtils.isEmpty(serialNo)
-          && StringUtils.isEmpty(expiryDate) && attValues.isEmpty()) {
-        myMessage = new OBError();
-        myMessage.setTitle("");
-        myMessage.setType("Success");
-        myMessage.setMessage(Utility.messageBD(this, "Success", 
vars.getLanguage()));
-      } else {
-        myMessage = attSetValue.setAttributeInstance(this, vars, 
strAttributeSet, strInstance,
-            strWindowId, strIsSOTrx, strProduct, attValues);
-
-        if (myMessage != null && StringUtils.equals("Error", 
myMessage.getType())) {
-          bdErrorGeneralPopUp(request, response, 
OBMessageUtils.messageBD("Error"),
-              myMessage.getMessage());
-        }
-      }
-
       vars.setSessionValue("AttributeSetInstance.instance", 
attSetValue.getAttSetInstanceId());
       vars.setSessionValue("AttributeSetInstance.attribute", strAttributeSet);
       vars.setSessionValue("AttributeSetInstance.close", "Y");

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to