hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2015-03-04 20:27:58 -05:00
commit 7b8f1e8f84
13 changed files with 272 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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
;

View File

@ -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
;

View File

@ -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;

View File

@ -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
{
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();
custom = (ReplenishInterface) clazz.newInstance();
}
}
catch (Exception e)
{

View File

@ -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
{
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();
custom = (ReplenishInterface) clazz.newInstance();
}
}
catch (Exception e)
{

View File

@ -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<IReplenishFactory> 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;
}
}

View File

@ -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);
}

View File

@ -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 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);
Boolean canAccess = MRole.getDefault().getWindowAccess(AD_Window_ID);
canAccess = MRole.getDefault().getWindowAccess(AD_Window_ID);
}
if (canAccess == null) {
isZoom = false;
}

View File

@ -347,7 +347,7 @@ public class RequestWindow extends Window implements EventListener<Event> {
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;

View File

@ -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);

View File

@ -71,7 +71,9 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
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);