IDEMPIERE-2676 Incorrect context variables - onNavigate Callout / make on navigate callout read only

This commit is contained in:
Carlos Ruiz 2016-09-03 16:17:23 +02:00
parent e3c42f6078
commit 2c4b9163ae
3 changed files with 46 additions and 4 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2676 Incorrect context variables - onNavigate Callout
-- Sep 3, 2016 3:07:56 PM GMT+01:00
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceListReadOnly', IsUpdateable='N',Updated=TO_DATE('2016-09-03 15:07:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2161
;
-- Sep 3, 2016 3:08:09 PM GMT+01:00
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceListReadOnly', IsUpdateable='N',Updated=TO_DATE('2016-09-03 15:08:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3484
;
SELECT register_migration_script('201609031608_IDEMPIERE-2676.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-2676 Incorrect context variables - onNavigate Callout
-- Sep 3, 2016 3:07:56 PM GMT+01:00
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceListReadOnly', IsUpdateable='N',Updated=TO_TIMESTAMP('2016-09-03 15:07:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2161
;
-- Sep 3, 2016 3:08:09 PM GMT+01:00
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceListReadOnly', IsUpdateable='N',Updated=TO_TIMESTAMP('2016-09-03 15:08:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3484
;
SELECT register_migration_script('201609031608_IDEMPIERE-2676.sql') FROM dual
;

View File

@ -661,9 +661,10 @@ public class CalloutOrder extends CalloutEngine
* @param mTab Grid Tab * @param mTab Grid Tab
* @param mField Grid Field * @param mField Grid Field
* @param value New Value * @param value New Value
* @param readonly Read Only - do not set tab fields, just context
* @return null or error message * @return null or error message
*/ */
public String priceList (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) public String priceListFill (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, boolean readonly)
{ {
Integer M_PriceList_ID = (Integer) mTab.getValue("M_PriceList_ID"); Integer M_PriceList_ID = (Integer) mTab.getValue("M_PriceList_ID");
if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0) if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0)
@ -695,12 +696,16 @@ public class CalloutOrder extends CalloutEngine
if (rs.next()) if (rs.next())
{ {
// Tax Included // Tax Included
mTab.setValue("IsTaxIncluded", new Boolean("Y".equals(rs.getString(1)))); if (!readonly) {
mTab.setValue("IsTaxIncluded", new Boolean("Y".equals(rs.getString(1))));
}
// Price Limit Enforce // Price Limit Enforce
Env.setContext(ctx, WindowNo, "EnforcePriceLimit", rs.getString(2)); Env.setContext(ctx, WindowNo, "EnforcePriceLimit", rs.getString(2));
// Currency // Currency
Integer ii = new Integer(rs.getInt(3)); if (!readonly) {
mTab.setValue("C_Currency_ID", ii); Integer ii = new Integer(rs.getInt(3));
mTab.setValue("C_Currency_ID", ii);
}
// PriceList Version // PriceList Version
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", rs.getInt(5)); Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", rs.getInt(5));
} }
@ -718,8 +723,18 @@ public class CalloutOrder extends CalloutEngine
if (steps) log.warning("fini"); if (steps) log.warning("fini");
return ""; return "";
} // priceListFill
public String priceList (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
return priceListFill (ctx, WindowNo, mTab, mField, value, false);
} // priceList } // priceList
/* IDEMPIERE-2676 - this is same callout priceList but not setting any variable, just reading and setting context, called on navigate */
public String priceListReadOnly (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
return priceListFill (ctx, WindowNo, mTab, mField, value, true);
} // priceListReadOnly
/** /**
* Set Payment Term. * Set Payment Term.