Merge development (8e403d4382f8) into zk7 branch

This commit is contained in:
Carlos Ruiz 2014-10-29 13:43:18 -05:00
commit 23c684d467
27 changed files with 600 additions and 210 deletions

View File

@ -61,7 +61,7 @@ BEGIN
FROM (
SELECT C_ConversionType_ID
FROM C_ConversionType
WHERE IsDefault='Y'
WHERE IsActive='Y' AND IsDefault='Y'
AND AD_Client_ID IN (0,p_Client_ID)
ORDER BY AD_Client_ID DESC
)
@ -137,7 +137,7 @@ BEGIN
CURSOR CUR_Rate IS
SELECT MultiplyRate
FROM C_Conversion_Rate
WHERE C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
WHERE IsActive='Y' AND C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
AND C_ConversionType_ID=v_ConversionType_ID
AND v_ConvDate BETWEEN ValidFrom AND ValidTo
AND AD_Client_ID IN (0,p_Client_ID) AND AD_Org_ID IN (0,p_Org_ID)

View File

@ -65,7 +65,7 @@ BEGIN
SELECT C_ConversionType_ID
INTO v_ConversionType_ID
FROM C_ConversionType
WHERE IsDefault='Y'
WHERE IsActive='Y' AND IsDefault='Y'
AND AD_Client_ID IN (0,p_Client_ID)
ORDER BY AD_Client_ID DESC
LIMIT 1;
@ -140,7 +140,7 @@ BEGIN
BEGIN
FOR c IN SELECT MultiplyRate
FROM C_Conversion_Rate
WHERE C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
WHERE IsActive='Y' AND C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
AND C_ConversionType_ID=v_ConversionType_ID
AND v_ConvDate BETWEEN ValidFrom AND ValidTo
AND AD_Client_ID IN (0,p_Client_ID) AND AD_Org_ID IN (0,p_Org_ID)

View File

@ -0,0 +1,194 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Oct 23, 2014 7:27:09 PM COT
-- IDEMPIERE-2250 Charge on bank transfer not needed
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=117
;
-- Oct 23, 2014 7:27:11 PM COT
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=120
;
-- Oct 23, 2014 7:27:14 PM COT
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=119
;
CREATE OR REPLACE FUNCTION currencyRate
(
p_CurFrom_ID IN NUMBER,
p_CurTo_ID IN NUMBER,
p_ConvDate IN DATE,
p_ConversionType_ID IN NUMBER,
p_Client_ID IN NUMBER,
p_Org_ID IN NUMBER
)
RETURN NUMBER
/*************************************************************************
* 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: C_Currency_Rate.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
***
* Title: Return Conversion Rate
* Description:
* from CurrencyFrom_ID to CurrencyTo_ID
* Returns NULL, if rate not found
* Test
* SELECT C_Currency_Rate(116, 100, null, null) FROM DUAL; => .647169
* SELECT C_Currency_Rate(116, 100) FROM DUAL; => .647169
************************************************************************/
AS
-- Currency From variables
cf_IsEuro CHAR(1);
cf_IsEMUMember CHAR(1);
cf_EMUEntryDate DATE;
cf_EMURate NUMBER;
-- Currency To variables
ct_IsEuro CHAR(1);
ct_IsEMUMember CHAR(1);
ct_EMUEntryDate DATE;
ct_EMURate NUMBER;
-- Triangle
v_CurrencyFrom NUMBER;
v_CurrencyTo NUMBER;
v_CurrencyEuro NUMBER;
--
v_ConvDate DATE := SysDate;
v_ConversionType_ID NUMBER := 0;
v_Rate NUMBER;
BEGIN
-- No Conversion
IF (p_CurFrom_ID = p_CurTo_ID) THEN
RETURN 1;
END IF;
-- Default Date Parameter
IF (p_ConvDate IS NOT NULL) THEN
v_ConvDate := p_ConvDate; -- SysDate
END IF;
-- Default Conversion Type
IF (p_ConversionType_ID IS NULL OR p_ConversionType_ID = 0) THEN
BEGIN
SELECT C_ConversionType_ID
INTO v_ConversionType_ID
FROM (
SELECT C_ConversionType_ID
FROM C_ConversionType
WHERE IsActive='Y' AND IsDefault='Y'
AND AD_Client_ID IN (0,p_Client_ID)
ORDER BY AD_Client_ID DESC
)
WHERE ROWNUM=1;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Conversion Type Not Found');
END;
ELSE
v_ConversionType_ID := p_ConversionType_ID;
END IF;
-- Get Currency Info
SELECT MAX(TO_CHAR(IsEuro)), MAX(TO_CHAR(IsEMUMember)), MAX(EMUEntryDate), MAX(EMURate)
INTO cf_IsEuro, cf_IsEMUMember, cf_EMUEntryDate, cf_EMURate
FROM C_Currency
WHERE C_Currency_ID = p_CurFrom_ID;
-- Not Found
IF (cf_IsEuro IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('From Currency Not Found');
RETURN NULL;
END IF;
SELECT MAX(TO_CHAR(IsEuro)), MAX(TO_CHAR(IsEMUMember)), MAX(EMUEntryDate), MAX(EMURate)
INTO ct_IsEuro, ct_IsEMUMember, ct_EMUEntryDate, ct_EMURate
FROM C_Currency
WHERE C_Currency_ID = p_CurTo_ID;
-- Not Found
IF (ct_IsEuro IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('To Currency Not Found');
RETURN NULL;
END IF;
-- Fixed - From Euro to EMU
IF (cf_IsEuro = 'Y' AND ct_IsEMUMember ='Y' AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN ct_EMURate;
END IF;
-- Fixed - From EMU to Euro
IF (ct_IsEuro = 'Y' AND cf_IsEMUMember ='Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
RETURN 1 / cf_EMURate;
END IF;
-- Fixed - From EMU to EMU
IF (cf_IsEMUMember = 'Y' AND cf_IsEMUMember ='Y'
AND v_ConvDate >= cf_EMUEntryDate AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN ct_EMURate / cf_EMURate;
END IF;
-- Flexible Rates
v_CurrencyFrom := p_CurFrom_ID;
v_CurrencyTo := p_CurTo_ID;
-- if EMU Member involved, replace From/To Currency
IF ((cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate)
OR (ct_isEMUMember = 'Y' AND v_ConvDate >= ct_EMUEntryDate)) THEN
SELECT MAX(C_Currency_ID)
INTO v_CurrencyEuro
FROM C_Currency
WHERE IsEuro = 'Y';
-- Conversion Rate not Found
IF (v_CurrencyEuro IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('Euro Not Found');
RETURN NULL;
END IF;
IF (cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
v_CurrencyFrom := v_CurrencyEuro;
ELSE
v_CurrencyTo := v_CurrencyEuro;
END IF;
END IF;
-- Get Rate
DECLARE
CURSOR CUR_Rate IS
SELECT MultiplyRate
FROM C_Conversion_Rate
WHERE IsActive='Y' AND C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
AND C_ConversionType_ID=v_ConversionType_ID
AND v_ConvDate BETWEEN ValidFrom AND ValidTo
AND AD_Client_ID IN (0,p_Client_ID) AND AD_Org_ID IN (0,p_Org_ID)
ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC;
BEGIN
FOR c IN CUR_Rate LOOP
v_Rate := c.MultiplyRate;
EXIT; -- only first
END LOOP;
END;
-- Not found
IF (v_Rate IS NULL) THEN
DBMS_OUTPUT.PUT_LINE('Conversion Rate Not Found');
RETURN NULL;
END IF;
-- Currency From was EMU
IF (cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
RETURN v_Rate / cf_EMURate;
END IF;
-- Currency To was EMU
IF (ct_isEMUMember = 'Y' AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN v_Rate * ct_EMURate;
END IF;
RETURN v_Rate;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
RETURN NULL;
END currencyRate;
/
SELECT register_migration_script('201410231928_IDEMPIERE-2269.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Oct 27, 2014 3:39:07 PM COT
-- IDEMPIERE-2250 Charge on bank transfer not needed
UPDATE AD_Field SET DisplayLogic='@PaymentRule@=''P''',Updated=TO_DATE('2014-10-27 15:39:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3439
;
SELECT register_migration_script('201410271541_IDEMPIERE-2276.sql') FROM dual
;

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Oct 28, 2014 6:45:00 PM CET
-- IDEMPIERE-2279 C_ContactActivity SalesRep_ID has no AD_Reference_Value_ID
UPDATE AD_Column SET AD_Reference_Value_ID=110,Updated=TO_DATE('2014-10-28 18:45:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=62467
;
SELECT register_migration_script('201410271848_IDEMPIERE-2279.sql') FROM dual
;

View File

@ -0,0 +1,6 @@
update ad_system set name='iDempiere' where name='?'
;
SELECT register_migration_script('201410291142_IDEMPIERE-2260.sql') FROM dual
;

View File

@ -0,0 +1,195 @@
-- Oct 23, 2014 7:27:09 PM COT
-- IDEMPIERE-2250 Charge on bank transfer not needed
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=117
;
-- Oct 23, 2014 7:27:11 PM COT
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=120
;
-- Oct 23, 2014 7:27:14 PM COT
DELETE FROM C_Conversion_Rate WHERE C_Conversion_Rate_ID=119
;
CREATE OR REPLACE FUNCTION currencyRate(
p_CurFrom_ID NUMERIC,
p_CurTo_ID NUMERIC,
p_ConvDate timestamp with time zone,
p_ConversionType_ID NUMERIC,
p_Client_ID NUMERIC,
p_Org_ID NUMERIC
)
RETURNS numeric 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 Conversion Rate
* Description:
* from CurrencyFrom_ID to CurrencyTo_ID
* Returns NULL, if rate not found
* Test
* SELECT currencyrate(116, 100, null, null, null, null) FROM AD_System; => .647169
************************************************************************/
DECLARE
-- Currency From variables
cf_IsEuro CHAR(1);
cf_IsEMUMember CHAR(1);
cf_EMUEntryDate timestamp with time zone;
cf_EMURate NUMERIC;
-- Currency To variables
ct_IsEuro CHAR(1);
ct_IsEMUMember CHAR(1);
ct_EMUEntryDate DATE;
ct_EMURate NUMERIC;
-- Triangle
v_CurrencyFrom NUMERIC;
v_CurrencyTo NUMERIC;
v_CurrencyEuro NUMERIC;
--
v_ConvDate timestamp with time zone := now();
v_ConversionType_ID NUMERIC := 0;
v_Rate NUMERIC;
c RECORD;
BEGIN
-- No Conversion
IF (p_CurFrom_ID = p_CurTo_ID) THEN
RETURN 1;
END IF;
-- Default Date Parameter
IF (p_ConvDate IS NOT NULL) THEN
v_ConvDate := p_ConvDate; -- SysDate
END IF;
-- Default Conversion Type
IF (p_ConversionType_ID IS NULL OR p_ConversionType_ID = 0) THEN
BEGIN
SELECT C_ConversionType_ID
INTO v_ConversionType_ID
FROM C_ConversionType
WHERE IsActive='Y' AND IsDefault='Y'
AND AD_Client_ID IN (0,p_Client_ID)
ORDER BY AD_Client_ID DESC
LIMIT 1;
EXCEPTION WHEN OTHERS THEN
RAISE NOTICE 'Conversion Type Not Found';
END;
ELSE
v_ConversionType_ID := p_ConversionType_ID;
END IF;
-- Get Currency Info
SELECT MAX(IsEuro), MAX(IsEMUMember), MAX(EMUEntryDate), MAX(EMURate)
INTO cf_IsEuro, cf_IsEMUMember, cf_EMUEntryDate, cf_EMURate
FROM C_Currency
WHERE C_Currency_ID = p_CurFrom_ID;
-- Not Found
IF (cf_IsEuro IS NULL) THEN
RAISE NOTICE 'From Currency Not Found';
RETURN NULL;
END IF;
SELECT MAX(IsEuro), MAX(IsEMUMember), MAX(EMUEntryDate), MAX(EMURate)
INTO ct_IsEuro, ct_IsEMUMember, ct_EMUEntryDate, ct_EMURate
FROM C_Currency
WHERE C_Currency_ID = p_CurTo_ID;
-- Not Found
IF (ct_IsEuro IS NULL) THEN
RAISE NOTICE 'To Currency Not Found';
RETURN NULL;
END IF;
-- Fixed - From Euro to EMU
IF (cf_IsEuro = 'Y' AND ct_IsEMUMember ='Y' AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN ct_EMURate;
END IF;
-- Fixed - From EMU to Euro
IF (ct_IsEuro = 'Y' AND cf_IsEMUMember ='Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
RETURN 1 / cf_EMURate;
END IF;
-- Fixed - From EMU to EMU
IF (cf_IsEMUMember = 'Y' AND cf_IsEMUMember ='Y'
AND v_ConvDate >= cf_EMUEntryDate AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN ct_EMURate / cf_EMURate;
END IF;
-- Flexible Rates
v_CurrencyFrom := p_CurFrom_ID;
v_CurrencyTo := p_CurTo_ID;
-- if EMU Member involved, replace From/To Currency
IF ((cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate)
OR (ct_isEMUMember = 'Y' AND v_ConvDate >= ct_EMUEntryDate)) THEN
SELECT MAX(C_Currency_ID)
INTO v_CurrencyEuro
FROM C_Currency
WHERE IsEuro = 'Y';
-- Conversion Rate not Found
IF (v_CurrencyEuro IS NULL) THEN
RAISE NOTICE 'Euro Not Found';
RETURN NULL;
END IF;
IF (cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
v_CurrencyFrom := v_CurrencyEuro;
ELSE
v_CurrencyTo := v_CurrencyEuro;
END IF;
END IF;
-- Get Rate
BEGIN
FOR c IN SELECT MultiplyRate
FROM C_Conversion_Rate
WHERE IsActive='Y' AND C_Currency_ID=v_CurrencyFrom AND C_Currency_ID_To=v_CurrencyTo
AND C_ConversionType_ID=v_ConversionType_ID
AND v_ConvDate BETWEEN ValidFrom AND ValidTo
AND AD_Client_ID IN (0,p_Client_ID) AND AD_Org_ID IN (0,p_Org_ID)
ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC
LOOP
v_Rate := c.MultiplyRate;
EXIT; -- only first
END LOOP;
END;
-- Not found
IF (v_Rate IS NULL) THEN
RAISE NOTICE 'Conversion Rate Not Found';
RETURN NULL;
END IF;
-- Currency From was EMU
IF (cf_isEMUMember = 'Y' AND v_ConvDate >= cf_EMUEntryDate) THEN
RETURN v_Rate / cf_EMURate;
END IF;
-- Currency To was EMU
IF (ct_isEMUMember = 'Y' AND v_ConvDate >= ct_EMUEntryDate) THEN
RETURN v_Rate * ct_EMURate;
END IF;
RETURN v_Rate;
EXCEPTION WHEN OTHERS THEN
RAISE NOTICE '%', SQLERRM;
RETURN NULL;
END;
$body$ LANGUAGE plpgsql STABLE;
SELECT register_migration_script('201410231928_IDEMPIERE-2269.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Oct 27, 2014 3:39:07 PM COT
-- IDEMPIERE-2250 Charge on bank transfer not needed
UPDATE AD_Field SET DisplayLogic='@PaymentRule@=''P''',Updated=TO_TIMESTAMP('2014-10-27 15:39:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3439
;
SELECT register_migration_script('201410271541_IDEMPIERE-2276.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- Oct 28, 2014 6:45:00 PM CET
-- IDEMPIERE-2279 C_ContactActivity SalesRep_ID has no AD_Reference_Value_ID
UPDATE AD_Column SET AD_Reference_Value_ID=110,Updated=TO_TIMESTAMP('2014-10-28 18:45:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=62467
;
SELECT register_migration_script('201410271848_IDEMPIERE-2279.sql') FROM dual
;

View File

@ -0,0 +1,6 @@
update ad_system set name='iDempiere' where name='?'
;
SELECT register_migration_script('201410291142_IDEMPIERE-2260.sql') FROM dual
;

View File

@ -616,13 +616,9 @@ public class ModelInterfaceGenerator
if ("D".equals(entityType))
return "org.compiere.model";
for (MEntityType entity : MEntityType.getEntityTypes(Env.getCtx()))
{
if (entity.getEntityType().equals(entityType))
{
return entity.getModelPackage();
}
}
MEntityType entity = MEntityType.get(Env.getCtx(), entityType);
if (entity != null)
return entity.getModelPackage();
return null;
}

View File

@ -35,6 +35,7 @@ import javax.swing.event.EventListenerList;
import org.adempiere.base.Core;
import org.compiere.db.CConnection;
import org.compiere.model.MClient;
import org.compiere.model.MSysConfig;
import org.compiere.model.MSystem;
import org.compiere.model.ModelValidationEngine;
import org.compiere.model.ServerStateChangeEvent;
@ -153,6 +154,10 @@ public final class Adempiere
*/
public static String getVersion()
{
String version = MSysConfig.getValue(MSysConfig.APPLICATION_MAIN_VERSION, null);
if(version != null)
return version;
IProduct product = Platform.getProduct();
if (product != null) {
Bundle bundle = product.getDefiningBundle();
@ -170,9 +175,40 @@ public final class Adempiere
return "Unknown";
} // getVersion
public static boolean isVersionShown(){
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_MAIN_VERSION_SHOWN, true);
}
public static boolean isDBVersionShown(){
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_DATABASE_VERSION_SHOWN, defaultVal);
}
public static boolean isVendorShown(){
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_IMPLEMENTATION_VENDOR_SHOWN, true);
}
public static boolean isJVMShown(){
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_JVM_VERSION_SHOWN, defaultVal);
}
public static boolean isOSShown(){
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_OS_INFO_SHOWN, defaultVal);
}
public static boolean isHostShown()
{
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_HOST_SHOWN, defaultVal);
}
public static String getDatabaseVersion()
{
return DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system");
// return DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system");
return MSysConfig.getValue(MSysConfig.APPLICATION_DATABASE_VERSION,
DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system"));
}
/**
@ -238,6 +274,11 @@ public final class Adempiere
*/
public static String getImplementationVendor()
{
if(DB.isConnected()){
String vendor = MSysConfig.getValue(MSysConfig.APPLICATION_IMPLEMENTATION_VENDOR, null);
if(vendor != null)
return vendor;
}
if (s_ImplementationVendor == null)
setPackageInfo();
return s_ImplementationVendor;

View File

@ -58,6 +58,8 @@ public class MAssetGroup extends X_A_Asset_Group
ag = new MAssetGroup(ctx, A_Asset_Group_ID, null);
if (ag != null && ag.get_ID() != A_Asset_Group_ID)
ag = null;
else
s_cache.put(A_Asset_Group_ID, ag);
//
return ag;
}

View File

@ -447,9 +447,10 @@ public class MClient extends X_AD_Client
return msgreturn.toString();
}
//
StringBuilder msgce = new StringBuilder("iDempiere EMail Test: ").append(toString());
String systemName = MSystem.get(getCtx()).getName();
StringBuilder msgce = new StringBuilder(systemName).append(" EMail Test: ").append(toString());
EMail email = createEMail (getRequestEMail(),
"iDempiere EMail Test",msgce.toString());
systemName + " EMail Test",msgce.toString());
if (email == null){
StringBuilder msgreturn = new StringBuilder("Could not create EMail: ").append(getName());
return msgreturn.toString();

View File

@ -16,15 +16,13 @@
*****************************************************************************/
package org.compiere.model;
import static org.compiere.model.SystemIDs.ENTITYTYPE_ADEMPIERE;
import static org.compiere.model.SystemIDs.ENTITYTYPE_DICTIONARY;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.Level;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
/**
@ -46,27 +44,8 @@ public class MEntityType extends X_AD_EntityType
/**
*
*/
private static final long serialVersionUID = 4670009709141738924L;
private static final long serialVersionUID = -8449015496292546851L;
/**
* Get Entity Types
* @param ctx context
* @return entity type array
*/
static synchronized public MEntityType[] getEntityTypes(Properties ctx)
{
if (s_entityTypes != null)
return s_entityTypes;
List<MEntityType> list = new Query(ctx, Table_Name, null, null)
.setOnlyActiveRecords(true)
.setOrderBy(COLUMNNAME_AD_EntityType_ID)
.list();
s_entityTypes = new MEntityType[list.size()];
list.toArray(s_entityTypes);
if (s_log.isLoggable(Level.FINER)) s_log.finer("# " + s_entityTypes.length);
return s_entityTypes;
} // getEntityTypes
/**
* Get EntityType object by name
* @param ctx
@ -75,102 +54,21 @@ public class MEntityType extends X_AD_EntityType
*/
public static MEntityType get(Properties ctx, String entityType)
{
for (MEntityType entity : getEntityTypes(ctx))
{
if (entity.getEntityType().equals(entityType))
{
return entity;
}
}
return null;
MEntityType retValue = (MEntityType) s_cache.get (entityType);
if (retValue != null)
return retValue;
retValue = new Query(ctx, Table_Name, "EntityType=?", null)
.setParameters(entityType)
.firstOnly();
if (retValue != null)
s_cache.put (entityType, retValue);
return retValue;
}
/**
* Get Entity Type as String array
* @param ctx context
* @return entity type array
*/
static public String[] getEntityTypeStrings(Properties ctx)
{
MEntityType[] entityTypes = getEntityTypes(ctx);
ArrayList<String> list = new ArrayList<String>(); // list capabilities
String[] retValue = new String[entityTypes.length];
for (int i = 0; i < entityTypes.length; i++)
{
String s = entityTypes[i].getEntityType().trim();
list.add(s);
retValue[i] = s;
}
if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString());
return retValue;
} // getEntityTypeStrings
/**
* Get Entity Type Classpath array
* @param ctx context
* @return classpath array
*/
static public String[] getClasspaths(Properties ctx)
{
MEntityType[] entityTypes = getEntityTypes(ctx);
ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < entityTypes.length; i++)
{
String classpath = entityTypes[i].getClasspath();
if (classpath == null || classpath.length() == 0)
continue;
StringTokenizer st = new StringTokenizer(classpath, ";, \t\n\r\f");
while (st.hasMoreTokens())
{
String token = st.nextToken();
if (token.length() > 0)
{
if (!list.contains(token))
list.add(token);
}
}
}
String[] retValue = new String[list.size()];
list.toArray(retValue);
if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString());
return retValue;
} // getClathpaths
/**
* Get Entity Type Model Package array
* @param ctx context
* @return entity type array
*/
static public String[] getModelPackages(Properties ctx)
{
MEntityType[] entityTypes = getEntityTypes(ctx);
ArrayList<String> list = new ArrayList<String>();
list.add("adempiere.model"); // default
for (int i = 0; i < entityTypes.length; i++)
{
String modelPackage = entityTypes[i].getModelPackage();
if (modelPackage == null || modelPackage.length() == 0)
continue;
StringTokenizer st = new StringTokenizer(modelPackage, ";, \t\n\r\f");
while (st.hasMoreTokens())
{
String token = st.nextToken();
if (token.length() > 0)
{
if (!list.contains(token))
list.add(token);
}
}
}
String[] retValue = new String[list.size()];
list.toArray(retValue);
if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString());
return retValue;
} // getModelPackages
/** Cached EntityTypes */
private static MEntityType[] s_entityTypes = null;
private static CCache<String,MEntityType> s_cache = new CCache<String,MEntityType>(Table_Name, 20);
/** Logger */
@SuppressWarnings("unused")
private static CLogger s_log = CLogger.getCLogger (MEntityType.class);
/**************************************************************************
@ -268,7 +166,6 @@ public class MEntityType extends X_AD_EntityType
*/
//setAD_EntityType_ID();
} // new
s_entityTypes = null; // reset
return true;
} // beforeSave
@ -283,7 +180,6 @@ public class MEntityType extends X_AD_EntityType
log.saveError("Error", "You cannot delete a System maintained entity");
return false;
}
s_entityTypes = null; // reset
return true;
} // beforeDelete

View File

@ -170,8 +170,8 @@ public class MInfoWindow extends X_AD_InfoWindow
Iterator<MInfoProcess> iterator = lsInfoProcess.iterator();
while (iterator.hasNext()){
MInfoProcess testInfoProcess = iterator.next();
// need more review
if (MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID()) == null){
Boolean access = MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID());
if (access == null || !access.booleanValue()) {
iterator.remove();
}
}

View File

@ -52,10 +52,13 @@ public class MProductCategory extends X_M_Product_Category
public static MProductCategory get (Properties ctx, int M_Product_Category_ID)
{
Integer ii = new Integer (M_Product_Category_ID);
MProductCategory pc = (MProductCategory)s_cache.get(ii);
if (pc == null)
pc = new MProductCategory (ctx, M_Product_Category_ID, null);
return pc;
MProductCategory retValue = (MProductCategory)s_cache.get(ii);
if (retValue != null)
return retValue;
retValue = new MProductCategory (ctx, M_Product_Category_ID, null);
if (retValue.get_ID () != 0)
s_cache.put (M_Product_Category_ID, retValue);
return retValue;
} // get
/**

View File

@ -42,14 +42,22 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 1418216769489567455L;
private static final long serialVersionUID = -5043918406658386237L;
public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
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 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 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";
public static final String APPLICATION_IMPLEMENTATION_VENDOR = "APPLICATION_IMPLEMENTATION_VENDOR";
public static final String APPLICATION_IMPLEMENTATION_VENDOR_SHOWN = "APPLICATION_IMPLEMENTATION_VENDOR_SHOWN";
public static final String APPLICATION_JVM_VERSION_SHOWN = "APPLICATION_JVM_VERSION_SHOWN";
public static final String APPLICATION_MAIN_VERSION = "APPLICATION_MAIN_VERSION";
public static final String APPLICATION_MAIN_VERSION_SHOWN = "APPLICATION_MAIN_VERSION_SHOWN";
public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN";
public static final String BACKGROUND_JOB_ALLOWED = "BACKGROUND_JOB_ALLOWED";
public static final String BACKGROUND_JOB_BY_DEFAULT = "BACKGROUND_JOB_BY_DEFAULT";
public static final String BACKGROUND_JOB_MAX_IN_SYSTEM = "BACKGROUND_JOB_MAX_IN_SYSTEM";
@ -107,7 +115,6 @@ public class MSysConfig extends X_AD_SysConfig
public static final String RecentItems_MaxShown = "RecentItems_MaxShown";
public static final String REPORT_SWAP_MAX_ROWS = "REPORT_SWAP_MAX_ROWS";
public static final String SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE = "SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE";
public static final String SHIPPING_SAVE_REQUEST_RESPONSE_LOG = "SHIPPING_SAVE_REQUEST_RESPONSE_LOG";
public static final String START_VALUE_BPLOCATION_NAME = "START_VALUE_BPLOCATION_NAME";
public static final String SWING_LOGIN_ALLOW_REMEMBER_ME = "SWING_LOGIN_ALLOW_REMEMBER_ME";
public static final String SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR = "SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR";
@ -116,7 +123,6 @@ public class MSysConfig extends X_AD_SysConfig
public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE";
public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG";
public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE";
public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG";
public static final String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
public static final String USE_EMAIL_FOR_LOGIN = "USE_EMAIL_FOR_LOGIN";
public static final String USER_LOCKING_MAX_ACCOUNT_LOCK_MINUTES = "USER_LOCKING_MAX_ACCOUNT_LOCK_MINUTES";

View File

@ -3014,6 +3014,8 @@ public abstract class PO
{
if (m_KeyColumns[i].endsWith("_ID"))
sb.append(m_IDs[i]);
else if(m_IDs[i] instanceof Timestamp)
sb.append(DB.TO_DATE((Timestamp)m_IDs[i], false));
else {
sb.append("'");
if (m_IDs[i] instanceof Boolean) {

View File

@ -22,7 +22,7 @@ import java.text.DateFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
@ -42,7 +42,7 @@ public class Language implements Serializable
/**
*
*/
private static final long serialVersionUID = 6705748825004207885L;
private static final long serialVersionUID = 8855937839841807335L;
/**
*
@ -59,19 +59,19 @@ public class Language implements Serializable
/***
* System Languages.
* If you want to add a language, extend the array
* - or use the addLanguage() method.
* If you want to add a language, use the method getLanguage which extends the array
**/
static private Language[] s_languages = new Language[] {
new Language ("English",
AD_Language_en_US, Locale.US, null, null,
MediaSize.NA.LETTER)
};
private static List<Language> s_languages = new ArrayList<Language>();
/** Base Language */
private static Language s_baseLanguage = s_languages[0];
private static Language s_baseLanguage = null;
private static boolean isBaseLanguageSet = false;
static {
s_languages.add(new Language ("English", AD_Language_en_US, Locale.US, null, null, MediaSize.NA.LETTER));
s_baseLanguage = s_languages.get(0);
}
/** Logger */
private static CLogger log = CLogger.getCLogger(Language.class.getName());
@ -81,7 +81,7 @@ public class Language implements Serializable
*/
public static int getLanguageCount()
{
return s_languages.length;
return s_languages.size();
} // getLanguageCount
/**
@ -91,33 +91,18 @@ public class Language implements Serializable
*/
public static Language getLanguage (int index)
{
if (index < 0 || index >= s_languages.length)
if (index < 0 || index >= s_languages.size())
return s_baseLanguage;
return s_languages[index];
return s_languages.get(index);
} // getLanguage
/**
* Add Language to supported Languages
* @param language new language
* @deprecated IDEMPIERE-489 Configure the language in the database
*/
public static void addLanguage (Language language)
{
if (language == null)
return;
ArrayList<Language> list = new ArrayList<Language>(Arrays.asList(s_languages));
list.add(language);
s_languages = new Language[list.size()];
list.toArray(s_languages);
} // addLanguage
/**************************************************************************
* Get Language.
* If language does not exist, create it on the fly assuming that it is valid
* @param langInfo either language (en) or locale (en-US) or display name
* @return Name (e.g. Deutsch)
*/
public static Language getLanguage (String langInfo)
public synchronized static Language getLanguage (String langInfo)
{
int idxReplace = -1;
String lang = langInfo;
@ -125,17 +110,17 @@ public class Language implements Serializable
lang = System.getProperty("user.language", "");
// Search existing Languages
for (int i = 0; i < s_languages.length; i++)
for (int i = 0; i < s_languages.size(); i++)
{
if ( lang.equals(s_languages[i].getName())
|| lang.equals(s_languages[i].getLanguageCode())
|| lang.equals(s_languages[i].getAD_Language())) {
if (!s_languages[i].m_fromDB && DB.isConnected()) {
if ( lang.equals(s_languages.get(i).getAD_Language())
|| lang.equals(s_languages.get(i).getLanguageCode())
|| lang.equals(s_languages.get(i).getName())) {
if (!s_languages.get(i).m_fromDB && DB.isConnected()) {
// if language was not get from DB and now we're connected
idxReplace = i;
break;
} else {
return s_languages[i];
return s_languages.get(i);
}
}
}
@ -181,17 +166,16 @@ public class Language implements Serializable
if (ll == null) {
ll = new Language (lang, lang, locale);
}
if (log.isLoggable(Level.INFO)) {
StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale);
log.info (msglog.toString());
}
StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale);
if (log.isLoggable(Level.INFO)) log.info (msglog.toString());
log.warning(msglog.toString());
if (idxReplace >= 0) {
s_languages[idxReplace] = ll;
s_languages.set(idxReplace, ll);
} else {
// Add to Languages
ArrayList<Language> list = new ArrayList<Language>(Arrays.asList(s_languages));
list.add(ll);
s_languages = new Language [list.size()];
list.toArray(s_languages);
// Return Language
s_languages.add(ll);
}
return ll;
}
@ -274,10 +258,10 @@ public class Language implements Serializable
{
if (locale != null)
{
for (int i = 0; i < s_languages.length; i++)
for (int i = 0; i < s_languages.size(); i++)
{
if (locale.getLanguage().equals(s_languages[i].getLocale().getLanguage()))
return s_languages[i].getAD_Language();
if (locale.getLanguage().equals(s_languages.get(i).getLocale().getLanguage()))
return s_languages.get(i).getAD_Language();
}
}
return s_baseLanguage.getAD_Language();
@ -309,9 +293,9 @@ public class Language implements Serializable
*/
public static String[] getNames()
{
String[] retValue = new String[s_languages.length];
for (int i = 0; i < s_languages.length; i++)
retValue[i] = s_languages[i].getName();
String[] retValue = new String[s_languages.size()];
for (int i = 0; i < s_languages.size(); i++)
retValue[i] = s_languages.get(i).getName();
return retValue;
} // getNames

View File

@ -85,6 +85,7 @@ public class CashFlow extends SvrProcess {
dateFrom.set(Calendar.HOUR_OF_DAY, 0);
dateFrom.set(Calendar.MINUTE, 0);
dateFrom.set(Calendar.SECOND, 0);
dateFrom.set(Calendar.MILLISECOND, 0);
p_dateFrom = new Timestamp(dateFrom.getTimeInMillis());
p_dateFrom.setNanos(0);

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# FileName: idempiere.init
# Description: adempiere erp software startup and shutdown
# Description: idempiere erp software startup and shutdown
# Vendor: K.K. Alice
# Created: 05. April 2004
# Author: S. Christians
@ -13,7 +13,7 @@
# FilePerms: 0755
#
# chkconfig: 2345 97 06
# $Id: adempiere,v 1.1 2006/03/16 05:00:28 cruiz Exp $
# $Id: idempiere,v 1.1 2006/03/16 05:00:28 cruiz Exp $
# initialization
# adjust these variables to your environment
@ -39,7 +39,7 @@ start () {
echo "iDempiere is already running"
return 1
fi
echo -n "Starting ADempiere ERP: "
echo -n "Starting iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
source $ENVFILE
export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log
@ -85,7 +85,7 @@ stop () {
cd $IDEMPIERE_HOME/utils
source $ENVFILE
echo "Trying direct kill with signal -15"
# Adempiere didn't finish - try direct kill with signal 15, then signal 9
# iDempiere didn't finish - try direct kill with signal 15, then signal 9
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus

View File

@ -57,7 +57,8 @@ public class ExecuteProcessCommand extends ServerResource {
String procedureName = (String) entity.get("procedureName");
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
if (!role.getProcessAccess(pi.getAD_Process_ID())) {
Boolean access = role.getProcessAccess(pi.getAD_Process_ID());
if (access == null || !access.booleanValue()) {
throw new AdempiereException("Access denied.");
}

View File

@ -63,6 +63,7 @@ import org.compiere.model.GridWindow;
import org.compiere.model.I_AD_Preference;
import org.compiere.model.MLookup;
import org.compiere.model.MPreference;
import org.compiere.model.MRole;
import org.compiere.model.MTab;
import org.compiere.model.MTable;
import org.compiere.model.MToolBarButton;
@ -633,8 +634,11 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
//get extra toolbar process buttons
MToolBarButton[] mToolbarButtons = MToolBarButton.getProcessButtonOfTab(gridTab.getAD_Tab_ID(), null);
for(MToolBarButton mToolbarButton : mToolbarButtons) {
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
toolbarProcessButtons.add(toolbarProcessButton);
Boolean access = MRole.getDefault().getProcessAccess(mToolbarButton.getAD_Process_ID());
if (access != null && access.booleanValue()) {
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
toolbarProcessButtons.add(toolbarProcessButton);
}
}
if (toolbarProcessButtons.size() > 0) {

View File

@ -20,6 +20,8 @@ import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_CURRENCY_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_PERIOD_AD_ORG_ID;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Vector;
import java.util.logging.Level;
@ -336,7 +338,13 @@ public class WAllocation extends Allocation
statusBar.setVflex("min");
// Date set to Login Date
dateField.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
Calendar cal = Calendar.getInstance();
cal.setTime(Env.getContextAsDate(Env.getCtx(), "#Date"));
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
dateField.setValue(new Timestamp(cal.getTimeInMillis()));
dateField.addValueChangeListener(this);

View File

@ -103,7 +103,7 @@ public class DefaultFeedbackService implements IFeedbackService {
Msg.getMsg(Env.getCtx(), "EMailSupport"),
MUser.get(Env.getCtx()),
"", // to
"iDempiere " + Msg.getMsg(Env.getCtx(), "TraceInfo"),
MSystem.get(Env.getCtx()).getName() + " " + Msg.getMsg(Env.getCtx(), "TraceInfo"),
"", ds);
dialog.setAttribute(Window.MODE_KEY, Mode.OVERLAPPED);

View File

@ -11,6 +11,13 @@ Copyright (C) 2009 Idalica Corporation
var vendor = Adempiere.getImplementationVendor();
var jvm = Adempiere.getJavaInfo();
var os = Adempiere.getOSInfo();
var isVersionShown = Adempiere.isVersionShown();
var isDBVersionShown = Adempiere.isDBVersionShown();
var isVendorShown = Adempiere.isVendorShown();
var isJVMShown = Adempiere.isJVMShown();
var isOSShown = Adempiere.isOSShown();
var isHostShown = Adempiere.isHostShown();
var isInfoShown = isVersionShown || isDBVersionShown || isVendorShown || isJVMShown || isOSShown || isHostShown;
</zscript>
<html>
<![CDATA[
@ -25,40 +32,41 @@ Copyright (C) 2009 Idalica Corporation
font-size: 8pt;
}
</style>
<div class="versionInfoBox">
]]>
<div class="versionInfoBox" if="${isInfoShown == true}">
<table border="0">
<tr>
<tr if="${isVersionShown == true}">
<td align="right">Version</td>
<td>:</td>
<td aligh="left">${mainVersion}</td>
</tr>
<tr>
<tr if="${isDBVersionShown == true}">
<td align="right">Database Version</td>
<td>:</td>
<td aligh="left">${dbVersion}</td>
</tr>
<tr>
<tr if="${isVendorShown == true}">
<td align="right">Vendor</td>
<td>:</td>
<td aligh="left">${vendor}</td>
</tr>
<tr>
<tr if="${isJVMShown == true}">
<td align="right">JVM</td>
<td>:</td>
<td aligh="left">${jvm}</td>
</tr>
<tr>
<tr if="${isOSShown == true}">
<td align="right">OS</td>
<td>:</td>
<td aligh="left">${os}</td>
</tr>
<tr>
<tr if="${isHostShown == true}">
<td align="right">Host</td>
<td>:</td>
<td aligh="left">${desktop.execution.serverName}</td>
</tr>
</table>
</div>
]]>
</html>
</zk>