From 6361c1720176c8f8e569ed6b863b1cf6f016ffef Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 8 Jan 2014 08:21:10 -0500 Subject: [PATCH 01/14] IDEMPIERE-1677 error message when stopping with debian service script / based on patch from Thomas Bayen (tbayen) --- .../utils.unix/unix/idempiere_Debian.sh | 4 ++-- .../utils.unix/unix/idempiere_RedHat.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh index 8cde9d15ca..e1aab7a358 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh @@ -90,14 +90,14 @@ stop () { . $ENVFILE log_warning_msg "Trying direct kill with signal -15" # try direct kill with signal 15, then signal 9 - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "` + kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then log_success_msg "Service stopped with kill -15" else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "` + kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh index 17f73ebf93..86c6b5b0b3 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh @@ -84,14 +84,14 @@ stop () { source $ENVFILE echo "Trying direct kill with signal -15" # Adempiere didn't finish - try direct kill with signal 15, then signal 9 - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "` + kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then echo_success else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "` + kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then From b379c973ebd76b518c3e39cf6f3a6a731635463f Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 20 Feb 2014 18:54:37 +0800 Subject: [PATCH 02/14] IDEMPIERE-1765 Support print format jasper process in WPayPrint --- .../adempiere/webui/apps/form/WPayPrint.java | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java index 567a58f341..f724551c7b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java @@ -52,7 +52,10 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaymentBatch; +import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ServerProcessCtl; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -428,9 +431,22 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.CHECK, check.get_ID()); try { - File file = File.createTempFile("WPayPrint", null); - re.getPDF(file); - pdfList.add(file); + MPrintFormat format = re.getPrintFormat(); + if (format.getJasperProcess_ID() > 0) + { + ProcessInfo pi = new ProcessInfo("", format.getJasperProcess_ID()); + pi.setRecord_ID(check.get_ID()); + pi.setIsBatch(true); + + ServerProcessCtl.process(pi, null); + pdfList.add(pi.getPDFReport()); + } + else + { + File file = File.createTempFile("WPayPrint", null); + re.getPDF(file); + pdfList.add(file); + } } catch (Exception e) { @@ -479,9 +495,22 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID()); try { - File file = File.createTempFile("WPayPrint", null); - re.getPDF(file); - pdfList.add(file); + MPrintFormat format = re.getPrintFormat(); + if (format.getJasperProcess_ID() > 0) + { + ProcessInfo pi = new ProcessInfo("", format.getJasperProcess_ID()); + pi.setRecord_ID(check.get_ID()); + pi.setIsBatch(true); + + ServerProcessCtl.process(pi, null); + pdfList.add(pi.getPDFReport()); + } + else + { + File file = File.createTempFile("WPayPrint", null); + re.getPDF(file); + pdfList.add(file); + } } catch (Exception e) { From c3031074da5b357a7d36b88f3c3113a500fe79ca Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 24 Feb 2014 10:29:02 -0500 Subject: [PATCH 03/14] IDEMPIERE-1767 1003774 Business Partners are not being allowed to be imported with BP Groups in a 2pack. --- .../src/org/compiere/model/MBPGroup.java | 16 ++++++++++++++++ .../src/org/compiere/model/MBPartner.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MBPGroup.java b/org.adempiere.base/src/org/compiere/model/MBPGroup.java index ee6f9f8e24..9462399d8e 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPGroup.java +++ b/org.adempiere.base/src/org/compiere/model/MBPGroup.java @@ -26,6 +26,7 @@ import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Util; /** * Business Partner Group Model @@ -58,6 +59,21 @@ public class MBPGroup extends X_C_BP_Group return retValue; } // get + /** + * + * @param ctx + * @param C_BP_Group_ID + * @param trxName + * @return MBPGroup + */ + public static MBPGroup get (Properties ctx, int C_BP_Group_ID, String trxName) + { + if (Util.isEmpty(trxName, true)) + return get(ctx, C_BP_Group_ID); + else + return new MBPGroup (ctx, C_BP_Group_ID, trxName); + } + /** * Get Default MBPGroup * @param ctx context diff --git a/org.adempiere.base/src/org/compiere/model/MBPartner.java b/org.adempiere.base/src/org/compiere/model/MBPartner.java index 9c96bb9fda..622868f57f 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPartner.java +++ b/org.adempiere.base/src/org/compiere/model/MBPartner.java @@ -822,7 +822,7 @@ public class MBPartner extends X_C_BPartner if (getC_BP_Group_ID() == 0) m_group = MBPGroup.getDefault(getCtx()); else - m_group = MBPGroup.get(getCtx(), getC_BP_Group_ID()); + m_group = MBPGroup.get(getCtx(), getC_BP_Group_ID(), get_TrxName()); } return m_group; } // getBPGroup From 98943d645ba8261b1394459f0e197549667718fe Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 24 Feb 2014 10:30:19 -0500 Subject: [PATCH 04/14] IDEMPIERE-1767 1003774 Business Partners are not being allowed to be imported with BP Groups in a 2pack. / Peer review --- org.adempiere.base/src/org/compiere/model/MBPGroup.java | 2 +- org.adempiere.base/src/org/compiere/model/MBPartner.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MBPGroup.java b/org.adempiere.base/src/org/compiere/model/MBPGroup.java index 9462399d8e..4e02ef7172 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPGroup.java +++ b/org.adempiere.base/src/org/compiere/model/MBPGroup.java @@ -39,7 +39,7 @@ public class MBPGroup extends X_C_BP_Group /** * */ - private static final long serialVersionUID = 3037428352124938328L; + private static final long serialVersionUID = -5323639776872742839L; /** * Get MBPGroup from Cache diff --git a/org.adempiere.base/src/org/compiere/model/MBPartner.java b/org.adempiere.base/src/org/compiere/model/MBPartner.java index 622868f57f..913b1906ce 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPartner.java +++ b/org.adempiere.base/src/org/compiere/model/MBPartner.java @@ -47,7 +47,7 @@ public class MBPartner extends X_C_BPartner /** * */ - private static final long serialVersionUID = -3669895599574182217L; + private static final long serialVersionUID = -4308267492285903865L; /** * Get Empty Template Business Partner From 83d3912c7998febd9c2d55ad72795dda7419d208 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 26 Feb 2014 09:35:24 -0500 Subject: [PATCH 05/14] IDEMPIERE-1613 BOM drop window show error message when click to radio button / integrate patch from hieplq - peer reviewed by red1 --- .../oracle/201402260912_IDEMPIERE-1613.sql | 11 + .../201402260912_IDEMPIERE-1613.sql | 8 + .../adempiere/webui/apps/form/WBOMDrop.java | 400 +++++++++++------- 3 files changed, 260 insertions(+), 159 deletions(-) create mode 100644 migration/i2.0/oracle/201402260912_IDEMPIERE-1613.sql create mode 100644 migration/i2.0/postgresql/201402260912_IDEMPIERE-1613.sql diff --git a/migration/i2.0/oracle/201402260912_IDEMPIERE-1613.sql b/migration/i2.0/oracle/201402260912_IDEMPIERE-1613.sql new file mode 100644 index 0000000000..8441e9386a --- /dev/null +++ b/migration/i2.0/oracle/201402260912_IDEMPIERE-1613.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 26, 2014 2:58:39 PM CET +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Reference SET IsOrderByValue='Y',Updated=TO_DATE('2014-02-26 14:58:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=279 +; + +SELECT register_migration_script('201402260912_IDEMPIERE-1613.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201402260912_IDEMPIERE-1613.sql b/migration/i2.0/postgresql/201402260912_IDEMPIERE-1613.sql new file mode 100644 index 0000000000..5b82653dea --- /dev/null +++ b/migration/i2.0/postgresql/201402260912_IDEMPIERE-1613.sql @@ -0,0 +1,8 @@ +-- Feb 26, 2014 2:58:39 PM CET +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Reference SET IsOrderByValue='Y',Updated=TO_TIMESTAMP('2014-02-26 14:58:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=279 +; + +SELECT register_migration_script('201402260912_IDEMPIERE-1613.sql') FROM dual +; + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java index 53d34b0801..463d93e06f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java @@ -23,9 +23,10 @@ package org.adempiere.webui.apps.form; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Arrays; +import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; +import java.util.List; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; @@ -56,19 +57,22 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.compiere.util.Trx; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.HtmlBasedComponent; 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.Caption; -import org.zkoss.zul.Cell; import org.zkoss.zul.Decimalbox; +import org.zkoss.zul.Div; import org.zkoss.zul.Groupbox; -import org.zkoss.zul.Hbox; +import org.zkoss.zul.Hlayout; +import org.zkoss.zul.Layout; import org.zkoss.zul.Radio; import org.zkoss.zul.Radiogroup; import org.zkoss.zul.Separator; import org.zkoss.zul.Space; +import org.zkoss.zul.Vlayout; @@ -77,7 +81,7 @@ public class WBOMDrop extends ADForm implements EventListener /** * */ - private static final long serialVersionUID = -5065364554398280623L; + private static final long serialVersionUID = 8864346687201400591L; /** Product to create BOMs from */ private MProduct m_product; @@ -101,6 +105,12 @@ public class WBOMDrop extends ADForm implements EventListener /** List of all products */ private ArrayList m_productList = new ArrayList(); + /** list child panel of each checkbox */ + private ArrayList m_childPanelList = new ArrayList(); + + /** list panel container checkbox and child panel*/ + private ArrayList m_containPanel = new ArrayList(); + /** Alternative Group Lists */ private HashMap m_buttonGroups = new HashMap(); @@ -117,7 +127,7 @@ public class WBOMDrop extends ADForm implements EventListener private Groupbox grpSelectionPanel = new Groupbox(); private Groupbox grpSelectProd = new Groupbox(); - + private int indend = 20; public WBOMDrop() {} @@ -175,6 +185,18 @@ public class WBOMDrop extends ADForm implements EventListener m_qtyList = null; + if (m_childPanelList != null) { + m_childPanelList.clear(); + } + + m_childPanelList = null; + + if (m_containPanel != null) { + m_containPanel.clear(); + } + + m_containPanel = null; + if (m_buttonGroups != null) m_buttonGroups.clear(); m_buttonGroups = null; @@ -380,6 +402,8 @@ public class WBOMDrop extends ADForm implements EventListener m_productList.clear(); m_qtyList.clear(); m_buttonGroups.clear(); + m_childPanelList.clear(); + m_containPanel.clear(); this.appendChild(new Separator()); this.appendChild(grpSelectionPanel); @@ -403,10 +427,28 @@ public class WBOMDrop extends ADForm implements EventListener ;//this.setsetToolTipText(m_product.getDescription()); m_bomLine = 0; - addBOMLines(m_product, m_qty); + maxBomDeep = getDeepBom (m_product, 0); + addBOMLines(m_product, m_qty, grpSelectProd, 0); + updateBomList(); } } // createMainPanel + private int maxBomDeep = 0; + + private int getDeepBom (MProduct product, int curentBomDeep) { + int bomDeep = curentBomDeep; + if (product.isBOM()) { + MProductBOM[] bomLines = MProductBOM.getBOMLines(product); + for (MProductBOM bomLine : bomLines) { + int testBomDeep = getDeepBom(bomLine.getProduct(), curentBomDeep + 1); + if (testBomDeep > bomDeep) { + bomDeep = testBomDeep; + } + } + } + return bomDeep; + } + /** * Add BOM Lines to this. * Called recursively @@ -414,15 +456,20 @@ public class WBOMDrop extends ADForm implements EventListener * @param qty quantity */ - private void addBOMLines (MProduct product, BigDecimal qty) + private void addBOMLines (MProduct product, BigDecimal qty, Component parentPanel, int bomLevel) { MProductBOM[] bomLines = MProductBOM.getBOMLines(product); - + //sort, gourp alter product with together + Arrays.sort(bomLines, new Comparator() { + @Override + public int compare(MProductBOM arg0, MProductBOM arg1) { + return arg0.getBOMType().compareTo(arg1.getBOMType()); + } + }); + for (int i = 0; i < bomLines.length; i++) { - grpSelectProd.appendChild(new Separator()); - addBOMLine (bomLines[i], qty); - grpSelectProd.appendChild(new Separator()); + addBOMLine (bomLines[i], qty, parentPanel, bomLevel); } if (log.isLoggable(Level.FINE)) log.fine("#" + bomLines.length); @@ -435,7 +482,7 @@ public class WBOMDrop extends ADForm implements EventListener * @param qty quantity */ - private void addBOMLine (MProductBOM line, BigDecimal qty) + private void addBOMLine (MProductBOM line, BigDecimal qty, Component parentPanel, int bomLevel) { if (log.isLoggable(Level.FINE)) log.fine(line.toString()); String bomType = line.getBOMType(); @@ -449,11 +496,20 @@ public class WBOMDrop extends ADForm implements EventListener if (product == null) return; - if (product.isBOM() && product.isVerified()) - addBOMLines (product, lineQty); // recursive - else - addDisplay (line.getM_Product_ID(), - product.getM_Product_ID(), bomType, product.getName(), lineQty); + Layout producPanel = addDisplay (line.getM_Product_ID(), + product.getM_Product_ID(), bomType, product.getName(), lineQty, parentPanel, bomLevel); + m_containPanel.add(producPanel); + + if (product.isBOM() && product.isVerified()) { + Vlayout childPanel = createVlayoutPanel("100%"); + m_childPanelList.add(childPanel); + producPanel.appendChild(childPanel); + addBOMLines (product, lineQty, childPanel, bomLevel + 1); // recursive + + } else { + m_childPanelList.add(null); + } + } // addBOMLine /** @@ -465,91 +521,117 @@ public class WBOMDrop extends ADForm implements EventListener * @param lineQty qty */ - private void addDisplay (int parentM_Product_ID, - int M_Product_ID, String bomType, String name, BigDecimal lineQty) + private Layout addDisplay (int parentM_Product_ID, + int M_Product_ID, String bomType, String name, BigDecimal lineQty, Component parentPanel, int bomLevel) { if (log.isLoggable(Level.FINE)) log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",Qty=" + lineQty); - boolean selected = true; - - Hbox boxQty = new Hbox(); - boxQty.setWidth("100%"); - Cell cell = new Cell(); - cell.setWidth("10%"); - - if (MProductBOM.BOMTYPE_StandardPart.equals(bomType)) - { - String title = ""; - Checkbox cb = new Checkbox(); - cb.setLabel(title); - cb.setChecked(true); - cb.setEnabled(false); + boolean selected = false; - m_selectionList.add(cb); - cell.appendChild(cb); - } - else if (MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) - { - String title = Msg.getMsg(Env.getCtx(), "Optional"); - Checkbox cb = new Checkbox(); - cb.setLabel(title); - cb.setChecked(false); - selected = false; - cb.addEventListener(Events.ON_CHECK, this); - - m_selectionList.add(cb); - cell.appendChild(cb); - } - else // Alternative - { - String title = Msg.getMsg(Env.getCtx(), "Alternative") + " " + bomType; - Radio b = new Radio(); - b.setLabel(title); - String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType; - Radiogroup group = m_buttonGroups.get(groupName); - - if (group == null) - { - if (log.isLoggable(Level.FINE)) log.fine("ButtonGroup=" + groupName); - group = new Radiogroup(); - m_buttonGroups.put(groupName, group); - group.appendChild(b); - b.setSelected(true); // select first one - } - else - { - group.appendChild(b); - b.setSelected(false); - selected = false; - } - b.addEventListener(Events.ON_CLICK, this); - m_selectionList.add(b); - cell.appendChild(b); - } - boxQty.appendChild(cell); + //Container info of product (checkBox or radio box,product name, qty input) + Layout productPanel = null; + productPanel = createHlayoutPanel("100%"); - // Add to List & display + //Container productPanel because, this container will contain child of this product by vertical + Layout outerProductPanel = new Vlayout(); + outerProductPanel.appendChild(productPanel); + + // checkbox or radio button for select product + Div selectPanel = createDivPanel(25); + org.zkoss.zul.Checkbox rd = null; + boolean isStandard = MProductBOM.BOMTYPE_StandardPart.equals(bomType); + + if (MProductBOM.BOMTYPE_StandardPart.equals(bomType) || MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) + { + rd = new Checkbox(); + rd.setChecked(isStandard); + rd.setDisabled(isStandard); + selected = isStandard; + } else { // Alternative + rd = new Radio(); + } + selectPanel.appendChild(rd); + m_selectionList.add(rd); + productPanel.appendChild(selectPanel); + if (!isStandard) + rd.addEventListener(Events.ON_CHECK, this); + + Div rightInden = createDivPanel((maxBomDeep - bomLevel) * indend); + productPanel.appendChild(rightInden); + + // Add to List m_productList.add (new Integer(M_Product_ID)); - Decimalbox qty = new Decimalbox(); - qty.setValue(lineQty); - qty.setReadonly(!selected); - m_qtyList.add(qty); - + + // add product name + selectPanel = createDivPanel(200); Label label = new Label(name); HtmlBasedComponent c = (HtmlBasedComponent) label.rightAlign(); c.setStyle(c.getStyle() + ";margin-right: 5px"); - cell = new Cell(); - cell.setWidth("40%"); - cell.appendChild(c); - boxQty.appendChild(cell); - cell = new Cell(); - cell.setWidth("50%"); - cell.appendChild(qty); - boxQty.appendChild(cell); + selectPanel.appendChild(c); + productPanel.appendChild(selectPanel); - grpSelectProd.appendChild(boxQty); + // qty input control + selectPanel = createDivPanel(200); + Decimalbox qty = new Decimalbox(); + qty.setValue(lineQty); + selectPanel.appendChild(qty); + productPanel.appendChild(selectPanel); + m_qtyList.add(qty); + + // outer container for indent contain index box and product panel + Layout outerContainer = createHlayoutPanel("100%"); + parentPanel.appendChild(outerContainer); + + if (!parentPanel.equals(grpSelectProd)) { + // indent + Div cellInden = createDivPanel(indend); + outerContainer.appendChild(cellInden); + } + + // add product panel to parent, with radio, add to radio group + if (MProductBOM.BOMTYPE_StandardPart.equals(bomType) || MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) { + outerContainer.appendChild(outerProductPanel); + } else { + String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType; + Radiogroup group = m_buttonGroups.get(groupName); + + if (group == null) { + if (log.isLoggable(Level.FINE)) log.fine("ButtonGroup=" + groupName); + group = new Radiogroup(); + m_buttonGroups.put(groupName, group); + rd.setChecked(true); + selected = true; + + outerContainer.appendChild(group); + } + group.appendChild(outerProductPanel); + } + + qty.setReadonly(!selected); + return outerProductPanel; } // addDisplay + private Div createDivPanel (int with) { + Div divPanel = new Div (); + divPanel.setWidth(String.format("%1$spx", with)); + divPanel.setStyle("padding-right:0;padding-left:0"); + return divPanel; + } + + private Hlayout createHlayoutPanel (String width) { + Hlayout layout = new Hlayout(); + layout.setSpacing("0"); + layout.setWidth(width); + return layout; + } + + private Vlayout createVlayoutPanel (String width) { + Vlayout layout = new Vlayout(); + layout.setSpacing("0"); + layout.setWidth(width); + return layout; + } + /************************************************************************** * Action Listener * @param e event @@ -561,39 +643,32 @@ public class WBOMDrop extends ADForm implements EventListener Object source = e.getTarget(); // Toggle Qty Enabled - if (source instanceof Checkbox || source instanceof Radio) + if (source instanceof org.zkoss.zul.Checkbox) { - cmd_selection (source); - // need to de-select the others in group - if (source instanceof Radio) - { - // find Button Group - Iterator it = m_buttonGroups.values().iterator(); + org.zkoss.zul.Checkbox chbSource = (org.zkoss.zul.Checkbox)source; + // set enable or disable qty input of this source + int index = m_selectionList.indexOf(chbSource); + m_qtyList.get(index).setReadonly(!chbSource.isChecked()); + + // disable qty of other radio in group + if (chbSource instanceof Radio) { + // find Button Group + Radiogroup group = ((Radio)chbSource).getRadiogroup(); + List lsRadio = group.getItems(); - while (it.hasNext()) - { - Radiogroup group = it.next(); - Enumeration en = (Enumeration) group.getChildren(); - - while (en.hasMoreElements()) - { - // We found the group - if (source == en.nextElement()) - { - Enumeration info = (Enumeration) group.getChildren(); - - while (info.hasMoreElements()) - { - Object infoObj = (Object)info.nextElement(); - if (source != infoObj) - cmd_selection(infoObj); - } - } + for (Radio testRadio : lsRadio) { + if (!chbSource.equals(testRadio)) { + // fix unknow error. at fisrt event, prev radio checkbox also is checked + testRadio.setChecked(false); + // set qty input of uncheck radio button + index = m_selectionList.indexOf(testRadio); + m_qtyList.get(index).setReadonly(true); } } } - } // JCheckBox or JRadioButton + updateBomList(); + } // JCheckBox or JRadioButton // Product / Qty else if (source == productField || source == productQty) { @@ -712,45 +787,46 @@ public class WBOMDrop extends ADForm implements EventListener confirmPanel.setEnabled("Ok", OK); } // actionPerformed + /** + * update display of bom tree + * for item is not selected, hidden child of it. + */ + protected void updateBomList() { + int index = 0; + for(org.zkoss.zul.Checkbox chbSource : m_selectionList) { + index = m_selectionList.indexOf(chbSource); + Layout childPanel = m_childPanelList.get(index); + Layout containPanel = m_containPanel.get(index); + + if (childPanel != null && chbSource.isChecked() && !containPanel.getChildren().contains(childPanel)) { + containPanel.appendChild(childPanel); + } else if (childPanel != null && !chbSource.isChecked() && containPanel.getChildren().contains(childPanel)) { + childPanel.detach(); + } + } + // add or remove child panel of selected radio + } + + private List displayList = new ArrayList (); + /** + * return list of checkbox is display + * @return + */ + private List getDisplayList () { + displayList.clear(); + for(org.zkoss.zul.Checkbox chbSource : m_selectionList) { + if (chbSource.getPage() != null) { + displayList.add(chbSource); + } + } + return displayList; + } + /** * Enable/disable qty based on selection * @param source JCheckBox or JRadioButton */ - - private void cmd_selection (Object source) - { - for (int i = 0; i < m_selectionList.size(); i++) - { - if (source == m_selectionList.get(i)) - { - boolean selected = isSelectionSelected(source); - Decimalbox qty = m_qtyList.get(i); - qty.setReadonly(!selected); - return; - } - } - log.log(Level.SEVERE, "not found - " + source); - } // cmd_selection - - /** - * Is Selection Selected - * @param source CheckBox or RadioButton - * @return true if selected - */ - - private boolean isSelectionSelected (Object source) - { - boolean retValue = false; - if (source instanceof Checkbox) - retValue = ((Checkbox)source).isChecked(); - else if (source instanceof Radio) - retValue = ((Radio)source).isChecked(); - else - log.log(Level.SEVERE, "Not valid - " + source); - - return retValue; - } // isSelected private boolean onSave() { @@ -839,10 +915,12 @@ public class WBOMDrop extends ADForm implements EventListener int lineCount = 0; try { - //for all bom lines - for (int i = 0; i < m_selectionList.size(); i++) + //for all display bom lines + List displayList = getDisplayList (); + for (org.zkoss.zul.Checkbox displayChb : displayList) { - if (isSelectionSelected(m_selectionList.get(i))) + int i = m_selectionList.indexOf(displayChb); + if (m_selectionList.get(i).isChecked()) { BigDecimal qty = m_qtyList.get(i).getValue(); int M_Product_ID = m_productList.get(i).intValue(); @@ -893,9 +971,11 @@ public class WBOMDrop extends ADForm implements EventListener // for all bom lines try { - for (int i = 0; i < m_selectionList.size(); i++) + List displayList = getDisplayList (); + for (org.zkoss.zul.Checkbox displayChb : displayList) { - if (isSelectionSelected(m_selectionList.get(i))) + int i = m_selectionList.indexOf(displayChb); + if (m_selectionList.get(i).isChecked()) { BigDecimal qty = m_qtyList.get(i).getValue(); int M_Product_ID = m_productList.get(i).intValue(); @@ -944,9 +1024,11 @@ public class WBOMDrop extends ADForm implements EventListener // for all bom lines try { - for (int i = 0; i < m_selectionList.size(); i++) + List displayList = getDisplayList (); + for (org.zkoss.zul.Checkbox displayChb : displayList) { - if (isSelectionSelected(m_selectionList.get(i))) + int i = m_selectionList.indexOf(displayChb); + if (m_selectionList.get(i).isChecked()) { BigDecimal qty = m_qtyList.get(i).getValue(); int M_Product_ID = m_productList.get(i).intValue(); From a66efa035009e0e5df469b6a383747a39514dce0 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Wed, 26 Feb 2014 11:34:41 +0800 Subject: [PATCH 06/14] IDEMPIERE-1598 Window Price List Schema - field Discount Type must be Schema Type --- db/ddlutils/data/AD_FIELD.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/ddlutils/data/AD_FIELD.xml b/db/ddlutils/data/AD_FIELD.xml index ea8937d39e..85d8e237a6 100644 --- a/db/ddlutils/data/AD_FIELD.xml +++ b/db/ddlutils/data/AD_FIELD.xml @@ -14090,7 +14090,7 @@ Invoices and Payment Allocations determine the Open Balance (i.e. not Orders or - + From 41c753a6058e51b31c3f825ba98d79fce794c070 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Wed, 26 Feb 2014 12:32:55 +0800 Subject: [PATCH 07/14] IDEMPIERE-1599 Correct naming for acct wildcard dimensions --- db/ddlutils/data/AD_COLUMN.xml | 112 ++++++------- db/ddlutils/data/AD_ELEMENT.xml | 8 +- db/ddlutils/data/AD_FIELD.xml | 150 +++++++++--------- db/ddlutils/data/AD_PRINTFORMATITEM.xml | 12 +- db/ddlutils/data/AD_REF_LIST.xml | 8 +- .../oracle/201402261230_IDEMPIERE-1599.sql | 50 ++++++ .../201402261230_IDEMPIERE-1599.sql | 47 ++++++ 7 files changed, 242 insertions(+), 145 deletions(-) create mode 100644 migration/i2.0/oracle/201402261230_IDEMPIERE-1599.sql create mode 100644 migration/i2.0/postgresql/201402261230_IDEMPIERE-1599.sql diff --git a/db/ddlutils/data/AD_COLUMN.xml b/db/ddlutils/data/AD_COLUMN.xml index d0149870a2..5f67a3726f 100644 --- a/db/ddlutils/data/AD_COLUMN.xml +++ b/db/ddlutils/data/AD_COLUMN.xml @@ -217,8 +217,8 @@ There are two reasons for de-activating and not deleting records: - - + + @@ -260,7 +260,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -660,7 +660,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -1303,7 +1303,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -1831,7 +1831,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -4279,7 +4279,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -4558,7 +4558,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -5152,7 +5152,7 @@ There are two reasons for de-activating and not deleting records: If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).]]> - + @@ -5269,7 +5269,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -5924,7 +5924,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -6468,7 +6468,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -6621,7 +6621,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -7123,7 +7123,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + @@ -7140,7 +7140,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + - + @@ -7534,7 +7534,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8127,7 +8127,7 @@ There are two reasons for de-activating and not deleting records: (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -8244,7 +8244,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8277,7 +8277,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8421,7 +8421,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8499,7 +8499,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8683,7 +8683,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -9108,7 +9108,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -9395,7 +9395,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -9500,7 +9500,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -9931,7 +9931,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -9963,7 +9963,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -10044,7 +10044,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -10082,7 +10082,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -10912,10 +10912,10 @@ Examples:
@Name@>J
Strings may be in single quotes (optional)]]>
- + - + - + @@ -11315,7 +11315,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -11981,7 +11981,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -12157,7 +12157,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -12489,8 +12489,8 @@ There are two reasons for de-activating and not deleting records: - - + + @@ -12576,7 +12576,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -13101,7 +13101,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -13413,7 +13413,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -13481,7 +13481,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + @@ -13923,10 +13923,10 @@ Strings may be in single quotes (optional)]]> - + - + @@ -13945,13 +13945,13 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -14240,7 +14240,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15287,7 +15287,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15575,7 +15575,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15996,7 +15996,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -16119,7 +16119,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + @@ -16420,7 +16420,7 @@ There are two reasons for de-activating and not deleting records: If the document type of your document has no automatic document sequence defined, the field is empty if you create a new document. This is for documents which usually have an external number (like vendor invoice). If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).]]> - + @@ -16464,7 +16464,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -16526,7 +16526,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -16619,7 +16619,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -16953,7 +16953,7 @@ There are two reasons for de-activating and not deleting records: - + diff --git a/db/ddlutils/data/AD_ELEMENT.xml b/db/ddlutils/data/AD_ELEMENT.xml index 7f87f1dfa3..ca776eefdf 100644 --- a/db/ddlutils/data/AD_ELEMENT.xml +++ b/db/ddlutils/data/AD_ELEMENT.xml @@ -61,7 +61,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -2002,7 +2002,7 @@ Asset - create Project Asset transactions - ability to issue material]]> - + @@ -2034,7 +2034,7 @@ If the pattern for your language is not correct, please create a Adempiere suppo - + diff --git a/db/ddlutils/data/AD_FIELD.xml b/db/ddlutils/data/AD_FIELD.xml index 85d8e237a6..1f139db78d 100644 --- a/db/ddlutils/data/AD_FIELD.xml +++ b/db/ddlutils/data/AD_FIELD.xml @@ -345,7 +345,7 @@ There are two reasons for de-activating and not deleting records: (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]>
- + @@ -419,7 +419,7 @@ Strings may be in single quotes (optional)]]> - + @@ -684,7 +684,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -1155,7 +1155,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -1425,7 +1425,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -1961,7 +1961,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -4029,7 +4029,7 @@ There are two reasons for de-activating and not deleting records: - + ". @@ -4376,7 +4376,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -4627,7 +4627,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + @@ -4856,7 +4856,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -5153,7 +5153,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + - + - + @@ -6183,7 +6183,7 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -6577,7 +6577,7 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -7044,7 +7044,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -7247,7 +7247,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -7469,10 +7469,10 @@ There are two reasons for de-activating and not deleting records: - - - - + + + + @@ -7578,7 +7578,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -7658,7 +7658,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -7697,9 +7697,9 @@ There are two reasons for de-activating and not deleting records: (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - - - + + + @@ -7822,7 +7822,7 @@ If you leave the search key empty, the system automatically creates a numeric nu - + @@ -7856,7 +7856,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -7874,7 +7874,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -8408,7 +8408,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -8549,7 +8549,7 @@ There are two reasons for de-activating and not deleting records: - + - + - - + + ". @@ -9449,7 +9449,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -9556,7 +9556,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -9577,7 +9577,7 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -10045,10 +10045,10 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -10120,8 +10120,8 @@ If you leave the search key empty, the system automatically creates a numeric nu - - + + @@ -10174,7 +10174,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -10529,8 +10529,8 @@ There are two reasons for de-activating and not deleting records: - - + + @@ -11151,7 +11151,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -11171,7 +11171,7 @@ If the document type of your document has no automatic document sequence defined - + @@ -11555,7 +11555,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -11770,7 +11770,7 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -11931,8 +11931,8 @@ There are two reasons for de-activating and not deleting records: (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - - + + @@ -12038,7 +12038,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -12093,7 +12093,7 @@ The callout is a Java class implementing org.compiere.model.Callout and a method - + @@ -12253,7 +12253,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -12578,7 +12578,7 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -12963,7 +12963,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -13404,7 +13404,7 @@ If you create a new Organization, you may supply a Organization Type. If you se - + @@ -14729,7 +14729,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -14884,7 +14884,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -14967,7 +14967,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -14975,7 +14975,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15262,7 +15262,7 @@ There are two reasons for de-activating and not deleting records: (1) The system requires the record for audit purposes. (2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.]]> - + @@ -15274,7 +15274,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15327,7 +15327,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15567,7 +15567,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15578,10 +15578,10 @@ There are two reasons for de-activating and not deleting records: - + - + @@ -15780,7 +15780,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -15861,7 +15861,7 @@ There are two reasons for de-activating and not deleting records: - + @@ -16153,10 +16153,10 @@ There are two reasons for de-activating and not deleting records: - + - + diff --git a/db/ddlutils/data/AD_PRINTFORMATITEM.xml b/db/ddlutils/data/AD_PRINTFORMATITEM.xml index da4939bbb4..11ed3babe0 100644 --- a/db/ddlutils/data/AD_PRINTFORMATITEM.xml +++ b/db/ddlutils/data/AD_PRINTFORMATITEM.xml @@ -545,8 +545,8 @@ - - + + @@ -1186,8 +1186,8 @@ - - + + @@ -1214,8 +1214,8 @@ - - + + diff --git a/db/ddlutils/data/AD_REF_LIST.xml b/db/ddlutils/data/AD_REF_LIST.xml index 9dd3f4afd7..d0dc987f8b 100644 --- a/db/ddlutils/data/AD_REF_LIST.xml +++ b/db/ddlutils/data/AD_REF_LIST.xml @@ -86,7 +86,7 @@ - + @@ -399,8 +399,8 @@ - - + + @@ -774,7 +774,7 @@ - + diff --git a/migration/i2.0/oracle/201402261230_IDEMPIERE-1599.sql b/migration/i2.0/oracle/201402261230_IDEMPIERE-1599.sql new file mode 100644 index 0000000000..2cc47d9509 --- /dev/null +++ b/migration/i2.0/oracle/201402261230_IDEMPIERE-1599.sql @@ -0,0 +1,50 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 26, 2014 11:50:10 AM SGT +-- IDEMPIERE-1599 Correct naming for acct wildcard dimensions +UPDATE AD_Ref_List SET Description='User Element List 1', Name='User Element List 1',Updated=TO_DATE('2014-02-26 11:50:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=282 +; + +-- Feb 26, 2014 11:50:32 AM SGT +UPDATE AD_Ref_List SET Description='User Element List 2', Name='User Element List 2',Updated=TO_DATE('2014-02-26 11:50:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=283 +; + +-- Feb 26, 2014 11:50:54 AM SGT +UPDATE AD_Ref_List SET Name='User Column 1',Updated=TO_DATE('2014-02-26 11:50:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=796 +; + +-- Feb 26, 2014 11:51:00 AM SGT +UPDATE AD_Ref_List SET Name='User Column 2',Updated=TO_DATE('2014-02-26 11:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=797 +; + +-- Feb 26, 2014 11:51:46 AM SGT +UPDATE AD_Ref_List SET Description='User Column 1',Updated=TO_DATE('2014-02-26 11:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=796 +; + +-- Feb 26, 2014 11:51:48 AM SGT +UPDATE AD_Ref_List SET Description='User Column 2',Updated=TO_DATE('2014-02-26 11:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=797 +; + +-- Feb 26, 2014 11:52:30 AM SGT +UPDATE AD_Ref_List SET Description='User Element List 1', Name='User Element List 1',Updated=TO_DATE('2014-02-26 11:52:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53430 +; + +-- Feb 26, 2014 11:52:38 AM SGT +UPDATE AD_Ref_List SET Name='User Element List 2',Updated=TO_DATE('2014-02-26 11:52:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53431 +; + +-- Feb 26, 2014 11:52:49 AM SGT +UPDATE AD_Ref_List SET Description='User Column 1', Name='User Column 1',Updated=TO_DATE('2014-02-26 11:52:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53432 +; + +-- Feb 26, 2014 11:52:52 AM SGT +UPDATE AD_Ref_List SET Name='User Column 2',Updated=TO_DATE('2014-02-26 11:52:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53433 +; + +-- Feb 26, 2014 11:52:54 AM SGT +UPDATE AD_Ref_List SET Description='User Column 2',Updated=TO_DATE('2014-02-26 11:52:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53433 +; + +SELECT register_migration_script('201402261230_IDEMPIERE-1599.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i2.0/postgresql/201402261230_IDEMPIERE-1599.sql b/migration/i2.0/postgresql/201402261230_IDEMPIERE-1599.sql new file mode 100644 index 0000000000..3043725d3d --- /dev/null +++ b/migration/i2.0/postgresql/201402261230_IDEMPIERE-1599.sql @@ -0,0 +1,47 @@ +-- Feb 26, 2014 11:50:10 AM SGT +-- IDEMPIERE-1599 Correct naming for acct wildcard dimensions +UPDATE AD_Ref_List SET Description='User Element List 1', Name='User Element List 1',Updated=TO_TIMESTAMP('2014-02-26 11:50:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=282 +; + +-- Feb 26, 2014 11:50:32 AM SGT +UPDATE AD_Ref_List SET Description='User Element List 2', Name='User Element List 2',Updated=TO_TIMESTAMP('2014-02-26 11:50:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=283 +; + +-- Feb 26, 2014 11:50:54 AM SGT +UPDATE AD_Ref_List SET Name='User Column 1',Updated=TO_TIMESTAMP('2014-02-26 11:50:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=796 +; + +-- Feb 26, 2014 11:51:00 AM SGT +UPDATE AD_Ref_List SET Name='User Column 2',Updated=TO_TIMESTAMP('2014-02-26 11:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=797 +; + +-- Feb 26, 2014 11:51:46 AM SGT +UPDATE AD_Ref_List SET Description='User Column 1',Updated=TO_TIMESTAMP('2014-02-26 11:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=796 +; + +-- Feb 26, 2014 11:51:48 AM SGT +UPDATE AD_Ref_List SET Description='User Column 2',Updated=TO_TIMESTAMP('2014-02-26 11:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=797 +; + +-- Feb 26, 2014 11:52:30 AM SGT +UPDATE AD_Ref_List SET Description='User Element List 1', Name='User Element List 1',Updated=TO_TIMESTAMP('2014-02-26 11:52:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53430 +; + +-- Feb 26, 2014 11:52:38 AM SGT +UPDATE AD_Ref_List SET Name='User Element List 2',Updated=TO_TIMESTAMP('2014-02-26 11:52:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53431 +; + +-- Feb 26, 2014 11:52:49 AM SGT +UPDATE AD_Ref_List SET Description='User Column 1', Name='User Column 1',Updated=TO_TIMESTAMP('2014-02-26 11:52:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53432 +; + +-- Feb 26, 2014 11:52:52 AM SGT +UPDATE AD_Ref_List SET Name='User Column 2',Updated=TO_TIMESTAMP('2014-02-26 11:52:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53433 +; + +-- Feb 26, 2014 11:52:54 AM SGT +UPDATE AD_Ref_List SET Description='User Column 2',Updated=TO_TIMESTAMP('2014-02-26 11:52:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=53433 +; + +SELECT register_migration_script('201402261230_IDEMPIERE-1599.sql') FROM dual +; \ No newline at end of file From a1332d890a52e032d181a8ebcda13f01478d9ec5 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 26 Feb 2014 14:08:06 +0800 Subject: [PATCH 08/14] 1003759 How to re-post a document if Charge type is changed in Product? ( related to IDEMPIERE-216 Average Costing: Zero Costing Item From Vendor but for standard costing ). --- org.adempiere.base/src/org/compiere/acct/Doc_InOut.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java index 59d72ef6de..459d16e2bb 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java @@ -412,6 +412,7 @@ public class Doc_InOut extends Doc int C_OrderLine_ID = line.getC_OrderLine_ID(); if (C_OrderLine_ID > 0) { + orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName()); MOrderLandedCostAllocation[] allocations = MOrderLandedCostAllocation.getOfOrderLine(C_OrderLine_ID, getTrxName()); for(MOrderLandedCostAllocation allocation : allocations) { @@ -421,15 +422,15 @@ public class Doc_InOut extends Doc landedCost = landedCost.add(amt); } } + //get costing method for product if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) || MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod) || MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) ) - { + { // Low - check if c_orderline_id is valid - if (C_OrderLine_ID > 0) + if (orderLine != null) { - orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName()); // Elaine 2008/06/26 C_Currency_ID = orderLine.getC_Currency_ID(); // From 38f64d4f54121667b4570521f1c9c2784487ab23 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 26 Feb 2014 15:01:52 +0800 Subject: [PATCH 09/14] 1003759 How to re-post a document if Charge type is changed in Product? ( related to IDEMPIERE-216 Average Costing: Zero Costing Item From Vendor but for standard costing ). --- .../src/org/compiere/acct/Doc_MatchPO.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index 369e1aaa10..419fe010b1 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -295,9 +295,17 @@ public class Doc_MatchPO extends Doc // No Costs yet - no PPV if (costs == null || costs.signum() == 0) { - p_Error = "Resubmit - No Costs for " + product.getName(); - log.log(Level.SEVERE, p_Error); - return null; + //ok if purchase price is zero too + if (m_oLine.getPriceActual().signum() == 0) + { + costs = BigDecimal.ZERO; + } + else + { + p_Error = "Resubmit - No Costs for " + product.getName(); + log.log(Level.SEVERE, p_Error); + return null; + } } // Difference From aea4e1017a55cab800b25a792767ea5ede36c243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa?= Date: Wed, 26 Feb 2014 09:51:15 -0500 Subject: [PATCH 10/14] IDEMPIERE-1769 RMA Line with product and charge --- .../src/org/adempiere/model/CalloutRMA.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java index 586fb5f66d..5fc2be2af1 100644 --- a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java +++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java @@ -85,10 +85,14 @@ public class CalloutRMA extends CalloutEngine { if (invoiceLine_ID != 0) { MInvoiceLine invoiceLine = new MInvoiceLine(ctx, invoiceLine_ID, null); - if (invoiceLine.getM_Product_ID() != 0) + if (invoiceLine.getM_Product_ID() != 0) { mTab.setValue(MRMALine.COLUMNNAME_M_Product_ID, invoiceLine.getM_Product_ID()); - if (invoiceLine.getC_Charge_ID() != 0) + mTab.setValue(MRMALine.COLUMNNAME_C_Charge_ID, null); + } + if (invoiceLine.getC_Charge_ID() != 0) { mTab.setValue(MRMALine.COLUMNNAME_C_Charge_ID, invoiceLine.getC_Charge_ID()); + mTab.setValue(MRMALine.COLUMNNAME_M_Product_ID, null); + } mTab.setValue(MRMALine.COLUMNNAME_Qty, invoiceLine.getQtyEntered()); mTab.setValue(MRMALine.COLUMNNAME_Amt, invoiceLine.getPriceEntered()); mTab.setValue(MRMALine.COLUMNNAME_C_Tax_ID, invoiceLine.getC_Tax_ID()); @@ -102,10 +106,14 @@ public class CalloutRMA extends CalloutEngine { else if (iol.getC_OrderLine_ID() != 0) { MOrderLine orderLine = new MOrderLine(ctx, iol.getC_OrderLine_ID(), null); - if (orderLine.getM_Product_ID() != 0) + if (orderLine.getM_Product_ID() != 0) { mTab.setValue(MRMALine.COLUMNNAME_M_Product_ID, orderLine.getM_Product_ID()); - if (orderLine.getC_Charge_ID() != 0) + mTab.setValue(MRMALine.COLUMNNAME_C_Charge_ID, null); + } + if (orderLine.getC_Charge_ID() != 0) { mTab.setValue(MRMALine.COLUMNNAME_C_Charge_ID, orderLine.getC_Charge_ID()); + mTab.setValue(MRMALine.COLUMNNAME_M_Product_ID, null); + } mTab.setValue(MRMALine.COLUMNNAME_Qty, orderLine.getQtyEntered()); mTab.setValue(MRMALine.COLUMNNAME_Amt, orderLine.getPriceEntered()); mTab.setValue(MRMALine.COLUMNNAME_C_Tax_ID, orderLine.getC_Tax_ID()); From fbdb0e0efe74521a7e764640e3dcf2f0a73081f5 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 26 Feb 2014 10:07:07 -0500 Subject: [PATCH 11/14] IDEMPIERE-1606 initial client testing > email improvements --- .../oracle/201402111604-IDEMPIERE-1606.sql | 14 +++++ .../201402111604-IDEMPIERE-1606.sql | 11 ++++ .../adempiere/process/InitialClientSetup.java | 22 ++++++- .../src/org/compiere/model/MSetup.java | 61 ++++++++++++------- 4 files changed, 86 insertions(+), 22 deletions(-) create mode 100644 migration/i2.0/oracle/201402111604-IDEMPIERE-1606.sql create mode 100644 migration/i2.0/postgresql/201402111604-IDEMPIERE-1606.sql diff --git a/migration/i2.0/oracle/201402111604-IDEMPIERE-1606.sql b/migration/i2.0/oracle/201402111604-IDEMPIERE-1606.sql new file mode 100644 index 0000000000..93006eff3d --- /dev/null +++ b/migration/i2.0/oracle/201402111604-IDEMPIERE-1606.sql @@ -0,0 +1,14 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 11, 2014 2:29:31 AM ICT +-- IDEMPIERE-1606:initial client testing > email improvements +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200074,'a9304d73-8f35-487a-a020-fd24c98bb9db',10,'N','D','Administrative User Email','AdminUserEmail',60,'N',45,NULL,'Y',100,TO_DATE('2014-02-11 02:29:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-02-11 02:29:30','YYYY-MM-DD HH24:MI:SS'),0,'N',0,53161) +; + +-- Feb 11, 2014 2:32:28 AM ICT +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200075,'422bd18a-9354-4bb6-9fcd-9c7be9985f9a',10,'N','D','Normal User Email','NormalUserEmail',60,'N',55,NULL,'Y',100,TO_DATE('2014-02-11 02:32:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-02-11 02:32:28','YYYY-MM-DD HH24:MI:SS'),0,'N',0,53161) +; + +SELECT register_migration_script('201402111604-IDEMPIERE-1606.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201402111604-IDEMPIERE-1606.sql b/migration/i2.0/postgresql/201402111604-IDEMPIERE-1606.sql new file mode 100644 index 0000000000..8cbdda94db --- /dev/null +++ b/migration/i2.0/postgresql/201402111604-IDEMPIERE-1606.sql @@ -0,0 +1,11 @@ +-- Feb 11, 2014 2:29:31 AM ICT +-- IDEMPIERE-1606:initial client testing > email improvements +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200074,'a9304d73-8f35-487a-a020-fd24c98bb9db',10,'N','D','Administrative User Email','AdminUserEmail',60,'N',45,NULL,'Y',100,TO_TIMESTAMP('2014-02-11 02:29:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-02-11 02:29:30','YYYY-MM-DD HH24:MI:SS'),0,'N',0,53161) +; + +-- Feb 11, 2014 2:32:28 AM ICT +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Process_ID) VALUES ('N',200075,'422bd18a-9354-4bb6-9fcd-9c7be9985f9a',10,'N','D','Normal User Email','NormalUserEmail',60,'N',55,NULL,'Y',100,TO_TIMESTAMP('2014-02-11 02:32:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-02-11 02:32:28','YYYY-MM-DD HH24:MI:SS'),0,'N',0,53161) +; + +SELECT register_migration_script('201402111604-IDEMPIERE-1606.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java b/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java index 5b7e1d280a..af96f3b813 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java @@ -36,12 +36,15 @@ import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MCity; import org.compiere.model.MCurrency; import org.compiere.model.MSetup; +import org.compiere.model.MSysConfig; import org.compiere.print.PrintUtil; import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.DB; +import org.compiere.util.EMail; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; +import org.compiere.util.Util; /** * Process to create a new client (tenant) @@ -76,6 +79,8 @@ public class InitialClientSetup extends SvrProcess private boolean p_IsUseCampaignDimension = false; private boolean p_IsUseSalesRegionDimension = false; private String p_CoAFile = null; + private String p_AdminUserEmail = null; + private String p_NormalUserEmail = null; /** WindowNo for this process */ public static final int WINDOW_THIS_PROCESS = 9999; @@ -137,6 +142,10 @@ public class InitialClientSetup extends SvrProcess p_EMail = (String) para[i].getParameter(); else if (name.equals("TaxID")) p_TaxID = (String) para[i].getParameter(); + else if (name.equals("AdminUserEmail")) + p_AdminUserEmail = (String) para[i].getParameter(); + else if (name.equals("NormalUserEmail")) + p_NormalUserEmail = (String) para[i].getParameter(); else log.log(Level.SEVERE, "Unknown Parameter: " + name); } @@ -205,6 +214,17 @@ public class InitialClientSetup extends SvrProcess } // Validate existence and read permissions on CoA file + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + if (email_login) { + if (Util.isEmpty(p_AdminUserEmail)) + throw new AdempiereException("AdminUserEmail is required"); + if (! EMail.validate(p_AdminUserEmail)) + throw new AdempiereException("AdminUserEmail " + p_AdminUserEmail + " is incorrect"); + if (Util.isEmpty(p_NormalUserEmail)) + throw new AdempiereException("NormalUserEmail is required"); + if (! EMail.validate(p_NormalUserEmail)) + throw new AdempiereException("NormalUserEmail " + p_NormalUserEmail + " is incorrect"); + } File coaFile = new File(p_CoAFile); if (!coaFile.exists()) throw new AdempiereException("CoaFile " + p_CoAFile + " does not exist"); @@ -219,7 +239,7 @@ public class InitialClientSetup extends SvrProcess MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS); if (! ms.createClient(p_ClientName, p_OrgValue, p_OrgName, p_AdminUserName, p_NormalUserName - , p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID)) { + , p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail)) { ms.rollback(); throw new AdempiereException("Create client failed"); } diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index e3254d7c47..dafad001f6 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -27,6 +27,7 @@ import java.sql.SQLException; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.util.ProcessUtil; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoParameter; @@ -108,7 +109,8 @@ public final class MSetup * @return true if created */ public boolean createClient (String clientName, String orgValue, String orgName, - String userClient, String userOrg, String phone, String phone2, String fax, String eMail, String taxID) + String userClient, String userOrg, String phone, String phone2, String fax, String eMail, String taxID, + String adminEmail, String userEmail) { log.info(clientName); m_trx.start(); @@ -276,19 +278,22 @@ public final class MSetup * - Client * - Org */ + MUser clientAdminUser = new MUser(m_ctx, 0, m_trx.getTrxName()); + name = userClient; if (name == null || name.length() == 0) name = m_clientName + "Client"; - AD_User_ID = getNextID(AD_Client_ID, "AD_User"); - AD_User_Name = name; - name = DB.TO_STRING(name); - sql = "INSERT INTO AD_User(" + m_stdColumns + ",AD_User_ID," - + "Name,Description,Password)" - + " VALUES (" + m_stdValues + "," + AD_User_ID + "," - + name + "," + name + "," + name + ")"; - no = DB.executeUpdate(sql, m_trx.getTrxName()); - if (no != 1) - { + + clientAdminUser.setPassword(name); + clientAdminUser.setDescription(name); + clientAdminUser.setName(name); + clientAdminUser.setAD_Client_ID(AD_Client_ID); + clientAdminUser.setAD_Org_ID(0); + clientAdminUser.setEMail(adminEmail); + + try { + clientAdminUser.saveEx(); + } catch (AdempiereException ex) { String err = "Admin User NOT inserted - " + AD_User_Name; log.log(Level.SEVERE, err); m_info.append(err); @@ -296,22 +301,33 @@ public final class MSetup m_trx.close(); return false; } + + AD_User_ID = clientAdminUser.getAD_User_ID(); + AD_User_Name = name; + // Info m_info.append(Msg.translate(m_lang, "AD_User_ID")).append("=").append(AD_User_Name).append("/").append(AD_User_Name).append("\n"); + MUser clientUser = new MUser(m_ctx, 0, m_trx.getTrxName()); + + name = userClient; + if (name == null || name.length() == 0) + name = m_clientName + "Client"; + name = userOrg; if (name == null || name.length() == 0) name = m_clientName + "Org"; - AD_User_U_ID = getNextID(AD_Client_ID, "AD_User"); - AD_User_U_Name = name; - name = DB.TO_STRING(name); - sql = "INSERT INTO AD_User(" + m_stdColumns + ",AD_User_ID," - + "Name,Description,Password)" - + " VALUES (" + m_stdValues + "," + AD_User_U_ID + "," - + name + "," + name + "," + name + ")"; - no = DB.executeUpdate(sql, m_trx.getTrxName()); - if (no != 1) - { + + clientUser.setPassword(name); + clientUser.setDescription(name); + clientUser.setName(name); + clientUser.setAD_Client_ID(AD_Client_ID); + clientUser.setAD_Org_ID(0); + clientUser.setEMail(userEmail); + + try { + clientUser.saveEx(); + } catch (AdempiereException ex) { String err = "Org User NOT inserted - " + AD_User_U_Name; log.log(Level.SEVERE, err); m_info.append(err); @@ -319,6 +335,9 @@ public final class MSetup m_trx.close(); return false; } + + AD_User_U_ID = clientUser.getAD_User_ID(); + AD_User_U_Name = name; // Info m_info.append(Msg.translate(m_lang, "AD_User_ID")).append("=").append(AD_User_U_Name).append("/").append(AD_User_U_Name).append("\n"); From 6dd5e1e2044caa3dbdc57c2164da7f0b4a511a9a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 26 Feb 2014 10:07:27 -0500 Subject: [PATCH 12/14] IDEMPIERE-1606 initial client testing > email improvements / fix broken unused swing form --- org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java index 29dc141c8f..571ea9c4b0 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java @@ -474,7 +474,7 @@ public class VSetup extends CPanel m_frame.setBusyTimer(45); // Step 1 boolean ok = ms.createClient(fClientName.getText(), fOrgValue.getText(), fOrgName.getText(), - fUserClient.getText(), fUserOrg.getText(), null, null, null, null, null); + fUserClient.getText(), fUserOrg.getText(), null, null, null, null, null, null, null); // this form is not used String info = ms.getInfo(); if (ok) From 17d281a701d3c88c2c404621ee00ed12bed5592b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 26 Feb 2014 10:10:12 -0500 Subject: [PATCH 13/14] IDEMPIERE-1764 Reversing a prepayment messes up the accounting --- org.adempiere.base/src/org/compiere/model/MPayment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 6e3b6e03f0..7e2734f7cd 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -2381,8 +2381,7 @@ public final class MPayment extends X_C_Payment */ private void deAllocate(boolean accrual) { - if (getC_Order_ID() != 0) - setC_Order_ID(0); + // if (getC_Order_ID() != 0) setC_Order_ID(0); // IDEMPIERE-1764 // if (getC_Invoice_ID() == 0) // return; // De-Allocate all @@ -2577,7 +2576,7 @@ public final class MPayment extends X_C_Payment MPayment reversal = new MPayment (getCtx(), 0, get_TrxName()); copyValues(this, reversal); reversal.setClientOrg(this); - reversal.setC_Order_ID(0); + // reversal.setC_Order_ID(0); // IDEMPIERE-1764 reversal.setC_Invoice_ID(0); reversal.setDateAcct(dateAcct); // From 8835fdb149c436b4312e50dfa52c4d887a4264ce Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 12 Jan 2014 10:38:05 +0700 Subject: [PATCH 14/14] IDEMPIERE-1683:Make iDempiere safer using saveEx(trx) instead of save(trx) --- org.adempiere.base/src/org/compiere/model/MMovementConfirm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java b/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java index 0aa148648f..062689eb32 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java @@ -79,7 +79,7 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction MMovementLine mLine = moveLines[i]; MMovementLineConfirm cLine = new MMovementLineConfirm (confirm); cLine.setMovementLine(mLine); - cLine.save(move.get_TrxName()); + cLine.saveEx(move.get_TrxName()); } return confirm; } // MInOutConfirm