diff --git a/db/ddlutils/oracle/functions/ProductAttribute.sql b/db/ddlutils/oracle/functions/ProductAttribute.sql index b7da1406c3..9c1536b7ef 100644 --- a/db/ddlutils/oracle/functions/ProductAttribute.sql +++ b/db/ddlutils/oracle/functions/ProductAttribute.sql @@ -53,7 +53,7 @@ BEGIN IF (p_M_AttributeSetInstance_ID > 0) THEN SELECT asi.Lot, asi.SerNo, asi.GuaranteeDate, COALESCE(a.SerNoCharSOverwrite, TO_NCHAR('#')), COALESCE(a.SerNoCharEOverwrite, TO_NCHAR('')), - COALESCE(a.LotCharSOverwrite, TO_NCHAR('«')), COALESCE(a.LotCharEOverwrite, TO_NCHAR('»')) + COALESCE(a.LotCharSOverwrite, to_nchar(chr(49835))), COALESCE(a.LotCharEOverwrite, to_nchar(chr(49851))) INTO v_Lot, v_SerNo, v_GuaranteeDate, v_SerNoStart, v_SerNoEnd, v_LotStart, v_LotEnd FROM M_AttributeSetInstance asi diff --git a/db/ddlutils/postgresql/functions/ProductAttribute.sql b/db/ddlutils/postgresql/functions/ProductAttribute.sql index 74d7027e4f..426b74fefe 100644 --- a/db/ddlutils/postgresql/functions/ProductAttribute.sql +++ b/db/ddlutils/postgresql/functions/ProductAttribute.sql @@ -52,7 +52,7 @@ BEGIN IF (p_M_AttributeSetInstance_ID > 0) THEN SELECT asi.Lot, asi.SerNo, asi.GuaranteeDate, COALESCE(a.SerNoCharSOverwrite, '#'::CHAR(1)), COALESCE(a.SerNoCharEOverwrite, ''::CHAR(1)), - COALESCE(a.LotCharSOverwrite, '«'::CHAR(1)), COALESCE(a.LotCharEOverwrite, '»'::CHAR(1)) + COALESCE(a.LotCharSOverwrite, chr(171)), COALESCE(a.LotCharEOverwrite, chr(187)) INTO v_Lot, v_SerNo, v_GuaranteeDate, v_SerNoStart, v_SerNoEnd, v_LotStart, v_LotEnd FROM M_AttributeSetInstance asi diff --git a/migration/i2.1/oracle/201503041855_IDEMPIERE-2501.sql b/migration/i2.1/oracle/201503041855_IDEMPIERE-2501.sql new file mode 100644 index 0000000000..9053cc2e3c --- /dev/null +++ b/migration/i2.1/oracle/201503041855_IDEMPIERE-2501.sql @@ -0,0 +1,88 @@ +CREATE OR REPLACE FUNCTION productAttribute +( + p_M_AttributeSetInstance_ID IN NUMBER +) +RETURN VARCHAR2 +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: M_Attribute_Name.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Instance Attribute Info + * Description: + * + * Test: + SELECT M_Attribute_Name (M_AttributeSetInstance_ID) + FROM M_InOutLine WHERE M_AttributeSetInstance_ID > 0 + -- + SELECT p.Name + FROM C_InvoiceLine il LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID); + SELECT p.Name || M_Attribute_Name (il.M_AttributeSetInstance_ID) + FROM C_InvoiceLine il LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID); + + ************************************************************************/ +AS + v_Name VARCHAR2(2000) := NULL; + v_NameAdd VARCHAR2(2000) := ''; + -- + v_Lot M_AttributeSetInstance.Lot%TYPE; + v_LotStart M_AttributeSet.LotCharSOverwrite%TYPE; + v_LotEnd M_AttributeSet.LotCharEOverwrite%TYPE; + v_SerNo M_AttributeSetInstance.SerNo%TYPE; + v_SerNoStart M_AttributeSet.SerNoCharSOverwrite%TYPE; + v_SerNoEnd M_AttributeSet.SerNoCharEOverwrite%TYPE; + v_GuaranteeDate M_AttributeSetInstance.GuaranteeDate%TYPE; + -- + CURSOR CUR_Attributes IS + SELECT ai.Value, a.Name + FROM M_AttributeInstance ai + INNER JOIN M_Attribute a ON (ai.M_Attribute_ID=a.M_Attribute_ID AND a.IsInstanceAttribute='Y') + WHERE ai.M_AttributeSetInstance_ID=p_M_AttributeSetInstance_ID; + +BEGIN +/* -- Get Product Name + SELECT Name + INTO v_Name + FROM M_Product WHERE M_Product_ID=p_M_Product_ID; +*/ + -- Get Product Attribute Set Instance + IF (p_M_AttributeSetInstance_ID > 0) THEN + SELECT asi.Lot, asi.SerNo, asi.GuaranteeDate, + COALESCE(a.SerNoCharSOverwrite, TO_NCHAR('#')), COALESCE(a.SerNoCharEOverwrite, TO_NCHAR('')), + COALESCE(a.LotCharSOverwrite, to_nchar(chr(49835))), COALESCE(a.LotCharEOverwrite, to_nchar(chr(49851))) + INTO v_Lot, v_SerNo, v_GuaranteeDate, + v_SerNoStart, v_SerNoEnd, v_LotStart, v_LotEnd + FROM M_AttributeSetInstance asi + INNER JOIN M_AttributeSet a ON (asi.M_AttributeSet_ID=a.M_AttributeSet_ID) + WHERE asi.M_AttributeSetInstance_ID=p_M_AttributeSetInstance_ID; + -- + IF (v_SerNo IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_SerNoStart || v_SerNo || v_SerNoEnd || ' '; + END IF; + IF (v_Lot IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_LotStart || v_Lot || v_LotEnd || ' '; + END IF; + IF (v_GuaranteeDate IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_GuaranteeDate || ' '; + END IF; + -- + FOR a IN CUR_Attributes LOOP + v_NameAdd := v_NameAdd || a.Name || ':' || a.Value || ' '; + END LOOP; + -- + IF (LENGTH(v_NameAdd) > 0) THEN + v_Name := v_Name || ' (' || TRIM(v_NameAdd) || ')'; + END IF; + END IF; + + RETURN v_Name; +END productAttribute; +/ + +SELECT register_migration_script('201503041855_IDEMPIERE-2501.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201503041855_IDEMPIERE-2501.sql b/migration/i2.1/postgresql/201503041855_IDEMPIERE-2501.sql new file mode 100644 index 0000000000..2e85571838 --- /dev/null +++ b/migration/i2.1/postgresql/201503041855_IDEMPIERE-2501.sql @@ -0,0 +1,95 @@ +set client_encoding='LATIN1'; + +CREATE OR REPLACE FUNCTION ProductAttribute +( + p_M_AttributeSetInstance_ID NUMERIC +) +RETURNS VARCHAR AS $body$ + +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved. + * + * converted to postgreSQL by Karsten Thiemann (Schaeffer AG), + * kthiemann@adempiere.org + ************************************************************************* + * Title: Return Instance Attribute Info + * Description: + * + * Test: + SELECT ProductAttribute (M_AttributeSetInstance_ID) + FROM M_InOutLine WHERE M_AttributeSetInstance_ID > 0 + -- + SELECT p.Name + FROM C_InvoiceLine il LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID); + SELECT p.Name || ProductAttribute (il.M_AttributeSetInstance_ID) + FROM C_InvoiceLine il LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID); + + ************************************************************************/ + + +DECLARE + + v_Name VARCHAR(2000) := ''; + v_NameAdd VARCHAR(2000) := ''; + -- + v_Lot M_AttributeSetInstance.Lot%TYPE; + v_LotStart M_AttributeSet.LotCharSOverwrite%TYPE; + v_LotEnd M_AttributeSet.LotCharEOverwrite%TYPE; + v_SerNo M_AttributeSetInstance.SerNo%TYPE; + v_SerNoStart M_AttributeSet.SerNoCharSOverwrite%TYPE; + v_SerNoEnd M_AttributeSet.SerNoCharEOverwrite%TYPE; + v_GuaranteeDate M_AttributeSetInstance.GuaranteeDate%TYPE; + + r RECORD; + -- + +BEGIN + -- Get Product Attribute Set Instance + IF (p_M_AttributeSetInstance_ID > 0) THEN + SELECT asi.Lot, asi.SerNo, asi.GuaranteeDate, + COALESCE(a.SerNoCharSOverwrite, '#'::CHAR(1)), COALESCE(a.SerNoCharEOverwrite, ''::CHAR(1)), + COALESCE(a.LotCharSOverwrite, chr(171)), COALESCE(a.LotCharEOverwrite, chr(187)) + INTO v_Lot, v_SerNo, v_GuaranteeDate, + v_SerNoStart, v_SerNoEnd, v_LotStart, v_LotEnd + FROM M_AttributeSetInstance asi + INNER JOIN M_AttributeSet a ON (asi.M_AttributeSet_ID=a.M_AttributeSet_ID) + WHERE asi.M_AttributeSetInstance_ID=p_M_AttributeSetInstance_ID; + -- + IF (v_SerNo IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_SerNoStart || v_SerNo || v_SerNoEnd || ' '; + END IF; + IF (v_Lot IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_LotStart || v_Lot || v_LotEnd || ' '; + END IF; + IF (v_GuaranteeDate IS NOT NULL) THEN + v_NameAdd := v_NameAdd || v_GuaranteeDate || ' '; + END IF; + -- + + FOR r IN + SELECT ai.Value, a.Name + FROM M_AttributeInstance ai + INNER JOIN M_Attribute a ON (ai.M_Attribute_ID=a.M_Attribute_ID AND a.IsInstanceAttribute='Y') + WHERE ai.M_AttributeSetInstance_ID=p_M_AttributeSetInstance_ID + LOOP + v_NameAdd := v_NameAdd || r.Name || ':' || r.Value || ' '; + END LOOP; + -- + IF (LENGTH(v_NameAdd) > 0) THEN + v_Name := v_Name || ' (' || TRIM(v_NameAdd) || ')'; + ELSE + v_Name := NULL; + END IF; + END IF; + RETURN v_Name; +END; + +$body$ LANGUAGE plpgsql STABLE; + +SELECT register_migration_script('201503041855_IDEMPIERE-2501.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/InventoryValue.java b/org.adempiere.base.process/src/org/compiere/process/InventoryValue.java index b2e88dea3d..ced0f26a03 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InventoryValue.java +++ b/org.adempiere.base.process/src/org/compiere/process/InventoryValue.java @@ -114,8 +114,9 @@ public class InventoryValue extends SvrProcess .append("WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID); int noInsertStd = DB.executeUpdateEx(sql.toString(), get_TrxName()); if (log.isLoggable(Level.FINE)) log.fine("Inserted Std=" + noInsertStd); - if (noInsertStd == 0) - return "No Standard Costs found"; + //IDEMPIERE-2500 - This may be invalid check. Removing still some one not admit reason + /*if (noInsertStd == 0) + return "No Standard Costs found";*/ // Insert addl Costs int noInsertCost = 0; diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java b/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java index 095b6088ec..b89a2cc2bd 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java @@ -24,6 +24,7 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.logging.Level; +import org.adempiere.base.Core; import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MDocType; @@ -351,8 +352,12 @@ public class ReplenishReport extends SvrProcess ReplenishInterface custom = null; try { - Class clazz = Class.forName(className); - custom = (ReplenishInterface)clazz.newInstance(); + custom = Core.getReplenish(className); + if(custom==null){ + // if no OSGi plugin is found try the legacy way (in my own classpath) + Class clazz = Class.forName(className); + custom = (ReplenishInterface) clazz.newInstance(); + } } catch (Exception e) { diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java b/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java index 8205b71451..ecaa359cf0 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java @@ -25,6 +25,7 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.logging.Level; +import org.adempiere.base.Core; import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MDocType; @@ -385,8 +386,12 @@ public class ReplenishReportProduction extends SvrProcess ReplenishInterface custom = null; try { - Class clazz = Class.forName(className); - custom = (ReplenishInterface)clazz.newInstance(); + custom = Core.getReplenish(className); + if(custom==null){ + // if no OSGi plugin is found try the legacy way (in my own classpath) + Class clazz = Class.forName(className); + custom = (ReplenishInterface) clazz.newInstance(); + } } catch (Exception e) { diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java index 11acd69359..9ecd4d46a0 100644 --- a/org.adempiere.base/src/org/adempiere/base/Core.java +++ b/org.adempiere.base/src/org/adempiere/base/Core.java @@ -40,6 +40,7 @@ import org.compiere.model.PaymentProcessor; import org.compiere.model.StandardTaxProvider; import org.compiere.process.ProcessCall; import org.compiere.util.CLogger; +import org.compiere.util.ReplenishInterface; /** * This is a facade class for the Service Locator. @@ -304,4 +305,38 @@ public class Core { return null; } + + /** + * get Custom Replenish instance + * + * @param className + * @return instance of the ReplenishInterface or null + */ + public static ReplenishInterface getReplenish(String className){ + if (className == null || className.length() == 0) { + s_log.log(Level.SEVERE, "No ReplenishInterface class name"); + return null; + } + + ReplenishInterface myReplenishInstance = null; + + List factoryList = + Service.locator().list(IReplenishFactory.class).getServices(); + if (factoryList != null) { + for(IReplenishFactory factory : factoryList) { + ReplenishInterface loader = factory.newReplenishInstance(className); + if (loader != null) { + myReplenishInstance = loader; + break; + } + } + } + + if (myReplenishInstance == null) { + s_log.log(Level.CONFIG, className + " not found in service/extension registry and classpath"); + return null; + } + + return myReplenishInstance; + } } diff --git a/org.adempiere.base/src/org/adempiere/base/IReplenishFactory.java b/org.adempiere.base/src/org/adempiere/base/IReplenishFactory.java new file mode 100644 index 0000000000..25ca46f313 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IReplenishFactory.java @@ -0,0 +1,19 @@ +package org.adempiere.base; + +import org.compiere.util.ReplenishInterface; + +/** + * Factory Interface for plugins to connect to the iDempiere core and provide a + * way to load Replication Custom Interface. + * + * @author tsvikruha + */ +public interface IReplenishFactory { + + /** + * + * @param className + * @return Replenish instance + */ + public ReplenishInterface newReplenishInstance(String className); +} diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 1d79805410..34d0c8a082 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -677,9 +677,17 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) if (isZoom) { // check permission on the zoomed window MTable mTable = MTable.get(getCtx(), pde.getForeignColumnName().substring(0, pde.getForeignColumnName().length()-3)); - int Record_ID = Integer.parseInt(pde.getValueAsString()); - int AD_Window_ID = Env.getZoomWindowID(mTable.get_ID(), Record_ID); - Boolean canAccess = MRole.getDefault().getWindowAccess(AD_Window_ID); + int Record_ID = -1; + try { + Record_ID = Integer.parseInt(pde.getValueAsString()); + } catch (Exception e) { + Record_ID = -1; + } + Boolean canAccess = null; + if (Record_ID >= 0) { + int AD_Window_ID = Env.getZoomWindowID(mTable.get_ID(), Record_ID); + canAccess = MRole.getDefault().getWindowAccess(AD_Window_ID); + } if (canAccess == null) { isZoom = false; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java index 03a76e51b4..f9cf86bdd0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java @@ -347,7 +347,7 @@ public class RequestWindow extends Window implements EventListener { calEnd.set(Calendar.SECOND, 0); calEnd.set(Calendar.MILLISECOND, 0); - if ((cal1.get(Calendar.HOUR_OF_DAY) >= cal2.get(Calendar.HOUR_OF_DAY)) && (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) == 0)) { + if (calBegin.compareTo(calEnd) >= 0) { return true; } else { return false; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 7291ac8dcd..2a1a2f0715 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -423,7 +423,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL boolean splitValue = false; if (m_count <= 0) { String[] values = queryValue.split("[_]"); - if (values.length == 2 && identifiers.size() == 2) { + if (values.length == 2) { splitValue = true; for(int i = 0; i < values.length && i < identifiers.size(); i++) { WEditor editor = identifiers.get(i); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java index df86416717..068503c3a0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java @@ -71,7 +71,9 @@ public class WPAttributeInstance extends Window implements EventListener super (); this.setTitle(Msg.getMsg(Env.getCtx(), "PAttributeInstance") + title); this.setBorder("normal"); - this.setWidth("500px"); + this.setSizable(true); + this.setMaximizable(true); + this.setWidth("1000px"); this.setHeight("550px"); init (M_Warehouse_ID, M_Locator_ID, M_Product_ID, C_BPartner_ID);