diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java index 8f70134894..dba843e84c 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java @@ -570,7 +570,7 @@ public class CalloutInOut extends CalloutEngine if (isCalloutActive() || value == null) return ""; - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); BigDecimal MovementQty, QtyEntered; @@ -606,7 +606,7 @@ public class CalloutInOut extends CalloutEngine mTab.setValue("MovementQty", MovementQty); } // No UOM defined - else if (Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID") == 0) + else if (Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID") == 0) { QtyEntered = (BigDecimal)mTab.getValue("QtyEntered"); mTab.setValue("MovementQty", QtyEntered); @@ -614,7 +614,7 @@ public class CalloutInOut extends CalloutEngine // QtyEntered changed - calculate MovementQty else if (mField.getColumnName().equals("QtyEntered")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); QtyEntered = (BigDecimal)value; BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); if (QtyEntered.compareTo(QtyEntered1) != 0) @@ -639,7 +639,7 @@ public class CalloutInOut extends CalloutEngine // MovementQty changed - calculate QtyEntered (should not happen) else if (mField.getColumnName().equals("MovementQty")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); MovementQty = (BigDecimal)value; int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision(); BigDecimal MovementQty1 = MovementQty.setScale(precision, BigDecimal.ROUND_HALF_UP); @@ -683,9 +683,9 @@ public class CalloutInOut extends CalloutEngine if (M_ASI_ID == null || M_ASI_ID.intValue() == 0) return ""; // - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); - int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID"); + int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Locator_ID"); if (log.isLoggable(Level.FINE)) log.fine("M_Product_ID=" + M_Product_ID + ", M_ASI_ID=" + M_ASI_ID + " - M_Warehouse_ID=" + M_Warehouse_ID diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index 771bb308fd..1a93a8c3d0 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -319,7 +319,7 @@ public class CalloutInvoice extends CalloutEngine /***** Price Calculation see also qty ****/ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, WindowNo, "C_BPartner_ID"); + int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced"); MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); // @@ -444,12 +444,12 @@ public class CalloutInvoice extends CalloutEngine if (column.equals("M_Product_ID")) M_Product_ID = ((Integer)value).intValue(); else - M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); int C_Charge_ID = 0; if (column.equals("C_Charge_ID")) C_Charge_ID = ((Integer)value).intValue(); else - C_Charge_ID = Env.getContextAsInt(ctx, WindowNo, "C_Charge_ID"); + C_Charge_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_Charge_ID"); if (log.isLoggable(Level.FINE)) log.fine("Product=" + M_Product_ID + ", C_Charge_ID=" + C_Charge_ID); if (M_Product_ID == 0 && C_Charge_ID == 0) return amt (ctx, WindowNo, mTab, mField, value); // @@ -506,8 +506,8 @@ public class CalloutInvoice extends CalloutEngine return ""; // log.log(Level.WARNING,"amt - init"); - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); int StdPrecision = MPriceList.getStandardPrecision(ctx, M_PriceList_ID); MPriceList pl = new MPriceList(ctx, M_PriceList_ID, null); @@ -732,7 +732,7 @@ public class CalloutInvoice extends CalloutEngine if (isCalloutActive() || value == null) return ""; - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); BigDecimal QtyInvoiced, QtyEntered, PriceActual, PriceEntered; @@ -776,7 +776,7 @@ public class CalloutInvoice extends CalloutEngine // QtyEntered changed - calculate QtyInvoiced else if (mField.getColumnName().equals("QtyEntered")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); QtyEntered = (BigDecimal)value; BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); if (QtyEntered.compareTo(QtyEntered1) != 0) @@ -801,7 +801,7 @@ public class CalloutInvoice extends CalloutEngine // QtyInvoiced changed - calculate QtyEntered (should not happen) else if (mField.getColumnName().equals("QtyInvoiced")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); QtyInvoiced = (BigDecimal)value; int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision(); BigDecimal QtyInvoiced1 = QtyInvoiced.setScale(precision, BigDecimal.ROUND_HALF_UP); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutMovement.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutMovement.java index a0bec96ca6..19d8ee70bc 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutMovement.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutMovement.java @@ -76,7 +76,7 @@ public class CalloutMovement extends CalloutEngine if (isCalloutActive() || value == null) return ""; - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, (BigDecimal)value); // return ""; @@ -95,7 +95,7 @@ public class CalloutMovement extends CalloutEngine public String locator(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { if (value == null) return ""; - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, null); return ""; } @@ -116,11 +116,11 @@ public class CalloutMovement extends CalloutEngine if (product.isStocked()) { if (MovementQty == null) MovementQty = (BigDecimal) mTab.getValue("MovementQty"); - int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID"); + int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Locator_ID"); // If no locator, don't check anything and assume is ok if (M_Locator_ID <= 0) return; - int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); + int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_AttributeSetInstance_ID"); BigDecimal available = MStorageOnHand.getQtyOnHandForLocator(M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID, null); if (available == null) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 1afce71542..0ff22e3ca8 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -841,7 +841,7 @@ public class CalloutOrder extends CalloutEngine { BigDecimal QtyOrdered = (BigDecimal)mTab.getValue("QtyOrdered"); int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); - int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); + int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_AttributeSetInstance_ID"); BigDecimal available = MStorageReservation.getQtyAvailable (M_Warehouse_ID, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null); if (available == null) @@ -961,12 +961,12 @@ public class CalloutOrder extends CalloutEngine if (column.equals("M_Product_ID")) M_Product_ID = ((Integer)value).intValue(); else - M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); int C_Charge_ID = 0; if (column.equals("C_Charge_ID")) C_Charge_ID = ((Integer)value).intValue(); else - C_Charge_ID = Env.getContextAsInt(ctx, WindowNo, "C_Charge_ID"); + C_Charge_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_Charge_ID"); if (log.isLoggable(Level.FINE)) log.fine("Product=" + M_Product_ID + ", C_Charge_ID=" + C_Charge_ID); if (M_Product_ID == 0 && C_Charge_ID == 0) return amt(ctx, WindowNo, mTab, mField, value); // @@ -1034,9 +1034,9 @@ public class CalloutOrder extends CalloutEngine return ""; if (steps) log.warning("init"); - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); - int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); + int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_PriceList_ID"); int StdPrecision = MPriceList.getStandardPrecision(ctx, M_PriceList_ID); MPriceList pl = new MPriceList(ctx, M_PriceList_ID, null); boolean isEnforcePriceLimit = pl.isEnforcePriceLimit(); @@ -1211,7 +1211,7 @@ public class CalloutOrder extends CalloutEngine { if (isCalloutActive() || value == null) return ""; - int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); + int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); if (steps) log.warning("init - M_Product_ID=" + M_Product_ID + " - " ); BigDecimal QtyOrdered = Env.ZERO; BigDecimal QtyEntered, PriceActual, PriceEntered; @@ -1257,7 +1257,7 @@ public class CalloutOrder extends CalloutEngine // QtyEntered changed - calculate QtyOrdered else if (mField.getColumnName().equals("QtyEntered")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); QtyEntered = (BigDecimal)value; BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); if (QtyEntered.compareTo(QtyEntered1) != 0) @@ -1282,7 +1282,7 @@ public class CalloutOrder extends CalloutEngine // QtyOrdered changed - calculate QtyEntered (should not happen) else if (mField.getColumnName().equals("QtyOrdered")) { - int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); + int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); QtyOrdered = (BigDecimal)value; int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision(); BigDecimal QtyOrdered1 = QtyOrdered.setScale(precision, BigDecimal.ROUND_HALF_UP); @@ -1320,7 +1320,7 @@ public class CalloutOrder extends CalloutEngine if (product.isStocked()) { int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); - int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); + int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_AttributeSetInstance_ID"); BigDecimal available = MStorageReservation.getQtyAvailable (M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, null); if (available == null) diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index 71ad2c4998..d309ff80ae 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -781,7 +781,7 @@ public class MProductPricing return; MDiscountSchema sd = MDiscountSchema.get(Env.getCtx(), M_DiscountSchema_ID); // not correct - if (sd.get_ID() == 0 || (MDiscountSchema.DISCOUNTTYPE_Breaks.equals(sd.getDiscountType()) && MDiscountSchema.CUMULATIVELEVEL_Line.equals(sd.getCumulativeLevel()))) + if (sd.get_ID() == 0 || (MDiscountSchema.DISCOUNTTYPE_Breaks.equals(sd.getDiscountType()) && !MDiscountSchema.CUMULATIVELEVEL_Line.equals(sd.getCumulativeLevel()))) return; // m_discountSchema = true; diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 93e76913d2..0a0487b330 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -3938,6 +3938,15 @@ public abstract class PO int id = get_ID(); if (id == 0) id = get_IDOld(); + + // IDEMPIERE-2453 + StringBuilder countSql = new StringBuilder("SELECT COUNT(*) FROM ") + .append(MTree_Base.getNodeTableName(treeType)) + .append(" WHERE Parent_ID=?"); + int cnt = DB.getSQLValue( get_TrxName(), countSql.toString(), id); + if (cnt > 0) + throw new AdempiereException(Msg.getMsg(Env.getCtx(),"NoParentDelete", new Object[] {cnt})); + StringBuilder sb = new StringBuilder ("DELETE FROM ") .append(MTree_Base.getNodeTableName(treeType)) .append(" n WHERE Node_ID=").append(id) diff --git a/org.adempiere.base/src/org/compiere/print/PrintDataElement.java b/org.adempiere.base/src/org/compiere/print/PrintDataElement.java index bbbc78d75c..ea2ef64e9a 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintDataElement.java +++ b/org.adempiere.base/src/org/compiere/print/PrintDataElement.java @@ -39,7 +39,7 @@ public class PrintDataElement implements Serializable /** * */ - private static final long serialVersionUID = 2177482817458457236L; + private static final long serialVersionUID = -2121125127301364735L; /** * Print Data Element Constructor @@ -129,6 +129,13 @@ public class PrintDataElement implements Serializable return m_foreignColumnName; } + /** + * Set ForeignName + * @return name + */ + public void setForeignColumnName(String foreignColumnName) { + m_foreignColumnName = foreignColumnName; + } /** * Get Node Value diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index ca3f98851f..1d79805410 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -72,6 +72,8 @@ import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MProject; import org.compiere.model.MQuery; import org.compiere.model.MRfQResponse; +import org.compiere.model.MRole; +import org.compiere.model.MTable; import org.compiere.model.PrintInfo; import static org.compiere.model.SystemIDs.*; @@ -652,16 +654,49 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) String value = pde.getValueDisplay(language); // formatted if (pde.getColumnName().endsWith("_ID") && extension != null) { - //link for column - a href = new a("javascript:void(0)"); - href.setID(pde.getColumnName() + "_" + row + "_a"); - td.addElement(href); - href.addElement(Util.maskHTML(value)); - if (cssPrefix != null) - href.setClass(cssPrefix + "-href"); - - extension.extendIDColumn(row, td, href, pde); - + boolean isZoom = false; + if (item.getColumnName().equals("Record_ID")) { + Object tablePDE = m_printData.getNode("AD_Table_ID"); + if (tablePDE != null && tablePDE instanceof PrintDataElement) { + int tableID = -1; + try { + tableID = Integer.parseInt(((PrintDataElement)tablePDE).getValueAsString()); + } catch (Exception e) { + tableID = -1; + } + if (tableID > 0) { + MTable mTable = MTable.get(getCtx(), tableID); + String foreignColumnName = mTable.getTableName() + "_ID"; + pde.setForeignColumnName(foreignColumnName); + isZoom = true; + } + } + } else { + isZoom = true; + } + if (isZoom) { + // check permission on the zoomed window + MTable mTable = MTable.get(getCtx(), pde.getForeignColumnName().substring(0, pde.getForeignColumnName().length()-3)); + int Record_ID = Integer.parseInt(pde.getValueAsString()); + int AD_Window_ID = Env.getZoomWindowID(mTable.get_ID(), Record_ID); + Boolean canAccess = MRole.getDefault().getWindowAccess(AD_Window_ID); + if (canAccess == null) { + isZoom = false; + } + } + if (isZoom) { + //link for column + a href = new a("javascript:void(0)"); + href.setID(pde.getColumnName() + "_" + row + "_a"); + td.addElement(href); + href.addElement(Util.maskHTML(value)); + if (cssPrefix != null) + href.setClass(cssPrefix + "-href"); + extension.extendIDColumn(row, td, href, pde); + } else { + td.addElement(Util.maskHTML(value)); + } + } else { diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java index 40901fc17f..f347c29475 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java @@ -121,7 +121,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements if(columnName.equalsIgnoreCase("IsActive") || columnName.equalsIgnoreCase("IsTranslated")){ - value = "true".equals(value) ? "Y" : "N"; + value = "true".equals(value) || "Y".equals(value) ? "Y" : "N"; } pstm.setString(i, value); } @@ -161,7 +161,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements if(columnName.equalsIgnoreCase("IsActive") || columnName.equalsIgnoreCase("IsTranslated")){ - value = "true".equals(value) ? "Y" : "N"; + value = "true".equals(value) || "Y".equals(value) ? "Y" : "N"; } pstm.setString(i, value); diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java index fa4cb8d8cb..edbbff4eab 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java @@ -133,17 +133,8 @@ public class MenuElementHandler extends AbstractElementHandler { int columnID = DB.getSQLValue(getTrxName(ctx), sql, colName, tableID); sql = "SELECT AD_Reference_ID FROM AD_COLUMN WHERE AD_Column_ID = ?"; int referenceID = DB.getSQLValue(getTrxName(ctx), sql, columnID); - if (referenceID == 20 || referenceID == 28) - if (rs.getObject(q).equals("Y")) - colValue = "true"; - else - colValue = "false"; - else - { - Object obj = rs.getObject(q); - colValue = obj == null ? "" : obj.toString(); - } - + Object obj = rs.getObject(q); + colValue = obj == null ? "" : obj.toString(); X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx.ctx, 0, getTrxName(ctx)); backup.setAD_Package_Imp_Detail_ID(impDetail.getAD_Package_Imp_Detail_ID()); backup.setAD_Package_Imp_ID(getPackageImpId(ctx.ctx)); diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java index 6cd744c5fd..3325d8118c 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java @@ -90,7 +90,7 @@ public class PoExporter { * @param boolValue */ public void addBoolean(String name, boolean boolValue, AttributesImpl atts){ - addTextElement(name, boolValue == true ? "true" : "false", atts); + addTextElement(name, boolValue == true ? "Y" : "N", atts); } @@ -120,7 +120,7 @@ public class PoExporter { if(value instanceof String){ addTextElement(columnName, (String)value, atts); } else if(value instanceof Boolean) { - addTextElement(columnName, (Boolean)value == true ? "true" : "false", atts); + addTextElement(columnName, (Boolean)value == true ? "Y" : "N", atts); } else if(value instanceof Integer) { addTextElement(columnName, value.toString(), atts); } else if(value instanceof BigDecimal) { diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java index 39f4d16b35..1f7136d27a 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java @@ -70,7 +70,7 @@ public class PoFiller{ Element e = element.properties.get(columnName); String value = e != null ? e.contents.toString() : null; - boolean bool = "true".equals(value) ? true : false; + boolean bool = "true".equals(value) || "Y".equals(value) ? true : false; if (po.get_Value(columnName) != null && po.get_ValueAsBoolean(columnName) == bool) return; diff --git a/org.adempiere.replication/build.properties b/org.adempiere.replication/build.properties index 34d2e4d2da..e9863e281e 100644 --- a/org.adempiere.replication/build.properties +++ b/org.adempiere.replication/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + plugin.xml diff --git a/org.adempiere.replication/plugin.xml b/org.adempiere.replication/plugin.xml new file mode 100644 index 0000000000..13774d1ee0 --- /dev/null +++ b/org.adempiere.replication/plugin.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java index 12c7b27dfb..ee98e28070 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java @@ -21,10 +21,10 @@ import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Button; import org.adempiere.webui.component.ConfirmPanel; -import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.Window; import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.factory.ButtonFactory; +import org.adempiere.webui.session.SessionManager; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -33,7 +33,8 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Div; -import org.zkoss.zul.Hbox; +import org.zkoss.zul.Hlayout; +import org.zkoss.zul.Layout; import org.zkoss.zul.Vlayout; /** @@ -54,8 +55,6 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi */ private static final long serialVersionUID = -3260639688339379279L; - private VerticalBox dialogBody; - /** Logger */ private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class); // @@ -138,23 +137,32 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi private void initComponents() { this.setBorder("normal"); - dialogBody = new VerticalBox(); + Layout dialogBody = new Vlayout(); dialogBody.setHflex("1"); + dialogBody.setStyle(dialogBody.getStyle() + ";max-height:" + (SessionManager.getAppDesktop().getClientInfo().desktopHeight - 100) + "px"); + + Vlayout dialogContent = new Vlayout(); dialogContent.setHflex("1"); dialogContent.setVflex("1"); dialogContent.setSclass("dialog-content"); dialogContent.setStyle("overflow-y: auto;"); dialogBody.appendChild(dialogContent); + // description Div div = new Div(); div.setId("message"); div.appendChild(getMessage()); div.setStyle("max-height: 150pt; overflow: auto;"); dialogContent.appendChild(div); + dialogContent.appendChild(getCenterPanel()); - Hbox hbox = new Hbox(); + // button panel + Layout hbox = new Hlayout(); + hbox.setStyle("bottom:0;text-align:right"); + dialogBody.appendChild(hbox); hbox.setWidth("100%"); hbox.setSclass("dialog-footer"); + Button btn = ButtonFactory.createNamedButton(ConfirmPanel.A_OK); btn.setId("Ok"); btn.addEventListener(Events.ON_CLICK, this); @@ -163,11 +171,10 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi btn = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL); btn.setId("Cancel"); btn.addEventListener(Events.ON_CLICK, this); - hbox.appendChild(btn); - hbox.setPack("end"); dialogBody.appendChild(hbox); this.appendChild(dialogBody); + this.setSclass("popup-dialog"); } @@ -201,13 +208,13 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi @Override public void showBusyDialog() { - this.setBorder("none"); - this.setTitle(null); - dialogBody.setVisible(false); - BusyDialog progressWindow = createBusyDialog(); - if (this.getParent() != null) + if (this.getParent() != null){ + this.getParent().appendChild(progressWindow); LayoutUtils.openOverlappedWindow(this.getParent(), progressWindow, "middle_center"); + } + + this.setVisible(false); } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java index 269f59d9e5..9d407ad7a8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java @@ -466,7 +466,7 @@ public class NumberBox extends Div */ public boolean isEnabled() { - return decimalBox.isReadonly(); + return !decimalBox.isReadonly(); } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleListModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleListModel.java index 6b5dc51c4f..ffc36915cb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleListModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleListModel.java @@ -15,8 +15,11 @@ package org.adempiere.webui.component; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.List; +import org.zkoss.lang.Objects; import org.zkoss.zul.AbstractListModel; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listcell; @@ -24,13 +27,14 @@ import org.zkoss.zul.Listitem; import org.zkoss.zul.ListitemRenderer; import org.zkoss.zul.ListitemRendererExt; import org.zkoss.zul.event.ListDataEvent; +import org.zkoss.zul.ext.Sortable; /** * * @author Low Heng Sin * */ -public class SimpleListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt { +public class SimpleListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt, Sortable { /** * @@ -39,6 +43,10 @@ public class SimpleListModel extends AbstractListModel implements Listit protected List list; + private Comparator _sorting; + + private boolean _sortDir; + private int[] maxLength; public SimpleListModel() { @@ -50,6 +58,7 @@ public class SimpleListModel extends AbstractListModel implements Listit this.list = (List)list; } + @Override public Object getElementAt(int index) { if (index >= 0 && index < list.size()) return list.get(index); @@ -57,6 +66,7 @@ public class SimpleListModel extends AbstractListModel implements Listit return null; } + @Override public int getSize() { return list.size(); } @@ -111,14 +121,17 @@ public class SimpleListModel extends AbstractListModel implements Listit } } + @Override public int getControls() { return DETACH_ON_RENDER; } + @Override public Listcell newListcell(Listitem item) { return null; } + @Override public Listitem newListitem(Listbox listbox) { ListItem item = new ListItem(); item.applyProperties(); @@ -159,4 +172,20 @@ public class SimpleListModel extends AbstractListModel implements Listit public int indexOf(Object value) { return list.indexOf(value); } + + @Override + public void sort(Comparator cmpr, boolean ascending) { + _sorting = cmpr; + _sortDir = ascending; + Collections.sort(list, cmpr); + fireEvent(ListDataEvent.STRUCTURE_CHANGED, -1, -1); + } + + @Override + public String getSortDirection(Comparator cmpr) { + if (Objects.equals(_sorting, cmpr)) + return _sortDir ? + "ascending" : "descending"; + return "natural"; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/CustomizeGridViewPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/CustomizeGridViewPanel.java index 34ebe697c1..bac23e419c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/CustomizeGridViewPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/CustomizeGridViewPanel.java @@ -41,11 +41,13 @@ import org.adempiere.webui.component.SimpleListModel; import org.adempiere.webui.factory.ButtonFactory; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.window.FDialog; +import org.compiere.model.I_AD_Field; import org.compiere.model.MField; import org.compiere.model.MRefList; import org.compiere.model.MRole; import org.compiere.model.MTab; import org.compiere.model.Query; +import org.compiere.model.X_AD_Tab_Customization; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -144,10 +146,11 @@ public class CustomizeGridViewPanel extends Panel yesList.setVflex(true); noList.setVflex(true); - + EventListener mouseListener = new EventListener() { + @Override public void onEvent(Event event) throws Exception { if (Events.ON_DOUBLE_CLICK.equals(event.getName())) @@ -161,6 +164,7 @@ public class CustomizeGridViewPanel extends Panel // EventListener actionListener = new EventListener() { + @Override public void onEvent(Event event) throws Exception { migrateValueAcrossLists(event); } @@ -184,6 +188,7 @@ public class CustomizeGridViewPanel extends Panel actionListener = new EventListener() { + @Override public void onEvent(Event event) throws Exception { migrateValueWithinYesList(event); } @@ -214,7 +219,10 @@ public class CustomizeGridViewPanel extends Panel listHead.setParent(noList); listHeader = new ListHeader(); listHeader.appendChild(noLabel); - + listHeader.setSort("auto"); + listHeader.setSortDirection("ascending"); + //http://books.zkoss.org/wiki/ZK%20Configuration%20Reference/zk.xml/The%20Library%20Properties/org.zkoss.zul.listbox.autoSort + noList.setAttribute("org.zkoss.zul.listbox.autoSort", "true"); Hlayout noButtonLayout = new Hlayout(); noButtonLayout.appendChild(bRemove); @@ -268,6 +276,7 @@ public class CustomizeGridViewPanel extends Panel LayoutUtils.addSclass("dialog-footer", confirmPanel); EventListener onClickListener = new EventListener() { + @Override public void onEvent(Event event) throws Exception { if (event.getTarget().equals( confirmPanel.getButton(ConfirmPanel.A_OK))) { @@ -298,7 +307,7 @@ public class CustomizeGridViewPanel extends Panel boolean baseLanguage = Env.isBaseLanguage(Env.getCtx(), "AD_Field"); Query query = null; - query = new Query(Env.getCtx(), MField.Table_Name, "AD_Tab_ID=? AND (IsDisplayed='Y' OR IsDisplayedGrid='Y') AND IsActive='Y'", null); + query = new Query(Env.getCtx(), I_AD_Field.Table_Name, "AD_Tab_ID=? AND (IsDisplayed='Y' OR IsDisplayedGrid='Y') AND IsActive='Y'", null); query.setOrderBy("SeqNoGrid, Name, SeqNo"); query.setParameters(new Object [] {m_AD_Tab_ID}); query.setApplyAccessFilter(true); @@ -319,7 +328,7 @@ public class CustomizeGridViewPanel extends Panel if (baseLanguage) name = field.getName(); else - name = field.get_Translation(MField.COLUMNNAME_Name); + name = field.get_Translation(I_AD_Field.COLUMNNAME_Name); ListElement pp = new ListElement(key, name); if (tableSeqs != null && tableSeqs.size() > 0 ) { @@ -359,7 +368,7 @@ public class CustomizeGridViewPanel extends Panel ValueNamePair pp = new ValueNamePair(null, null); lstGridMode.addItem(pp); - ValueNamePair[] list = MRefList.getList(Env.getCtx(), MTabCustomization.ISDISPLAYEDGRID_AD_Reference_ID, false); + ValueNamePair[] list = MRefList.getList(Env.getCtx(), X_AD_Tab_Customization.ISDISPLAYEDGRID_AD_Reference_ID, false); for (int i = 0;i < list.length; i++ ) { lstGridMode.addItem(list[i]); if (m_tabcust != null && list[i].getValue().equals(m_tabcust.getIsDisplayedGrid())) @@ -637,8 +646,7 @@ public class CustomizeGridViewPanel extends Panel return s; } } - - /** + /** * @author eslatis * */ @@ -652,6 +660,7 @@ public class CustomizeGridViewPanel extends Panel { } + @Override public void onEvent(Event event) throws Exception { if (event instanceof DropEvent) { @@ -669,7 +678,6 @@ public class CustomizeGridViewPanel extends Panel Listbox listTo = (Listbox)endItem.getListbox(); endIndex = yesList.getIndexOfItem(endItem); migrateLists (listFrom,listTo,endIndex); - }else if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList) { List selObjects = new ArrayList(); @@ -718,3 +726,4 @@ public class CustomizeGridViewPanel extends Panel } } //CustomizeGridViewPanel +