diff --git a/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql b/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql
new file mode 100644
index 0000000000..089d3c6cc0
--- /dev/null
+++ b/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql
@@ -0,0 +1,9 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Oct 13, 2018 4:35:41 PM IST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','D','S','54085add-8245-4bfe-a978-3583bbe2cc2a')
+;
+
+SELECT register_migration_script('201810131655_IDEMPIERE-1311.sql') FROM dual
+;
diff --git a/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql b/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql
new file mode 100644
index 0000000000..8f608dd810
--- /dev/null
+++ b/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-1311 Ability to hide fields on Connection panel
+-- Jan 25, 2019, 2:53:25 PM CET
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Defaults',0,0,'Y',TO_DATE('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,200486,'Defaults','D','4b2b5e32-b978-47d9-a843-7e6c9eb647f2')
+;
+
+SELECT register_migration_script('201901251453_IDEMPIERE-1311.sql') FROM dual
+;
+
diff --git a/migration/i6.2/oracle/201901261333_IDEMPIERE-3509.sql b/migration/i6.2/oracle/201901261333_IDEMPIERE-3509.sql
new file mode 100644
index 0000000000..fcdf855fb7
--- /dev/null
+++ b/migration/i6.2/oracle/201901261333_IDEMPIERE-3509.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3509:Message about can't find out direct table reference
+-- Sep 30, 2017 11:59:56 PM ICT
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Can''''t resolve reference table for column "{0}"',0,0,'Y',TO_DATE('2017-09-30 23:59:55','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-09-30 23:59:55','YYYY-MM-DD HH24:MI:SS'),100,200432,'NotReferenceTable','D','4f338d58-5c2d-4dda-8817-93f1954ab4eb')
+;
+
+SELECT register_migration_script('201901261333_IDEMPIERE-3509.sql') FROM dual
+;
+
diff --git a/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql b/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql
new file mode 100644
index 0000000000..bf441026c5
--- /dev/null
+++ b/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql
@@ -0,0 +1,6 @@
+-- Oct 13, 2018 4:35:41 PM IST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','D','S','54085add-8245-4bfe-a978-3583bbe2cc2a')
+;
+
+SELECT register_migration_script('201810131655_IDEMPIERE-1311.sql') FROM dual
+;
diff --git a/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql b/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql
new file mode 100644
index 0000000000..e54f78061c
--- /dev/null
+++ b/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-1311 Ability to hide fields on Connection panel
+-- Jan 25, 2019, 2:53:25 PM CET
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Defaults',0,0,'Y',TO_TIMESTAMP('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,200486,'Defaults','D','4b2b5e32-b978-47d9-a843-7e6c9eb647f2')
+;
+
+SELECT register_migration_script('201901251453_IDEMPIERE-1311.sql') FROM dual
+;
+
diff --git a/migration/i6.2/postgresql/201901261333_IDEMPIERE-3509.sql b/migration/i6.2/postgresql/201901261333_IDEMPIERE-3509.sql
new file mode 100644
index 0000000000..db51b43c15
--- /dev/null
+++ b/migration/i6.2/postgresql/201901261333_IDEMPIERE-3509.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-3509:Message about can't find out direct table reference
+-- Sep 30, 2017 11:59:56 PM ICT
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Can''''t resolve reference table for column "{0}"',0,0,'Y',TO_TIMESTAMP('2017-09-30 23:59:55','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-09-30 23:59:55','YYYY-MM-DD HH24:MI:SS'),100,200432,'NotReferenceTable','D','4f338d58-5c2d-4dda-8817-93f1954ab4eb')
+;
+
+SELECT register_migration_script('201901261333_IDEMPIERE-3509.sql') FROM dual
+;
+
diff --git a/org.adempiere.base-feature/model.generator.launch b/org.adempiere.base-feature/model.generator.launch
index 8517318b57..97278d327b 100644
--- a/org.adempiere.base-feature/model.generator.launch
+++ b/org.adempiere.base-feature/model.generator.launch
@@ -30,7 +30,7 @@
-
+
diff --git a/org.adempiere.base-feature/packinfolder.app.launch b/org.adempiere.base-feature/packinfolder.app.launch
index 59452c515f..3b416a2547 100644
--- a/org.adempiere.base-feature/packinfolder.app.launch
+++ b/org.adempiere.base-feature/packinfolder.app.launch
@@ -27,7 +27,7 @@
-
+
diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch
index 96a7dbc451..112cceb3aa 100644
--- a/org.adempiere.base-feature/sign.database.build.launch
+++ b/org.adempiere.base-feature/sign.database.build.launch
@@ -30,7 +30,7 @@
-
+
diff --git a/org.adempiere.base-feature/synchronize-terminology.app.launch b/org.adempiere.base-feature/synchronize-terminology.app.launch
index 0fe75da3ca..1bb69ef189 100644
--- a/org.adempiere.base-feature/synchronize-terminology.app.launch
+++ b/org.adempiere.base-feature/synchronize-terminology.app.launch
@@ -10,7 +10,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
diff --git a/org.adempiere.base-feature/translation.app.launch b/org.adempiere.base-feature/translation.app.launch
index 9201753ed0..5d97cf9ae2 100644
--- a/org.adempiere.base-feature/translation.app.launch
+++ b/org.adempiere.base-feature/translation.app.launch
@@ -30,7 +30,7 @@
-
+
diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyFromInvoice.java b/org.adempiere.base.process/src/org/compiere/process/CopyFromInvoice.java
index 8749ef9ec7..b9b2cabf91 100644
--- a/org.adempiere.base.process/src/org/compiere/process/CopyFromInvoice.java
+++ b/org.adempiere.base.process/src/org/compiere/process/CopyFromInvoice.java
@@ -65,7 +65,7 @@ public class CopyFromInvoice extends SvrProcess
MInvoice from = new MInvoice (getCtx(), m_C_Invoice_ID, get_TrxName());
MInvoice to = new MInvoice (getCtx(), To_C_Invoice_ID, get_TrxName());
//
- int no = to.copyLinesFrom (from, false, false);
+ int no = to.copyLinesFrom (from, false, false, false);
//
return "@Copied@=" + no;
} // doIt
diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java
index 2026d2bf27..c3dba63b85 100644
--- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java
+++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java
@@ -247,7 +247,7 @@ public class InOutGenerate extends SvrProcess
.append(" INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) ")
.append("WHERE iol.C_OrderLine_ID=C_OrderLine.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))");
// Deadlock Prevention - Order by M_Product_ID
- MOrderLine[] lines = order.getLines (where.toString(), "C_BPartner_Location_ID, M_Product_ID");
+ MOrderLine[] lines = order.getLines (where.toString(), "C_BPartner_Location_ID, M_Product_ID, Line");
for (int i = 0; i < lines.length; i++)
{
MOrderLine line = lines[i];
diff --git a/org.adempiere.base.process/src/org/compiere/process/MatchInvDelete.java b/org.adempiere.base.process/src/org/compiere/process/MatchInvDelete.java
index 0aabf53a49..8b4d3a08e7 100644
--- a/org.adempiere.base.process/src/org/compiere/process/MatchInvDelete.java
+++ b/org.adempiere.base.process/src/org/compiere/process/MatchInvDelete.java
@@ -20,6 +20,8 @@ import java.util.logging.Level;
import org.compiere.model.MMatchInv;
import org.compiere.util.AdempiereUserError;
+import org.compiere.util.CLogger;
+import org.compiere.util.ValueNamePair;
/**
@@ -54,8 +56,14 @@ public class MatchInvDelete extends SvrProcess
throw new AdempiereUserError("@NotFound@ @M_MatchInv_ID@ " + p_M_MatchInv_ID);
if (inv.delete(true))
return "@OK@";
- inv.saveEx();
- return "@Error@";
+
+ String msg = null;
+ ValueNamePair err = CLogger.retrieveError();
+ if (err != null)
+ msg = err.getName();
+ if (msg == null || msg.length() == 0)
+ msg = " - Check log";
+ return "@Error@: " + msg;
} // doIt
} // MatchInvDelete
diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java
index 83ed39cdff..fd8c74cc8e 100644
--- a/org.adempiere.base/src/org/adempiere/base/Core.java
+++ b/org.adempiere.base/src/org/adempiere/base/Core.java
@@ -26,8 +26,9 @@ import java.util.List;
import java.util.logging.Level;
import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
-import org.adempiere.base.osgi.OSGiScriptEngineManager;
import org.adempiere.model.IAddressValidation;
import org.adempiere.model.IShipmentProcessor;
import org.adempiere.model.ITaxProvider;
@@ -47,7 +48,6 @@ import org.compiere.process.ProcessCall;
import org.compiere.util.CLogger;
import org.compiere.util.PaymentExport;
import org.compiere.util.ReplenishInterface;
-import org.osgi.framework.FrameworkUtil;
/**
* This is a facade class for the Service Locator.
@@ -55,8 +55,6 @@ import org.osgi.framework.FrameworkUtil;
*
* @author viola
* @author hengsin
- * @author Silvano Trinchero, www.freepath.it
- *
IDEMPIERE-3243 added getScriptEngine to manage both registered engines and engines provided by osgi bundles
*/
public class Core {
@@ -437,17 +435,31 @@ public class Core {
}
- /** Get script engine, checking classpath first, and then osgi plugins
+ /** Get script engine
*
* @param engineName
* @return ScriptEngine found, or null
*/
public static ScriptEngine getScriptEngine(String engineName)
{
- OSGiScriptEngineManager osgiFactory = new OSGiScriptEngineManager( FrameworkUtil.getBundle(Core.class).getBundleContext());
- ScriptEngine engine = osgiFactory.getEngineByName(engineName);
-
- return engine;
+ ScriptEngineManager manager = new ScriptEngineManager(Core.class.getClassLoader());
+ ScriptEngine engine = manager.getEngineByName(engineName);
+ if (engine != null)
+ return engine;
+
+ List factoryList =
+ Service.locator().list(ScriptEngineFactory.class).getServices();
+ if (factoryList != null) {
+ for(ScriptEngineFactory factory : factoryList) {
+ for (String name : factory.getNames()) {
+ if (engineName.equals(name)) {
+ return factory.getScriptEngine();
+ }
+ }
+ }
+ }
+
+ return null;
}
/**
diff --git a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngine.java b/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngine.java
deleted file mode 100644
index 31619a0428..0000000000
--- a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngine.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.adempiere.base.osgi;
-
-import java.io.Reader;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptException;
-
-/**
- * Imported from Apache Felix project.
- * Original file:
- * http://svn.apache.org/repos/asf/felix/trunk/mishell/src/main/java/org/apache/felix/mishell/OSGiScriptEngine.java
- *
- */
-
-
-public class OSGiScriptEngine implements ScriptEngine{
- private ScriptEngine engine;
- private OSGiScriptEngineFactory factory;
- public OSGiScriptEngine(ScriptEngine engine, OSGiScriptEngineFactory factory){
- this.engine=engine;
- this.factory=factory;
- }
- public Bindings createBindings() {
- return engine.createBindings();
- }
- public Object eval(Reader reader, Bindings n) throws ScriptException {
- return engine.eval(reader, n);
- }
- public Object eval(Reader reader, ScriptContext context) throws ScriptException {
- return engine.eval(reader, context);
- }
- public Object eval(Reader reader) throws ScriptException {
- return engine.eval(reader);
- }
- public Object eval(String script, Bindings n) throws ScriptException {
- return engine.eval(script, n);
- }
- public Object eval(String script, ScriptContext context) throws ScriptException {
- return engine.eval(script, context);
- }
- public Object eval(String script) throws ScriptException {
- return engine.eval(script);
- }
- public Object get(String key) {
- return engine.get(key);
- }
- public Bindings getBindings(int scope) {
- return engine.getBindings(scope);
- }
- public ScriptContext getContext() {
- return engine.getContext();
- }
- public ScriptEngineFactory getFactory() {
- return factory;
- }
- public void put(String key, Object value) {
- engine.put(key, value);
- }
- public void setBindings(Bindings bindings, int scope) {
- engine.setBindings(bindings, scope);
- }
- public void setContext(ScriptContext context) {
- engine.setContext(context);
- }
-
-}
diff --git a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineFactory.java b/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineFactory.java
deleted file mode 100644
index e071878fc7..0000000000
--- a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.adempiere.base.osgi;
-
-import java.util.List;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-/**
- * This is a wrapper class for the ScriptEngineFactory class that deals with context class loader issues
- * It is necessary because engines (at least ruby) use the context classloader to find their resources (i.e., their "native" classes)
- *
- */
-
-/**
- * Imported from Apache Felix project.
- * Original file:
- * http://svn.apache.org/repos/asf/felix/trunk/mishell/src/main/java/org/apache/felix/mishell/OSGiScriptEngineFactory.java
- *
- */
-public class OSGiScriptEngineFactory implements ScriptEngineFactory{
- private ScriptEngineFactory factory;
- private ClassLoader contextClassLoader;
- public OSGiScriptEngineFactory (ScriptEngineFactory factory, ClassLoader contextClassLoader){
- this.factory=factory;
- this.contextClassLoader=contextClassLoader;
- }
- public String getEngineName() {
- return factory.getEngineName();
- }
- public String getEngineVersion() {
- return factory.getEngineVersion();
- }
- public List getExtensions() {
- return factory.getExtensions();
- }
- public String getLanguageName() {
- return factory.getLanguageName();
- }
- public String getLanguageVersion() {
- return factory.getLanguageVersion();
- }
- public String getMethodCallSyntax(String obj, String m, String... args) {
- return factory.getMethodCallSyntax(obj, m, args);
- }
- public List getMimeTypes() {
- return factory.getMimeTypes();
- }
- public List getNames() {
- return factory.getNames();
- }
- public String getOutputStatement(String toDisplay) {
- return factory.getOutputStatement(toDisplay);
- }
- public Object getParameter(String key) {
- return factory.getParameter(key);
- }
- public String getProgram(String... statements) {
- return factory.getProgram(statements);
- }
- public ScriptEngine getScriptEngine() {
- ScriptEngine engine=null;
- if(contextClassLoader!=null){
- ClassLoader old=Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(contextClassLoader);
- engine=factory.getScriptEngine();
- Thread.currentThread().setContextClassLoader(old);
- }
- else engine=factory.getScriptEngine();
- return engine;
- }
-
-
-}
diff --git a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineManager.java b/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineManager.java
deleted file mode 100644
index a020533875..0000000000
--- a/org.adempiere.base/src/org/adempiere/base/osgi/OSGiScriptEngineManager.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.adempiere.base.osgi;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptEngineManager;
-import javax.script.SimpleBindings;
-
-import org.adempiere.base.Service;
-import org.osgi.framework.BundleContext;
-
-/**
- * This class acts as a delegate for all the available ScriptEngineManagers. Unluckily, the standard did not
- * define it as an interface, so we need to extend it to allow polymorphism. However, no calls to super are used.
- * It wraps all available ScriptEngineManagers in the OSGi ServicePlatform into a merged ScriptEngineManager.
- *
- * Internally, what this class does is creating ScriptEngineManagers for each bundle
- * that contains a ScriptEngineFactory and includes a META-INF/services/javax.script.ScriptEngineFactory file.
- * It assumes that the file contains a list of @link ScriptEngineFactory classes. For each bundle, it creates a
- * ScriptEngineManager, then merges them. @link ScriptEngineFactory objects are wrapped
- * into @link OSGiScriptEngineFactory objects to deal with problems of context class loader:
- * Those scripting engines that rely on the ContextClassloader for finding resources need to use this wrapper
- * and the @link OSGiScriptFactory. Mainly, jruby does.
- *
- * Note that even if no context classloader issues arose, it would still be needed to search manually for the
- * factories and either use them directly (losing the mimeType/extension/shortName mechanisms for finding engines
- * or manually registering them) or still use this class, which would be smarter. In the latter case,
- * it would only be needed to remove the hack that temporarily sets the context classloader to the appropriate,
- * bundle-related, class loader.
- *
- * Caveats:
- * -
- * All factories are wrapped with an {@link OSGiScriptEngineFactory}. As Engines are not wrapped,
- * calls like
- *
- * ScriptEngineManager osgiManager=new OSGiScriptEngineManager(context);
- * ScriptEngine engine=osgiManager.getEngineByName("ruby");
- * ScriptEngineFactory factory=engine.getFactory() //this does not return the OSGiFactory wrapper
- * factory.getScriptEngine(); //this might fail, as it does not use OSGiScriptEngineFactory wrapper
- *
- * might result in unexpected errors. Future versions may wrap the ScriptEngine with a OSGiScriptEngine to solve this
- * issue, but for the moment it is not needed.
- *
- *
- */
-
-/**
- * Imported from Apache Felix project.
- * Original file:
- * http://svn.apache.org/repos/asf/felix/trunk/mishell/src/main/java/org/apache/felix/mishell/OSGiScriptEngineManager.java
- *
- * @author Silvano Trinchero, www.freepath.it
- * - IDEMPIERE-3243 fixed class discovery to avoid comment lines
- *
- */
-
-public class OSGiScriptEngineManager extends ScriptEngineManager{
- private Bindings bindings;
- private Map classLoaders;
- private BundleContext context;
-
- public OSGiScriptEngineManager(BundleContext context){
- this.context=context;
- bindings=new SimpleBindings();
- this.classLoaders=findManagers(context);
- }
- /**
- * This method is the only one that is visible and not part of the ScriptEngineManager class.
- * Its purpose is to find new managers that weren't available before, but keeping the globalScope bindings
- * set.
- * If you want to clean the bindings you can either get a fresh instance of OSGiScriptManager or
- * setting up a new bindings object.
- * This can be done with:
- *
- * ScriptEngineManager manager=new OSGiScriptEngineManager(context);
- * (...)//do stuff
- * osgiManager=(OSGiScriptEngineManager)manager;//cast to ease reading
- * osgiManager.reloadManagers();
- *
- * manager.setBindings(new OSGiBindings());//or you can use your own bindings implementation
- *
- *
- *
- */
- public void reloadManagers(){
- this.classLoaders=findManagers(context);
- }
-
- public Object get(String key) {
- return bindings.get(key);
- }
-
- public Bindings getBindings() {
- return bindings;
- }
-
- public ScriptEngine getEngineByExtension(String extension) {
- //TODO this is a hack to deal with context class loader issues
- ScriptEngine engine=null;
- for(ScriptEngineManager manager: classLoaders.keySet()){
- ClassLoader old=Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoaders.get(manager));
- engine=manager.getEngineByExtension(extension);
- Thread.currentThread().setContextClassLoader(old);
- if (engine!=null) break;
- }
- return engine;
- }
-
- public ScriptEngine getEngineByMimeType(String mimeType) {
- //TODO this is a hack to deal with context class loader issues
- ScriptEngine engine=null;
- for(ScriptEngineManager manager: classLoaders.keySet()){
- ClassLoader old=Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoaders.get(manager));
- engine=manager.getEngineByMimeType(mimeType);
- Thread.currentThread().setContextClassLoader(old);
- if (engine!=null) break;
- }
- return engine;
- }
-
- public ScriptEngine getEngineByName(String shortName) {
- //TODO this is a hack to deal with context class loader issues
- for(ScriptEngineManager manager: classLoaders.keySet()){
- ClassLoader old=Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoaders.get(manager));
- ScriptEngine engine=manager.getEngineByName(shortName);
- Thread.currentThread().setContextClassLoader(old);
- if (engine!=null){
- return new OSGiScriptEngine(engine, new OSGiScriptEngineFactory(engine.getFactory(), classLoaders.get(manager)));
- }
- }
- return null;
- }
- public List getEngineFactories() {
- List osgiFactories=new ArrayList();
- for(ScriptEngineManager engineManager: classLoaders.keySet()){
- for (ScriptEngineFactory factory : engineManager.getEngineFactories()){
- osgiFactories.add(new OSGiScriptEngineFactory(factory, classLoaders.get(engineManager)));
- }
- }
- return osgiFactories;
- }
-
- public void put(String key, Object value) {
- bindings.put(key, value);
- }
-
- public void registerEngineExtension(String extension, ScriptEngineFactory factory) {
- for(ScriptEngineManager engineManager: classLoaders.keySet())
- engineManager.registerEngineExtension(extension, factory);
- }
-
- public void registerEngineMimeType(String type, ScriptEngineFactory factory) {
- for(ScriptEngineManager engineManager: classLoaders.keySet())
- engineManager.registerEngineMimeType(type, factory);
- }
-
- public void registerEngineName(String name, ScriptEngineFactory factory) {
- for(ScriptEngineManager engineManager: classLoaders.keySet())
- engineManager.registerEngineName(name, factory);
- }
- /**
- * Follows the same behavior of @link javax.script.ScriptEngineManager#setBindings(Bindings)
- * This means that the same bindings are applied to all the underlying managers.
- * @param bindings
- */
- public void setBindings(Bindings bindings) {
- this.bindings=bindings;
- for(ScriptEngineManager manager: classLoaders.keySet()){
- manager.setBindings(bindings);
- }
-
- }
-
- private Map findManagers(BundleContext context) {
-
- Map managers=new HashMap();
-
- List seFactoryList =
- Service.locator().list(ScriptEngineFactory.class).getServices();
- if (seFactoryList != null) {
- for(ScriptEngineFactory seFactory : seFactoryList) {
- ClassLoader factoryLoader = seFactory.getClass().getClassLoader();
- ScriptEngineManager manager=new ScriptEngineManager(factoryLoader);
- manager.setBindings(bindings);
- managers.put(manager, factoryLoader);
- }
- }
-
- return managers;
- }
-
-}
diff --git a/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java b/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java
index e3f9974785..cda6c560f9 100644
--- a/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java
+++ b/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java
@@ -29,6 +29,7 @@ import java.util.logging.Level;
import javax.script.ScriptEngine;
import org.adempiere.base.Core;
+import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MProcess;
import org.compiere.model.MRule;
import org.compiere.process.ProcessCall;
@@ -217,6 +218,9 @@ public final class ProcessUtil {
}
ScriptEngine engine = rule.getScriptEngine();
+ if (engine == null) {
+ throw new AdempiereException("Engine not found: " + rule.getEngineName());
+ }
// Window context are W_
// Login context are G_
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
index 3bd709173a..5ea0cc4d88 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java
@@ -415,16 +415,6 @@ public class Doc_Invoice extends Doc
serviceAmt = serviceAmt.add(amt);
}
}
- // Set Locations
- FactLine[] fLines = fact.getLines();
- for (int i = 0; i < fLines.length; i++)
- {
- if (fLines[i] != null)
- {
- fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), true); // from Loc
- fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
- }
- }
// Receivables DR
int receivables_ID = getValidCombination_ID(Doc.ACCTTYPE_C_Receivable, as);
@@ -446,6 +436,17 @@ public class Doc_Invoice extends Doc
if (serviceAmt.signum() != 0)
fact.createLine(null, MAccount.get(getCtx(), receivablesServices_ID),
getC_Currency_ID(), serviceAmt, null);
+
+ // Set Locations
+ FactLine[] fLines = fact.getLines();
+ for (int i = 0; i < fLines.length; i++)
+ {
+ if (fLines[i] != null)
+ {
+ fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), true); // from Loc
+ fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
+ }
+ }
}
// ARC
else if (getDocumentType().equals(DOCTYPE_ARCredit))
@@ -496,16 +497,7 @@ public class Doc_Invoice extends Doc
serviceAmt = serviceAmt.add(amt);
}
}
- // Set Locations
- FactLine[] fLines = fact.getLines();
- for (int i = 0; i < fLines.length; i++)
- {
- if (fLines[i] != null)
- {
- fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), true); // from Loc
- fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
- }
- }
+
// Receivables CR
int receivables_ID = getValidCombination_ID (Doc.ACCTTYPE_C_Receivable, as);
int receivablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_C_Receivable_Services, as);
@@ -526,6 +518,17 @@ public class Doc_Invoice extends Doc
if (serviceAmt.signum() != 0)
fact.createLine(null, MAccount.get(getCtx(), receivablesServices_ID),
getC_Currency_ID(), null, serviceAmt);
+
+ // Set Locations
+ FactLine[] fLines = fact.getLines();
+ for (int i = 0; i < fLines.length; i++)
+ {
+ if (fLines[i] != null)
+ {
+ fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), true); // from Loc
+ fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
+ }
+ }
}
// ** API
@@ -600,16 +603,6 @@ public class Doc_Invoice extends Doc
line.getDescription(), getTrxName());
}
}
- // Set Locations
- FactLine[] fLines = fact.getLines();
- for (int i = 0; i < fLines.length; i++)
- {
- if (fLines[i] != null)
- {
- fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
- fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), false); // to Loc
- }
- }
// Liability CR
int payables_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability, as);
@@ -631,6 +624,18 @@ public class Doc_Invoice extends Doc
if (serviceAmt.signum() != 0)
fact.createLine(null, MAccount.get(getCtx(), payablesServices_ID),
getC_Currency_ID(), null, serviceAmt);
+
+ // Set Locations
+ FactLine[] fLines = fact.getLines();
+ for (int i = 0; i < fLines.length; i++)
+ {
+ if (fLines[i] != null)
+ {
+ fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
+ fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), false); // to Loc
+ }
+ }
+
//
updateProductPO(as); // Only API
}
@@ -705,16 +710,7 @@ public class Doc_Invoice extends Doc
line.getDescription(), getTrxName());
}
}
- // Set Locations
- FactLine[] fLines = fact.getLines();
- for (int i = 0; i < fLines.length; i++)
- {
- if (fLines[i] != null)
- {
- fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
- fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), false); // to Loc
- }
- }
+
// Liability DR
int payables_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability, as);
int payablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability_Services, as);
@@ -735,6 +731,17 @@ public class Doc_Invoice extends Doc
if (serviceAmt.signum() != 0)
fact.createLine(null, MAccount.get(getCtx(), payablesServices_ID),
getC_Currency_ID(), serviceAmt, null);
+
+ // Set Locations
+ FactLine[] fLines = fact.getLines();
+ for (int i = 0; i < fLines.length; i++)
+ {
+ if (fLines[i] != null)
+ {
+ fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
+ fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), false); // to Loc
+ }
+ }
}
else
{
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
index d65d8ae04f..15b8b66e10 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java
@@ -156,7 +156,7 @@ public class Doc_MatchInv extends Doc
setC_Currency_ID (as.getC_Currency_ID());
boolean isInterOrg = isInterOrg(as);
- /** Needs to be handeled in PO Matching as no Receipt info
+ /** Needs to be handled in PO Matching as no Receipt info
if (m_pc.isService())
{
log.fine("Service - skipped");
@@ -168,8 +168,7 @@ public class Doc_MatchInv extends Doc
// NotInvoicedReceipt DR
// From Receipt
BigDecimal multiplier = getQty()
- .divide(m_receiptLine.getMovementQty(), 12, RoundingMode.HALF_UP)
- .abs();
+ .divide(m_receiptLine.getMovementQty(), 12, RoundingMode.HALF_UP);
FactLine dr = fact.createLine (null,
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
as.getC_Currency_ID(), Env.ONE, null); // updated below
@@ -192,12 +191,9 @@ public class Doc_MatchInv extends Doc
}
else
{
- BigDecimal effMultiplier = multiplier;
- if (getQty().signum() < 0)
- effMultiplier = effMultiplier.negate();
if (!dr.updateReverseLine (MInOut.Table_ID, // Amt updated
m_receiptLine.getM_InOut_ID(), m_receiptLine.getM_InOutLine_ID(),
- effMultiplier))
+ multiplier))
{
p_Error = "Mat.Receipt not posted yet";
return null;
@@ -213,8 +209,7 @@ public class Doc_MatchInv extends Doc
expense = m_pc.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
multiplier = getQty()
- .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP)
- .abs();
+ .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP);
if (multiplier.compareTo(Env.ONE) != 0)
LineNetAmt = LineNetAmt.multiply(multiplier);
if (m_pc.isService())
@@ -246,13 +241,10 @@ public class Doc_MatchInv extends Doc
else
{
cr.setQty(getQty().negate());
- BigDecimal effMultiplier = multiplier;
- if (getQty().signum() < 0)
- effMultiplier = effMultiplier.negate();
// Set AmtAcctCr/Dr from Invoice (sets also Project)
if (!cr.updateReverseLine (MInvoice.Table_ID, // Amt updated
- m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), effMultiplier))
+ m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), multiplier))
{
p_Error = "Invoice not posted yet";
return null;
@@ -454,8 +446,7 @@ public class Doc_MatchInv extends Doc
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
BigDecimal multiplier = getQty()
- .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP)
- .abs();
+ .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP);
if (multiplier.compareTo(Env.ONE) != 0)
LineNetAmt = LineNetAmt.multiply(multiplier);
@@ -470,7 +461,7 @@ public class Doc_MatchInv extends Doc
{
tQty = tQty.add(mInv[i].getQty());
multiplier = mInv[i].getQty()
- .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP).abs();
+ .divide(m_invoiceLine.getQtyInvoiced(), 12, RoundingMode.HALF_UP);
tAmt = tAmt.add(m_invoiceLine.getLineNetAmt().multiply(multiplier));
}
}
diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java
index af44023cb2..83826a7c9b 100644
--- a/org.adempiere.base/src/org/compiere/model/GridTab.java
+++ b/org.adempiere.base/src/org/compiere/model/GridTab.java
@@ -2880,6 +2880,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
}
ScriptEngine engine = rule.getScriptEngine();
+ if (engine == null) {
+ retValue = "Callout Invalid, engine not found: " + rule.getEngineName();
+ log.log(Level.SEVERE, retValue);
+ return retValue;
+ }
// Window context are W_
// Login context are G_
diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java
index f7a302758b..7c12a848ec 100644
--- a/org.adempiere.base/src/org/compiere/model/MColumn.java
+++ b/org.adempiere.base/src/org/compiere/model/MColumn.java
@@ -274,7 +274,25 @@ public class MColumn extends X_AD_Column
return false;
}
}
-
+
+ if ( displayType == DisplayType.TableDir ||
+ (displayType == DisplayType.Search && getAD_Reference_Value_ID() <= 0))
+ {
+ // verify the foreign table exists
+ String foreignTableName = getReferenceTableName();
+ MTable foreignTable = MTable.get(getCtx(), foreignTableName);
+ if (foreignTable == null || foreignTable.getAD_Table_ID() <= 0) {
+ log.saveError("Error", Msg.getMsg(getCtx(), "NotReferenceTable", new Object[] {getColumnName()}));
+ return false;
+ }
+ }
+
+ if (displayType == DisplayType.Table && getAD_Reference_Value_ID() <= 0)
+ {
+ log.saveError("FillMandatory", Msg.getElement(getCtx(), "AD_Reference_Value_ID"));
+ return false;
+ }
+
if (displayType != DisplayType.Button)
{
if (! ISTOOLBARBUTTON_Window.equals(getIsToolbarButton()))
diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java
index 861ff92afd..13a39a7403 100644
--- a/org.adempiere.base/src/org/compiere/model/MInvoice.java
+++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java
@@ -68,7 +68,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
/**
*
*/
- private static final long serialVersionUID = -9210893813732918522L;
+ private static final long serialVersionUID = -3191227310812025813L;
/**
* Get Payments Of BPartner
@@ -725,7 +725,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
}
m_lines = null;
} // renumberLines
-
+
/**
* Copy Lines From other Invoice.
* @param otherInvoice invoice
@@ -733,7 +733,19 @@ public class MInvoice extends X_C_Invoice implements DocAction
* @param setOrder set order links
* @return number of lines copied
*/
- public int copyLinesFrom (MInvoice otherInvoice, boolean counter, boolean setOrder)
+ public int copyLinesFrom (MInvoice otherInvoice, boolean counter, boolean setOrder){
+ return copyLinesFrom (otherInvoice, counter, setOrder, true);
+ }
+
+ /**
+ * Copy Lines From other Invoice.
+ * @param otherInvoice invoice
+ * @param counter create counter links
+ * @param setOrder set order links
+ * @param copyClientOrg copy also Client and Org
+ * @return number of lines copied
+ */
+ public int copyLinesFrom (MInvoice otherInvoice, boolean counter, boolean setOrder, boolean copyClientOrg)
{
if (isProcessed() || isPosted() || otherInvoice == null)
return 0;
@@ -743,7 +755,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
MInvoiceLine line = new MInvoiceLine (getCtx(), 0, get_TrxName());
MInvoiceLine fromLine = fromLines[i];
- if (counter) // header
+ if (counter || !copyClientOrg) // header
PO.copyValues (fromLine, line, getAD_Client_ID(), getAD_Org_ID());
else
PO.copyValues (fromLine, line, fromLine.getAD_Client_ID(), fromLine.getAD_Org_ID());
diff --git a/org.adempiere.base/src/org/compiere/model/MMatchInv.java b/org.adempiere.base/src/org/compiere/model/MMatchInv.java
index 9bfb064ae4..d1ee2ed0c6 100644
--- a/org.adempiere.base/src/org/compiere/model/MMatchInv.java
+++ b/org.adempiere.base/src/org/compiere/model/MMatchInv.java
@@ -230,9 +230,15 @@ public class MMatchInv extends X_M_MatchInv
{
MInOutLine line = new MInOutLine(getCtx(), getM_InOutLine_ID(), get_TrxName());
BigDecimal matchedQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchInv WHERE M_InOutLine_ID=?" , getM_InOutLine_ID());
- if (matchedQty != null && matchedQty.compareTo(line.getMovementQty()) > 0)
+ BigDecimal matchedQtyDB = matchedQty;
+ BigDecimal movementQty = line.getMovementQty();
+ if (movementQty.signum() < 0) {
+ movementQty = movementQty.negate();
+ matchedQty = matchedQty.negate();
+ }
+ if (matchedQty != null && matchedQty.compareTo(movementQty) > 0)
{
- throw new IllegalStateException("Total matched qty > movement qty. MatchedQty="+matchedQty+", MovementQty="+line.getMovementQty()+", Line="+line);
+ throw new IllegalStateException("Total matched qty > movement qty. MatchedQty="+matchedQtyDB+", MovementQty="+line.getMovementQty()+", Line="+line);
}
}
@@ -240,9 +246,15 @@ public class MMatchInv extends X_M_MatchInv
{
MInvoiceLine line = new MInvoiceLine(getCtx(), getC_InvoiceLine_ID(), get_TrxName());
BigDecimal matchedQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchInv WHERE C_InvoiceLine_ID=?" , getC_InvoiceLine_ID());
- if (matchedQty != null && matchedQty.compareTo(line.getQtyInvoiced()) > 0)
+ BigDecimal matchedQtyDB = matchedQty;
+ BigDecimal qtyInvoiced = line.getQtyInvoiced();
+ if (qtyInvoiced.signum() < 0) {
+ qtyInvoiced = qtyInvoiced.negate();
+ matchedQty = matchedQty.negate();
+ }
+ if (matchedQty != null && matchedQty.compareTo(qtyInvoiced) > 0)
{
- throw new IllegalStateException("Total matched qty > invoiced qty. MatchedQty="+matchedQty+", InvoicedQty="+line.getQtyInvoiced()+", Line="+line);
+ throw new IllegalStateException("Total matched qty > invoiced qty. MatchedQty="+matchedQtyDB+", InvoicedQty="+line.getQtyInvoiced()+", Line="+line);
}
}
return true;
diff --git a/org.adempiere.base/src/org/compiere/model/MMeasure.java b/org.adempiere.base/src/org/compiere/model/MMeasure.java
index 238bc1a72b..f81cc7b5fa 100644
--- a/org.adempiere.base/src/org/compiere/model/MMeasure.java
+++ b/org.adempiere.base/src/org/compiere/model/MMeasure.java
@@ -28,6 +28,7 @@ import java.util.logging.Level;
import javax.script.ScriptEngine;
import org.adempiere.apps.graph.GraphColumn;
+import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.MeasureInterface;
import org.compiere.util.CCache;
import org.compiere.util.DB;
@@ -613,6 +614,9 @@ public class MMeasure extends X_PA_Measure
break;
}
ScriptEngine engine = rule.getScriptEngine();
+ if (engine == null) {
+ throw new AdempiereException("Engine not found: " + rule.getEngineName());
+ }
MRule.setContext(engine, po.getCtx(), 0);
engine.put(MRule.ARGUMENTS_PREFIX + "Ctx", po.getCtx());
engine.put(MRule.ARGUMENTS_PREFIX + "PO", po);
diff --git a/org.adempiere.base/src/org/compiere/model/MRule.java b/org.adempiere.base/src/org/compiere/model/MRule.java
index a2489408dc..47d68c91f1 100644
--- a/org.adempiere.base/src/org/compiere/model/MRule.java
+++ b/org.adempiere.base/src/org/compiere/model/MRule.java
@@ -34,8 +34,6 @@ import org.compiere.util.Util;
/**
* Persistent Rule Model
* @author Carlos Ruiz
- * @author Silvano Trinchero, www.freepath.it
- * - IDEMPIERE-3243 refactored getScriptEngine to use Core.getScriptEngine
* @version $Id: MRule.java
*
*/
@@ -196,12 +194,9 @@ public class MRule extends X_AD_Rule
* @return ScriptEngine
*/
public ScriptEngine getScriptEngine() {
-
String engineName = getEngineName();
-
- if(engineName != null)
+ if (engineName != null)
engine = Core.getScriptEngine(engineName);
-
return engine;
}
diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java
index f515a6e80e..4e24f676fa 100644
--- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java
+++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java
@@ -42,14 +42,15 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
- private static final long serialVersionUID = 2856526441538434702L;
+ private static final long serialVersionUID = -1401329788730986024L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
public static final String ALLOCATION_DESCRIPTION = "ALLOCATION_DESCRIPTION";
public static final String ALLOW_APPLY_PAYMENT_TO_CREDITMEMO = "ALLOW_APPLY_PAYMENT_TO_CREDITMEMO";
public static final String ALLOW_OVER_APPLIED_PAYMENT = "ALLOW_OVER_APPLIED_PAYMENT";
- public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole";
+ public static final String ALogin_ShowDate = "ALogin_ShowDate";
+ public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole"; // deprecated
public static final String APPLICATION_DATABASE_VERSION = "APPLICATION_DATABASE_VERSION";
public static final String APPLICATION_DATABASE_VERSION_SHOWN = "APPLICATION_DATABASE_VERSION_SHOWN";
public static final String APPLICATION_HOST_SHOWN = "APPLICATION_HOST_SHOWN";
diff --git a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java
index 8c22fb0bcd..de3c1e7385 100644
--- a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java
+++ b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java
@@ -35,6 +35,7 @@ import org.adempiere.base.event.IEventManager;
import org.adempiere.base.event.IEventTopics;
import org.adempiere.base.event.ImportEventData;
import org.adempiere.base.event.LoginEventData;
+import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.ImportValidator;
import org.adempiere.process.ImportProcess;
import org.compiere.acct.Fact;
@@ -241,6 +242,9 @@ public class ModelValidationEngine
String error;
try {
ScriptEngine engine = loginRule.getScriptEngine();
+ if (engine == null) {
+ throw new AdempiereException("Engine not found: " + loginRule.getEngineName());
+ }
MRule.setContext(engine, Env.getCtx(), 0); // no window
// now add the method arguments to the engine
@@ -378,6 +382,9 @@ public class ModelValidationEngine
String error;
try {
ScriptEngine engine = rule.getScriptEngine();
+ if (engine == null) {
+ throw new AdempiereException("Engine not found: " + rule.getEngineName());
+ }
MRule.setContext(engine, po.getCtx(), 0); // no window
// now add the method arguments to the engine
@@ -542,6 +549,9 @@ public class ModelValidationEngine
String error;
try {
ScriptEngine engine = rule.getScriptEngine();
+ if (engine == null) {
+ throw new AdempiereException("Engine not found: " + rule.getEngineName());
+ }
MRule.setContext(engine, po.getCtx(), 0); // no window
// now add the method arguments to the engine
diff --git a/org.adempiere.server-feature/server.product.functionaltest.launch b/org.adempiere.server-feature/server.product.functionaltest.launch
index 6d50aba807..29f4e1baa4 100644
--- a/org.adempiere.server-feature/server.product.functionaltest.launch
+++ b/org.adempiere.server-feature/server.product.functionaltest.launch
@@ -27,7 +27,7 @@
-
+
diff --git a/org.adempiere.ui.swing-feature/swingclient.product.launch b/org.adempiere.ui.swing-feature/swingclient.product.launch
index 63528b283d..017fc282fd 100644
--- a/org.adempiere.ui.swing-feature/swingclient.product.launch
+++ b/org.adempiere.ui.swing-feature/swingclient.product.launch
@@ -30,8 +30,8 @@
-
-
+
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
index 2306d33d39..f84899ecad 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
@@ -85,13 +85,13 @@ public class RolePanel extends Window implements EventListener, Deferrabl
/**
*
*/
- private static final long serialVersionUID = 372661654078492488L;
+ private static final long serialVersionUID = 4486118071892173802L;
protected LoginWindow wndLogin;
protected Login login;
protected Combobox lstRole, lstClient, lstOrganisation, lstWarehouse;
- protected Label lblRole, lblClient, lblOrganisation, lblWarehouse, lblDate;
+ protected Label lblRole, lblClient, lblDef, lblOrganisation, lblWarehouse, lblDate;
protected WDateEditor lstDate;
protected Button btnOk, btnCancel;
@@ -156,12 +156,10 @@ public class RolePanel extends Window implements EventListener, Deferrabl
AuFocus auf = null;
if (lstClient.getItemCount() > 1) {
auf = new AuFocus(lstClient);
+ } else if (lstRole.getItemCount() > 1) {
+ auf = new AuFocus(lstRole);
} else {
- if (MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowOneRole, true) || lstRole.getItemCount() > 1) {
- auf = new AuFocus(lstRole);
- } else {
- auf = new AuFocus(lstOrganisation);
- }
+ auf = new AuFocus(lstOrganisation);
}
Clients.response(auf);
} else {
@@ -225,6 +223,19 @@ public class RolePanel extends Window implements EventListener, Deferrabl
tr.appendChild(td);
td.appendChild(lstRole);
+ tr = new Tr();
+ tr.setId("rowLabelDefault");
+ table.appendChild(tr);
+ //td = new Td();
+ //tr.appendChild(td);
+ td = new Td();
+ tr.appendChild(td);
+ td.setSclass(ITheme.LOGIN_LABEL_CLASS);
+ div = new Div();
+ div.setStyle("text-align: right; text-decoration: underline");
+ div.appendChild(lblDef);
+ td.appendChild(div);
+
tr = new Tr();
tr.setId("rowOrganisation");
table.appendChild(tr);
@@ -288,6 +299,10 @@ public class RolePanel extends Window implements EventListener, Deferrabl
lblRole.setId("lblRole");
lblRole.setValue(Msg.getMsg(language,"Role"));
+ lblDef = new Label();
+ lblDef.setId("lblDef");
+ lblDef.setValue(Msg.getMsg(language,"Defaults"));
+
lblOrganisation = new Label();
lblOrganisation.setId("lblOrganisation");
lblOrganisation.setValue(Msg.getMsg(language,"Organization"));
@@ -373,14 +388,19 @@ public class RolePanel extends Window implements EventListener, Deferrabl
//
if (m_clientKNPairs!=null && m_clientKNPairs.length == 1) {
- // don't show client if is just one
+ // disable client if is just one
lstClient.setSelectedIndex(0);
- lblClient.setVisible(false);
- lstClient.setVisible(false);
+ lstClient.setEnabled(false);
} else {
- lblClient.setVisible(true);
- lstClient.setVisible(true);
+ lstClient.setEnabled(true);
}
+
+ // Disable date combo-box at login screen
+ if (!MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowDate, true))
+ {
+ lstDate.setReadWrite(false);
+ }
+
setUserID();
updateRoleList();
@@ -425,18 +445,14 @@ public class RolePanel extends Window implements EventListener, Deferrabl
//force reload of default role
MRole.getDefault(m_ctx, true);
-
- // If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94
- if (m_clientKNPairs.length == 1 && lstRole.getItemCount() == 1 && ! MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowOneRole, true))
+
+ // If we have only one role, we can make readonly the combobox
+ if (lstRole.getItemCount() == 1)
{
lstRole.setSelectedIndex(0);
- lblRole.setVisible(false);
- lstRole.setVisible(false);
- }
- else
- {
- lblRole.setVisible(true);
- lstRole.setVisible(true);
+ lstRole.setEnabled(false);
+ } else {
+ lstRole.setEnabled(true);
}
}
setUserID();
@@ -477,6 +493,15 @@ public class RolePanel extends Window implements EventListener, Deferrabl
lstOrganisation.setSelectedIndex(0);
}
}
+
+ // If we have only one org, we can make readonly the combobox
+ if (lstOrganisation.getItemCount() == 1)
+ {
+ lstOrganisation.setSelectedIndex(0);
+ lstOrganisation.setEnabled(false);
+ } else {
+ lstOrganisation.setEnabled(true);
+ }
//
}
updateWarehouseList();