From 5044414ae47e92e657f22cb4d7dadbb76ce1e1fe Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 3 Dec 2017 14:13:52 +0100 Subject: [PATCH 01/26] IDEMPIERE-2544 Integrate/peer review patch IDEMPIERE-2544-containFunction.patch provided by Hiep Lq --- .../src/org/compiere/model/ModelValidationEngine.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java index a092a71cd6..8c22fb0bcd 100644 --- a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java +++ b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java @@ -621,7 +621,7 @@ public class ModelValidationEngine return; // String propertyName = - m_globalValidators.contains(listener) + (listener instanceof ModelValidator && m_globalValidators.contains((ModelValidator)listener)) ? tableName + "*" : tableName + listener.getAD_Client_ID(); ArrayList list = m_factsValidateListeners.get(propertyName); @@ -666,7 +666,7 @@ public class ModelValidationEngine if (tableName == null || listener == null) return; String propertyName = - m_globalValidators.contains(listener) + (listener instanceof ModelValidator && m_globalValidators.contains((ModelValidator)listener)) ? tableName + "*" : tableName + listener.getAD_Client_ID(); ArrayList list = m_factsValidateListeners.get(propertyName); @@ -733,7 +733,7 @@ public class ModelValidationEngine { validator = list.get(i); if (validator.getAD_Client_ID() == po.getAD_Client_ID() - || m_globalValidators.contains(validator)) + || (validator instanceof ModelValidator && m_globalValidators.contains((ModelValidator)validator))) { String error = validator.factsValidate(schema, facts, po); if (error != null && error.length() > 0) From 0305e1bf32451fddd3422c4a558a3027c8af62e9 Mon Sep 17 00:00:00 2001 From: hieplq Date: Thu, 30 Nov 2017 13:44:30 +0700 Subject: [PATCH 02/26] IDEMPIERE-2544:to more warning compiler hidden good warning leak io --- .../src/main/server/org/compiere/server/EMailProcessor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.server/src/main/server/org/compiere/server/EMailProcessor.java b/org.adempiere.server/src/main/server/org/compiere/server/EMailProcessor.java index b8784359b9..92d7972d44 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/EMailProcessor.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/EMailProcessor.java @@ -465,6 +465,8 @@ public class EMailProcessor int c; while ((c = is.read()) != -1) sb.append((char)c); + + is.close(); deliveryMessage = sb.toString().trim(); } else @@ -674,6 +676,7 @@ public class EMailProcessor int c; while ((c = is.read()) != -1) System.out.write(c); + is.close(); } else { From 7245687377ec203771d5e248571063efc359ca29 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 3 Dec 2017 14:37:20 +0100 Subject: [PATCH 03/26] IDEMPIERE-2544:to more warning compiler hidden good warning code warning --- org.adempiere.base/META-INF/MANIFEST.MF | 3 +++ .../base/ComponentBlackListService.java | 25 ++++++++++--------- .../org/adempiere/report/jasper/Barbecue.java | 9 ++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index cb71359c21..2b64bd4c53 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -101,7 +101,10 @@ Import-Package: com.sun.mail.smtp;version="1.5", org.osgi.framework, org.osgi.service.cm;version="1.3.0", org.osgi.service.component;version="1.1.0", + org.osgi.service.component.runtime;version="1.3.0", + org.osgi.service.component.runtime.dto;version="1.3.0", org.osgi.service.event;version="1.2.0", + org.osgi.util.promise;version="1.0.0", org.osgi.util.tracker;version="1.5.0", org.restlet, org.restlet.data, diff --git a/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java b/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java index ddefa16f38..f6f565c45f 100644 --- a/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java +++ b/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java @@ -19,10 +19,9 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import org.apache.felix.scr.Component; -import org.apache.felix.scr.ScrService; import org.compiere.util.Ini; import org.compiere.util.Util; import org.osgi.framework.BundleContext; @@ -30,6 +29,8 @@ import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.runtime.ServiceComponentRuntime; +import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO; /** * @author hengsin @@ -37,11 +38,11 @@ import org.osgi.service.component.ComponentConstants; */ public class ComponentBlackListService implements ServiceListener { - private ScrService scrService = null; + private ServiceComponentRuntime scrService = null; private List blackListComponentNames = null; protected ComponentBlackListService(BundleContext context) { - ServiceReference ref = context.getServiceReference(ScrService.class); + ServiceReference ref = context.getServiceReference(ServiceComponentRuntime.class); scrService = context.getService(ref); blackListComponentNames = new ArrayList(); retrieveBlacklistCandidates(); @@ -89,20 +90,20 @@ public class ComponentBlackListService implements ServiceListener { private void disableComponents() { - Component[] comps = scrService.getComponents(); - for (Component comp : comps) { - if (blackListComponentNames.contains(comp.getName())) { - comp.disable(); + Collection comps = scrService.getComponentDescriptionDTOs(); + for (ComponentDescriptionDTO comp : comps) { + if (blackListComponentNames.contains(comp.name)) { + scrService.disableComponent(comp); } } } private void disableComponent(String componentName) { - Component[] comps = scrService.getComponents(); - for (Component comp : comps) { - if (comp.getName().equals(componentName)) { - comp.disable(); + Collection comps = scrService.getComponentDescriptionDTOs(); + for (ComponentDescriptionDTO comp : comps) { + if (comp.name.equals(componentName)) { + scrService.disableComponent(comp); break; } } diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java index 6cc619f6db..c3fd85c29b 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java @@ -2,10 +2,12 @@ package org.adempiere.report.jasper; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; -import net.sf.jasperreports.engine.JRAbstractSvgRenderer; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JasperReportsContext; +import net.sf.jasperreports.renderers.AbstractRenderToImageDataRenderer; import net.sourceforge.barbecue.Barcode; -public class Barbecue extends JRAbstractSvgRenderer +public class Barbecue extends AbstractRenderToImageDataRenderer { private static final long serialVersionUID = 5112469398754718739L; @@ -29,7 +31,8 @@ public class Barbecue extends JRAbstractSvgRenderer m_barcode.setDrawingText(showDrawingText); } - public void render(Graphics2D grx, Rectangle2D rectangle) + @Override + public void render(JasperReportsContext jasperReportsContext, Graphics2D grx, Rectangle2D rectangle) throws JRException { try { From 73511f25bba977d0e0189193020e28a6ef0e3797 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 3 Dec 2017 14:46:10 +0100 Subject: [PATCH 04/26] IDEMPIERE-2544 remove minor warning --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 58404d246f..524d44bd43 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -1463,8 +1463,6 @@ public class GridTabCSVImporter implements IGridTabImporter } private int resolveForeign(String foreignTable, String foreignColumn, Object value,Trx trx) { - int id = -1; - boolean systemAccess = false; if (!"AD_Client".equals(foreignTable)) { MTable ft = MTable.get(Env.getCtx(), foreignTable); From 72bba72d94e2cc6739f305df979e978859c3147b Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Sun, 3 Dec 2017 15:18:54 +0100 Subject: [PATCH 05/26] IDEMPIERE-3570 Migrate gmaps to 3.0.4 --- org.idempiere.zk.extra/copyjars.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.idempiere.zk.extra/copyjars.xml b/org.idempiere.zk.extra/copyjars.xml index d784d6cfca..56cbf729f8 100644 --- a/org.idempiere.zk.extra/copyjars.xml +++ b/org.idempiere.zk.extra/copyjars.xml @@ -1,7 +1,7 @@ - + From eb729142e704fb237ae63b9b1f527eae8eed1a13 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Wed, 6 Dec 2017 14:40:26 +0100 Subject: [PATCH 06/26] IDEMPIERE-3441 Import Movement Require Wrongly OrgValue, LocatorValue and LocatorToValue / integrating patch suggested by Eduardo Gil --- .../src/org/eevolution/process/ImportInventoryMove.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java index f705516bac..79f3d1c3b9 100644 --- a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java +++ b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java @@ -333,13 +333,13 @@ public class ImportInventoryMove extends SvrProcess { for(X_I_Movement imove : getRecords(false, m_IsImportOnlyNoErrors)) { - //if(imov.getAD_Org_ID()==0) + if(imove.getAD_Org_ID()==0) imove.setAD_Org_ID(getID(MOrg.Table_Name,"Value = ?", new Object[]{imove.getOrgValue()})); if(imove.getM_Product_ID()==0) imove.setM_Product_ID(getID(MProduct.Table_Name,"Value = ?", new Object[]{imove.getProductValue()})); - //if(imov.getM_Locator_ID()==0) + if(imove.getM_Locator_ID()==0) imove.setM_Locator_ID(getID(MLocator.Table_Name,"Value = ?", new Object[]{imove.getLocatorValue()})); - //if(imov.getM_LocatorTo_ID()==0) + if(imove.getM_LocatorTo_ID()==0) imove.setM_LocatorTo_ID(getID(MLocator.Table_Name,"Value = ?", new Object[]{imove.getLocatorToValue()})); if(imove.getC_DocType_ID()==0) imove.setC_DocType_ID(getID(MDocType.Table_Name,"Name=?", new Object[]{imove.getDocTypeName()})); From 74cd2d1078265ad0e017db0eae264ded2bd2466e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 6 Dec 2017 15:10:38 +0100 Subject: [PATCH 07/26] IDEMPIERE-3441 - peer review - solved bugs and some conceptual errors in the way import is expected to behave --- .../process/ImportInventoryMove.java | 53 ++++++++++++------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java index 79f3d1c3b9..70de6b09f7 100644 --- a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java +++ b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java @@ -61,6 +61,8 @@ public class ImportInventoryMove extends SvrProcess private boolean m_IsImportOnlyNoErrors = true; + private boolean m_ErrorsFound = false; + private String m_docAction = MMovement.DOCACTION_Prepare; private boolean isImported = false; @@ -127,13 +129,18 @@ public class ImportInventoryMove extends SvrProcess private void importRecords() { + if (m_IsImportOnlyNoErrors && m_ErrorsFound) + return; // not importing because error were found + isImported = false; - - for(X_I_Movement imove : getRecords(false,m_IsImportOnlyNoErrors)) + + for(X_I_Movement imove : getRecords(false,true)) { MMovement mov = importMInventoryMove(imove); if(mov!= null) { + imove.setM_Movement_ID(mov.getM_Movement_ID()); + imove.saveEx(); isImported = importMInventoryMoveLine(mov,imove); } else @@ -143,7 +150,6 @@ public class ImportInventoryMove extends SvrProcess if(isImported) { - imove.setM_Movement_ID(mov.getM_Movement_ID()); imove.setI_IsImported(true); imove.setProcessed(true); imove.saveEx(); @@ -156,7 +162,7 @@ public class ImportInventoryMove extends SvrProcess else { imove.setI_IsImported(false); - imove.setProcessed(true); + imove.setProcessed(false); imove.saveEx(); notimported++; } @@ -331,10 +337,15 @@ public class ImportInventoryMove extends SvrProcess */ private void fillIDValues() { - for(X_I_Movement imove : getRecords(false, m_IsImportOnlyNoErrors)) + m_ErrorsFound = false; + for(X_I_Movement imove : getRecords(false, false)) { - if(imove.getAD_Org_ID()==0) - imove.setAD_Org_ID(getID(MOrg.Table_Name,"Value = ?", new Object[]{imove.getOrgValue()})); + if(imove.getAD_Org_ID()==0) { + int orgId = getID(MOrg.Table_Name,"Value = ?", new Object[]{imove.getOrgValue()}); + if (orgId >= 0) { + imove.setAD_Org_ID(orgId); + } + } if(imove.getM_Product_ID()==0) imove.setM_Product_ID(getID(MProduct.Table_Name,"Value = ?", new Object[]{imove.getProductValue()})); if(imove.getM_Locator_ID()==0) @@ -353,10 +364,7 @@ public class ImportInventoryMove extends SvrProcess imove.setC_Campaign_ID(getID(MCampaign.Table_Name, "Value = ?", new Object[]{imove.getCampaignValue()})); if(imove.getAD_OrgTrx_ID()==0) imove.setAD_OrgTrx_ID(getID(MOrg.Table_Name, "Value = ?", new Object[]{imove.getOrgTrxValue()})); - - - imove.saveEx(); - + StringBuilder err = new StringBuilder(""); if(imove.getAD_Org_ID() <=0) err.append(" @AD_Org_ID@ @NotFound@,"); @@ -373,12 +381,17 @@ public class ImportInventoryMove extends SvrProcess if(imove.getC_DocType_ID()<=0) err.append(" @C_DocType_ID@ @NotFound@,"); - if(err.toString()!=null && err.toString().length()>0) - { + if (imove.getMovementQty().signum() == 0) + err.append(" @MovementQty@ @NotFound@,"); + + if(err.toString()!=null && err.toString().length()>0) { notimported++; + m_ErrorsFound = true; imove.setI_ErrorMsg(Msg.parseTranslation(getCtx(), err.toString())); - imove.saveEx(); - } + } else { + imove.setI_ErrorMsg(null); + } + imove.saveEx(); } } @@ -397,17 +410,17 @@ public class ImportInventoryMove extends SvrProcess /** - * get all records in X_I_ProductPlanning table + * get all records in X_I_Movement table * @param imported boolean - * @param isWithError boolean - * @return collection of X_I_ProductPlanning records + * @param isWithoutError boolean + * @return collection of X_I_Movement records */ - private Collection getRecords(boolean imported, boolean isWithError) + private Collection getRecords(boolean imported, boolean isWithoutError) { final StringBuffer whereClause = new StringBuffer(X_I_Movement.COLUMNNAME_I_IsImported) .append("=?"); - if(isWithError) + if(isWithoutError) { whereClause.append(" AND ").append(X_I_Movement.COLUMNNAME_I_ErrorMsg).append(" IS NULL"); } From 35d6fbc1b49fc029c62814d16f0e17d46e007041 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 6 Dec 2017 15:59:38 +0100 Subject: [PATCH 08/26] IDEMPIERE-2480:ZK7 - Horizontal Scrollbar calculate wrong full width --- .../adempiere/webui/adwindow/GridView.java | 10 +++-- org.adempiere.ui.zk/index.zul | 38 ++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java index 936cdc4fe7..b9ca3e3c25 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java @@ -63,7 +63,7 @@ import org.zkoss.zul.Frozen; import org.zkoss.zul.Paging; import org.zkoss.zul.Row; import org.zkoss.zul.Tabpanel; -import org.zkoss.zul.Vbox; +import org.zkoss.zul.Vlayout; import org.zkoss.zul.event.ZulEvents; import org.zkoss.zul.impl.CustomGridDataLoader; @@ -72,8 +72,9 @@ import org.zkoss.zul.impl.CustomGridDataLoader; * @author Low Heng Sin * */ -public class GridView extends Vbox implements EventListener, IdSpace, IFieldEditorContainer, StateChangeListener +public class GridView extends Vlayout implements EventListener, IdSpace, IFieldEditorContainer, StateChangeListener { + /** * */ @@ -243,7 +244,10 @@ public class GridView extends Vbox implements EventListener, IdSpace, IFi setupColumns(); render(); - + if (listbox.getFrozen() != null){ + listbox.getFrozen().setWidgetOverride("syncScroll", "function (){syncScrollOVR(this);}"); + } + updateListIndex(); this.init = true; diff --git a/org.adempiere.ui.zk/index.zul b/org.adempiere.ui.zk/index.zul index 5a554a5bf4..5aa8ed4320 100644 --- a/org.adempiere.ui.zk/index.zul +++ b/org.adempiere.ui.zk/index.zul @@ -250,8 +250,44 @@ Copyright (C) 2007 Ashley G Ramdass. } this.$onSize.apply(this, arguments); }); - }); + }); + // overload for recalculate width of scroll when has frozen control + function syncScrollOVR (wgt){ + var parent = wgt.parent; + + if (parent.eheadtbl && parent._nativebar) { + var scroll = wgt.$n('scrollX'); + var cells = parent._getFirstRowCells(parent.eheadrows); + var totalcols = cells.length; + var columns = wgt._columns; + var scrollScale = totalcols - columns - 1; + var leftWidth = 0; + + var headerWidth = 0; + for (var i = 0; i < columns; i++) + headerWidth += cells[i].offsetWidth; + + var bodyWidth = parent.$n('body').offsetWidth; + var extraWidth = parent.$n('body').offsetWidth - headerWidth; + var extraColumnNum = 0; + for (var i = totalcols - 1; i >= columns; i--){ + extraWidth -= cells[i].offsetWidth; + if (cells[i].offsetWidth == 0)// when scroll to right, column at left has width = 0 + continue; + if (extraWidth >= 0){ + extraColumnNum++; + }else{ + break; + } + } + + + scroll.firstChild.style.width = jq.px0(bodyWidth + 50 * (scrollScale - extraColumnNum)); + } + + wgt.$syncScroll () + } ]]> From d6f2de3d7d378a725d28f7daaeec214a9cbefbbd Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 6 Dec 2017 16:22:05 +0100 Subject: [PATCH 09/26] IDEMPIERE-3451 IDEMPIERE_JAVA_OPTIONS property not work - improvement suggested by Silvano (freepath) --- org.adempiere.server-feature/idempiere-server.bat | 3 +-- org.adempiere.server-feature/idempiere-server.sh | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/org.adempiere.server-feature/idempiere-server.bat b/org.adempiere.server-feature/idempiere-server.bat index 216310fdef..abaf87737c 100644 --- a/org.adempiere.server-feature/idempiere-server.bat +++ b/org.adempiere.server-feature/idempiere-server.bat @@ -1,5 +1,6 @@ @Echo off +CALL utils\myEnvironment.bat Server @if not "%JAVA_HOME%" == "" goto JAVA_HOME_OK @Set JAVA=java @@ -17,8 +18,6 @@ goto START @Echo Starting iDempiere Server ... @Echo ======================================= -CALL utils\myEnvironment.bat Server - FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c @Set VMOPTS=-Xbootclasspath/p:alpn-boot.jar diff --git a/org.adempiere.server-feature/idempiere-server.sh b/org.adempiere.server-feature/idempiere-server.sh index 1891706b18..cb171274d3 100644 --- a/org.adempiere.server-feature/idempiere-server.sh +++ b/org.adempiere.server-feature/idempiere-server.sh @@ -1,5 +1,8 @@ #!/bin/sh # +unset DISPLAY +BASE=`dirname $( readlink -f $0 )` +. $BASE/utils/myEnvironment.sh Server if [ $JAVA_HOME ]; then JAVA=$JAVA_HOME/bin/java else @@ -17,9 +20,6 @@ echo =================================== echo Starting iDempiere Server echo =================================== -unset DISPLAY -BASE=`dirname $( readlink -f $0 )` -. $BASE/utils/myEnvironment.sh Server VMOPTS="-Xbootclasspath/p:alpn-boot.jar -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn From 524be5d6a36194b8ce5dc9a912f413639d10bf3a Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Mon, 11 Dec 2017 18:06:33 +0100 Subject: [PATCH 10/26] IDEMPIERE-3577 Replace now() - postgres specific - by sysdate --- .../org/adempiere/base/process/AcceptCtxHelpSuggestion.java | 2 +- .../WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java | 4 ++-- .../src/org/adempiere/webui/window/WCtxHelpSuggestion.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java b/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java index f8095c47c5..cbe8923926 100644 --- a/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java +++ b/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java @@ -127,7 +127,7 @@ public class AcceptCtxHelpSuggestion extends SvrProcess { } else { StringBuilder insert = new StringBuilder("Insert Into AD_CtxHelpMsg_Trl (AD_Client_ID, AD_Org_ID, AD_CtxHelpMsg_ID, IsActive, IsTranslated, AD_Language, MsgText,"); insert.append("Created, CreatedBy, Updated, UpdatedBy, AD_CtxHelpMsg_Trl_UU)") - .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, now(), ?, now(), ?, generate_uuid()) "); + .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, sysdate, ?, sysdate, ?, generate_uuid()) "); List params = new ArrayList(); params.add(AD_Client_ID); params.add(0); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java index c8bcff4e85..4a3e153da8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java @@ -680,7 +680,7 @@ public class ADSortTab extends Panel implements IADTabpanel .append(" SET ").append(m_ColumnSortName).append("=0"); if (m_ColumnYesNoName != null) sql.append(",").append(m_ColumnYesNoName).append("='N'"); - sql.append(", Updated=Now(), UpdatedBy=").append(Env.getAD_User_ID(Env.getCtx())); + sql.append(", Updated=sysdate, UpdatedBy=").append(Env.getAD_User_ID(Env.getCtx())); sql.append(" WHERE ").append(m_KeyColumnName).append("=").append(pp.getKey()); if (DB.executeUpdate(sql.toString(), null) == 1) { pp.setSortNo(0); @@ -710,7 +710,7 @@ public class ADSortTab extends Panel implements IADTabpanel .append(" SET ").append(m_ColumnSortName).append("=").append(index); if (m_ColumnYesNoName != null) sql.append(",").append(m_ColumnYesNoName).append("='Y'"); - sql.append(", Updated=Now(), UpdatedBy=").append(Env.getAD_User_ID(Env.getCtx())); + sql.append(", Updated=sysdate, UpdatedBy=").append(Env.getAD_User_ID(Env.getCtx())); sql.append(" WHERE ").append(m_KeyColumnName).append("=").append(pp.getKey()); if (DB.executeUpdate(sql.toString(), null) == 1) { pp.setSortNo(index); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WCtxHelpSuggestion.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WCtxHelpSuggestion.java index 9e9af15a3e..b12d9e29fe 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WCtxHelpSuggestion.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WCtxHelpSuggestion.java @@ -46,7 +46,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener { /** * generated serial id */ - private static final long serialVersionUID = -8110247807841690907L; + private static final long serialVersionUID = 2068729997836800852L; private ConfirmPanel confirmPanel; @@ -239,7 +239,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener { } else { StringBuilder insert = new StringBuilder("Insert Into AD_CtxHelpMsg_Trl (AD_Client_ID, AD_Org_ID, AD_CtxHelpMsg_ID, IsActive, IsTranslated, AD_Language, MsgText,"); insert.append("Created, CreatedBy, Updated, UpdatedBy, AD_CtxHelpMsg_Trl_UU)") - .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, now(), ?, now(), ?, generate_uuid()) "); + .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, sysdate, ?, sysdate, ?, generate_uuid()) "); List params = new ArrayList(); params.add(0); params.add(0); From 2ad8d5e02d79f47f8b7d57ecfdf953334ca25f09 Mon Sep 17 00:00:00 2001 From: z5k1 Date: Thu, 14 Dec 2017 09:37:54 +0100 Subject: [PATCH 11/26] IDEMPIERE-3522 Fix amount in words for zh_CN --- .../src/org/compiere/util/AmtInWords_ZH.java | 298 ++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 org.adempiere.base/src/org/compiere/util/AmtInWords_ZH.java diff --git a/org.adempiere.base/src/org/compiere/util/AmtInWords_ZH.java b/org.adempiere.base/src/org/compiere/util/AmtInWords_ZH.java new file mode 100644 index 0000000000..d273dd977a --- /dev/null +++ b/org.adempiere.base/src/org/compiere/util/AmtInWords_ZH.java @@ -0,0 +1,298 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; +import java.math.BigDecimal; + +/** + * Amount in Words for Zh_CN (CNY in Simplified Chinese) + * @author z5k1@qq.com + * @version $Id: AmtInWords_ZH.java,v1.0 2017/09/21 00:54:35 $ + * + * The class is based on the AmtInWords_EN.java written by jjanke + * The algorithm is based on code named snhongtenzone@foxmail.com + * + * Rule: + * 1. CNY is an currency of 10000-unit scale, dislike dollar with 1000-unit scale. + * 2. CNY currency accuracy is 0.01. And it's under a strict decimal number system. + * 3. Option of add an "zero" after "Yuan" is false. (Line 186) + * Reference: [1997]393 People's Bank of China "the Measures for Payment and Settlement" + * \u53c2\u8003: \u4e2d\u56fd\u4eba\u6c11\u94f6\u884c \u94f6\u53d1[1997]393\u53f7 \u300a\u652f\u4ed8\u7ed3\u7b97\u529e\u6cd5\u300b\u9644\u4ef6\u300a\u6b63\u786e\u586b\u5199\u7968\u636e\u548c\u7ed3\u7b97\u51ed\u8bc1\u7684\u57fa\u672c\u89c4\u5b9a\u300b + * + * + * Results: (Rule 3 = true) + * + * 0.00 \u96f6\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a\u91d1\u989d\u4e3a 0\uff09 + * 0.03 \u53c1\u5206 \uff08\u6d4b\u8bd5\uff1a\u89d20\u5206\u975e0\uff0c\u5916\u52a0 \u51430\uff09 + * 0.234 \u8d30\u89d2\u53c1\u5206 \uff08\u6d4b\u8bd5\uff1a\u89d2\u975e0\u5206\u975e0\uff0c\u820d4\uff09 + * 1.001 \u58f9\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a\u89d20\u52060\uff0c\u52a0 \u201c \u6574 \u201d\uff0c\u820d1\uff09 + * 1.035 \u58f9\u5143\u96f6\u8086\u5206 \uff08\u89c4\u52194.4\uff1a\u89d20\u5206\u975e0\uff0c\u52a0\u96f6\uff0c\u51655\uff09 + * 1.205 \u58f9\u5143\u8d30\u89d2\u58f9\u5206 \uff08\u6d4b\u8bd5\uff1a\u89d2\u975e0\u52060\uff0c\u51655\u540e\uff0c\u89d2\u975e0\u5206\u975e0\uff09 + * 1.3345 \u58f9\u5143\u53c1\u89d2\u53c1\u5206 \uff08\u6d4b\u8bd5\uff1a\u5c0f\u6570\u70b94\u4f4d\uff09 + * 10.03 \u58f9\u62fe\u5143\u96f6\u53c1\u5206 \uff08\u89c4\u52194.4\uff1a\u89d20\u5206\u975e0\uff0c\u52a0\u96f6\uff09 + * 10.23 \u58f9\u62fe\u5143\u96f6\u8d30\u89d2\u53c1\u5206 \uff08\u89c4\u52194.3\uff1a\u51430\u89d2\u975e0\uff0c\u53ef\u9009\u52a0\u96f6\uff09 + * 23.00 \u8d30\u62fe\u53c1\u5143\u6574 \uff08\u89c4\u52192\uff1a\u52a0 \u201c \u6574 \u201d\uff09 + * 100.20 \u58f9\u4f70\u5143\u96f6\u8d30\u89d2 \uff08\u89c4\u52194.2 \u591a\u96f6\u5199\u4e00\u96f6\uff0c\u89d2\u975e0\u52060\uff09 + * 103.45 \u58f9\u4f70\u96f6\u53c1\u5143\u8086\u89d2\u4f0d\u5206 \uff08\u89c4\u52194.1\uff1a\u67090\u52a0 \u201c \u96f6 \u201d\uff0c\u89d2\u975e0\u5206\u975e0\uff09 + * 2,345 \u8d30\u4edf\u53c1\u4f70\u8086\u62fe\u4f0d\u5143\u6574 \uff08\u89c4\u52192\uff1a\u52a0 \u201c \u6574 \u201d\uff09 + * 1020.45 \u58f9\u4edf\u96f6\u8d30\u62fe\u5143\u96f6\u8086\u89d2\u4f0d\u5206 \uff08\u89c4\u52194.1+4.3\uff1a\u67090\u52a0 \u201c \u96f6 \u201d\uff1b\u51430\u89d2\u975e0\uff0c\u53ef\u9009\u52a0\u96f6\uff09 + * 1,234.56 \u58f9\u4edf\u8d30\u4f70\u53c1\u62fe\u8086\u5143\u4f0d\u89d2\u9646\u5206 \uff08\u6d4b\u8bd5\uff1a\u5343\u5206\u4f4d \u662f\u5426\u6b63\u786e\uff09 + * 12345.78 \u58f9\u4e07\u8d30\u4edf\u53c1\u4f70\u8086\u62fe\u4f0d\u5143\u67d2\u89d2\u634c\u5206 \uff08\u6d4b\u8bd5\uff1a\u5343\u5206\u4f4d \u662f\u5426\u6b63\u786e\uff09 + * 100457.89 \u58f9\u62fe\u4e07\u96f6\u8086\u4f70\u4f0d\u62fe\u67d2\u5143\u634c\u89d2\u7396\u5206 \uff08\u89c4\u52194.2\uff1a\u591a\u96f6\u5199\u4e00\u96f6\uff09 + * 103457.89 \u58f9\u62fe\u4e07\u96f6\u53c1\u4edf\u8086\u4f70\u4f0d\u62fe\u67d2\u5143\u634c\u89d2\u7396\u5206 \uff08\u89c4\u52194.3\uff1a\u4e070\u5343\u975e\u96f6\uff0c\u53ef\u9009\u52a0\u96f6\uff09 + * 107000.03 \u58f9\u62fe\u4e07\u96f6\u67d2\u4edf\u5143\u96f6\u53c1\u5206 \uff08\u89c4\u52194.3+4.4\uff1a\u4e070\u51430\u5343\u975e0\uff0c\u4e2d\u95f4\u591a0\uff0c\u89d20\uff0c\u53ef\u9009\u52a0\u96f6\uff09 + * 9,000,000.00 \u7396\u4f70\u4e07\u5143\u6574 \uff08\u89c4\u5219: 4\u4f4d\u8fdb\u5236\uff09 + * 10,000,000.00 \u58f9\u4edf\u4e07\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a4\u4f4d\u8fdb\u5236\uff09 + * 10220134 \u58f9\u4edf\u96f6\u8d30\u62fe\u8d30\u4e07\u96f6\u58f9\u4f70\u53c1\u62fe\u8086\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a\u65e0\u5343\u5206\u4f4d \u201c\u662f\u5426\u6b63\u786e\uff09 + * 100,234,578.90 \u58f9\u4ebf\u96f6\u8d30\u62fe\u53c1\u4e07\u8086\u4edf\u4f0d\u4f70\u67d2\u62fe\u634c\u5143\u7396\u89d2 \uff08\u6d4b\u8bd5\uff1a\u4ebf\uff09 + * 203010000.56 \u8d30\u4ebf\u96f6\u53c1\u4f70\u96f6\u58f9\u4e07\u5143\u96f6\u4f0d\u89d2\u9646\u5206 \uff08\u6d4b\u8bd5\uff1a\u4ebf\u96f6\uff0c\u4e07\u96f6\uff0c\u5143\uff09 + * 103,004,000.90 \u58f9\u4ebf\u96f6\u53c1\u4f70\u4e07\u96f6\u8086\u4edf\u5143\u96f6\u7396\u89d2 \uff08\u89c4\u52194.2+4.3\uff1a\u591a\u96f6\u5199\u4e00\u96f6\uff0c\u4e070\u5343\u975e\u96f6\uff0c\u4e2d\u95f4\u591a0\uff0c\u53ef\u9009\u52a0\u96f6\uff09 + * 1,201,034,578.90 \u58f9\u62fe\u8d30\u4ebf\u96f6\u58f9\u4f70\u96f6\u53c1\u4e07\u8086\u4edf\u4f0d\u4f70\u67d2\u62fe\u634c\u5143\u7396\u89d2 \uff08\u6d4b\u8bd5\uff1a\u5341\u4ebf\uff0c3\u4e2a\u5343\u5206\u4f4d \u662f\u5426\u6b63\u786e\uff09 + * 90,000,000,000 \u7396\u4f70\u4ebf\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a4\u4f4d\u8fdb\u5236\uff09 + * 100,000,000,000 \u58f9\u4edf\u4ebf\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a4\u4f4d\u8fdb\u5236\uff09 + * 1,932,110,345,780 \u58f9\u5146\u7396\u4edf\u53c1\u4f70\u8d30\u62fe\u58f9\u4ebf\u58f9\u4edf\u96f6\u53c1\u62fe\u8086\u4e07\u4f0d\u4edf\u67d2\u4f70\u634c\u62fe\u5143\u6574 \uff08\u6d4b\u8bd5\uff1a13\u4f4d\u6574\u6570\uff0c\u5146\uff0c4\u4e2a\u5343\u5206\u4f4d\uff09 + * 10,000,000,000,000 \u9519\u8bef \uff08\u6d4b\u8bd5\uff1a\u8d85\u8fc7\u6216\u7b49\u4e8e\u6700\u5927\u4f4d\u657010\u5146\uff0c\u6570\u5b57\u5fc5\u987b\u5c0f\u4e8e14\u4f4d\uff09 + * -1220.354 \u8d1f\u58f9\u4edf\u8d30\u4f70\u8d30\u62fe\u5143\u96f6\u53c1\u89d2\u4f0d\u5206 \uff08\u6d4b\u8bd5\uff1a\u8d1f\u6570\uff0c\u56db\u820d\u4e94\u5165\uff09 + * 1.222,33 \u9519\u8bef \uff08\u6d4b\u8bd5\uff1a\u975e\u6cd5\u5b57\u7b26\uff09 + * + */ + +public class AmtInWords_ZH implements AmtInWords +{ + /** + * AmtInWords_ZH + */ + public AmtInWords_ZH () + { + super (); + } // AmtInWords_ZH + + /** Currency scales */ + private static final String[] scaleNames = + { + "\u5206", // 0 0.01 + "\u89d2", // 1 0.1 + "\u5143", // 2 1 \uff0810^0\uff09 + "\u62fe", // 3 10 + "\u4f70", // 4 100 + "\u4edf", // 5 1000 + "\u4e07", // 6 10000 \uff0810^4\uff09 + "\u62fe", // 7 10*10000 + "\u4f70", // 8 100*10000 + "\u4edf", // 9 1000*10000 + "\u4ebf", // 10 100000000 \uff0810^8\uff09 \u4e07\u4e07\u4e3a\u4ebf + "\u62fe", // 11 10*100000000 + "\u4f70", // 12 100*100000000 + "\u4edf", // 13 1000*100000000 + "\u5146", // 14 1000000000000 \uff0810^12\uff09 \u4e07\u4ebf\u4e3a\u5146 + + }; + /** numbers 0 to 9 */ + private static final String[] numNames = + { + "\u96f6", // 0 + "\u58f9", // 1 + "\u8d30", // 2 + "\u53c1", // 3 + "\u8086", // 4 + "\u4f0d", // 5 + "\u9646", // 6 + "\u67d2", // 7 + "\u634c", // 8 + "\u7396" // 9 + }; + + private static final String CNY_NEGATIVE = "\u8d1f"; + private static final String CNY_FULL = "\u6574"; + private static final String CNY_ZEOR_FULL = "\u96f6\u5143\u6574"; + + /** + * Convert + * @description Convert BigDecimal number to String + * @param number (-5432.135 with no period) + * @return amt (amt in words of CNY) + */ + private String convert (BigDecimal number) + { + StringBuffer sb = new StringBuffer(); + int signum = number.signum(); // positive , 0 , negative + int numUnit = 0; // each number character + int numIndex = 0; // each number position + int zeroSize = 0; // sizes of zero + + // number = 0 + if (signum == 0){ + return CNY_ZEOR_FULL; // zero_full + } + + // round to 1/100, get long number ,eg -5432.135 = 543214 + long lnumber = number.movePointRight(2).setScale(0, BigDecimal.ROUND_HALF_UP).abs().longValue(); + + // number must less 10000000000000 (10^13) + if (lnumber >= 1000000000000000L) { + return "\u4eb2\uff0c\u91d1\u989d\u8f6c\u6362\u4e0a\u9650\u4e3a10\u5146\uff0810\u4e07\u4ebf\uff09"; + } + + // get the last 2 number (decimal number) ,eg 543214 = 14 + long decamt = lnumber % 100; + boolean getZero = false; // sign of zero + + // decimal options\uff1a00 = 0, 01 = 1, 10, 11 + + // decimal = 00 + if (!(decamt > 0)) { // special decimal case 00 + numIndex = 2; // 2, begin from "Yuan" + lnumber = lnumber / 100; // eg: 5432.00 = 543200 = 5432 + getZero = true; + } + + // decimal = 10 + if ((decamt > 0) && (!(decamt % 10 > 0))) { // special decimal case 10 + numIndex = 1; // 1, begin from "Jiao" + lnumber = lnumber / 10; // eg: 5432.10 = 543210 = 54321 + getZero = true; + } + + // begin foreach for all cases + while (true) { + if (lnumber <= 0) { // each character done + break; + } + // get the last number each + numUnit = (int) (lnumber % 10); + if (numUnit > 0) { // Character = 1-9 ,insert (number + scale) + if ((numIndex == 9) && (zeroSize >= 3)) { // special 9 (8th), eg: 10,000,000 + sb.insert(0, scaleNames[6]); // add "WAN" + } + if ((numIndex == 13) && (zeroSize >= 3)) { // special 13 (11st), eg: 100,000,000,000 + sb.insert(0, scaleNames[10]); // add "YI" + } + sb.insert(0, scaleNames[numIndex]); // first insert scale to Chinese + sb.insert(0, numNames[numUnit]); // then insert number to Chinese + getZero = false; + zeroSize = 0; + } else { // Character = 0, insert (scale + 0 ) + ++zeroSize; + if (!(getZero) & numIndex != 2) { // separated zero and option of "YUAN" suffix + sb.insert(0, numNames[numUnit]); // first insert 0 to Chinese + } // + if (numIndex == 2) { // option1: "YUAN"=0 + sb.insert(0, scaleNames[numIndex]); // then insert scale to Chinese + } // option2: "WAN"|"YI"|"ZHAO" =0 + else if (((numIndex - 2) % 4 == 0) && (lnumber % 1000 > 0)) { // special 4th,8th, eg: 9,000,000 or 90,000,000,000 + sb.insert(0, scaleNames[numIndex]); // then insert scale to Chinese + } + getZero = true; // multi-zero nothing added + } + + lnumber = lnumber / 10; // cut the last number off each + ++numIndex; // ++ position of number + } + + // add suffix of "zheng" when decimal = 00 + if (!(decamt > 0)) { + sb.append(CNY_FULL); // add suffix CNY_full + } + + // add prefix of "fu" when negative + if (signum == -1) { + sb.insert(0, CNY_NEGATIVE); // add prefix negative + } + + return sb.toString(); // return amt string completed + } // convert + + /************************************************************************** + * Get Amount in Words + * @param amount numeric amount (352.80) + * @return amount in words + * @throws Exception + */ + public String getAmtInWords (String amount) throws Exception + { + if (amount == null || amount.length() <= 0) // null string + return amount; + + //TODO: Check string illegal character + + amount = amount.replaceAll (",", ""); // fire period "," + //TODO: 1.234,56 as comma replace period + + StringBuilder sb = new StringBuilder (); + BigDecimal cny = new BigDecimal(amount); // convert String to BigDecimal + sb.append (convert (cny)); // get result string from convert + return sb.toString (); // return + } + + /** + * Test Print + * @param amt amount + */ + private void print (String amt) + { + try + { + System.out.println(amt + " = " + getAmtInWords(amt)); + } + catch (Exception e) + { + e.printStackTrace(); + } + } // print + + /** + * Test + * @param args ignored + */ + public static void main (String[] args) + { + AmtInWords_ZH aiw = new AmtInWords_ZH(); + aiw.print (null); + aiw.print (""); + aiw.print ("0.00"); + aiw.print ("0.03"); + aiw.print ("0.234"); + aiw.print ("1.001"); + aiw.print ("1.035"); + aiw.print ("1.205"); + aiw.print ("1.3345"); + aiw.print ("10.03"); + aiw.print ("10.23"); + aiw.print ("23.00"); + aiw.print ("100.20"); + aiw.print ("103.45"); + aiw.print ("2,345"); + aiw.print ("1020.45"); + aiw.print ("1,234.56"); + aiw.print ("12345.78"); + aiw.print ("100457.89"); + aiw.print ("103457.89"); + aiw.print ("107000.03"); + aiw.print ("9,000,000.00"); // Line 189 + aiw.print ("10,000,000.00"); // Line 171 + aiw.print ("10220134"); + aiw.print ("100,234,578.90"); + aiw.print ("203010000.56"); + aiw.print ("103,004,000.90"); + aiw.print ("1,201,034,578.90"); + aiw.print ("90,000,000,000"); // Line 189 + aiw.print ("100,000,000,000"); // Line 174 + aiw.print ("1,932,110,345,780"); + aiw.print ("10,000,000,000,000"); + aiw.print ("-1220.354"); +// aiw.print ("1.234,56"); ERROR + } // main +} From 290429f1383b3b7326c2a07164ce9e377cd1b9e4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Dec 2017 15:13:49 +0100 Subject: [PATCH 12/26] IDEMPIERE-3388 - change GardenWorld to Average PO instead of Average Invoice --- .../i5.1/oracle/201712141459_IDEMPIERE-3388.sql | 15 +++++++++++++++ .../postgresql/201712141459_IDEMPIERE-3388.sql | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql create mode 100644 migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql diff --git a/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql b/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql new file mode 100644 index 0000000000..8bb23e0e46 --- /dev/null +++ b/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3388 +-- Dec 14, 2017 2:58:05 PM CET +UPDATE C_AcctSchema SET CostingMethod='A',Updated=TO_DATE('2017-12-14 14:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_AcctSchema_ID=101 +; + +-- Dec 14, 2017 2:58:14 PM CET +UPDATE M_CostElement SET IsActive='N',Updated=TO_DATE('2017-12-14 14:58:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE M_CostElement_ID=104 +; + +SELECT register_migration_script('201712141459_IDEMPIERE-3388.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql b/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql new file mode 100644 index 0000000000..cb5a300614 --- /dev/null +++ b/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-3388 +-- Dec 14, 2017 2:58:05 PM CET +UPDATE C_AcctSchema SET CostingMethod='A',Updated=TO_TIMESTAMP('2017-12-14 14:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_AcctSchema_ID=101 +; + +-- Dec 14, 2017 2:58:14 PM CET +UPDATE M_CostElement SET IsActive='N',Updated=TO_TIMESTAMP('2017-12-14 14:58:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE M_CostElement_ID=104 +; + +SELECT register_migration_script('201712141459_IDEMPIERE-3388.sql') FROM dual +; + From c3940f38b719a874e4de322910d48126ffe970eb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Dec 2017 15:43:13 +0100 Subject: [PATCH 13/26] IDEMPIERE-3573 Invoice Vendor (create lines from..) - Error - Total matched qty > movement qty --- .../src/org/compiere/grid/CreateFromInvoice.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java index 1a2fa9d335..13c96ac176 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java @@ -30,6 +30,7 @@ import org.compiere.model.MInOutLine; import org.compiere.model.MInvoice; import org.compiere.model.MInvoiceLine; import org.compiere.model.MInvoicePaySchedule; +import org.compiere.model.MMatchInv; import org.compiere.model.MOrder; import org.compiere.model.MOrderLine; import org.compiere.model.MOrderPaySchedule; @@ -495,7 +496,12 @@ public abstract class CreateFromInvoice extends CreateFrom for (int j = 0; j < lines.length; j++) { MInOutLine line = lines[j]; - if (line.getQtyEntered().compareTo(QtyEntered) == 0) + // qty matched + BigDecimal qtyMatched = Env.ZERO; + for (MMatchInv match : MMatchInv.getInOutLine(Env.getCtx(), line.getM_InOutLine_ID(), trxName)) { + qtyMatched = qtyMatched.add(match.getQty()); + } + if (line.getQtyEntered().subtract(qtyMatched).compareTo(QtyEntered) == 0) { inoutLine = line; M_InOutLine_ID = inoutLine.getM_InOutLine_ID(); From 0f870b7bafc71eb91740f34e3da548d46b71858c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Dec 2017 16:11:06 +0100 Subject: [PATCH 14/26] IDEMPIERE-3415 PO Matching and PO list in Create Lines From: wrong result --- .../org/adempiere/webui/apps/form/WCreateFromShipmentUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java index 045738d401..8e9f4fc7c4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java @@ -394,7 +394,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi C_BPartner_ID = ((Integer)e.getNewValue()).intValue(); } - initBPOrderDetails (C_BPartner_ID, true); + initBPOrderDetails (C_BPartner_ID, false); } window.tableChanged(null); } // vetoableChange @@ -464,7 +464,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi orderField.addActionListener(this); initBPDetails(C_BPartner_ID); - } // initBPartnerOIS + } // initBPOrderDetails public void initBPDetails(int C_BPartner_ID) { From 981346c74e43b8f15b1963d96eb1800070c8b77b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Dec 2017 18:13:40 +0100 Subject: [PATCH 15/26] IDEMPIERE-2743 Vendor RMA Void Reset Returned Qty to 1 / IDEMPIERE-576 --- org.adempiere.base/src/org/compiere/model/MRMALine.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java index d9899cf8b6..6e12609e16 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMALine.java +++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java @@ -351,7 +351,7 @@ public class MRMALine extends X_M_RMALine } // Set default amount and qty for product - if (this.getM_Product_ID() != 0 && this.getQty().doubleValue() <= 0) + if (this.getM_Product_ID() != 0 && this.getQty().doubleValue() <= 0 && !MRMA.DOCACTION_Void.equals(getParent().getDocAction())) { if (getQty().signum() == 0) this.setQty(Env.ONE); @@ -360,7 +360,7 @@ public class MRMALine extends X_M_RMALine } // Set default amount and qty for charge - if (this.getC_Charge_ID() != 0 && this.getQty().doubleValue() <= 0) + if (this.getC_Charge_ID() != 0 && this.getQty().doubleValue() <= 0 && !MRMA.DOCACTION_Void.equals(getParent().getDocAction())) { if (getQty().signum() == 0) this.setQty(Env.ONE); @@ -369,7 +369,7 @@ public class MRMALine extends X_M_RMALine } // Set amount for products - if (this.getM_InOutLine_ID() != 0) + if (this.getM_InOutLine_ID() != 0 && !MRMA.DOCACTION_Void.equals(getParent().getDocAction())) { this.setM_Product_ID(m_ioLine.getM_Product_ID()); this.setC_Charge_ID(m_ioLine.getC_Charge_ID()); From a898f32438933668fdebf334673d71ea859cd933 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 15 Dec 2017 13:52:49 +0100 Subject: [PATCH 16/26] Fix help of form Merge Entities wrongly formatted breaking the wiki manual --- .../i5.1/oracle/201712151351_MinorHelpFix.sql | 16 ++++++++++++++++ .../postgresql/201712151351_MinorHelpFix.sql | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 migration/i5.1/oracle/201712151351_MinorHelpFix.sql create mode 100644 migration/i5.1/postgresql/201712151351_MinorHelpFix.sql diff --git a/migration/i5.1/oracle/201712151351_MinorHelpFix.sql b/migration/i5.1/oracle/201712151351_MinorHelpFix.sql new file mode 100644 index 0000000000..b84fff0d58 --- /dev/null +++ b/migration/i5.1/oracle/201712151351_MinorHelpFix.sql @@ -0,0 +1,16 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Fix help of form Merge Entities wrongly formatted breaking the wiki manual +-- Dec 15, 2017 1:49:32 PM CET +UPDATE AD_Form SET Help='Dangerous - Please are aware of what you are doing! +All instances of the From entity (e.g. Customer A) are changed to the To entity (e.g. Customer B). +The From entity (e.g. Customer A) is deleted. +

There is NO undo nor trace ! Please do a backup first Please be aware that you may be changing history records (e.g. invoices, etc.) !

+

Side effects: Merging Products are likely to distort product costs; Merging Business Partners may result in incorrect open item balance. Check with support on remedies.

+

Restrictions: Accounting and Inventory conflicts are not resolved in this version.

',Updated=TO_DATE('2017-12-15 13:49:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=112 +; + +SELECT register_migration_script('201712151351_MinorHelpFix.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql b/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql new file mode 100644 index 0000000000..9604328067 --- /dev/null +++ b/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql @@ -0,0 +1,13 @@ +-- Fix help of form Merge Entities wrongly formatted breaking the wiki manual +-- Dec 15, 2017 1:49:32 PM CET +UPDATE AD_Form SET Help='Dangerous - Please are aware of what you are doing! +All instances of the From entity (e.g. Customer A) are changed to the To entity (e.g. Customer B). +The From entity (e.g. Customer A) is deleted. +

There is NO undo nor trace ! Please do a backup first Please be aware that you may be changing history records (e.g. invoices, etc.) !

+

Side effects: Merging Products are likely to distort product costs; Merging Business Partners may result in incorrect open item balance. Check with support on remedies.

+

Restrictions: Accounting and Inventory conflicts are not resolved in this version.

',Updated=TO_TIMESTAMP('2017-12-15 13:49:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=112 +; + +SELECT register_migration_script('201712151351_MinorHelpFix.sql') FROM dual +; + From e725b3f6647a4a1df1b84d1ad7b24765fd6a18f7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 16 Dec 2017 10:12:26 +0100 Subject: [PATCH 17/26] IDEMPIERE-1721 Window Position, tab Remuneration, refers to a disabled window --- .../i5.1/oracle/201712161006_IDEMPIERE-1721.sql | 15 +++++++++++++++ .../postgresql/201712161006_IDEMPIERE-1721.sql | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql create mode 100644 migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql diff --git a/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql b/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql new file mode 100644 index 0000000000..c3b53506ad --- /dev/null +++ b/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1721 Window Position, tab Remuneration, refers to a disabled window +-- Dec 16, 2017 10:04:11 AM CET +UPDATE AD_Window SET IsActive='Y', IsBetaFunctionality='N',Updated=TO_DATE('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=353 +; + +-- Dec 16, 2017 10:04:11 AM CET +UPDATE AD_Menu SET Name='Remuneration', Description='Maintain Remuneration', IsActive='Y',Updated=TO_DATE('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=532 +; + +SELECT register_migration_script('201712161006_IDEMPIERE-1721.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql b/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql new file mode 100644 index 0000000000..a618574d99 --- /dev/null +++ b/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-1721 Window Position, tab Remuneration, refers to a disabled window +-- Dec 16, 2017 10:04:11 AM CET +UPDATE AD_Window SET IsActive='Y', IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=353 +; + +-- Dec 16, 2017 10:04:11 AM CET +UPDATE AD_Menu SET Name='Remuneration', Description='Maintain Remuneration', IsActive='Y',Updated=TO_TIMESTAMP('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=532 +; + +SELECT register_migration_script('201712161006_IDEMPIERE-1721.sql') FROM dual +; + From 7a488b2a0d768fcc6b9c663bc9c9254333569778 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 18 Sep 2017 12:45:02 +0800 Subject: [PATCH 18/26] 1008477 List on Position field in Lead window is blank even if there are position options configured. (IDEMPIERE-1721) --- migration/i5.1/oracle/201709181100_Ticket_1008477.sql | 11 +++++++++++ .../i5.1/postgresql/201709181100_Ticket_1008477.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i5.1/oracle/201709181100_Ticket_1008477.sql create mode 100644 migration/i5.1/postgresql/201709181100_Ticket_1008477.sql diff --git a/migration/i5.1/oracle/201709181100_Ticket_1008477.sql b/migration/i5.1/oracle/201709181100_Ticket_1008477.sql new file mode 100644 index 0000000000..999c740297 --- /dev/null +++ b/migration/i5.1/oracle/201709181100_Ticket_1008477.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 18, 2017 12:37:19 PM GMT+08:00 +-- 1008477 List on Position field in Lead window is blank even if there are position options configured. +UPDATE AD_Val_Rule SET Code='((C_Job.IsEmployee=(SELECT IsEmployee FROM C_BPartner WHERE C_BPartner_ID=@C_BPartner_ID:0@)) OR (C_Job.IsEmployee=''N'' AND @C_BPartner_ID:0@=0))',Updated=TO_DATE('2017-09-18 12:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=243 +; + +SELECT register_migration_script('201709181100_Ticket_1008477.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql b/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql new file mode 100644 index 0000000000..f015d8518c --- /dev/null +++ b/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql @@ -0,0 +1,8 @@ +-- Sep 18, 2017 12:37:19 PM GMT+08:00 +-- 1008477 List on Position field in Lead window is blank even if there are position options configured. +UPDATE AD_Val_Rule SET Code='((C_Job.IsEmployee=(SELECT IsEmployee FROM C_BPartner WHERE C_BPartner_ID=@C_BPartner_ID:0@)) OR (C_Job.IsEmployee=''N'' AND @C_BPartner_ID:0@=0))',Updated=TO_TIMESTAMP('2017-09-18 12:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=243 +; + +SELECT register_migration_script('201709181100_Ticket_1008477.sql') FROM dual +; + From acf10e57a51d4a490801b041884816ef35099ffb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 16 Dec 2017 10:25:39 +0100 Subject: [PATCH 19/26] IDEMPIERE-3358 Dictionary fixes / fix readonly translated flag on activity and sales region translation tab --- .../i5.1/oracle/201712161023_IDEMPIERE-3358.sql | 15 +++++++++++++++ .../postgresql/201712161023_IDEMPIERE-3358.sql | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql create mode 100644 migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql diff --git a/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql b/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql new file mode 100644 index 0000000000..95d1d1923f --- /dev/null +++ b/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3358 Dictionary fixes +-- Dec 16, 2017 10:22:29 AM CET +UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-12-16 10:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202750 +; + +-- Dec 16, 2017 10:22:42 AM CET +UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-12-16 10:22:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202776 +; + +SELECT register_migration_script('201712161023_IDEMPIERE-3358.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql b/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql new file mode 100644 index 0000000000..0a48b6d65a --- /dev/null +++ b/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-3358 Dictionary fixes +-- Dec 16, 2017 10:22:29 AM CET +UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-12-16 10:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202750 +; + +-- Dec 16, 2017 10:22:42 AM CET +UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-12-16 10:22:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202776 +; + +SELECT register_migration_script('201712161023_IDEMPIERE-3358.sql') FROM dual +; + From 43cfdd2a9613dbf56828b668d6a6d0d452250bc5 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Mon, 18 Dec 2017 18:40:11 +0100 Subject: [PATCH 20/26] IDEMPIERE-2825 - Pluggable product pricing --- .../src/org/adempiere/model/CalloutRMA.java | 6 +- .../org/compiere/model/CalloutInvoice.java | 11 +- .../src/org/compiere/model/CalloutOrder.java | 11 +- .../compiere/model/CalloutRequisition.java | 5 +- .../compiere/process/ProjectLinePricing.java | 8 +- .../OSGI-INF/defaultproductpricingfactory.xml | 7 + org.adempiere.base/build.properties | 1 + .../base/AbstractProductPricing.java | 135 +++++++++++++++ .../src/org/adempiere/base/Core.java | 22 +++ .../base/DefaultProductPricingFactory.java | 18 ++ .../org/adempiere/base/IProductPricing.java | 157 ++++++++++++++++++ .../base/IProductPricingFactory.java | 20 +++ .../ProductNotOnPriceListException.java | 6 +- .../src/org/compiere/model/MInvoiceLine.java | 8 +- .../src/org/compiere/model/MOrderLine.java | 10 +- .../org/compiere/model/MProductPricing.java | 106 ++++++------ .../src/org/compiere/model/MProjectLine.java | 7 +- .../src/org/compiere/model/MRMALine.java | 4 +- .../org/compiere/model/MRequisitionLine.java | 7 +- 19 files changed, 468 insertions(+), 81 deletions(-) create mode 100644 org.adempiere.base/OSGI-INF/defaultproductpricingfactory.xml create mode 100644 org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultProductPricingFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IProductPricing.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IProductPricingFactory.java 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 bdadacea6a..c14c3bb203 100644 --- a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java +++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java @@ -20,6 +20,8 @@ package org.adempiere.model; import java.math.BigDecimal; import java.util.Properties; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.compiere.model.CalloutEngine; import org.compiere.model.GridField; import org.compiere.model.GridTab; @@ -30,7 +32,6 @@ import org.compiere.model.MInvoice; import org.compiere.model.MInvoiceLine; import org.compiere.model.MOrder; import org.compiere.model.MOrderLine; -import org.compiere.model.MProductPricing; import org.compiere.model.MRMA; import org.compiere.model.MRMALine; import org.compiere.model.Query; @@ -146,7 +147,8 @@ public class CalloutRMA extends CalloutEngine { return ""; MRMA rma = new MRMA(ctx, M_RMA_ID, null); - MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null); int taxId = 0; int precision = 0; 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 e8b3f4f666..a0d7beafc3 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -24,6 +24,8 @@ import java.sql.Timestamp; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -327,7 +329,8 @@ public class CalloutInvoice extends CalloutEngine boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); 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, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -564,7 +567,8 @@ public class CalloutInvoice extends CalloutEngine if (QtyInvoiced == null) QtyInvoiced = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -845,7 +849,8 @@ public class CalloutInvoice extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); 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 7cc24c63aa..59cf24c2fc 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -24,6 +24,8 @@ import java.sql.Timestamp; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -800,7 +802,8 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -1096,7 +1099,8 @@ public class CalloutOrder extends CalloutEngine if (QtyOrdered == null) QtyOrdered = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -1425,7 +1429,8 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java index 5391757bda..45eb0157fc 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java @@ -21,6 +21,8 @@ import java.sql.Timestamp; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.adempiere.model.GridTabWrapper; import org.compiere.util.Env; @@ -100,7 +102,8 @@ public class CalloutRequisition extends CalloutEngine int C_BPartner_ID = line.getC_BPartner_ID(); BigDecimal Qty = line.getQty(); boolean isSOTrx = false; - MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null); // int M_PriceList_ID = req.getM_PriceList_ID(); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java index 695c6201cd..3c2a3e117b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java +++ b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java @@ -19,7 +19,8 @@ package org.compiere.process; import java.util.logging.Level; -import org.compiere.model.MProductPricing; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.compiere.model.MProject; import org.compiere.model.MProjectLine; import org.compiere.util.Msg; @@ -71,8 +72,9 @@ public class ProjectLinePricing extends SvrProcess throw new IllegalArgumentException("No PriceList"); // boolean isSOTrx = true; - MProductPricing pp = new MProductPricing (projectLine.getM_Product_ID(), - project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx, get_TrxName()); + IProductPricing pp = Core.getProductPricing(); + pp.setInitialValues(projectLine.getM_Product_ID(), project.getC_BPartner_ID(), + projectLine.getPlannedQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(project.getM_PriceList_ID()); pp.setPriceDate(project.getDateContract()); // diff --git a/org.adempiere.base/OSGI-INF/defaultproductpricingfactory.xml b/org.adempiere.base/OSGI-INF/defaultproductpricingfactory.xml new file mode 100644 index 0000000000..27ed659f8a --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultproductpricingfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/build.properties b/org.adempiere.base/build.properties index 47da21473d..1c58047ed2 100644 --- a/org.adempiere.base/build.properties +++ b/org.adempiere.base/build.properties @@ -22,6 +22,7 @@ bin.includes = META-INF/,\ OSGI-INF/defaultaddressvalidationfactory.xml,\ OSGI-INF/defaulttaxproviderfactory.xml,\ OSGI-INF/addressvalidationeventhandler.xml,\ + OSGI-INF/defaultproductpricingfactory.xml\ schema/,\ bsh-2.0b6.jar,\ commons-validator-1.6.jar diff --git a/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java new file mode 100644 index 0000000000..10704ccd5e --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java @@ -0,0 +1,135 @@ +/****************************************************************************** + * Copyright (C) 2017 Diego Ruiz * + * Copyright (C) 2017 Bx Service GmbH * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import org.compiere.model.I_C_InvoiceLine; +import org.compiere.model.I_C_OrderLine; +import org.compiere.model.I_C_ProjectLine; +import org.compiere.model.I_M_RMALine; +import org.compiere.model.I_M_RequisitionLine; +import org.compiere.util.Env; + +public abstract class AbstractProductPricing implements IProductPricing { + + protected int m_M_Product_ID; + protected int m_C_BPartner_ID; + protected BigDecimal m_Qty = Env.ONE; + protected boolean m_isSOTrx = true; + protected String trxName = null; + + protected int m_M_PriceList_Version_ID = 0; + protected int m_M_PriceList_ID = 0; + protected Timestamp m_PriceDate; + + public AbstractProductPricing() {} + + @Override + public void setInitialValues(int M_Product_ID, int C_BPartner_ID, BigDecimal qty, boolean isSOTrx, String trxName) { + this.trxName=trxName; + m_M_Product_ID = M_Product_ID; + m_C_BPartner_ID = C_BPartner_ID; + + if (qty != null && Env.ZERO.compareTo(qty) != 0) + m_Qty = qty; + m_isSOTrx = isSOTrx; + } + + @Override + public int getM_Product_ID() { + return m_M_Product_ID; + } + + @Override + public int getM_PriceList_ID() { + return m_M_PriceList_ID; + } + + @Override + public void setM_PriceList_ID(int M_PriceList_ID) { + m_M_PriceList_ID = M_PriceList_ID; + } + + @Override + public void setM_PriceList_Version_ID(int M_PriceList_Version_ID) { + m_M_PriceList_Version_ID = M_PriceList_Version_ID; + } + + @Override + public Timestamp getPriceDate() { + return m_PriceDate; + } + + @Override + public void setPriceDate(Timestamp priceDate) { + m_PriceDate = priceDate; + } + + @Override + public void setOrderLine(I_C_OrderLine orderLine, String trxName) { + m_M_Product_ID = orderLine.getM_Product_ID(); + m_C_BPartner_ID = orderLine.getC_BPartner_ID(); + BigDecimal qty = orderLine.getQtyOrdered(); + if (qty != null && Env.ZERO.compareTo(qty) != 0) + m_Qty = qty; + m_isSOTrx = orderLine.getC_Order().isSOTrx(); + m_PriceDate = orderLine.getDateOrdered(); + this.trxName = trxName; + } + + @Override + public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) { + m_M_Product_ID = invoiceLine.getM_Product_ID(); + m_C_BPartner_ID = invoiceLine.getC_Invoice().getC_BPartner_ID(); + BigDecimal qty = invoiceLine.getQtyInvoiced(); + if (qty != null && Env.ZERO.compareTo(qty) != 0) + m_Qty = qty; + m_isSOTrx = invoiceLine.getC_Invoice().isSOTrx(); + m_PriceDate = invoiceLine.getC_Invoice().getDateInvoiced(); + this.trxName = trxName; + } + + @Override + public void setProjectLine(I_C_ProjectLine projectLine, String trxName) { + m_M_Product_ID = projectLine.getM_Product_ID(); + m_C_BPartner_ID = projectLine.getC_Project().getC_BPartner_ID(); + BigDecimal qty = projectLine.getPlannedQty(); + if (qty != null && Env.ZERO.compareTo(qty) != 0) + m_Qty = qty; + m_isSOTrx = true; + this.trxName = trxName; + } + + @Override + public void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName) { + m_M_Product_ID = reqLine.getM_Product_ID(); + m_C_BPartner_ID = reqLine.getC_BPartner_ID(); + BigDecimal qty = reqLine.getQty(); + if (qty != null && Env.ZERO.compareTo(qty) != 0) + m_Qty = qty; + m_isSOTrx = false; + this.trxName = trxName; + } + + @Override + public void setRMALine(I_M_RMALine rmaLine, String trxName) { + m_M_Product_ID = rmaLine.getM_Product_ID(); + m_C_BPartner_ID = rmaLine.getM_RMA().getC_BPartner_ID(); + m_Qty = Env.ONE; + m_isSOTrx = rmaLine.getM_RMA().isSOTrx(); + this.trxName = trxName; + } +} diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java index 59c5a90c8e..a562fe6a28 100644 --- a/org.adempiere.base/src/org/adempiere/base/Core.java +++ b/org.adempiere.base/src/org/adempiere/base/Core.java @@ -450,4 +450,26 @@ public class Core { return myPaymentExporter; } + + /** + * get ProductPricing instance + * + * @return instance of the IProductPricing or null + */ + public static IProductPricing getProductPricing() { + + List factoryList = + Service.locator().list(IProductPricingFactory.class).getServices(); + if (factoryList != null) { + for(IProductPricingFactory factory : factoryList) { + IProductPricing myProductPricing = factory.newProductPricingInstance(); + if (myProductPricing != null) { + return myProductPricing; + } + } + } + + return null; + } + } diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultProductPricingFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultProductPricingFactory.java new file mode 100644 index 0000000000..e8f87f618d --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultProductPricingFactory.java @@ -0,0 +1,18 @@ +package org.adempiere.base; + +import org.compiere.model.MProductPricing; + +public class DefaultProductPricingFactory implements IProductPricingFactory { + + /** + * default constructor + */ + public DefaultProductPricingFactory() { + } + + @Override + public AbstractProductPricing newProductPricingInstance() { + return new MProductPricing(); + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/IProductPricing.java b/org.adempiere.base/src/org/adempiere/base/IProductPricing.java new file mode 100644 index 0000000000..4487deabf2 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IProductPricing.java @@ -0,0 +1,157 @@ +/****************************************************************************** + * Copyright (C) 2017 Diego Ruiz * + * Copyright (C) 2017 Bx Service GmbH * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import org.compiere.model.I_C_InvoiceLine; +import org.compiere.model.I_C_OrderLine; +import org.compiere.model.I_C_ProjectLine; +import org.compiere.model.I_M_RMALine; +import org.compiere.model.I_M_RequisitionLine; + +/** + * Product Price Calculations + */ +public interface IProductPricing { + + /** + * Set the initial values that the old MProductPricing uses + * for backward compatibility + * @param M_Product_ID + * @param C_BPartner_ID + * @param qty + * @param isSOTrx + * @param trxName + */ + void setInitialValues(int M_Product_ID, int C_BPartner_ID, + BigDecimal qty, boolean isSOTrx, String trxName); + + /** + * Calculate Price + * @return true if calculated + */ + boolean calculatePrice(); + + /** + * Calculate Discount Percentage + * @return Discount + */ + BigDecimal getDiscount(); + + int getM_Product_ID(); + + int getM_PriceList_ID(); + + void setM_PriceList_ID(int M_PriceList_ID); + + void setM_PriceList_Version_ID(int M_PriceList_Version_ID); + + /** + * Get Price Date + * @return date + */ + Timestamp getPriceDate(); + + /** + * Set Price Date + * @param priceDate date + */ + void setPriceDate(Timestamp priceDate); + + /** + * Get C_UOM_ID + * @return uom + */ + int getC_UOM_ID(); + + /** + * Get Price List + * @return list + */ + BigDecimal getPriceList(); + + /** + * Get Price Std + * @return std + */ + BigDecimal getPriceStd(); + + /** + * Get Price Limit + * @return limit + */ + BigDecimal getPriceLimit(); + + /** + * Get Price List Currency + * @return currency + */ + int getC_Currency_ID(); + + /** + * Is Price List enforced? + * @return enforce limit + */ + boolean isEnforcePriceLimit(); + + /** + * Is a DiscountSchema active? + * @return active Discount Schema + */ + boolean isDiscountSchema(); + + /** + * Is the Price Calculated (i.e. found)? + * @return calculated + */ + boolean isCalculated(); + + /** + * Set order line and calculate the parameters from it + * @param orderLine + * @param trxName + */ + void setOrderLine(I_C_OrderLine orderLine, String trxName); + + /** + * Set invoice line and calculate the parameters from it + * @param invoiceLine + * @param trxName + */ + void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName); + + /** + * Set project line and calculate the parameters from it + * @param projectLine + * @param trxName + */ + void setProjectLine(I_C_ProjectLine projectLine, String trxName); + + /** + * Set requisition line and calculate the parameters from it + * @param reqLine + * @param trxName + */ + void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName); + + /** + * Set rma line and calculate the parameters from it + * @param rmaLine + * @param trxName + */ + void setRMALine(I_M_RMALine rmaLine, String trxName); + +} diff --git a/org.adempiere.base/src/org/adempiere/base/IProductPricingFactory.java b/org.adempiere.base/src/org/adempiere/base/IProductPricingFactory.java new file mode 100644 index 0000000000..846929a6c2 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IProductPricingFactory.java @@ -0,0 +1,20 @@ +/****************************************************************************** + * Copyright (C) 2017 Diego Ruiz * + * Copyright (C) 2017 Bx Service GmbH * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +public interface IProductPricingFactory { + + public AbstractProductPricing newProductPricingInstance(); + +} diff --git a/org.adempiere.base/src/org/adempiere/exceptions/ProductNotOnPriceListException.java b/org.adempiere.base/src/org/adempiere/exceptions/ProductNotOnPriceListException.java index c654354149..33fca3567b 100644 --- a/org.adempiere.base/src/org/adempiere/exceptions/ProductNotOnPriceListException.java +++ b/org.adempiere.base/src/org/adempiere/exceptions/ProductNotOnPriceListException.java @@ -15,9 +15,9 @@ package org.adempiere.exceptions; import java.text.DateFormat; +import org.adempiere.base.IProductPricing; import org.compiere.model.MPriceList; import org.compiere.model.MProduct; -import org.compiere.model.MProductPricing; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -36,12 +36,12 @@ public class ProductNotOnPriceListException extends AdempiereException public static final String AD_Message = "ProductNotOnPriceList"; - public ProductNotOnPriceListException(MProductPricing productPricing, int documentLineNo) + public ProductNotOnPriceListException(IProductPricing productPricing, int documentLineNo) { super(buildMessage(productPricing, documentLineNo)); } - private static final String buildMessage (MProductPricing pp, int documentLineNo) + private static final String buildMessage (IProductPricing pp, int documentLineNo) { StringBuilder sb = new StringBuilder(); if (documentLineNo > 0) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index e0a80eafb4..272995eb03 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -26,6 +26,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.adempiere.exceptions.AdempiereException; import org.adempiere.model.ITaxProvider; import org.compiere.util.CLogger; @@ -177,7 +178,7 @@ public class MInvoiceLine extends X_C_InvoiceLine /** Cached Precision */ private Integer m_precision = null; /** Product Pricing */ - private MProductPricing m_productPricing = null; + private IProductPricing m_productPricing = null; /** Parent */ private MInvoice m_parent = null; @@ -378,10 +379,9 @@ public class MInvoiceLine extends X_C_InvoiceLine return; // if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); - m_productPricing = new MProductPricing (getM_Product_ID(), - C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx, get_TrxName()); + m_productPricing = Core.getProductPricing(); + m_productPricing.setInvoiceLine(this, get_TrxName()); m_productPricing.setM_PriceList_ID(M_PriceList_ID); - m_productPricing.setPriceDate(m_DateInvoiced); // setPriceActual (m_productPricing.getPriceStd()); setPriceList (m_productPricing.getPriceList()); diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index ffa04d4299..c4858e018a 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -23,6 +23,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.ProductNotOnPriceListException; import org.adempiere.model.ITaxProvider; @@ -196,7 +197,7 @@ public class MOrderLine extends X_C_OrderLine // protected boolean m_IsSOTrx = true; // Product Pricing - protected MProductPricing m_productPrice = null; + protected IProductPricing m_productPrice = null; /** Tax */ protected MTax m_tax = null; @@ -321,12 +322,11 @@ public class MOrderLine extends X_C_OrderLine * @param M_PriceList_ID id * @return product pricing */ - protected MProductPricing getProductPricing (int M_PriceList_ID) + protected IProductPricing getProductPricing (int M_PriceList_ID) { - m_productPrice = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx, get_TrxName()); + m_productPrice = Core.getProductPricing(); + m_productPrice.setOrderLine(this, get_TrxName()); m_productPrice.setM_PriceList_ID(M_PriceList_ID); - m_productPrice.setPriceDate(getDateOrdered()); // m_productPrice.calculatePrice(); return m_productPrice; diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index b49cd5357e..c2a06912fa 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -22,6 +22,7 @@ import java.sql.ResultSet; import java.sql.Timestamp; import java.util.logging.Level; +import org.adempiere.base.AbstractProductPricing; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -33,13 +34,19 @@ import org.compiere.util.Trace; * @author Jorg Janke * @version $Id: MProductPricing.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ */ -public class MProductPricing +public class MProductPricing extends AbstractProductPricing { private String trxName=null; + + /** + * New constructor to be used with the ProductPriceFactories + */ + public MProductPricing() {} /** - * Constructor + * Old Constructor to keep backward + * compatibility * @param M_Product_ID product * @param C_BPartner_ID partner * @param Qty quantity @@ -49,17 +56,7 @@ public class MProductPricing public MProductPricing (int M_Product_ID, int C_BPartner_ID, BigDecimal Qty, boolean isSOTrx, String trxName) { - this.trxName=trxName; - - m_M_Product_ID = M_Product_ID; - m_C_BPartner_ID = C_BPartner_ID; - if (Qty != null && Env.ZERO.compareTo(Qty) != 0) - m_Qty = Qty; - m_isSOTrx = isSOTrx; - int thereAreVendorBreakRecords = DB.getSQLValue(trxName, - "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", - m_M_Product_ID, m_C_BPartner_ID); - m_useVendorBreak = thereAreVendorBreakRecords > 0; + setInitialValues(M_Product_ID, C_BPartner_ID, Qty, isSOTrx, trxName); } @@ -76,13 +73,20 @@ public class MProductPricing { this(M_Product_ID,C_BPartner_ID,Qty,isSOTrx,null); } // MProductPricing + + @Override + public void setInitialValues(int M_Product_ID, int C_BPartner_ID, BigDecimal qty, boolean isSOTrx, String trxName) { + super.setInitialValues(M_Product_ID, C_BPartner_ID, qty, isSOTrx, trxName); + checkVendorBreak(); + } + + private void checkVendorBreak() { + int thereAreVendorBreakRecords = DB.getSQLValue(trxName, + "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", + m_M_Product_ID, m_C_BPartner_ID); + m_useVendorBreak = thereAreVendorBreakRecords > 0; + } - private int m_M_Product_ID; - private int m_C_BPartner_ID; - private BigDecimal m_Qty = Env.ONE; - private boolean m_isSOTrx = true; - // - private int m_M_PriceList_ID = 0; private int m_M_PriceList_Version_ID = 0; private Timestamp m_PriceDate; /** Precision -1 = no rounding */ @@ -828,32 +832,13 @@ public class MProductPricing - - /************************************************************************** - * Get Product ID - * @return id - */ - public int getM_Product_ID() - { - return m_M_Product_ID; - } - - /** - * Get PriceList ID - * @return pl - */ - public int getM_PriceList_ID() - { - return m_M_PriceList_ID; - } // getM_PriceList_ID - /** * Set PriceList * @param M_PriceList_ID pl */ public void setM_PriceList_ID( int M_PriceList_ID) { - m_M_PriceList_ID = M_PriceList_ID; + super.setM_PriceList_ID(M_PriceList_ID); m_calculated = false; } // setM_PriceList_ID @@ -872,26 +857,17 @@ public class MProductPricing */ public void setM_PriceList_Version_ID (int M_PriceList_Version_ID) { - m_M_PriceList_Version_ID = M_PriceList_Version_ID; + super.setM_PriceList_Version_ID(M_PriceList_Version_ID); m_calculated = false; } // setM_PriceList_Version_ID - /** - * Get Price Date - * @return date - */ - public Timestamp getPriceDate() - { - return m_PriceDate; - } // getPriceDate - /** * Set Price Date * @param priceDate date */ public void setPriceDate(Timestamp priceDate) { - m_PriceDate = priceDate; + super.setPriceDate(priceDate); m_calculated = false; } // setPriceDate @@ -1006,4 +982,34 @@ public class MProductPricing return m_calculated; } // isCalculated + @Override + public void setOrderLine(I_C_OrderLine orderLine, String trxName) { + super.setOrderLine(orderLine, trxName); + checkVendorBreak(); + } + + @Override + public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) { + super.setInvoiceLine(invoiceLine, trxName); + checkVendorBreak(); + } + + @Override + public void setProjectLine(I_C_ProjectLine projectLine, String trxName) { + super.setProjectLine(projectLine, trxName); + checkVendorBreak(); + } + + @Override + public void setRequisitionLine(I_M_RequisitionLine reqLine, String trxName) { + super.setRequisitionLine(reqLine, trxName); + checkVendorBreak(); + } + + @Override + public void setRMALine(I_M_RMALine rmaLine, String trxName) { + super.setRMALine(rmaLine, trxName); + checkVendorBreak(); + } + } // MProductPrice diff --git a/org.adempiere.base/src/org/compiere/model/MProjectLine.java b/org.adempiere.base/src/org/compiere/model/MProjectLine.java index 22f92c20fe..eb5cc11d91 100644 --- a/org.adempiere.base/src/org/compiere/model/MProjectLine.java +++ b/org.adempiere.base/src/org/compiere/model/MProjectLine.java @@ -21,6 +21,8 @@ import java.sql.ResultSet; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.compiere.util.DB; import org.compiere.util.Env; @@ -146,9 +148,8 @@ public class MProjectLine extends X_C_ProjectLine return limitPrice; if (getProject() == null) return limitPrice; - boolean isSOTrx = true; - MProductPricing pp = new MProductPricing (getM_Product_ID(), - m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx, get_TrxName()); + IProductPricing pp = Core.getProductPricing(); + pp.setProjectLine(this, get_TrxName()); pp.setM_PriceList_ID(m_parent.getM_PriceList_ID()); if (pp.calculatePrice()) limitPrice = pp.getPriceLimit(); diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java index 6e12609e16..4150085e01 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMALine.java +++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java @@ -22,6 +22,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.adempiere.exceptions.AdempiereException; import org.adempiere.model.ITaxProvider; import org.compiere.util.DB; @@ -147,7 +148,8 @@ public class MRMALine extends X_M_RMALine } else if (getM_Product_ID() != 0) { - MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx(), get_TrxName()); + IProductPricing pp = Core.getProductPricing(); + pp.setRMALine(this, get_TrxName()); MInvoice invoice = getParent().getOriginalInvoice(); if (invoice != null) diff --git a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java index 322c82de36..b6449be440 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; +import org.adempiere.base.IProductPricing; import org.adempiere.exceptions.AdempiereException; import org.compiere.util.DB; import org.compiere.util.Env; @@ -232,9 +234,8 @@ public class MRequisitionLine extends X_M_RequisitionLine return; // if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); - boolean isSOTrx = false; - MProductPricing pp = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQty(), isSOTrx, get_TrxName()); + IProductPricing pp = Core.getProductPricing(); + pp.setRequisitionLine(this, get_TrxName()); pp.setM_PriceList_ID(M_PriceList_ID); // pp.setPriceDate(getDateOrdered()); // From 8bca99e93c76062694bafc4033a8d41bb9dbadd9 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 27 Dec 2017 15:58:13 +0100 Subject: [PATCH 21/26] IDEMPIERE-2825 - Pluggable product pricing --- .../org/compiere/model/CalloutInvoice.java | 24 +++++++------------ .../src/org/compiere/model/CalloutOrder.java | 23 +++++++----------- .../base/AbstractProductPricing.java | 8 ++++++- .../org/adempiere/base/IProductPricing.java | 2 ++ 4 files changed, 25 insertions(+), 32 deletions(-) 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 a0d7beafc3..6ac5239d23 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import org.adempiere.base.Core; import org.adempiere.base.IProductPricing; +import org.adempiere.model.GridTabWrapper; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -326,11 +327,9 @@ public class CalloutInvoice extends CalloutEngine mTab.setValue("M_AttributeSetInstance_ID", null); /***** Price Calculation see also qty ****/ - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); - BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced"); + I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + pp.setInvoiceLine(invoiceLine, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -353,8 +352,6 @@ public class CalloutInvoice extends CalloutEngine } pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced"); - pp.setPriceDate(date); // mTab.setValue("PriceList", pp.getPriceList()); mTab.setValue("PriceLimit", pp.getPriceLimit()); @@ -560,20 +557,18 @@ public class CalloutInvoice extends CalloutEngine || mField.getColumnName().equals("M_Product_ID")) && !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema"))) { - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); if (mField.getColumnName().equals("QtyEntered")) QtyInvoiced = MUOMConversion.convertProductFrom (ctx, M_Product_ID, C_UOM_To_ID, QtyEntered); if (QtyInvoiced == null) QtyInvoiced = QtyEntered; - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null); + pp.setInvoiceLine(invoiceLine, null); pp.setM_PriceList_ID(M_PriceList_ID); + pp.setQty(QtyInvoiced); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - Timestamp date = (Timestamp)mTab.getValue("DateInvoiced"); - pp.setPriceDate(date); // PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, C_UOM_To_ID, pp.getPriceStd()); @@ -846,11 +841,9 @@ public class CalloutInvoice extends CalloutEngine } /***** Price Calculation see also qty ****/ - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); - BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + pp.setInvoiceLine(invoiceLine, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -871,7 +864,6 @@ public class CalloutInvoice extends CalloutEngine Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID ); } pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - pp.setPriceDate(orderDate); // Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N"); Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N"); 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 59cf24c2fc..ef322ab187 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import org.adempiere.base.Core; import org.adempiere.base.IProductPricing; +import org.adempiere.model.GridTabWrapper; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -799,11 +800,9 @@ public class CalloutOrder extends CalloutEngine mTab.setValue("M_AttributeSetInstance_ID", null); /***** Price Calculation see also qty ****/ - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); - BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + pp.setOrderLine(orderLine, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -824,7 +823,6 @@ public class CalloutOrder extends CalloutEngine Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID ); } pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - pp.setPriceDate(orderDate); // mTab.setValue("PriceList", pp.getPriceList()); mTab.setValue("PriceLimit", pp.getPriceLimit()); @@ -1092,20 +1090,18 @@ public class CalloutOrder extends CalloutEngine || mField.getColumnName().equals("M_Product_ID")) && !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema"))) { - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); if (mField.getColumnName().equals("QtyEntered")) QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, C_UOM_To_ID, QtyEntered); if (QtyOrdered == null) QtyOrdered = QtyEntered; - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null); + pp.setOrderLine(orderLine, null); + pp.setQty(QtyOrdered); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - Timestamp date = (Timestamp)mTab.getValue("DateOrdered"); - pp.setPriceDate(date); // PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, C_UOM_To_ID, pp.getPriceStd()); @@ -1426,11 +1422,9 @@ public class CalloutOrder extends CalloutEngine } /***** Price Calculation see also qty ****/ - int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); - BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); - boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); + I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class); IProductPricing pp = Core.getProductPricing(); - pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); + pp.setOrderLine(orderLine, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -1451,7 +1445,6 @@ public class CalloutOrder extends CalloutEngine Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID ); } pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); - pp.setPriceDate(orderDate); // Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N"); Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N"); diff --git a/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java index 10704ccd5e..db1ea95931 100644 --- a/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java +++ b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java @@ -67,6 +67,11 @@ public abstract class AbstractProductPricing implements IProductPricing { public void setM_PriceList_Version_ID(int M_PriceList_Version_ID) { m_M_PriceList_Version_ID = M_PriceList_Version_ID; } + + @Override + public void setQty(BigDecimal qty) { + m_Qty = qty; + } @Override public Timestamp getPriceDate() { @@ -94,7 +99,8 @@ public abstract class AbstractProductPricing implements IProductPricing { public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) { m_M_Product_ID = invoiceLine.getM_Product_ID(); m_C_BPartner_ID = invoiceLine.getC_Invoice().getC_BPartner_ID(); - BigDecimal qty = invoiceLine.getQtyInvoiced(); + BigDecimal qty = invoiceLine.getQtyInvoiced() != null ? + invoiceLine.getQtyInvoiced() : invoiceLine.getQtyEntered(); if (qty != null && Env.ZERO.compareTo(qty) != 0) m_Qty = qty; m_isSOTrx = invoiceLine.getC_Invoice().isSOTrx(); diff --git a/org.adempiere.base/src/org/adempiere/base/IProductPricing.java b/org.adempiere.base/src/org/adempiere/base/IProductPricing.java index 4487deabf2..fd3eecd6b3 100644 --- a/org.adempiere.base/src/org/adempiere/base/IProductPricing.java +++ b/org.adempiere.base/src/org/adempiere/base/IProductPricing.java @@ -59,6 +59,8 @@ public interface IProductPricing { void setM_PriceList_Version_ID(int M_PriceList_Version_ID); + void setQty(BigDecimal qty); + /** * Get Price Date * @return date From 9683bd7ea599022512e450605aaf3c1951a42f8e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Dec 2017 15:59:07 +0100 Subject: [PATCH 22/26] IDEMPIERE-3587 RequisitionCallout create model from parent gridtab / integrate patch from Ben Parker (benparker_93) --- .../src/org/compiere/model/CalloutRequisition.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java index 45eb0157fc..c219a54c8d 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java @@ -28,7 +28,6 @@ import org.compiere.util.Env; /** * Requisition Callouts - * * @author Jorg Janke * @version $Id: CalloutRequisition.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $ */ @@ -49,7 +48,7 @@ public class CalloutRequisition extends CalloutEngine Integer M_Product_ID = (Integer)value; if (M_Product_ID == null || M_Product_ID.intValue() == 0) return ""; - final I_M_Requisition req = GridTabWrapper.create(mTab, I_M_Requisition.class); + final I_M_Requisition req = GridTabWrapper.create(mTab.getParentTab(), I_M_Requisition.class); final I_M_RequisitionLine line = GridTabWrapper.create(mTab, I_M_RequisitionLine.class); setPrice(ctx, WindowNo, req, line); MProduct product = MProduct.get(ctx, M_Product_ID); @@ -73,7 +72,7 @@ public class CalloutRequisition extends CalloutEngine if (isCalloutActive() || value == null) return ""; - final I_M_Requisition req = GridTabWrapper.create(mTab, I_M_Requisition.class); + final I_M_Requisition req = GridTabWrapper.create(mTab.getParentTab(), I_M_Requisition.class); final I_M_RequisitionLine line = GridTabWrapper.create(mTab, I_M_RequisitionLine.class); // Qty changed - recalc price if (mField.getColumnName().equals(I_M_RequisitionLine.COLUMNNAME_Qty) From 62e61b2833d5eccbbb116b8d9f380ee7c2f7276b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 31 Dec 2017 12:11:17 +0100 Subject: [PATCH 23/26] IDEMPIERE-3594 Wrong callout rules for PaymentRule --- .../src/org/compiere/model/CalloutInvoice.java | 12 ++++-------- .../compiere/model/CalloutInvoiceBatch.java | 10 +++------- .../src/org/compiere/model/CalloutOrder.java | 18 ------------------ 3 files changed, 7 insertions(+), 33 deletions(-) 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 6ac5239d23..8772db6a42 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -90,9 +90,9 @@ public class CalloutInvoice extends CalloutEngine Env.setContext(ctx, WindowNo, "DocBaseType", s); // AP Check & AR Credit Memo if (s.startsWith("AP")) - mTab.setValue("PaymentRule", "S"); // Check + mTab.setValue("PaymentRule", X_C_Invoice.PAYMENTRULE_Check); else if (s.endsWith("C")) - mTab.setValue("PaymentRule", "P"); // OnCredit + mTab.setValue("PaymentRule", X_C_Invoice.PAYMENTRULE_OnCredit); } } catch (SQLException e) @@ -186,13 +186,9 @@ public class CalloutInvoice extends CalloutEngine // PaymentRule String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO"); if (s != null && s.length() != 0) - { - if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term - s = "P"; - else if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx - s = "P"; // Payment Term mTab.setValue("PaymentRule", s); - } + if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term + s = X_C_Invoice.PAYMENTRULE_OnCredit; // Payment Term ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID")); if (!rs.wasNull()) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java index 08414017be..236f4143c5 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java @@ -105,13 +105,9 @@ public class CalloutInvoiceBatch extends CalloutEngine // PaymentRule String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO"); if (s != null && s.length() != 0) - { - if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term - s = "P"; - else if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx - s = "P"; // Payment Term - // mTab.setValue("PaymentRule", s); - } + mTab.setValue("PaymentRule", s); + if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term + s = X_C_Invoice.PAYMENTRULE_OnCredit; // Payment Term Integer ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID")); if (!rs.wasNull()) 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 ef322ab187..36ef208b32 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -184,13 +184,7 @@ public class CalloutOrder extends CalloutEngine // PaymentRule String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO"); if (s != null && s.length() != 0) - { - if (IsSOTrx && (s.equals("B") || s.equals("S") || s.equals("U"))) // No Cash/Check/Transfer for SO_Trx - s = "P"; // Payment Term - if (!IsSOTrx && (s.equals("B"))) // No Cash for PO_Trx - s = "P"; // Payment Term mTab.setValue("PaymentRule", s); - } // Payment Term Integer ii =new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID")); if (!rs.wasNull()) @@ -404,13 +398,7 @@ public class CalloutOrder extends CalloutEngine // PaymentRule s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO"); if (s != null && s.length() != 0) - { - if (s.equals("B")) // No Cache in Non POS - s = "P"; - if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx - s = "P"; // Payment Term mTab.setValue("PaymentRule", s); - } // Payment Term ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID")); if (!rs.wasNull()) @@ -592,13 +580,7 @@ public class CalloutOrder extends CalloutEngine // PaymentRule s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO"); if (s != null && s.length() != 0) - { - if (s.equals("B")) // No Cache in Non POS - s = "P"; - if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx - s = "P"; // Payment Term mTab.setValue("PaymentRule", s); - } // Payment Term ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID")); if (!rs.wasNull()) From c922644b6f897a583e39630b635e43513a1d5749 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 5 Jan 2018 13:58:21 +0100 Subject: [PATCH 24/26] IDEMPIERE-3597 org/krysalis/barcode4j/output/CanvasProvider --- org.adempiere.base/META-INF/MANIFEST.MF | 3 ++- org.adempiere.server-feature/server.product.launch | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index 2b64bd4c53..b0381ada23 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -121,4 +121,5 @@ Require-Bundle: org.eclipse.equinox.app;bundle-version="0.0.0", com.itextpdf;bundle-version="0.0.0", net.sf.supercsv.super-csv;bundle-version="0.0.0", bcprov;bundle-version="1.54.0", - groovy-all;bundle-version="[2.4.7,2.5.0)" + groovy-all;bundle-version="[2.4.7,2.5.0)", + org.krysalis.barcode4j;bundle-version="2.1.0" diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch index a5ddda54ec..a957e198b7 100644 --- a/org.adempiere.server-feature/server.product.launch +++ b/org.adempiere.server-feature/server.product.launch @@ -27,8 +27,8 @@ - - + + From d7353f8e2af046b6109b926f77bc74e306728e4b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 5 Jan 2018 15:14:50 +0100 Subject: [PATCH 25/26] IDEMPIERE-3535 / thanks to Murilo - fixed a flaw on the rendering of Lock button --- .../src/org/adempiere/webui/adwindow/ADWindowToolbar.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java index 970be8a714..3d90b92343 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java @@ -576,7 +576,13 @@ public class ADWindowToolbar extends FToolbar implements EventListener { this.btnLock.setPressed(locked); - String imgURL = "images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + "24.png"; + String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); + String suffix = "24.png"; + if (!Util.isEmpty(size)) + { + suffix = size + ".png"; + } + String imgURL = "images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + suffix; imgURL = ThemeManager.getThemeResource(imgURL); this.btnLock.setImage(imgURL); } From 23d2ca465e2665b557750c06943d3cb4a0cddd9a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 5 Jan 2018 15:15:37 +0100 Subject: [PATCH 26/26] IDEMPIERE-905 Post-it functionality / add 16 pixels icon --- .../theme/default/images/PostIt16.png | Bin 0 -> 826 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 org.adempiere.ui.zk/theme/default/images/PostIt16.png diff --git a/org.adempiere.ui.zk/theme/default/images/PostIt16.png b/org.adempiere.ui.zk/theme/default/images/PostIt16.png new file mode 100644 index 0000000000000000000000000000000000000000..3a676cd642aacb42181a3a1fd9aec9a267c87bb5 GIT binary patch literal 826 zcmV-A1I7G_P)?>2 zK~y-)rISr-TxA%Bujf7QIcIW`Gc!phGs%oi(pss41PY}RH-btQZlo5WE5St<;-3&) zRB-9qoxei5kp!%uD4K;|)Fy4rm&tr)X3od^K3!CoU3snV#SPbe!}F0(u3g``|MHs; zfveBU$i~LCT5G;qfA{v*hga4Y+QvCm@5!cl9Dnxp9n|?Jci-54VZHH}suS>t8qNp9 z{-^i8`qJLI_4eJ5KYH);G%*@gVu4wZ5F>`~+OP1-_I>Vr@Xl6}7@!1SQjVt#in5!| z&3s|6t~IYLEzY3RSjY_+fD#phn_RH<{%vNW8Ke-<67@MQcf>Y~x;?GfOP5v`AwaA{ z@n{fXYzV-Ow{Ft!_Sic(B@7Kqi&f&#g0+~yhu{D3bH~=|$vR#^fiS`qhKGMXVl*1^ z&q4y2p3b5r4$Fh>9V$tcxO+9jX#*?j#5&hLvzSyQdKSv{7!59y|K+6eu3mSl*5a4jxWXV>7T(mS)qJShxX*C;A7N`p9;6Fow zbsQa>kuEGV>YY)q8A_kEY???YilTT#KrDn61dI3rOb$5m!HDC-L%O{#v4vW#YBE=J z>^D0nlljD(m6fIyouU$h2qFeNKu(zrc>LQggTa6#iLo}PcMx#&M{iI5eN|`k)ytci zpOi)lK|RlwWk8-4>onUeHWtXT0`&ok+JnE(cKN?N1!G4*d&XeE5dZ)H07*qoM6N<$ Ef_x@_-~a#s literal 0 HcmV?d00001