Work in progress - integrate bug fixing from Compiere 260b

This commit is contained in:
Carlos Ruiz 2007-02-25 22:25:35 +00:00
parent 244779d909
commit 8425078adf
67 changed files with 1137 additions and 607 deletions

View File

@ -274,24 +274,24 @@ public class ImportGLJournal extends SvrProcess
log.fine("Set Home CurrencyRate=" + no); log.fine("Set Home CurrencyRate=" + no);
// Set Currency Rate // Set Currency Rate
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET CurrencyRate=(SELECT r.MultiplyRate FROM C_Conversion_Rate r, C_AcctSchema s" + "SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s"
+ " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID" + " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID"
+ " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID" + " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID"
+ " AND r.AD_Client_ID=i.AD_Client_ID AND r.AD_Org_ID=i.AD_OrgDoc_ID" + " AND r.AD_Client_ID=i.AD_Client_ID AND r.AD_Org_ID=i.AD_OrgDoc_ID"
+ " AND r.C_ConversionType_ID=i.C_ConversionType_ID" + " AND r.C_ConversionType_ID=i.C_ConversionType_ID"
+ " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo AND ROWNUM=1" + " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo "
// ORDER BY ValidFrom DESC // ORDER BY ValidFrom DESC
+ ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0" + ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Org Rate=" + no); log.fine("Set Org Rate=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET CurrencyRate=(SELECT r.MultiplyRate FROM C_Conversion_Rate r, C_AcctSchema s" + "SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s"
+ " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID" + " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID"
+ " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID" + " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID"
+ " AND r.AD_Client_ID=i.AD_Client_ID" + " AND r.AD_Client_ID=i.AD_Client_ID"
+ " AND r.C_ConversionType_ID=i.C_ConversionType_ID" + " AND r.C_ConversionType_ID=i.C_ConversionType_ID"
+ " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo AND ROWNUM=1" + " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo "
// ORDER BY ValidFrom DESC // ORDER BY ValidFrom DESC
+ ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0" + ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
@ -307,25 +307,25 @@ public class ImportGLJournal extends SvrProcess
// Set Period // Set Period
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET C_Period_ID=(SELECT p.C_Period_ID FROM C_Period p" + "SET C_Period_ID=(SELECT MAX(p.C_Period_ID) FROM C_Period p"
+ " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)" + " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)"
+ " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID)" + " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID)"
+ " WHERE c.AD_Client_ID=i.AD_Client_ID" + " WHERE c.AD_Client_ID=i.AD_Client_ID"
// globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug
+ " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S' AND ROWNUM=1) " + " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S') "
+ "WHERE C_Period_ID IS NULL" + "WHERE C_Period_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Period=" + no); log.fine("Set Period=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Period, '" + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Period, '"
+ "WHERE C_Period_ID IS NULL OR C_Period_ID<>" + "WHERE C_Period_ID IS NULL OR C_Period_ID NOT IN"
+ "(SELECT C_Period_ID FROM C_Period p" + "(SELECT C_Period_ID FROM C_Period p"
+ " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)" + " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)"
+ " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID) " + " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID) "
+ " WHERE c.AD_Client_ID=i.AD_Client_ID" + " WHERE c.AD_Client_ID=i.AD_Client_ID"
// globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug
+ " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S' AND ROWNUM=1)" + " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S')"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
@ -384,11 +384,11 @@ public class ImportGLJournal extends SvrProcess
// Set Account // Set Account
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET Account_ID=(SELECT ev.C_ElementValue_ID FROM C_ElementValue ev" + "SET Account_ID=(SELECT MAX(ev.C_ElementValue_ID) FROM C_ElementValue ev"
+ " INNER JOIN C_Element e ON (e.C_Element_ID=ev.C_Element_ID)" + " INNER JOIN C_Element e ON (e.C_Element_ID=ev.C_Element_ID)"
+ " INNER JOIN C_AcctSchema_Element ase ON (e.C_Element_ID=ase.C_Element_ID AND ase.ElementType='AC')" + " INNER JOIN C_AcctSchema_Element ase ON (e.C_Element_ID=ase.C_Element_ID AND ase.ElementType='AC')"
+ " WHERE ev.Value=i.AccountValue AND ev.IsSummary='N'" + " WHERE ev.Value=i.AccountValue AND ev.IsSummary='N'"
+ " AND i.C_AcctSchema_ID=ase.C_AcctSchema_ID AND i.AD_Client_ID=ev.AD_Client_ID AND ROWNUM=1) " + " AND i.C_AcctSchema_ID=ase.C_AcctSchema_ID AND i.AD_Client_ID=ev.AD_Client_ID) "
+ "WHERE Account_ID IS NULL AND AccountValue IS NOT NULL" + "WHERE Account_ID IS NULL AND AccountValue IS NOT NULL"
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -419,9 +419,9 @@ public class ImportGLJournal extends SvrProcess
// Set Product // Set Product
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuffer ("UPDATE I_GLJournal i "
+ "SET M_Product_ID=(SELECT p.M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(p.M_Product_ID) FROM M_Product p"
+ " WHERE (p.Value=i.ProductValue OR p.UPC=i.UPC OR p.SKU=i.SKU)" + " WHERE (p.Value=i.ProductValue OR p.UPC=i.UPC OR p.SKU=i.SKU)"
+ " AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)" + "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)"
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());

View File

@ -66,7 +66,7 @@ public class ImportInOutConfirm extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info(""); log.info("I_InOutLineConfirm_ID=" + p_I_InOutLineConfirm_ID);
StringBuffer sql = null; StringBuffer sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID; String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID;

View File

@ -122,15 +122,15 @@ public class ImportInventory extends SvrProcess
// Location // Location
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuffer ("UPDATE I_Inventory i "
+ "SET M_Locator_ID=(SELECT M_Locator_ID FROM M_Locator l" + "SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l"
+ " WHERE i.LocatorValue=l.Value AND i.AD_Client_ID=l.AD_Client_ID AND ROWNUM=1) " + " WHERE i.LocatorValue=l.Value AND i.AD_Client_ID=l.AD_Client_ID) "
+ "WHERE M_Locator_ID IS NULL AND LocatorValue IS NOT NULL" + "WHERE M_Locator_ID IS NULL AND LocatorValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Locator from Value =" + no); log.fine("Set Locator from Value =" + no);
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuffer ("UPDATE I_Inventory i "
+ "SET M_Locator_ID=(SELECT M_Locator_ID FROM M_Locator l" + "SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l"
+ " WHERE i.X=l.X AND i.Y=l.Y AND i.Z=l.Z AND i.AD_Client_ID=l.AD_Client_ID AND ROWNUM=1) " + " WHERE i.X=l.X AND i.Y=l.Y AND i.Z=l.Z AND i.AD_Client_ID=l.AD_Client_ID) "
+ "WHERE M_Locator_ID IS NULL AND X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL" + "WHERE M_Locator_ID IS NULL AND X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
@ -171,19 +171,19 @@ public class ImportInventory extends SvrProcess
// Product // Product
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuffer ("UPDATE I_Inventory i "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND Value IS NOT NULL" + "WHERE M_Product_ID IS NULL AND Value IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuffer ("UPDATE I_Inventory i "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" + "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuffer ("UPDATE I_Inventory "
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Product, ' " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Product, ' "
+ "WHERE M_Product_ID IS NULL" + "WHERE M_Product_ID IS NULL"

View File

@ -146,22 +146,22 @@ public class ImportInvoice extends SvrProcess
log.warning ("Invalid DocTypeName=" + no); log.warning ("Invalid DocTypeName=" + no);
// DocType Default // DocType Default
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType='API' AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType='API' AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set PO Default DocType=" + no); log.fine("Set PO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType='ARI' AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType='ARI' AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set SO Default DocType=" + no); log.fine("Set SO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType IN('ARI','API') AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType IN('ARI','API') AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
@ -190,26 +190,26 @@ public class ImportInvoice extends SvrProcess
// Price List // Price List
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p WHERE p.IsDefault='Y'" + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'"
+ " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default Currency PriceList=" + no); log.fine("Set Default Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p WHERE p.IsDefault='Y'" + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'"
+ " AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PriceList=" + no); log.fine("Set Default PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p " + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p "
+ " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency PriceList=" + no); log.fine("Set Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p " + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p "
+ " WHERE p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PriceList=" + no); log.fine("Set PriceList=" + no);
@ -230,8 +230,8 @@ public class ImportInvoice extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PaymentTerm=" + no); log.fine("Set PaymentTerm=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p" + "SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p"
+ " WHERE p.IsDefault='Y' AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PaymentTerm=" + no); log.fine("Set Default PaymentTerm=" + no);
@ -263,8 +263,8 @@ public class ImportInvoice extends SvrProcess
log.fine("Set BP from ContactName=" + no); log.fine("Set BP from ContactName=" + no);
// BP from Value // BP from Value
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner bp" + "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp"
+ " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID AND ROWNUM=1) " + " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) "
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" + "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -292,10 +292,10 @@ public class ImportInvoice extends SvrProcess
log.fine("Found Location=" + no); log.fine("Found Location=" + no);
// Set Location from BPartner // Set Location from BPartner
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID FROM C_BPartner_Location l" + "SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l"
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" + " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID"
+ " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')" + " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')"
+ " AND ROWNUM=1) " + ") "
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" + "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -312,8 +312,8 @@ public class ImportInvoice extends SvrProcess
// Set Country // Set Country
/** /**
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET CountryCode=(SELECT CountryCode FROM C_Country c WHERE c.IsDefault='Y'" + "SET CountryCode=(SELECT MAX(CountryCode) FROM C_Country c WHERE c.IsDefault='Y'"
+ " AND c.AD_Client_ID IN (0, o.AD_Client_ID) AND ROWNUM=1) " + " AND c.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL" + "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -337,9 +337,9 @@ public class ImportInvoice extends SvrProcess
// Set Region // Set Region
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "Set RegionName=(SELECT Name FROM C_Region r" + "Set RegionName=(SELECT MAX(Name) FROM C_Region r"
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID" + " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID"
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID) AND ROWNUM=1) " + " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL" + "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -366,22 +366,22 @@ public class ImportInvoice extends SvrProcess
// Product // Product
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL" + "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" + "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL" + "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -396,8 +396,8 @@ public class ImportInvoice extends SvrProcess
// Tax // Tax
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuffer ("UPDATE I_Invoice o "
+ "SET C_Tax_ID=(SELECT C_Tax_ID FROM C_Tax t" + "SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t"
+ " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID AND ROWNUM=1) " + " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) "
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" + "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());

View File

@ -143,20 +143,20 @@ public class ImportOrder extends SvrProcess
log.warning ("Invalid DocTypeName=" + no); log.warning ("Invalid DocTypeName=" + no);
// DocType Default // DocType Default
sql = new StringBuffer ("UPDATE I_Order o " // Default PO sql = new StringBuffer ("UPDATE I_Order o " // Default PO
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType='POO' AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PO Default DocType=" + no); log.fine("Set PO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " // Default SO sql = new StringBuffer ("UPDATE I_Order o " // Default SO
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType='SOO' AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set SO Default DocType=" + no); log.fine("Set SO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.IsDefault='Y'" + "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'"
+ " AND d.DocBaseType IN('SOO','POO') AND ROWNUM=1 AND o.AD_Client_ID=d.AD_Client_ID) " + " AND d.DocBaseType IN('SOO','POO') AND o.AD_Client_ID=d.AD_Client_ID) "
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default DocType=" + no); log.fine("Set Default DocType=" + no);
@ -184,26 +184,26 @@ public class ImportOrder extends SvrProcess
// Price List // Price List
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p WHERE p.IsDefault='Y'" + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'"
+ " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default Currency PriceList=" + no); log.fine("Set Default Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p WHERE p.IsDefault='Y'" + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'"
+ " AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PriceList=" + no); log.fine("Set Default PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p " + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p "
+ " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency PriceList=" + no); log.fine("Set Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p " + "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p "
+ " WHERE p.IsSOPriceList=o.IsSOTrx AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PriceList=" + no); log.fine("Set PriceList=" + no);
@ -224,8 +224,8 @@ public class ImportOrder extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PaymentTerm=" + no); log.fine("Set PaymentTerm=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p" + "SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p"
+ " WHERE p.IsDefault='Y' AND ROWNUM=1 AND o.AD_Client_ID=p.AD_Client_ID) " + " WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PaymentTerm=" + no); log.fine("Set Default PaymentTerm=" + no);
@ -240,8 +240,8 @@ public class ImportOrder extends SvrProcess
// Warehouse // Warehouse
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w" + "SET M_Warehouse_ID=(SELECT MAX(M_Warehouse_ID) FROM M_Warehouse w"
+ " WHERE ROWNUM=1 AND o.AD_Client_ID=w.AD_Client_ID AND o.AD_Org_ID=w.AD_Org_ID) " + " WHERE o.AD_Client_ID=w.AD_Client_ID AND o.AD_Org_ID=w.AD_Org_ID) "
+ "WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); + "WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); // Warehouse for Org no = DB.executeUpdate(sql.toString(), get_TrxName()); // Warehouse for Org
if (no != 0) if (no != 0)
@ -283,8 +283,8 @@ public class ImportOrder extends SvrProcess
log.fine("Set BP from ContactName=" + no); log.fine("Set BP from ContactName=" + no);
// BP from Value // BP from Value
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner bp" + "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp"
+ " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID AND ROWNUM=1) " + " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) "
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" + "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -312,20 +312,20 @@ public class ImportOrder extends SvrProcess
log.fine("Found Location=" + no); log.fine("Found Location=" + no);
// Set Bill Location from BPartner // Set Bill Location from BPartner
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET BillTo_ID=(SELECT C_BPartner_Location_ID FROM C_BPartner_Location l" + "SET BillTo_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l"
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" + " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID"
+ " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR (l.IsPayFrom='Y' AND o.IsSOTrx='N'))" + " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR (l.IsPayFrom='Y' AND o.IsSOTrx='N'))"
+ " AND ROWNUM=1) " + ") "
+ "WHERE C_BPartner_ID IS NOT NULL AND BillTo_ID IS NULL" + "WHERE C_BPartner_ID IS NOT NULL AND BillTo_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP BillTo from BP=" + no); log.fine("Set BP BillTo from BP=" + no);
// Set Location from BPartner // Set Location from BPartner
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID FROM C_BPartner_Location l" + "SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l"
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" + " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID"
+ " AND ((l.IsShipTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')" + " AND ((l.IsShipTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')"
+ " AND ROWNUM=1) " + ") "
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" + "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -342,8 +342,8 @@ public class ImportOrder extends SvrProcess
// Set Country // Set Country
/** /**
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET CountryCode=(SELECT CountryCode FROM C_Country c WHERE c.IsDefault='Y'" + "SET CountryCode=(SELECT MAX(CountryCode) FROM C_Country c WHERE c.IsDefault='Y'"
+ " AND c.AD_Client_ID IN (0, o.AD_Client_ID) AND ROWNUM=1) " + " AND c.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL" + "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -367,9 +367,9 @@ public class ImportOrder extends SvrProcess
// Set Region // Set Region
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "Set RegionName=(SELECT Name FROM C_Region r" + "Set RegionName=(SELECT MAX(Name) FROM C_Region r"
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID" + " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID"
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID) AND ROWNUM=1) " + " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL" + "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -396,22 +396,22 @@ public class ImportOrder extends SvrProcess
// Product // Product
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL" + "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" + "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" + "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p"
+ " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID AND ROWNUM=1) " + " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL" + "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -426,8 +426,8 @@ public class ImportOrder extends SvrProcess
// Tax // Tax
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_Tax_ID=(SELECT C_Tax_ID FROM C_Tax t" + "SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t"
+ " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID AND ROWNUM=1) " + " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) "
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" + "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());

View File

@ -255,8 +255,8 @@ public class ImportPayment extends SvrProcess
// Invoice // Invoice
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuffer ("UPDATE I_Payment i "
+ "SET C_Invoice_ID=(SELECT C_Invoice_ID FROM C_Invoice ii" + "SET C_Invoice_ID=(SELECT MAX(C_Invoice_ID) FROM C_Invoice ii"
+ " WHERE i.InvoiceDocumentNo=ii.DocumentNo AND i.AD_Client_ID=ii.AD_Client_ID AND ROWNUM=1) " + " WHERE i.InvoiceDocumentNo=ii.DocumentNo AND i.AD_Client_ID=ii.AD_Client_ID) "
+ "WHERE C_Invoice_ID IS NULL AND InvoiceDocumentNo IS NOT NULL" + "WHERE C_Invoice_ID IS NULL AND InvoiceDocumentNo IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -265,8 +265,8 @@ public class ImportPayment extends SvrProcess
// BPartner // BPartner
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuffer ("UPDATE I_Payment i "
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner bp" + "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp"
+ " WHERE i.BPartnerValue=bp.Value AND i.AD_Client_ID=bp.AD_Client_ID AND ROWNUM=1) " + " WHERE i.BPartnerValue=bp.Value AND i.AD_Client_ID=bp.AD_Client_ID) "
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" + "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -274,8 +274,8 @@ public class ImportPayment extends SvrProcess
log.fine("Set BP from Value=" + no); log.fine("Set BP from Value=" + no);
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuffer ("UPDATE I_Payment i "
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_Invoice ii" + "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_Invoice ii"
+ " WHERE i.C_Invoice_ID=ii.C_Invoice_ID AND i.AD_Client_ID=ii.AD_Client_ID AND ROWNUM=1) " + " WHERE i.C_Invoice_ID=ii.C_Invoice_ID AND i.AD_Client_ID=ii.AD_Client_ID) "
+ "WHERE C_BPartner_ID IS NULL AND C_Invoice_ID IS NOT NULL" + "WHERE C_BPartner_ID IS NULL AND C_Invoice_ID IS NOT NULL"
+ " AND I_IsImported<>'Y'").append (clientCheck); + " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());

View File

@ -35,8 +35,6 @@ public class ImportProduct extends SvrProcess
/** Delete old Imported */ /** Delete old Imported */
private boolean m_deleteOldImported = false; private boolean m_deleteOldImported = false;
/** Organization to be imported to */
private int m_AD_Org_ID = 0;
/** Effective */ /** Effective */
private Timestamp m_DateValue = null; private Timestamp m_DateValue = null;
/** Pricelist to Update */ /** Pricelist to Update */
@ -152,8 +150,8 @@ public class ImportProduct extends SvrProcess
// Set Product Category // Set Product Category
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuffer ("UPDATE I_Product "
+ "SET ProductCategory_Value=(SELECT Value FROM M_Product_Category" + "SET ProductCategory_Value=(SELECT MAX(Value) FROM M_Product_Category"
+ " WHERE IsDefault='Y' AND AD_Client_ID=").append(m_AD_Client_ID).append(" AND ROWNUM=1) " + " WHERE IsDefault='Y' AND AD_Client_ID=").append(m_AD_Client_ID).append(") "
+ "WHERE ProductCategory_Value IS NULL AND M_Product_Category_ID IS NULL" + "WHERE ProductCategory_Value IS NULL AND M_Product_Category_ID IS NULL"
+ " AND M_Product_ID IS NULL" // set category only if product not found + " AND M_Product_ID IS NULL" // set category only if product not found
+ " AND I_IsImported<>'Y'").append(clientCheck); + " AND I_IsImported<>'Y'").append(clientCheck);
@ -247,7 +245,7 @@ public class ImportProduct extends SvrProcess
// Set UOM (System/own) // Set UOM (System/own)
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuffer ("UPDATE I_Product i "
+ "SET X12DE355 = " + "SET X12DE355 = "
+ "(SELECT X12DE355 FROM C_UOM u WHERE u.IsDefault='Y' AND u.AD_Client_ID IN (0,i.AD_Client_ID) AND ROWNUM=1) " + "(SELECT MAX(X12DE355) FROM C_UOM u WHERE u.IsDefault='Y' AND u.AD_Client_ID IN (0,i.AD_Client_ID)) "
+ "WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL" + "WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL"
+ " AND I_IsImported<>'Y'").append(clientCheck); + " AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -404,8 +402,9 @@ public class ImportProduct extends SvrProcess
+ "WHERE I_Product_ID=?"); + "WHERE I_Product_ID=?");
*/ */
// Update Product from Import // Update Product from Import
PreparedStatement pstmt_updateProduct = DB.prepareStatement //jz moved
("UPDATE M_PRODUCT " /*
String sqlt = "UPDATE M_PRODUCT "
+ "SET (Value,Name,Description,DocumentNote,Help," + "SET (Value,Name,Description,DocumentNote,Help,"
+ "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType," + "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,"
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet," + "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,"
@ -415,11 +414,12 @@ public class ImportProduct extends SvrProcess
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet," + "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,"
+ "Discontinued,DiscontinuedBy,SysDate,UpdatedBy" + "Discontinued,DiscontinuedBy,SysDate,UpdatedBy"
+ " FROM I_Product WHERE I_Product_ID=?) " + " FROM I_Product WHERE I_Product_ID=?) "
+ "WHERE M_Product_ID=?", get_TrxName()); + "WHERE M_Product_ID=?";
PreparedStatement pstmt_updateProduct = DB.prepareStatement
(sqlt, get_TrxName());
// Update Product_PO from Import // Update Product_PO from Import
PreparedStatement pstmt_updateProductPO = DB.prepareStatement sqlt = "UPDATE M_Product_PO "
("UPDATE M_Product_PO "
+ "SET (IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC," + "SET (IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,"
+ "PriceList,PricePO,RoyaltyAmt,PriceEffective," + "PriceList,PricePO,RoyaltyAmt,PriceEffective,"
+ "VendorProductNo,VendorCategory,Manufacturer," + "VendorProductNo,VendorCategory,Manufacturer,"
@ -432,8 +432,10 @@ public class ImportProduct extends SvrProcess
+ "CostPerOrder,DeliveryTime_Promised,SysDate,UpdatedBy" + "CostPerOrder,DeliveryTime_Promised,SysDate,UpdatedBy"
+ " FROM I_Product" + " FROM I_Product"
+ " WHERE I_Product_ID=?) " + " WHERE I_Product_ID=?) "
+ "WHERE M_Product_ID=? AND C_BPartner_ID=?", get_TrxName()); + "WHERE M_Product_ID=? AND C_BPartner_ID=?";
PreparedStatement pstmt_updateProductPO = DB.prepareStatement
(sqlt, get_TrxName());
*/
// Insert Product from Import // Insert Product from Import
PreparedStatement pstmt_insertProductPO = DB.prepareStatement PreparedStatement pstmt_insertProductPO = DB.prepareStatement
("INSERT INTO M_Product_PO (M_Product_ID,C_BPartner_ID, " ("INSERT INTO M_Product_PO (M_Product_ID,C_BPartner_ID, "
@ -493,8 +495,22 @@ public class ImportProduct extends SvrProcess
} }
else // Update Product else // Update Product
{ {
pstmt_updateProduct.setInt(1, I_Product_ID); String sqlt = "UPDATE M_PRODUCT "
pstmt_updateProduct.setInt(2, M_Product_ID); + "SET (Value,Name,Description,DocumentNote,Help,"
+ "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,"
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,"
+ "Discontinued,DiscontinuedBy,Updated,UpdatedBy)= "
+ "(SELECT Value,Name,Description,DocumentNote,Help,"
+ "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,"
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,"
+ "Discontinued,DiscontinuedBy,SysDate,UpdatedBy"
+ " FROM I_Product WHERE I_Product_ID="+I_Product_ID+") "
+ "WHERE M_Product_ID="+M_Product_ID;
PreparedStatement pstmt_updateProduct = DB.prepareStatement
(sqlt, get_TrxName());
//jz pstmt_updateProduct.setInt(1, I_Product_ID);
// pstmt_updateProduct.setInt(2, M_Product_ID);
try try
{ {
no = pstmt_updateProduct.executeUpdate(); no = pstmt_updateProduct.executeUpdate();
@ -510,6 +526,7 @@ public class ImportProduct extends SvrProcess
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
} }
pstmt_updateProduct.close();
} }
// Do we have PO Info // Do we have PO Info
@ -519,9 +536,25 @@ public class ImportProduct extends SvrProcess
// If Product existed, Try to Update first // If Product existed, Try to Update first
if (!newProduct) if (!newProduct)
{ {
pstmt_updateProductPO.setInt(1, I_Product_ID); String sqlt = "UPDATE M_Product_PO "
pstmt_updateProductPO.setInt(2, M_Product_ID); + "SET (IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,"
pstmt_updateProductPO.setInt(3, C_BPartner_ID); + "PriceList,PricePO,RoyaltyAmt,PriceEffective,"
+ "VendorProductNo,VendorCategory,Manufacturer,"
+ "Discontinued,DiscontinuedBy,Order_Min,Order_Pack,"
+ "CostPerOrder,DeliveryTime_Promised,Updated,UpdatedBy)= "
+ "(SELECT CAST('Y' AS CHAR),C_UOM_ID,C_Currency_ID,UPC," //jz fix EDB unknown datatype error
+ "PriceList,PricePO,RoyaltyAmt,PriceEffective,"
+ "VendorProductNo,VendorCategory,Manufacturer,"
+ "Discontinued,DiscontinuedBy,Order_Min,Order_Pack,"
+ "CostPerOrder,DeliveryTime_Promised,SysDate,UpdatedBy"
+ " FROM I_Product"
+ " WHERE I_Product_ID="+I_Product_ID+") "
+ "WHERE M_Product_ID="+M_Product_ID+" AND C_BPartner_ID="+C_BPartner_ID;
PreparedStatement pstmt_updateProductPO = DB.prepareStatement
(sqlt, get_TrxName());
//jz pstmt_updateProductPO.setInt(1, I_Product_ID);
// pstmt_updateProductPO.setInt(2, M_Product_ID);
// pstmt_updateProductPO.setInt(3, C_BPartner_ID);
try try
{ {
no = pstmt_updateProductPO.executeUpdate(); no = pstmt_updateProductPO.executeUpdate();
@ -539,6 +572,7 @@ public class ImportProduct extends SvrProcess
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
} }
pstmt_updateProductPO.close();
} }
if (no == 0) // Insert PO if (no == 0) // Insert PO
{ {
@ -594,10 +628,10 @@ public class ImportProduct extends SvrProcess
pstmt.close(); pstmt.close();
// //
// pstmt_insertProduct.close(); // pstmt_insertProduct.close();
pstmt_updateProduct.close(); // pstmt_updateProduct.close();
pstmt_insertProductPO.close(); pstmt_insertProductPO.close();
pstmt_updateProductPO.close(); // pstmt_updateProductPO.close();
pstmt_setImported.close(); pstmt_setImported.close();
// //
} }

View File

@ -36,8 +36,6 @@ public class ImportReportLine extends SvrProcess
/** Delete old Imported */ /** Delete old Imported */
private boolean m_deleteOldImported = false; private boolean m_deleteOldImported = false;
/** Organization to be imported to */
private int m_AD_Org_ID = 0;
/** Effective */ /** Effective */
private Timestamp m_DateValue = null; private Timestamp m_DateValue = null;
@ -228,8 +226,8 @@ public class ImportReportLine extends SvrProcess
// Set PA_ReportLine_ID // Set PA_ReportLine_ID
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuffer ("UPDATE I_ReportLine i "
+ "SET PA_ReportLine_ID=(SELECT PA_ReportLine_ID FROM PA_ReportLine r" + "SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r"
+ " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID AND ROWNUM=1) " + " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) "
+ "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL" + "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL"
+ " AND I_IsImported='N'").append(clientCheck); + " AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -257,9 +255,14 @@ public class ImportReportLine extends SvrProcess
+ "SELECT ?,PA_ReportLineSet_ID," + "SELECT ?,PA_ReportLineSet_ID,"
+ "AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy," + "AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy,"
+ "Name,SeqNo,IsPrinted,IsSummary,LineType " + "Name,SeqNo,IsPrinted,IsSummary,LineType "
//jz + "FROM I_ReportLine "
// + "WHERE PA_ReportLineSet_ID=? AND Name=? AND ROWNUM=1" // #2..3
+ "FROM I_ReportLine " + "FROM I_ReportLine "
+ "WHERE PA_ReportLineSet_ID=? AND Name=? AND ROWNUM=1" // #2..3 + "WHERE I_ReportLine_ID=(SELECT MAX(I_ReportLine_ID) "
+ clientCheck, get_TrxName()); + "FROM I_ReportLine "
+ "WHERE PA_ReportLineSet_ID=? AND Name=? " // #2..3
//jz + clientCheck, get_TrxName());
+ clientCheck + ")", get_TrxName());
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
@ -299,8 +302,8 @@ public class ImportReportLine extends SvrProcess
// Set PA_ReportLine_ID (for newly created) // Set PA_ReportLine_ID (for newly created)
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuffer ("UPDATE I_ReportLine i "
+ "SET PA_ReportLine_ID=(SELECT PA_ReportLine_ID FROM PA_ReportLine r" + "SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r"
+ " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID AND ROWNUM=1) " + " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) "
+ "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL" + "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL"
+ " AND I_IsImported='N'").append(clientCheck); + " AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -348,14 +351,18 @@ public class ImportReportLine extends SvrProcess
+ clientCheck, get_TrxName()); + clientCheck, get_TrxName());
// Update ReportSource // Update ReportSource
PreparedStatement pstmt_updateSource = DB.prepareStatement //jz
("UPDATE PA_ReportSource " /*
String sqlt="UPDATE PA_ReportSource "
+ "SET (ElementType,C_ElementValue_ID,Updated,UpdatedBy)=" + "SET (ElementType,C_ElementValue_ID,Updated,UpdatedBy)="
+ " (SELECT 'AC',C_ElementValue_ID,SysDate,UpdatedBy" + " (SELECT 'AC',C_ElementValue_ID,SysDate,UpdatedBy"
+ " FROM I_ReportLine" + " FROM I_ReportLine"
+ " WHERE I_ReportLine_ID=?) " + " WHERE I_ReportLine_ID=?) "
+ "WHERE PA_ReportSource_ID=?" + "WHERE PA_ReportSource_ID=?"
+ clientCheck, get_TrxName()); + clientCheck;
PreparedStatement pstmt_updateSource = DB.prepareStatement
(sqlt, get_TrxName());
*/
// Set Imported = Y // Set Imported = Y
PreparedStatement pstmt_setImported = DB.prepareStatement PreparedStatement pstmt_setImported = DB.prepareStatement
@ -396,11 +403,22 @@ public class ImportReportLine extends SvrProcess
} }
else // update Report Source else // update Report Source
{ {
pstmt_updateSource.setInt(1, I_ReportLine_ID); //jz
pstmt_updateSource.setInt(2, PA_ReportSource_ID); String sqlt="UPDATE PA_ReportSource "
+ "SET (ElementType,C_ElementValue_ID,Updated,UpdatedBy)="
+ " (SELECT CAST('AC' AS CHAR(2)),C_ElementValue_ID,SysDate,UpdatedBy" //jz
+ " FROM I_ReportLine"
+ " WHERE I_ReportLine_ID=" + I_ReportLine_ID + ") "
+ "WHERE PA_ReportSource_ID="+PA_ReportSource_ID+" "
+ clientCheck;
PreparedStatement pstmt_updateSource = DB.prepareStatement
(sqlt, get_TrxName());
//pstmt_updateSource.setInt(1, I_ReportLine_ID);
//pstmt_updateSource.setInt(2, PA_ReportSource_ID);
try try
{ {
no = pstmt_updateSource.executeUpdate(); no = pstmt_updateSource.executeUpdate();
//no = DB.executeUpdate(sqlt, get_TrxName());
log.finest("Update ReportSource = " + no + ", I_ReportLine_ID=" + I_ReportLine_ID + ", PA_ReportSource_ID=" + PA_ReportSource_ID); log.finest("Update ReportSource = " + no + ", I_ReportLine_ID=" + I_ReportLine_ID + ", PA_ReportSource_ID=" + PA_ReportSource_ID);
noUpdateSource++; noUpdateSource++;
} }
@ -413,6 +431,7 @@ public class ImportReportLine extends SvrProcess
DB.executeUpdate(sql.toString(), get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
continue; continue;
} }
pstmt_updateSource.close();
} // update source } // update source
// Set Imported to Y // Set Imported to Y
@ -428,7 +447,7 @@ public class ImportReportLine extends SvrProcess
pstmt.close(); pstmt.close();
// //
pstmt_insertSource.close(); pstmt_insertSource.close();
pstmt_updateSource.close(); //jz pstmt_updateSource.close();
pstmt_setImported.close(); pstmt_setImported.close();
// //
} }

View File

@ -143,12 +143,13 @@ public class InOutGenerate extends SvrProcess
+ " AND o.DeliveryRule<>'M'" + " AND o.DeliveryRule<>'M'"
// Open Order Lines with Warehouse // Open Order Lines with Warehouse
+ " AND EXISTS (SELECT * FROM C_OrderLine ol " + " AND EXISTS (SELECT * FROM C_OrderLine ol "
+ "WHERE ol.M_Warehouse_ID=?" + "WHERE ol.M_Warehouse_ID=?"; // #1
+ " AND o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyDelivered)";
if (p_C_BPartner_ID != 0)
m_sql += " AND C_BPartner_ID=?";
if (p_DatePromised != null) if (p_DatePromised != null)
m_sql += " AND TRUNC(DatePromised)<=?"; m_sql += " AND TRUNC(ol.DatePromised)<=?"; // #2
m_sql += " AND o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyDelivered)";
//
if (p_C_BPartner_ID != 0)
m_sql += " AND o.C_BPartner_ID=?"; // #3
} }
m_sql += " ORDER BY M_Warehouse_ID, PriorityRule, M_Shipper_ID, C_BPartner_ID, C_BPartner_Location_ID, C_Order_ID"; m_sql += " ORDER BY M_Warehouse_ID, PriorityRule, M_Shipper_ID, C_BPartner_ID, C_BPartner_Location_ID, C_Order_ID";
// m_sql += " FOR UPDATE"; // m_sql += " FOR UPDATE";
@ -163,10 +164,10 @@ public class InOutGenerate extends SvrProcess
else else
{ {
pstmt.setInt(index++, p_M_Warehouse_ID); pstmt.setInt(index++, p_M_Warehouse_ID);
if (p_C_BPartner_ID != 0)
pstmt.setInt(index++, p_C_BPartner_ID);
if (p_DatePromised != null) if (p_DatePromised != null)
pstmt.setTimestamp(index++, p_DatePromised); pstmt.setTimestamp(index++, p_DatePromised);
if (p_C_BPartner_ID != 0)
pstmt.setInt(index++, p_C_BPartner_ID);
} }
} }
catch (Exception e) catch (Exception e)
@ -200,8 +201,11 @@ public class InOutGenerate extends SvrProcess
// //
Timestamp minGuaranteeDate = m_movementDate; Timestamp minGuaranteeDate = m_movementDate;
boolean completeOrder = MOrder.DELIVERYRULE_CompleteOrder.equals(order.getDeliveryRule()); boolean completeOrder = MOrder.DELIVERYRULE_CompleteOrder.equals(order.getDeliveryRule());
// // OrderLine WHERE
String where = " AND M_Warehouse_ID=" + p_M_Warehouse_ID; String where = " AND M_Warehouse_ID=" + p_M_Warehouse_ID;
if (p_DatePromised != null)
where += " AND (TRUNC(DatePromised)<=" + DB.TO_DATE(p_DatePromised, true)
+ " OR DatePromised IS NULL)";
// Exclude Auto Delivery if not Force // Exclude Auto Delivery if not Force
if (!MOrder.DELIVERYRULE_Force.equals(order.getDeliveryRule())) if (!MOrder.DELIVERYRULE_Force.equals(order.getDeliveryRule()))
where += " AND (C_OrderLine.M_Product_ID IS NULL" where += " AND (C_OrderLine.M_Product_ID IS NULL"
@ -229,10 +233,6 @@ public class InOutGenerate extends SvrProcess
if (product != null && toDeliver.signum() == 0) if (product != null && toDeliver.signum() == 0)
continue; continue;
// or it's a charge - Bug#: 1603966
if (line.getC_Charge_ID()!=0 && toDeliver.signum() == 0)
continue;
// Check / adjust for confirmations // Check / adjust for confirmations
BigDecimal unconfirmedShippedQty = Env.ZERO; BigDecimal unconfirmedShippedQty = Env.ZERO;
if (p_IsUnconfirmedInOut && product != null && toDeliver.signum() != 0) if (p_IsUnconfirmedInOut && product != null && toDeliver.signum() != 0)

View File

@ -181,6 +181,7 @@ public class InventoryCountCreate extends SvrProcess
+ " AND il.M_Product_ID=s.M_Product_ID" + " AND il.M_Product_ID=s.M_Product_ID"
+ " AND il.M_Locator_ID=s.M_Locator_ID" + " AND il.M_Locator_ID=s.M_Locator_ID"
+ " AND COALESCE(il.M_AttributeSetInstance_ID,0)=COALESCE(s.M_AttributeSetInstance_ID,0))"); + " AND COALESCE(il.M_AttributeSetInstance_ID,0)=COALESCE(s.M_AttributeSetInstance_ID,0))");
// + " AND il.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID)");
// //
sql.append(" ORDER BY l.Value, p.Value, s.QtyOnHand DESC"); // Locator/Product sql.append(" ORDER BY l.Value, p.Value, s.QtyOnHand DESC"); // Locator/Product
// //

View File

@ -354,7 +354,7 @@ public class InvoiceGenerate extends SvrProcess
m_bp = new MBPartner (getCtx(), ship.getC_BPartner_ID(), get_TrxName()); m_bp = new MBPartner (getCtx(), ship.getC_BPartner_ID(), get_TrxName());
// Reference: Delivery: 12345 - 12.12.12 // Reference: Delivery: 12345 - 12.12.12
MClient client = MClient.get(getCtx()); MClient client = MClient.get(getCtx(), order.getAD_Client_ID ());
String AD_Language = client.getAD_Language(); String AD_Language = client.getAD_Language();
if (client.isMultiLingualDocument() && m_bp.getAD_Language() != null) if (client.isMultiLingualDocument() && m_bp.getAD_Language() != null)
AD_Language = m_bp.getAD_Language(); AD_Language = m_bp.getAD_Language();

View File

@ -91,6 +91,11 @@ public class InvoicePrint extends SvrProcess
// Need to have Template // Need to have Template
if (p_EMailPDF && p_R_MailText_ID == 0) if (p_EMailPDF && p_R_MailText_ID == 0)
throw new AdempiereUserError ("@NotFound@: @R_MailText_ID@"); throw new AdempiereUserError ("@NotFound@: @R_MailText_ID@");
log.info ("C_BPartner_ID=" + m_C_BPartner_ID
+ ", C_Invoice_ID=" + m_C_Invoice_ID
+ ", EmailPDF=" + p_EMailPDF + ",R_MailText_ID=" + p_R_MailText_ID
+ ", DateInvoiced=" + m_dateInvoiced_From + "-" + m_dateInvoiced_To
+ ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To);
MMailText mText = null; MMailText mText = null;
if (p_R_MailText_ID != 0) if (p_R_MailText_ID != 0)

View File

@ -30,8 +30,6 @@ import org.compiere.util.*;
*/ */
public class PaymentOnline extends SvrProcess public class PaymentOnline extends SvrProcess
{ {
private int m_C_Payment_ID = -1;
/** /**
* Prepare - e.g., get Parameters. * Prepare - e.g., get Parameters.
*/ */

View File

@ -57,7 +57,7 @@ public class TreeMaintenance extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
log.info("doIt - AD_Tree_ID=" + m_AD_Tree_ID); log.info("AD_Tree_ID=" + m_AD_Tree_ID);
if (m_AD_Tree_ID == 0) if (m_AD_Tree_ID == 0)
throw new IllegalArgumentException("Tree_ID = 0"); throw new IllegalArgumentException("Tree_ID = 0");
MTree tree = new MTree (getCtx(), m_AD_Tree_ID, get_TrxName()); MTree tree = new MTree (getCtx(), m_AD_Tree_ID, get_TrxName());
@ -139,13 +139,13 @@ public class TreeMaintenance extends SvrProcess
// node = new MTree_NodeMM(tree, Node_ID); // node = new MTree_NodeMM(tree, Node_ID);
// //
if (node == null) if (node == null)
log.log(Level.SEVERE, "verifyTree - no Model for " + nodeTableName); log.log(Level.SEVERE, "No Model for " + nodeTableName);
else else
{ {
if (node.save()) if (node.save())
inserts++; inserts++;
else else
log.log(Level.SEVERE, "verifyTree - Could not add to " + tree + " Node_ID=" + Node_ID); log.log(Level.SEVERE, "Could not add to " + tree + " Node_ID=" + Node_ID);
} }
} }
rs.close(); rs.close();

View File

@ -327,6 +327,14 @@ public class FileUtil
} }
} // license } // license
/**
* Get Filter String
* @return flter String
*/
String getFilterString()
{
return m_filterString;
} // getFilterString
/************************************************************************** /**************************************************************************
* File Filter. * File Filter.
@ -347,7 +355,8 @@ public class FileUtil
File file = new File (dir, name); File file = new File (dir, name);
if (file.isDirectory()) if (file.isDirectory())
return true; return true;
if (m_filterString == null || m_filterString.length() == 0) String filterString = getFilterString();
if (filterString == null || filterString.length() == 0)
return true; return true;
if (name == null) if (name == null)
return false; return false;
@ -355,7 +364,7 @@ public class FileUtil
if (name.indexOf("~") != -1 || name.equals("FileUtil.java")) if (name.indexOf("~") != -1 || name.equals("FileUtil.java"))
return false; return false;
// //
return name.indexOf(m_filterString) != -1; return name.indexOf(filterString) != -1;
} // accept } // accept
} // FileUtilFilter } // FileUtilFilter

View File

@ -24,7 +24,8 @@ import java.util.logging.*;
/** /**
* WebLogin provides a standard interface to login from Webapps like WStore or M * WebLogin provides a standard interface to login
* from Webapps like WStore or CM
* *
* @author Yves Sandfort * @author Yves Sandfort
* @version $Id$ * @version $Id$
@ -33,7 +34,8 @@ public class WebLogin
{ {
/** Logging */ /** Logging */
private CLogger log = CLogger.getCLogger(getClass()); private CLogger log = CLogger.getCLogger(getClass());
private final static String COOKIE_NAME = "adempiereWebUser"; private final static String COOKIE_NAME = "CompiereWebUser";
/** Forward Parameter */ /** Forward Parameter */
private String P_ForwardTo = "ForwardTo"; private String P_ForwardTo = "ForwardTo";
/** SalesRep Parameter */ /** SalesRep Parameter */
@ -44,32 +46,36 @@ public class WebLogin
private String P_Password = "Password"; private String P_Password = "Password";
/** Mode/Action Parameter */ /** Mode/Action Parameter */
private String P_Action = "Mode"; private String P_Action = "Mode";
/** Login Page */ /** Login Page */
private String LOGIN_RelURL = "/login.jsp"; private String m_login_page = "/login.jsp";
/** Update Page */ /** Update Page */
private String update_page = "/update.jsp"; private String m_update_page = "/update.jsp";
/** Message */ /** Message */
private String message = null; private String m_message = null;
/** Context */ /** Context */
private Properties ctx; private Properties m_ctx;
/** HttpServletRequest */ /** HttpServletRequest */
private HttpServletRequest request; private HttpServletRequest m_request;
/** HttpServletResponse */ /** HttpServletResponse */
private HttpServletResponse response; private HttpServletResponse m_response;
/** HttpSession */ /** HttpSession */
private HttpSession session; private HttpSession m_session;
/** adressConfirm */ /** adressConfirm */
private boolean addressConfirm; private boolean m_addressConfirm;
/** forward */ /** forward */
private String forward; private String m_forward;
/** SalesRep */ /** SalesRep */
private String salesRep; private String m_salesRep;
/** EMail */ /** EMail */
private String email; private String m_email;
/** Password */ /** Password */
private String password; private String m_password;
/** WebUser */ /** WebUser */
private WebUser wu; private WebUser m_wu;
/** Mode */
private String m_mode;
/** /**
* WebLogin * WebLogin
@ -79,24 +85,24 @@ public class WebLogin
*/ */
public WebLogin (HttpServletRequest t_request, HttpServletResponse t_response, Properties t_ctx) public WebLogin (HttpServletRequest t_request, HttpServletResponse t_response, Properties t_ctx)
{ {
request = t_request; m_request = t_request;
response = t_response; m_response = t_response;
ctx = t_ctx; m_ctx = t_ctx;
// We will check the Request to see whether Parameters are overwritten // We will check the Request to see whether Parameters are overwritten
if (request.getParameter ("P_ForwardTo")!=null) if (m_request.getParameter ("P_ForwardTo")!=null)
setP_ForwardTo (request.getParameter("P_ForwardTo")); setP_ForwardTo (m_request.getParameter("P_ForwardTo"));
if (request.getParameter ("SalesRep_ID")!=null) if (m_request.getParameter ("SalesRep_ID")!=null)
setP_SalesRep_ID (request.getParameter ("SalesRep_ID")); setP_SalesRep_ID (m_request.getParameter ("SalesRep_ID"));
if (request.getParameter ("P_EMail")!=null) if (m_request.getParameter ("P_EMail")!=null)
setP_EMail (request.getParameter ("P_EMail")); setP_EMail (m_request.getParameter ("P_EMail"));
if (request.getParameter ("P_Password")!=null) if (m_request.getParameter ("P_Password")!=null)
setP_Password (request.getParameter ("P_Password")); setP_Password (m_request.getParameter ("P_Password"));
if (request.getParameter ("P_Action")!=null) if (m_request.getParameter ("P_Action")!=null)
setP_Action (request.getParameter ("P_Action")); setP_Action (m_request.getParameter ("P_Action"));
if (request.getParameter ("LOGIN_RelURL")!=null) if (m_request.getParameter ("LOGIN_RelURL")!=null)
setLogin_RelURL (request.getParameter ("LOGIN_RelURL")); setLogin_RelURL (m_request.getParameter ("LOGIN_RelURL"));
if (request.getParameter ("update_page")!=null) if (m_request.getParameter ("update_page")!=null)
setLogin_RelURL (request.getParameter ("update_page")); setLogin_RelURL (m_request.getParameter ("update_page"));
} }
/** /**
@ -105,35 +111,37 @@ public class WebLogin
*/ */
public boolean init() public boolean init()
{ {
session = request.getSession(true); // create new m_session = m_request.getSession(true); // create new
forward = WebUtil.getParameter (request, P_ForwardTo); // get forward from request m_forward = WebUtil.getParameter (m_request, P_ForwardTo); // get forward from request
if (forward != null) if (m_forward != null)
session.setAttribute(P_ForwardTo, forward); m_session.setAttribute(P_ForwardTo, m_forward);
salesRep = WebUtil.getParameter (request, P_SalesRep_ID); // get SalesRep from request else
if (salesRep != null) m_forward = "";
session.setAttribute(P_SalesRep_ID, salesRep); m_salesRep = WebUtil.getParameter (m_request, P_SalesRep_ID); // get SalesRep from request
if (m_salesRep != null)
m_session.setAttribute(P_SalesRep_ID, m_salesRep);
// Get Base Info // Get Base Info
email = WebUtil.getParameter (request, P_EMail); m_email = WebUtil.getParameter (m_request, P_EMail);
if (email == null) if (m_email == null)
email = ""; m_email = "";
email = email.trim(); m_email = m_email.trim();
if (email != null) if (m_email != null)
session.setAttribute (P_EMail, email); m_session.setAttribute (P_EMail, m_email);
password = WebUtil.getParameter (request, P_Password); m_password = WebUtil.getParameter (m_request, P_Password);
if (password == null) if (m_password == null)
password = ""; // null loads w/o check m_password = ""; // null loads w/o check
password = password.trim(); m_password = m_password.trim();
if (session.getAttribute (WebInfo.NAME)!=null) if (m_session.getAttribute (WebInfo.NAME)!=null)
{ {
WebInfo wi = (WebInfo)session.getAttribute(WebInfo.NAME); WebInfo wi = (WebInfo)m_session.getAttribute(WebInfo.NAME);
wu = wi.getWebUser (); m_wu = wi.getWebUser ();
} }
return true; return true;
} }
/** /**
* action run functions against the Login process * Action run functions against the Login process.
* @return true if successfull * @return true if successfull
* @throws IOException * @throws IOException
* @throws ServletException * @throws ServletException
@ -141,184 +149,190 @@ public class WebLogin
public boolean action() throws IOException, ServletException public boolean action() throws IOException, ServletException
{ {
// Mode // Mode
String mode = WebUtil.getParameter (request, P_Action); if (getMode() == null)
boolean deleteCookie = "deleteCookie".equals(mode); {
String s = WebUtil.getParameter (m_request, P_Action);
setMode(s);
}
boolean deleteCookie = "deleteCookie".equals(m_mode);
if (deleteCookie) if (deleteCookie)
{ {
log.fine("** deleteCookie"); log.fine("** deleteCookie");
WebUtil.deleteCookieWebUser (request, response, COOKIE_NAME); WebUtil.deleteCookieWebUser (m_request, m_response, COOKIE_NAME);
} }
boolean logout = "logout".equals(mode); //
boolean logout = "logout".equals(m_mode);
if (logout || deleteCookie) if (logout || deleteCookie)
{ {
log.fine("** logout"); log.fine("** logout");
if (session != null) if (m_session != null)
{ {
MSession cSession = MSession.get (ctx, false); MSession cSession = MSession.get (m_ctx, false);
if (cSession != null) if (cSession != null)
cSession.logout(); cSession.logout();
// //
wu = (WebUser)session.getAttribute(WebUser.NAME); m_wu = (WebUser)m_session.getAttribute(WebUser.NAME);
if (wu != null) if (m_wu != null)
wu.logout(); m_wu.logout();
session.removeAttribute(WebUser.NAME); m_session.removeAttribute(WebUser.NAME);
session.setMaxInactiveInterval(1); m_session.setMaxInactiveInterval(1);
session.invalidate (); m_session.invalidate ();
} }
// Forward to unsecure / // Forward to unsecure /
WebUtil.createForwardPage(response, "Logout", "http://" + request.getServerName() + "/", 2); WebUtil.createForwardPage(m_response, "Logout", "http://" + m_request.getServerName() + "/", 2);
} }
// Send EMail *** Send Password EMail Request // Send EMail *** Send Password EMail Request
else if ("SendEMail".equals(mode)) else if ("SendEMail".equals(m_mode))
{ {
log.info("** send mail"); log.info("** send mail");
wu = WebUser.get (ctx, email); // find it m_wu = WebUser.get (m_ctx, m_email); // find it
if (!wu.isEMailValid()) if (!m_wu.isEMailValid())
wu.setPasswordMessage("EMail not found in system"); m_wu.setPasswordMessage("EMail not found in system");
else else
{ {
wu.setPassword(); // set password to current m_wu.setPassword(); // set password to current
// //
String msg = WebUtil.sendEMail (request, wu, String msg = WebUtil.sendEMail (m_request, m_wu,
MMailMsg.MAILMSGTYPE_UserPassword, new Object[]{ MMailMsg.MAILMSGTYPE_UserPassword, new Object[]{
request.getServerName(), m_request.getServerName(),
wu.getName(), m_wu.getName(),
WebUtil.getFrom(request), WebUtil.getFrom(m_request),
wu.getPassword()}); m_wu.getPassword()});
if (EMail.SENT_OK.equals(msg)) if (EMail.SENT_OK.equals(msg))
wu.setPasswordMessage ("EMail sent"); m_wu.setPasswordMessage ("EMail sent");
else else
wu.setPasswordMessage ("Problem sending EMail: " + msg); m_wu.setPasswordMessage ("Problem sending EMail: " + msg);
} }
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
} // SendEMail } // SendEMail
// Login // Login
else if ("Login".equals(mode)) else if ("Login".equals(m_mode))
{ {
log.info("** login " + email + "/" + password); log.info("** login " + m_email + "/" + m_password);
// add Cookie // add Cookie
WebUtil.addCookieWebUser(request, response, email, COOKIE_NAME); WebUtil.addCookieWebUser(m_request, m_response, m_email, COOKIE_NAME);
// Always re-query // Always re-query
wu = WebUser.get (ctx, email, password, false); m_wu = WebUser.get (m_ctx, m_email, m_password, false);
wu.login(password); m_wu.login(m_password);
// Password valid // Password valid
if (wu.isLoggedIn()) if (m_wu.isLoggedIn())
{ {
if (forward==null || forward.equals(getLogin_RelURL ())) if (m_forward==null || m_forward.equals(getLogin_RelURL ()))
forward = "/index.jsp"; m_forward = "/index.jsp";
// Create Session with User ID // Create Session with User ID
MSession cSession = MSession.get (ctx, request.getRemoteAddr(), MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
request.getRemoteHost(), session.getId()); m_request.getRemoteHost(), m_session.getId());
if (cSession != null) if (cSession != null)
cSession.setWebStoreSession(true); cSession.setWebStoreSession(true);
} }
else else
{ {
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
log.fine("- PasswordMessage=" + wu.getPasswordMessage()); log.fine("- PasswordMessage=" + m_wu.getPasswordMessage());
} }
// If no session exists or is not loaded, load or create it // If no session exists or is not loaded, load or create it
if (session==null) if (m_session==null)
session = request.getSession (true); m_session = m_request.getSession (true);
session.setAttribute (WebInfo.NAME, new WebInfo (ctx, wu)); m_session.setAttribute (WebInfo.NAME, new WebInfo (m_ctx, m_wu));
} // Login } // Login
// Login New // Login New
else if ("LoginNew".equals(mode)) else if ("LoginNew".equals(m_mode))
{ {
log.info("** loginNew"); log.info("** loginNew");
WebUtil.addCookieWebUser(request, response, "", COOKIE_NAME); WebUtil.addCookieWebUser(m_request, m_response, "", COOKIE_NAME);
wu = WebUser.get (ctx, ""); m_wu = WebUser.get (m_ctx, "");
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
} }
// Submit - update/new Contact // Submit - update/new Contact
else if ("Submit".equals(mode)) else if ("Submit".equals(m_mode))
{ {
log.info("** submit " + email + "/" + password + " - AddrConf=" + addressConfirm); log.info("** submit " + m_email + "/" + m_password + " - AddrConf=" + m_addressConfirm);
// we have a record for address update // we have a record for address update
if (wu != null && wu.isLoggedIn() && addressConfirm) // address update if (m_wu != null && m_wu.isLoggedIn() && m_addressConfirm) // address update
; ;
else // Submit - always re-load user record else // Submit - always re-load user record
wu = WebUser.get (ctx, email, null, false); // load w/o password check direct m_wu = WebUser.get (m_ctx, m_email, null, false); // load w/o password check direct
// //
if (wu.getAD_User_ID() != 0) // existing BPC if (m_wu.getAD_User_ID() != 0) // existing BPC
{ {
String passwordNew = WebUtil.getParameter (request, "PasswordNew"); String passwordNew = WebUtil.getParameter (m_request, "PasswordNew");
if (passwordNew == null) if (passwordNew == null)
passwordNew = ""; passwordNew = "";
boolean passwordChange = passwordNew.length() > 0 && !passwordNew.equals(password); boolean passwordChange = passwordNew.length() > 0 && !passwordNew.equals(m_password);
if (addressConfirm || wu.login (password)) if (m_addressConfirm || m_wu.login (m_password))
{ {
// Create / set session // Create / set session
if (wu.isLoggedIn()) if (m_wu.isLoggedIn())
{ {
MSession cSession = MSession.get (ctx, request.getRemoteAddr(), MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
request.getRemoteHost(), session.getId()); m_request.getRemoteHost(), m_session.getId());
if (cSession != null) if (cSession != null)
cSession.setWebStoreSession(true); cSession.setWebStoreSession(true);
} }
// //
if (passwordChange) if (passwordChange)
log.fine("- update Pwd " + email + ", Old=" + password + ", DB=" + wu.getPassword() + ", New=" + passwordNew); log.fine("- update Pwd " + m_email + ", Old=" + m_password + ", DB=" + m_wu.getPassword() + ", New=" + passwordNew);
if (WebUtil.updateFields(request, wu, passwordChange)) if (WebUtil.updateFields(m_request, m_wu, passwordChange))
{ {
if (passwordChange) if (passwordChange)
session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Password changed"); m_session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Password changed");
} }
else else
{ {
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
log.warning(" - update not done"); log.warning(" - update not done");
} }
} }
else else
{ {
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Email/Password not correct"); m_session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Email/Password not correct");
log.warning(" - update not confirmed"); log.warning(" - update not confirmed");
} }
} }
else // new else // new
{ {
log.fine("** new " + email + "/" + password); log.fine("** new " + m_email + "/" + m_password);
wu.setEmail (email); m_wu.setEmail (m_email);
wu.setPassword (password); m_wu.setPassword (m_password);
if (WebUtil.updateFields (request, wu, true)) if (WebUtil.updateFields (m_request, m_wu, true))
{ {
if (wu.login(password)) if (m_wu.login(m_password))
{ {
session.setAttribute (WebInfo.NAME, new WebInfo (ctx, wu)); m_session.setAttribute (WebInfo.NAME, new WebInfo (m_ctx, m_wu));
// Create / set session // Create / set session
MSession cSession = MSession.get (ctx, request.getRemoteAddr(), MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(),
request.getRemoteHost(), session.getId()); m_request.getRemoteHost(), m_session.getId());
if (cSession != null) if (cSession != null)
cSession.setWebStoreSession(true); cSession.setWebStoreSession(true);
WebUtil.resendCode(m_request, m_wu);
} }
else else
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
} }
else else
{ {
log.fine("- failed - " + wu.getSaveErrorMessage() + " - " + wu.getPasswordMessage()); log.fine("- failed - " + m_wu.getSaveErrorMessage() + " - " + m_wu.getPasswordMessage());
forward = getLogin_RelURL (); m_forward = getLogin_RelURL ();
} }
} // new } // new
if (wu!=null) if (m_wu!=null)
session.setAttribute (WebInfo.NAME, new WebInfo (ctx, wu)); m_session.setAttribute (WebInfo.NAME, new WebInfo (m_ctx, m_wu));
} // Submit } // Submit
else if("email".equals(mode)) else if("email".equals(m_mode))
{ {
String email = WebUtil.getParameter (request, "EMail"); String email = WebUtil.getParameter (m_request, "EMail");
if (email == null) if (email == null)
email = ""; email = "";
email = email.trim(); email = email.trim();
String emailNew = WebUtil.getParameter (request, "EMailNew"); String emailNew = WebUtil.getParameter (m_request, "EMailNew");
if (emailNew == null) if (emailNew == null)
emailNew = ""; emailNew = "";
@ -335,36 +349,36 @@ public class WebLogin
return false; return false;
} }
wu.setEmail(emailNew); m_wu.setEmail(emailNew);
wu.save(); m_wu.save();
session.setAttribute(WebSessionCtx.HDR_MESSAGE, "EMail Address Changed"); m_session.setAttribute(WebSessionCtx.HDR_MESSAGE, "EMail Address Changed");
session.setAttribute(WebInfo.NAME, new WebInfo(ctx, wu)); m_session.setAttribute(WebInfo.NAME, new WebInfo(m_ctx, m_wu));
} }
else if("password".equals(mode)) else if("password".equals(m_mode))
{ {
if (wu == null) if (m_wu == null)
{ {
log.warning("No web user"); log.warning("No web user");
return false; return false;
} }
String password = WebUtil.getParameter (request, "Password"); String password = WebUtil.getParameter (m_request, "Password");
if (password == null) if (password == null)
password = ""; // null loads w/o check password = ""; // null loads w/o check
password = password.trim(); password = password.trim();
if(!wu.login(password)) if(!m_wu.login(password))
{ {
setMessage("Email/Password not correct"); setMessage("Email/Password not correct");
return false; return false;
} }
MSession cSession = MSession.get (ctx, request.getRemoteAddr(), request.getRemoteHost(), session.getId()); MSession cSession = MSession.get (m_ctx, m_request.getRemoteAddr(), m_request.getRemoteHost(), m_session.getId());
if (cSession != null) if (cSession != null)
cSession.setWebStoreSession(true); cSession.setWebStoreSession(true);
String passwordNew = WebUtil.getParameter (request, "PasswordNew"); String passwordNew = WebUtil.getParameter (m_request, "PasswordNew");
if (passwordNew == null) if (passwordNew == null)
passwordNew = ""; passwordNew = "";
@ -375,79 +389,81 @@ public class WebLogin
return false; return false;
} }
wu.setPasswordMessage(null); m_wu.setPasswordMessage(null);
wu.setPassword(passwordNew); m_wu.setPassword(passwordNew);
if(wu.getPasswordMessage() != null) if(m_wu.getPasswordMessage() != null)
{ {
setMessage("New Password invalid."); setMessage("New Password invalid.");
return false; return false;
} }
wu.save(); m_wu.save();
session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Password Changed"); if (m_forward==null || m_forward.equals(getLogin_RelURL ()))
session.setAttribute(WebInfo.NAME, new WebInfo(ctx, wu)); m_forward = "/index.jsp";
m_session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Password Changed");
m_session.setAttribute(WebInfo.NAME, new WebInfo(m_ctx, m_wu));
} }
else if("address".equals(mode)) else if("address".equals(m_mode))
{ {
wu.setC_Country_ID(WebUtil.getParamOrNull(request, "C_Country_ID")); m_wu.setC_Country_ID(WebUtil.getParamOrNull(m_request, "C_Country_ID"));
wu.setC_Region_ID(WebUtil.getParamOrNull(request, "C_Region_ID")); m_wu.setC_Region_ID(WebUtil.getParamOrNull(m_request, "C_Region_ID"));
wu.setRegionName(WebUtil.getParamOrNull(request, "RegionName")); m_wu.setRegionName(WebUtil.getParamOrNull(m_request, "RegionName"));
wu.setName(WebUtil.getParamOrNull(request, "Name")); m_wu.setName(WebUtil.getParamOrNull(m_request, "Name"));
wu.setCompany(WebUtil.getParamOrNull(request, "Company")); m_wu.setCompany(WebUtil.getParamOrNull(m_request, "Company"));
wu.setTitle(WebUtil.getParamOrNull(request, "Title")); m_wu.setTitle(WebUtil.getParamOrNull(m_request, "Title"));
wu.setAddress(WebUtil.getParamOrNull(request, "Address")); m_wu.setAddress(WebUtil.getParamOrNull(m_request, "Address"));
wu.setAddress2(WebUtil.getParamOrNull(request, "Address2")); m_wu.setAddress2(WebUtil.getParamOrNull(m_request, "Address2"));
wu.setCity(WebUtil.getParamOrNull(request, "City")); m_wu.setCity(WebUtil.getParamOrNull(m_request, "City"));
wu.setPostal(WebUtil.getParamOrNull(request, "Postal")); m_wu.setPostal(WebUtil.getParamOrNull(m_request, "Postal"));
wu.setPhone(WebUtil.getParamOrNull(request, "Phone")); m_wu.setPhone(WebUtil.getParamOrNull(m_request, "Phone"));
wu.setFax(WebUtil.getParamOrNull(request, "Fax")); m_wu.setFax(WebUtil.getParamOrNull(m_request, "Fax"));
wu.save(); m_wu.save();
session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Contact Information Changed"); m_session.setAttribute(WebSessionCtx.HDR_MESSAGE, "Contact Information Changed");
session.setAttribute(WebInfo.NAME, new WebInfo(ctx, wu)); m_session.setAttribute(WebInfo.NAME, new WebInfo(m_ctx, m_wu));
} }
else if ("EMailVerify".equals(mode)) else if ("EMailVerify".equals(m_mode))
{ {
if (wu == null) if (m_wu == null)
{ {
log.warning("No web user"); log.warning("No web user");
return false; return false;
} }
log.info(forward + " - " + wu.toString()); log.info(m_forward + " - " + m_wu.toString());
String cmd = WebUtil.getParameter(request, "ReSend"); String cmd = WebUtil.getParameter(m_request, "ReSend");
if (cmd != null && cmd.length() > 1) if (cmd != null && cmd.length() > 1)
WebUtil.resendCode(request, wu); WebUtil.resendCode(m_request, m_wu);
else else
wu.setEMailVerifyCode(WebUtil.getParameter(request, "VerifyCode"), request.getRemoteAddr()); m_wu.setEMailVerifyCode(WebUtil.getParameter(m_request, "VerifyCode"), m_request.getRemoteAddr());
} }
else if ("bankaccountach".equals(mode)) else if ("bankaccountach".equals(m_mode))
{ {
if (wu == null) if (m_wu == null)
{ {
log.warning("No web user"); log.warning("No web user");
return false; return false;
} }
log.info(forward + " - " + wu.toString()); log.info(m_forward + " - " + m_wu.toString());
MBPBankAccount thisBPBankAccount = wu.getBankAccount (true); MBPBankAccount thisBPBankAccount = m_wu.getBankAccount (true);
// As this sets bankaccountach // As this sets bankaccountach
thisBPBankAccount.setIsACH (true); thisBPBankAccount.setIsACH (true);
thisBPBankAccount.setA_City (WebUtil.getParamOrNull (request, "A_City")); thisBPBankAccount.setA_City (WebUtil.getParamOrNull (m_request, "A_City"));
thisBPBankAccount.setA_Name (WebUtil.getParamOrNull (request, "A_Name")); thisBPBankAccount.setA_Name (WebUtil.getParamOrNull (m_request, "A_Name"));
thisBPBankAccount.setAccountNo (WebUtil.getParamOrNull (request, "AccountNo")); thisBPBankAccount.setAccountNo (WebUtil.getParamOrNull (m_request, "AccountNo"));
thisBPBankAccount.setRoutingNo (WebUtil.getParamOrNull (request, "RoutingNo")); thisBPBankAccount.setRoutingNo (WebUtil.getParamOrNull (m_request, "RoutingNo"));
thisBPBankAccount.save (); thisBPBankAccount.save ();
} }
else else
log.log(Level.WARNING, "Unknown request='" + mode + "'"); log.log(Level.WARNING, "Unknown request='" + m_mode + "'");
return true; return true;
} } // action
/** /**
* setMessage to set a Message * setMessage to set a Message
@ -456,7 +472,7 @@ public class WebLogin
public void setMessage(String newVal) public void setMessage(String newVal)
{ {
if (newVal!=null) if (newVal!=null)
message = newVal; m_message = newVal;
} }
/** /**
@ -465,7 +481,7 @@ public class WebLogin
*/ */
public String getMessage() public String getMessage()
{ {
return message; return m_message;
} }
/** /**
@ -482,7 +498,8 @@ public class WebLogin
* getP_ForwardTo * getP_ForwardTo
* @return ForwardTo request parameter * @return ForwardTo request parameter
*/ */
public String getP_ForwardTo() { public String getP_ForwardTo()
{
return P_ForwardTo; return P_ForwardTo;
} }
@ -500,7 +517,8 @@ public class WebLogin
* getP_EMail * getP_EMail
* @return EMail request parameter * @return EMail request parameter
*/ */
public String getP_EMail() { public String getP_EMail()
{
return P_EMail; return P_EMail;
} }
@ -518,7 +536,8 @@ public class WebLogin
* getP_Password * getP_Password
* @return Password request parameter * @return Password request parameter
*/ */
public String getP_Password() { public String getP_Password()
{
return P_Password; return P_Password;
} }
@ -536,7 +555,8 @@ public class WebLogin
* getP_SalesRep_ID * getP_SalesRep_ID
* @return SalesRep_ID request parameter * @return SalesRep_ID request parameter
*/ */
public String getP_SalesRep_ID() { public String getP_SalesRep_ID()
{
return P_SalesRep_ID; return P_SalesRep_ID;
} }
@ -554,7 +574,8 @@ public class WebLogin
* getP_SalesRep_ID * getP_SalesRep_ID
* @return SalesRep_ID request parameter * @return SalesRep_ID request parameter
*/ */
public String getP_Action() { public String getP_Action()
{
return P_Action; return P_Action;
} }
@ -565,15 +586,16 @@ public class WebLogin
public void setLogin_RelURL(String newVal) public void setLogin_RelURL(String newVal)
{ {
if (newVal!=null) if (newVal!=null)
LOGIN_RelURL = newVal; m_login_page = newVal;
} }
/** /**
* getLogin_RelURL * getLogin_RelURL
* @return Login_RelURL request parameter * @return Login_RelURL request parameter
*/ */
public String getLogin_RelURL() { public String getLogin_RelURL()
return LOGIN_RelURL; {
return m_login_page;
} }
/** /**
@ -583,15 +605,16 @@ public class WebLogin
public void setUpdate_page(String newVal) public void setUpdate_page(String newVal)
{ {
if (newVal!=null) if (newVal!=null)
update_page = newVal; m_update_page = newVal;
} }
/** /**
* getLogin_RelURL * getLogin_RelURL
* @return Login_RelURL request parameter * @return Login_RelURL request parameter
*/ */
public String getUpdate_page() { public String getUpdate_page()
return update_page; {
return m_update_page;
} }
/** /**
@ -601,23 +624,25 @@ public class WebLogin
public void setForward(String newVal) public void setForward(String newVal)
{ {
if (newVal!=null) if (newVal!=null)
forward = newVal; m_forward = newVal;
} }
/** /**
* getForward * getForward
* @return URL to forward request on to * @return URL to forward request on to
*/ */
public String getForward() { public String getForward()
return forward; {
return m_forward;
} }
/** /**
* getSalesRep_ID * getSalesRep_ID
* @return SalesRep_ID of the SalesRep_ID in the Request * @return SalesRep_ID of the SalesRep_ID in the Request
*/ */
public String getSalesRep_ID() { public String getSalesRep_ID()
return salesRep; {
return m_salesRep;
} }
/** /**
@ -626,18 +651,30 @@ public class WebLogin
*/ */
public void setAddressConfirm(boolean newVal) public void setAddressConfirm(boolean newVal)
{ {
addressConfirm = newVal; m_addressConfirm = newVal;
} }
/** /**
* getAdressConfirm * getAdressConfirm
* @return boolean addressConfirm * @return boolean addressConfirm
*/ */
public boolean getAddressConfirm() { public boolean getAddressConfirm()
return addressConfirm; {
return m_addressConfirm;
} }
public WebUser getWebUser() { public WebUser getWebUser()
return wu; {
return m_wu;
}
public void setMode(String t_mode)
{
m_mode = t_mode;
}
public String getMode()
{
return m_mode;
} }
} }

View File

@ -200,7 +200,7 @@ public class MWFNodeNext extends X_AD_WF_NodeNext
// No Conditions // No Conditions
if (getConditions(false).length == 0) if (getConditions(false).length == 0)
{ {
log.fine("isValidFor #0 " + toString()); log.fine("#0 " + toString());
return true; return true;
} }
// First condition always AND // First condition always AND

View File

@ -18,7 +18,6 @@ package org.compiere.apps;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.net.*;
import java.util.logging.*; import java.util.logging.*;
import javax.swing.*; import javax.swing.*;
import org.compiere.model.*; import org.compiere.model.*;

View File

@ -229,7 +229,7 @@ public final class AEnv
{ {
JMenu menu = new JMenu(); JMenu menu = new JMenu();
String text = Msg.getMsg(Env.getCtx(), AD_Message); String text = Msg.getMsg(Env.getCtx(), AD_Message);
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic if (pos != -1 && text.length() > pos) // We have a nemonic
{ {
char ch = text.toUpperCase().charAt(pos+1); char ch = text.toUpperCase().charAt(pos+1);
@ -268,7 +268,7 @@ public final class AEnv
if (al != null) if (al != null)
mi.addActionListener(al); mi.addActionListener(al);
return mi; return mi;
} // addMeniItem } // addMenuItem
/** /**
* Perform action command for common menu items. * Perform action command for common menu items.
@ -408,7 +408,7 @@ public final class AEnv
/** /**
* Set Text and Mnemonic for Button. * Set Text and Mnemonic for Button.
* Create Mnemonics of text containing "&". * Create Mnemonics of text containing '&'.
* Based on MS notation of &Help => H is Mnemonics * Based on MS notation of &Help => H is Mnemonics
* @param b The button * @param b The button
* @param text The text with optional Mnemonics * @param text The text with optional Mnemonics
@ -417,7 +417,7 @@ public final class AEnv
{ {
if (text == null || b == null) if (text == null || b == null)
return; return;
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic if (pos != -1) // We have a nemonic
{ {
char ch = text.charAt(pos+1); char ch = text.charAt(pos+1);
@ -429,12 +429,12 @@ public final class AEnv
/** /**
* Get Mnemonic character from text. * Get Mnemonic character from text.
* @param text text with "&" * @param text text with '&'
* @return Mnemonic or 0 * @return Mnemonic or 0
*/ */
public static char getMnemonic (String text) public static char getMnemonic (String text)
{ {
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic if (pos != -1) // We have a nemonic
return text.charAt(pos+1); return text.charAt(pos+1);
return 0; return 0;

View File

@ -190,12 +190,14 @@ public final class ALogin extends CDialog
versionLabel.setToolTipText(Adempiere.getImplementationVersion()); versionLabel.setToolTipText(Adempiere.getImplementationVersion());
hostLabel.setHorizontalAlignment(SwingConstants.RIGHT); hostLabel.setHorizontalAlignment(SwingConstants.RIGHT);
hostLabel.setText("Host"); hostLabel.setText("Host");
hostLabel.setLabelFor(hostField);
connectionPanel.add(hostLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 connectionPanel.add(hostLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
connectionPanel.add(hostField, new GridBagConstraints(1, 2, 3, 1, 1.0, 0.0 connectionPanel.add(hostField, new GridBagConstraints(1, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
userLabel.setHorizontalAlignment(SwingConstants.RIGHT); userLabel.setHorizontalAlignment(SwingConstants.RIGHT);
userLabel.setText("User"); userLabel.setText("User");
userLabel.setLabelFor(userTextField);
connectionPanel.add(userLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 connectionPanel.add(userLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
userTextField.setText("System"); // default userTextField.setText("System"); // default
@ -203,6 +205,7 @@ public final class ALogin extends CDialog
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT); passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
passwordLabel.setText("Password"); passwordLabel.setText("Password");
passwordLabel.setLabelFor(passwordField);
connectionPanel.add(passwordLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 connectionPanel.add(passwordLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
passwordField.setText("System"); // default passwordField.setText("System"); // default
@ -210,6 +213,7 @@ public final class ALogin extends CDialog
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
languageLabel.setHorizontalAlignment(SwingConstants.RIGHT); languageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
languageLabel.setText("Language"); languageLabel.setText("Language");
languageLabel.setLabelFor(languageCombo);
connectionPanel.add(languageLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 connectionPanel.add(languageLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
languageCombo.addActionListener(this); languageCombo.addActionListener(this);
@ -218,7 +222,7 @@ public final class ALogin extends CDialog
copy0Label.setHorizontalAlignment(SwingConstants.RIGHT); copy0Label.setHorizontalAlignment(SwingConstants.RIGHT);
connectionPanel.add(copy0Label, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0 connectionPanel.add(copy0Label, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
/** Removing/modifying the Adempiere copyright notice is a violation of the license */
copy1Label.setText(Adempiere.COPYRIGHT); copy1Label.setText(Adempiere.COPYRIGHT);
connectionPanel.add(copy1Label, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0 connectionPanel.add(copy1Label, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 12, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 12, 12), 0, 0));
@ -236,6 +240,7 @@ public final class ALogin extends CDialog
// //
roleLabel.setText("Role"); roleLabel.setText("Role");
roleLabel.setHorizontalAlignment(SwingConstants.RIGHT); roleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
roleLabel.setLabelFor(roleCombo);
roleCombo.addActionListener(this); roleCombo.addActionListener(this);
defaultPanel.add(roleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 defaultPanel.add(roleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
@ -243,6 +248,7 @@ public final class ALogin extends CDialog
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
clientLabel.setText("Client"); clientLabel.setText("Client");
clientLabel.setHorizontalAlignment(SwingConstants.RIGHT); clientLabel.setHorizontalAlignment(SwingConstants.RIGHT);
clientLabel.setLabelFor(clientCombo);
defaultPanel.add(clientLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 defaultPanel.add(clientLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
clientCombo.addActionListener(this); clientCombo.addActionListener(this);
@ -250,6 +256,7 @@ public final class ALogin extends CDialog
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
orgLabel.setText("Organization"); orgLabel.setText("Organization");
orgLabel.setHorizontalAlignment(SwingConstants.RIGHT); orgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
orgLabel.setLabelFor(orgCombo);
defaultPanel.add(orgLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 defaultPanel.add(orgLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
orgCombo.addActionListener(this); orgCombo.addActionListener(this);
@ -257,6 +264,7 @@ public final class ALogin extends CDialog
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
dateLabel.setText("Date"); dateLabel.setText("Date");
dateLabel.setHorizontalAlignment(SwingConstants.RIGHT); dateLabel.setHorizontalAlignment(SwingConstants.RIGHT);
dateLabel.setLabelFor(dateField);
defaultPanel.add(dateLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 defaultPanel.add(dateLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
defaultPanel.add(dateField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 defaultPanel.add(dateField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0
@ -264,8 +272,10 @@ public final class ALogin extends CDialog
// //
warehouseLabel.setText("Warehouse"); warehouseLabel.setText("Warehouse");
warehouseLabel.setHorizontalAlignment(SwingConstants.RIGHT); warehouseLabel.setHorizontalAlignment(SwingConstants.RIGHT);
warehouseLabel.setLabelFor(warehouseCombo);
printerLabel.setText("Printer"); printerLabel.setText("Printer");
printerLabel.setHorizontalAlignment(SwingConstants.RIGHT); printerLabel.setHorizontalAlignment(SwingConstants.RIGHT);
printerLabel.setLabelFor(printerField);
defaultPanel.add(printerLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 defaultPanel.add(printerLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 12, 5), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 12, 5), 0, 0));
defaultPanel.add(printerField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0 defaultPanel.add(printerField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0
@ -623,6 +633,7 @@ public final class ALogin extends CDialog
userTextField.setBackground(AdempierePLAF.getFieldBackground_Normal()); userTextField.setBackground(AdempierePLAF.getFieldBackground_Normal());
passwordField.setBackground(AdempierePLAF.getFieldBackground_Normal()); passwordField.setBackground(AdempierePLAF.getFieldBackground_Normal());
// //
this.setTitle(hostField.getDisplay());
statusBar.setStatusLine(txt_LoggedIn); statusBar.setStatusLine(txt_LoggedIn);
m_comboActive = false; m_comboActive = false;
roleComboChanged(); roleComboChanged();
@ -859,9 +870,15 @@ public final class ALogin extends CDialog
dateField.setValue(new Timestamp(System.currentTimeMillis())); dateField.setValue(new Timestamp(System.currentTimeMillis()));
// //
if (m_connectionOK) if (m_connectionOK)
{
this.setTitle(hostField.getDisplay());
statusBar.setStatusLine(txt_LoggedIn); statusBar.setStatusLine(txt_LoggedIn);
}
else else
{
this.setTitle(res.getString("Login"));
statusBar.setStatusLine(txt_NotConnected, true); statusBar.setStatusLine(txt_NotConnected, true);
}
} // languageCombo_actionPerformed } // languageCombo_actionPerformed
} // ALogin } // ALogin

View File

@ -61,7 +61,8 @@ public final class AMenu extends CFrame
splash.paint(splash.getGraphics()); splash.paint(splash.getGraphics());
// //
Adempiere.startupEnvironment(true); // Load Environment if (!Adempiere.startupEnvironment(true)) // Load Environment
System.exit(1);
MSession.get (Env.getCtx(), true); // Start Session MSession.get (Env.getCtx(), true); // Start Session
// Preparation // Preparation

View File

@ -96,10 +96,12 @@ public class AMenuStartItem extends Thread implements ActionListener
m_menu.progressBar.setValue(m_value); m_menu.progressBar.setValue(m_value);
} }
}; };
private int m_value = 0; /** Value */
private int m_increment = 20; int m_value = 0;
private javax.swing.Timer m_timer = new javax.swing.Timer(500, this); // every 1/2 second /** Increment */
int m_increment = 20;
/** Timer */
private Timer m_timer = new Timer(500, this); // every 1/2 second
/** /**
* Start Menu Item * Start Menu Item

View File

@ -715,6 +715,7 @@ public final class APanel extends CPanel
mTab.getAD_Table_ID(), mTab.getTableName(), mTab.getAD_Table_ID(), mTab.getTableName(),
where.toString(), findFields, 10); // no query below 10 where.toString(), findFields, 10); // no query below 10
query = find.getQuery(); query = find.getQuery();
find.dispose();
find = null; find = null;
} }
return query; return query;
@ -1767,6 +1768,7 @@ public final class APanel extends CPanel
m_curTab.getAD_Table_ID(), m_curTab.getTableName(), m_curTab.getAD_Table_ID(), m_curTab.getTableName(),
m_curTab.getWhereExtended(), findFields, 1); m_curTab.getWhereExtended(), findFields, 1);
MQuery query = find.getQuery(); MQuery query = find.getQuery();
find.dispose();
find = null; find = null;
// Confirmed query // Confirmed query
@ -2077,8 +2079,9 @@ public final class APanel extends CPanel
{ {
if (ADialog.ask(m_curWindowNo, this, "PostImmediate?")) if (ADialog.ask(m_curWindowNo, this, "PostImmediate?"))
{ {
boolean force = ps != null && !ps.equals ("N"); // force when problems
String error = AEnv.postImmediate (m_curWindowNo, Env.getAD_Client_ID(m_ctx), String error = AEnv.postImmediate (m_curWindowNo, Env.getAD_Client_ID(m_ctx),
m_curTab.getAD_Table_ID(), m_curTab.getRecord_ID(), false); m_curTab.getAD_Table_ID(), m_curTab.getRecord_ID(), force);
m_curTab.dataRefresh(); m_curTab.dataRefresh();
if (error != null) if (error != null)
ADialog.error(m_curWindowNo, this, "PostingError-N", error); ADialog.error(m_curWindowNo, this, "PostingError-N", error);

View File

@ -74,7 +74,7 @@ public final class AppsAction extends AbstractAction
// Data // Data
if (toolTipText == null) if (toolTipText == null)
toolTipText = Msg.getMsg(Env.getCtx(), action); toolTipText = Msg.getMsg(Env.getCtx(), action);
int pos = toolTipText.indexOf("&"); int pos = toolTipText.indexOf('&');
if (pos != -1 && toolTipText.length() > pos) // We have a nemonic - creates ALT-_ if (pos != -1 && toolTipText.length() > pos) // We have a nemonic - creates ALT-_
{ {
Character ch = new Character(toolTipText.toUpperCase().charAt(pos+1)); Character ch = new Character(toolTipText.toUpperCase().charAt(pos+1));
@ -222,9 +222,12 @@ public final class AppsAction extends AbstractAction
m_pressed = pressed; m_pressed = pressed;
// Set Button // Set Button
m_button.setSelected(pressed); if (m_button != null)
m_button.setSelected(pressed);
// Set Menu // Set Menu
m_menu.setSelected(pressed); if (m_menu != null)
m_menu.setSelected(pressed);
} // setPressed } // setPressed
/** /**

View File

@ -66,7 +66,25 @@ public class ProcessCtl extends Thread
{ {
log.fine("WindowNo=" + WindowNo + " - " + pi); log.fine("WindowNo=" + WindowNo + " - " + pi);
MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); MPInstance instance = null;
try
{
instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
}
catch (Exception e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return null;
}
catch (Error e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return null;
}
if (!instance.save()) if (!instance.save())
{ {
pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
@ -117,7 +135,25 @@ public class ProcessCtl extends Thread
{ {
log.fine("WindowNo=" + WindowNo + " - " + pi); log.fine("WindowNo=" + WindowNo + " - " + pi);
MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); MPInstance instance = null;
try
{
instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
}
catch (Exception e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return null;
}
catch (Error e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return null;
}
if (!instance.save()) if (!instance.save())
{ {
pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
@ -156,8 +192,10 @@ public class ProcessCtl extends Thread
m_trx = trx; // handeled correctly m_trx = trx; // handeled correctly
} // ProcessCtl } // ProcessCtl
private ASyncProcess m_parent; /** Parenr */
private ProcessInfo m_pi; ASyncProcess m_parent;
/** Process Info */
ProcessInfo m_pi;
private Trx m_trx; private Trx m_trx;
private Waiting m_waiting; private Waiting m_waiting;
private boolean m_IsServerProcess = false; private boolean m_IsServerProcess = false;

View File

@ -153,8 +153,8 @@ public class RecordInfo extends CDialog
// Title // Title
if (dse.AD_Table_ID != 0) if (dse.AD_Table_ID != 0)
{ {
MTable table = MTable.get (Env.getCtx(), dse.AD_Table_ID); MTable table1 = MTable.get (Env.getCtx(), dse.AD_Table_ID);
setTitle(title + " - " + table.getName()); setTitle(title + " - " + table1.getName());
} }
// Only Client Preference can view Change Log // Only Client Preference can view Change Log

View File

@ -350,7 +350,7 @@ public class VAllocation extends CPanel
Vector<String> columnNames = new Vector<String>(); Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.getMsg(Env.getCtx(), "Select")); columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
columnNames.add(Msg.translate(Env.getCtx(), "Date")); columnNames.add(Msg.translate(Env.getCtx(), "Date"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo")); columnNames.add(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo")));
if (multiCurrency.isSelected()) if (multiCurrency.isSelected())
{ {
columnNames.add(Msg.getMsg(Env.getCtx(), "TrxCurrency")); columnNames.add(Msg.getMsg(Env.getCtx(), "TrxCurrency"));
@ -472,7 +472,7 @@ public class VAllocation extends CPanel
columnNames = new Vector<String>(); columnNames = new Vector<String>();
columnNames.add(Msg.getMsg(Env.getCtx(), "Select")); columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
columnNames.add(Msg.translate(Env.getCtx(), "Date")); columnNames.add(Msg.translate(Env.getCtx(), "Date"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo")); columnNames.add(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo")));
if (multiCurrency.isSelected()) if (multiCurrency.isSelected())
{ {
columnNames.add(Msg.getMsg(Env.getCtx(), "TrxCurrency")); columnNames.add(Msg.getMsg(Env.getCtx(), "TrxCurrency"));

View File

@ -467,8 +467,9 @@ public class WFContentPanel extends CPanel
if (e.getSource()== m_NewMenuNode) if (e.getSource()== m_NewMenuNode)
{ {
log.info("Create New Node"); log.info("Create New Node");
String nameLabel = Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Name"));
String name = JOptionPane.showInputDialog(this, String name = JOptionPane.showInputDialog(this,
Msg.getMsg(Env.getCtx(), "Name"), // message nameLabel, // message
Msg.getMsg(Env.getCtx(), "CreateNewNode"), // title Msg.getMsg(Env.getCtx(), "CreateNewNode"), // title
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (name != null && name.length() > 0) if (name != null && name.length() > 0)

View File

@ -425,7 +425,7 @@ public class Calendar extends CDialog
} }
// Set Hour // Set Hour
boolean pm = m_current24Hour > 12; boolean pm = m_current24Hour > 11;
int index = m_current24Hour; int index = m_current24Hour;
if (pm && m_hasAM_PM) if (pm && m_hasAM_PM)
index -= 12; index -= 12;

View File

@ -201,17 +201,16 @@ public final class MDocNumber extends PlainDocument
} // decimal or thousand } // decimal or thousand
// something else // something else
else else if (VNumber.AUTO_POPUP)
{ {
log.fine("Input=" + c + " (" + (int)c + ")"); log.fine("Input=" + c + " (" + (int)c + ")");
//hengsin, [ 1648436 ] Remove auto popup of calculator
/*
String result = VNumber.startCalculator(m_tc, getText(), String result = VNumber.startCalculator(m_tc, getText(),
m_format, m_displayType, m_title); m_format, m_displayType, m_title);
super.remove(0, content.length()); super.remove(0, content.length());
super.insertString(0, result, attr);*/ super.insertString(0, result, attr);
ADialog.beep();
} }
else
ADialog.beep();
} // insertString } // insertString

View File

@ -360,5 +360,15 @@ public final class VAccount extends JComponent
m_WindowNo = mField.getWindowNo(); m_WindowNo = mField.getWindowNo();
} // setField } // setField
} // VAccount /**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("VAccount[");
sb.append (m_value).append ("]");
return sb.toString ();
} // toString
} // VAccount

View File

@ -992,7 +992,8 @@ public final class VAccountDialog extends CDialog
f_AD_Org_ID.setValue(null); f_AD_Org_ID.setValue(null);
// Account (mandatory) // Account (mandatory)
f_Account_ID.setValue(null); f_Account_ID.setValue(null);
f_SubAcct_ID.setValue(null); if (f_SubAcct_ID != null)
f_SubAcct_ID.setValue(null);
// Product // Product
if (f_M_Product_ID != null) if (f_M_Product_ID != null)

View File

@ -22,7 +22,6 @@ import java.beans.*;
import java.io.*; import java.io.*;
import java.util.logging.*; import java.util.logging.*;
import javax.swing.*; import javax.swing.*;
import org.compiere.model.*;
import org.compiere.util.*; import org.compiere.util.*;
/** /**

View File

@ -62,7 +62,7 @@ public final class VCellEditor extends AbstractCellEditor
/** Table */ /** Table */
private JTable m_table = null; private JTable m_table = null;
/** ClickCount */ /** ClickCount */
private static int CLICK_TO_START = 2; private static int CLICK_TO_START = 1;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(VCellEditor.class); private static CLogger log = CLogger.getCLogger(VCellEditor.class);

View File

@ -28,8 +28,6 @@ import org.compiere.plaf.*;
import java.util.logging.*; import java.util.logging.*;
import org.compiere.util.*; import org.compiere.util.*;
import sun.security.krb5.internal.*;
/** /**
* Table Cell Renderer based on DisplayType * Table Cell Renderer based on DisplayType
* *
@ -122,7 +120,11 @@ public final class VCellRenderer extends DefaultTableCellRenderer
// Inactive Background // Inactive Background
boolean ro = !table.isCellEditable(row, col); boolean ro = !table.isCellEditable(row, col);
if (ro) if (ro)
{
bg = AdempierePLAF.getFieldBackground_Inactive(); bg = AdempierePLAF.getFieldBackground_Inactive();
if (isSelected && !hasFocus)
bg = bg.darker();
}
// Foreground // Foreground
int cCode = 0; int cCode = 0;

View File

@ -155,5 +155,5 @@ public class VComboBox extends CComboBox
return ""; return "";
return p.getName(); return p.getName();
} // getDisplay } // getDisplay
} // VComboBox } // VComboBox

View File

@ -73,7 +73,7 @@ public final class VHeaderRenderer implements TableCellRenderer
{ {
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString()); // Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
// indicator for invisible column // indicator for invisible column
m_button.setFont(table.getFont());
Icon icon = null; Icon icon = null;
if (table instanceof CTable) if (table instanceof CTable)
{ {

View File

@ -40,7 +40,8 @@ public final class VNumber extends JComponent
{ {
/** Number of Columns (12) */ /** Number of Columns (12) */
public final static int SIZE = 12; public final static int SIZE = 12;
/** Automatically pop up calculator */
public final static boolean AUTO_POPUP = false;
/** /**
* IDE Bean Constructor * IDE Bean Constructor
*/ */
@ -143,6 +144,14 @@ public final class VNumber extends JComponent
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(VNumber.class); private static CLogger log = CLogger.getCLogger(VNumber.class);
/**
* Select all the number text.
*/
public void selectAll()
{
m_text.selectAll();
}
/** /**
* Set no of Columns * Set no of Columns
* @param columns columns * @param columns columns
@ -531,12 +540,48 @@ public final class VNumber extends JComponent
m_text.setText(m_initialText); m_text.setText(m_initialText);
return; return;
} }
Object oo = getValue();
if (m_rangeSet)
{
String error = "";
if (oo instanceof Integer)
{
Integer ii = (Integer)oo;
if (ii < m_minValue)
{
error = oo + " < " + m_minValue;
oo = new Integer(m_minValue.intValue());
}
else if (ii > m_maxValue)
{
error = oo + " > " + m_maxValue;
oo = new Integer(m_maxValue.intValue());
}
}
else if (oo instanceof BigDecimal)
{
BigDecimal bd = (BigDecimal)oo;
if (bd.doubleValue() < m_minValue)
{
error = oo + " < " + m_minValue;
oo = new BigDecimal(m_minValue);
}
else if (bd.doubleValue() > m_maxValue)
{
error = oo + " > " + m_maxValue;
oo = new BigDecimal(m_maxValue);
}
}
if (error != null)
log.warning(error);
}
try try
{ {
fireVetoableChange (m_columnName, m_initialText, getValue()); fireVetoableChange (m_columnName, m_initialText, oo);
fireActionPerformed(); fireActionPerformed();
} }
catch (PropertyVetoException pve) {} catch (PropertyVetoException pve)
{}
} // focusLost } // focusLost
/** /**

View File

@ -171,7 +171,6 @@ public class ValuePreference extends CDialog
m_Value = Value; m_Value = Value;
m_DisplayValue = DisplayValue; m_DisplayValue = DisplayValue;
m_DisplayType = displayType; m_DisplayType = displayType;
m_AD_Reference_ID = AD_Reference_ID;
// //
m_role = MRole.getDefault(); m_role = MRole.getDefault();
try try
@ -197,7 +196,6 @@ public class ValuePreference extends CDialog
private String m_Value; private String m_Value;
private String m_DisplayValue; private String m_DisplayValue;
private int m_DisplayType; private int m_DisplayType;
private int m_AD_Reference_ID;
private MRole m_role; private MRole m_role;
// Display // Display

View File

@ -477,6 +477,7 @@ public final class VTreePanel extends CPanel
//Statement stmt = trx.getConnection().createStatement(); //Statement stmt = trx.getConnection().createStatement();
//end vpj-cd e-evolution 07/12/2005 PostgreSQL //end vpj-cd e-evolution 07/12/2005 PostgreSQL
// START TRANSACTION ************** // START TRANSACTION **************
int no = 0;
for (int i = 0; i < oldParent.getChildCount(); i++) for (int i = 0; i < oldParent.getChildCount(); i++)
{ {
MTreeNode nd = (MTreeNode)oldParent.getChildAt(i); MTreeNode nd = (MTreeNode)oldParent.getChildAt(i);
@ -488,10 +489,10 @@ public final class VTreePanel extends CPanel
.append(" WHERE AD_Tree_ID=").append(m_AD_Tree_ID) .append(" WHERE AD_Tree_ID=").append(m_AD_Tree_ID)
.append(" AND Node_ID=").append(nd.getNode_ID()); .append(" AND Node_ID=").append(nd.getNode_ID());
log.fine(sql.toString()); log.fine(sql.toString());
//begin vpj-cd e-evolution 07/12/2005 PostgreSQL //begin vpj-cd e-evolution 07/12/2005 PostgreSQL
//stmt.executeUpdate(sql.toString()); //stmt.executeUpdate(sql.toString());
DB.executeUpdate(sql.toString(),trx.getTrxName()); no = DB.executeUpdate(sql.toString(),trx.getTrxName());
//end vpj-cd e-evolution 07/12/2005 PostgreSQL //end vpj-cd e-evolution 07/12/2005 PostgreSQL
} }
if (oldParent != newParent) if (oldParent != newParent)
for (int i = 0; i < newParent.getChildCount(); i++) for (int i = 0; i < newParent.getChildCount(); i++)
@ -507,8 +508,8 @@ public final class VTreePanel extends CPanel
log.fine(sql.toString()); log.fine(sql.toString());
//begin vpj-cd e-evolution 07/12/2005 PostgreSQL //begin vpj-cd e-evolution 07/12/2005 PostgreSQL
//stmt.executeUpdate(sql.toString()); //stmt.executeUpdate(sql.toString());
DB.executeUpdate(sql.toString(),trx.getTrxName()); no = DB.executeUpdate(sql.toString(),trx.getTrxName());
//end vpj-cd e-evolution 07/12/2005 PostgreSQL //end vpj-cd e-evolution 07/12/2005 PostgreSQL
} }
// COMMIT ********************* // COMMIT *********************
trx.commit(true); trx.commit(true);

View File

@ -905,7 +905,7 @@ public class Viewer extends CFrame
+ "FROM AD_Tab t" + "FROM AD_Tab t"
+ " INNER JOIN AD_Window w ON (t.AD_Window_ID=w.AD_Window_ID)" + " INNER JOIN AD_Window w ON (t.AD_Window_ID=w.AD_Window_ID)"
+ " INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) " + " INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) "
+ "WHERE t.AD_Table_ID=? " + "WHERE tt.AD_Table_ID=? "
+ "ORDER BY w.IsDefault DESC, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)"; + "ORDER BY w.IsDefault DESC, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)";
int AD_Tab_ID = DB.getSQLValue(null, sql, AD_Table_ID); int AD_Tab_ID = DB.getSQLValue(null, sql, AD_Table_ID);
// //
@ -944,6 +944,8 @@ public class Viewer extends CFrame
Find find = new Find (this, m_WindowNo, title, Find find = new Find (this, m_WindowNo, title,
AD_Table_ID, tableName, "", findFields, 1); AD_Table_ID, tableName, "", findFields, 1);
m_reportEngine.setQuery(find.getQuery()); m_reportEngine.setQuery(find.getQuery());
find.dispose();
find = null;
revalidate(); revalidate();
} }
cmd_drill(); // setCursor cmd_drill(); // setCursor

View File

@ -22,6 +22,7 @@ import java.net.*;
import java.util.logging.*; import java.util.logging.*;
import javax.jnlp.*; import javax.jnlp.*;
import javax.swing.*; import javax.swing.*;
import org.adempiere.plaf.AdempierePLAF; import org.adempiere.plaf.AdempierePLAF;
import org.compiere.db.*; import org.compiere.db.*;
import org.compiere.model.*; import org.compiere.model.*;
@ -483,13 +484,16 @@ public final class Adempiere
if (!DB.isConnected()) if (!DB.isConnected())
{ {
log.severe ("No Database"); log.severe ("No Database");
System.exit(1); return false;
} }
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
if (system == null)
return false;
// Initialize main cached Singletons // Initialize main cached Singletons
ModelValidationEngine.get(); ModelValidationEngine.get();
try try
{ {
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
String className = system.getEncryptionKey(); String className = system.getEncryptionKey();
if (className == null || className.length() == 0) if (className == null || className.length() == 0)
{ {

View File

@ -22,6 +22,8 @@ import java.util.*;
import java.util.logging.*; import java.util.logging.*;
import javax.naming.*; import javax.naming.*;
import javax.sql.*; import javax.sql.*;
import javax.swing.JOptionPane;
import org.compiere.*; import org.compiere.*;
import org.compiere.interfaces.*; import org.compiere.interfaces.*;
import org.compiere.util.*; import org.compiere.util.*;
@ -1241,6 +1243,22 @@ public class CConnection implements Serializable
break; break;
} }
} }
if (m_db != null) // test class loader ability
m_db.getDataSource(this);
}
catch (NoClassDefFoundError ee)
{
System.err.println("Environment Error - Check Adempiere.properties - " + ee);
if (Ini.isClient())
{
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog
(null, "There is a configuration error:\n" + ee
+ "\nDo you want to reset the saved configuration?",
"Adempiere Configuration Error",
JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE))
Ini.deletePropertyFile();
}
System.exit (1);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -95,6 +95,30 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger (DB_Oracle.class); private static CLogger log = CLogger.getCLogger (DB_Oracle.class);
/**
* Check if a connect is valid
* conn Connection
* @return true if connection is valid
*/
public boolean isConnectionValid(Connection conn)
{
try
{
if (((OracleConnection)conn).pingDatabase(1) < 0)
{
return false;
}
else
return true;
}
catch (SQLException e)
{
return false;
}
}
/** /**
* Get Database Name * Get Database Name
* @return database short name * @return database short name
@ -466,7 +490,20 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba
{ {
if (number == null) if (number == null)
return "NULL"; return "NULL";
return number.toString(); BigDecimal result = number;
int scale = DisplayType.getDefaultPrecision(displayType);
if (scale > number.scale())
{
try
{
result = number.setScale(scale, BigDecimal.ROUND_HALF_UP);
}
catch (Exception e)
{
// log.severe("Number=" + number + ", Scale=" + " - " + e.getMessage());
}
}
return result.toString();
} // TO_NUMBER } // TO_NUMBER

View File

@ -234,7 +234,7 @@ public class MClientShare extends X_AD_ClientShare
StringBuffer info = new StringBuffer(); StringBuffer info = new StringBuffer();
String sql = "SELECT AD_Table_ID, TableName " String sql = "SELECT AD_Table_ID, TableName "
+ "FROM AD_Table t " + "FROM AD_Table t "
+ "WHERE AccessLevel=3 AND IsView='N'" + "WHERE AccessLevel='3' AND IsView='N'"
+ " AND EXISTS (SELECT * FROM AD_Column c " + " AND EXISTS (SELECT * FROM AD_Column c "
+ "WHERE t.AD_Table_ID=c.AD_Table_ID" + "WHERE t.AD_Table_ID=c.AD_Table_ID"
+ " AND c.IsParent='Y'" + " AND c.IsParent='Y'"

View File

@ -29,10 +29,10 @@ import org.compiere.util.*;
public class MColumn extends X_AD_Column public class MColumn extends X_AD_Column
{ {
/** /**
* Get M_Column from Cache * Get MColumn from Cache
* @param ctx context * @param ctx context
* @param AD_Column_ID id * @param AD_Column_ID id
* @return M_Column * @return MColumn
*/ */
public static MColumn get (Properties ctx, int AD_Column_ID) public static MColumn get (Properties ctx, int AD_Column_ID)
{ {
@ -91,7 +91,7 @@ public class MColumn extends X_AD_Column
setIsUpdateable (true); // Y setIsUpdateable (true); // Y
setVersion (Env.ZERO); setVersion (Env.ZERO);
} }
} // M_Column } // MColumn
/** /**
* Load Constructor * Load Constructor
@ -102,7 +102,7 @@ public class MColumn extends X_AD_Column
public MColumn (Properties ctx, ResultSet rs, String trxName) public MColumn (Properties ctx, ResultSet rs, String trxName)
{ {
super(ctx, rs, trxName); super(ctx, rs, trxName);
} // M_Column } // MColumn
/** /**
* Parent Constructor * Parent Constructor
@ -114,7 +114,7 @@ public class MColumn extends X_AD_Column
setClientOrg(parent); setClientOrg(parent);
setAD_Table_ID (parent.getAD_Table_ID()); setAD_Table_ID (parent.getAD_Table_ID());
setEntityType(parent.getEntityType()); setEntityType(parent.getEntityType());
} // M_Column } // MColumn
/** /**
@ -170,12 +170,26 @@ public class MColumn extends X_AD_Column
*/ */
protected boolean beforeSave (boolean newRecord) protected boolean beforeSave (boolean newRecord)
{ {
if (getFieldLength() == 0 // LOB can be 0 int displayType = getAD_Reference_ID();
&& !DisplayType.isLOB(getAD_Reference_ID())) if (DisplayType.isLOB(displayType)) // LOBs are 0
{
if (getFieldLength() != 0)
setFieldLength(0);
}
else if (getFieldLength() == 0)
{
if (DisplayType.isID(displayType))
setFieldLength(10);
else if (DisplayType.isNumeric (displayType))
setFieldLength(14);
else if (DisplayType.isDate (displayType))
setFieldLength(7);
else
{ {
log.saveError("FillMandatory", Msg.getElement(getCtx(), "FieldLength")); log.saveError("FillMandatory", Msg.getElement(getCtx(), "FieldLength"));
return false; return false;
} }
}
/** Views are not updateable /** Views are not updateable
UPDATE AD_Column c UPDATE AD_Column c
@ -211,6 +225,17 @@ public class MColumn extends X_AD_Column
setIsEncrypted(false); setIsEncrypted(false);
} }
} }
// Sync Terminology
if ((newRecord || is_ValueChanged ("AD_Element_ID"))
&& getAD_Element_ID() != 0)
{
M_Element element = new M_Element (getCtx(), getAD_Element_ID (), get_TrxName());
setColumnName (element.getColumnName());
setName (element.getName());
setDescription (element.getDescription());
setHelp (element.getHelp());
}
return true; return true;
} // beforeSave } // beforeSave
@ -407,4 +432,15 @@ public class MColumn extends X_AD_Column
return ""; return "";
} // getConstraint } // getConstraint
} // M_Column /**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MColumn[");
sb.append (get_ID()).append ("-").append (getColumnName()).append ("]");
return sb.toString ();
} // toString
} // MColumn

View File

@ -105,4 +105,26 @@ public class MField extends X_AD_Field
setEntityType(column.getEntityType()); setEntityType(column.getEntityType());
} // setColumn } // setColumn
/**
* beforeSave
* @see org.compiere.model.PO#beforeSave(boolean)
* @param newRecord
* @return
*/
@Override
protected boolean beforeSave(boolean newRecord)
{
// Sync Terminology
if ((newRecord || is_ValueChanged("AD_Column_ID"))
&& isCentrallyMaintained())
{
M_Element element = M_Element.getOfColumn(getCtx(), getAD_Column_ID());
setName (element.getName ());
setDescription (element.getDescription ());
setHelp (element.getHelp());
}
return true;
} // beforeSave
} // MField } // MField

View File

@ -43,6 +43,7 @@ public class MIssue extends X_AD_Issue
s_log.config(record.getMessage()); s_log.config(record.getMessage());
MSystem system = MSystem.get(Env.getCtx()); MSystem system = MSystem.get(Env.getCtx());
if (!DB.isConnected() if (!DB.isConnected()
|| system == null
|| !system.isAutoErrorReport()) || !system.isAutoErrorReport())
return null; return null;
// //

View File

@ -309,6 +309,19 @@ public class MLanguage extends X_AD_Language
return m_dateFormat; return m_dateFormat;
} // getDateFormat } // getDateFormat
/**
* Set AD_Language_ID
*/
private void setAD_Language_ID()
{
int AD_Language_ID = getAD_Language_ID();
if (AD_Language_ID == 0)
{
String sql = "SELECT NVL(MAX(AD_Language_ID), 999999) FROM AD_Language WHERE AD_Language_ID > 1000";
AD_Language_ID = DB.getSQLValue (get_TrxName(), sql);
setAD_Language_ID(AD_Language_ID+1);
}
} // setAD_Language_ID
/** /**
* Before Save * Before Save
@ -317,9 +330,9 @@ public class MLanguage extends X_AD_Language
*/ */
protected boolean beforeSave (boolean newRecord) protected boolean beforeSave (boolean newRecord)
{ {
if (is_ValueChanged("DatePattern") && getDatePattern() != null) String dp = getDatePattern();
if (is_ValueChanged("DatePattern") && dp != null && dp.length() > 0)
{ {
String dp = getDatePattern();
if (dp.indexOf("MM") == -1) if (dp.indexOf("MM") == -1)
{ {
log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @DatePattern@ - No Month (MM)")); log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @DatePattern@ - No Month (MM)"));
@ -349,6 +362,8 @@ public class MLanguage extends X_AD_Language
return false; return false;
} }
} }
if (newRecord)
setAD_Language_ID();
return true; return true;
} // beforeSae } // beforeSae

View File

@ -77,7 +77,7 @@ public final class MLookup extends Lookup implements Serializable
/** Inactive Marker End */ /** Inactive Marker End */
public static final String INACTIVE_E = "~"; public static final String INACTIVE_E = "~";
/** Number of max rows to load */ /** Number of max rows to load */
private static final int MAX_ROWS = 1000; // i.e. Drop Down has max 500 items private static final int MAX_ROWS = 10000;
/** Indicator for Null */ /** Indicator for Null */
private static Integer MINUS_ONE = new Integer(-1); private static Integer MINUS_ONE = new Integer(-1);

View File

@ -31,6 +31,92 @@ import org.compiere.util.*;
public class MLookupInfo implements Serializable, Cloneable public class MLookupInfo implements Serializable, Cloneable
{ {
/** /**
* Get first AD_Reference_ID of a matching Reference Name.
* Can have SQL LIKE placeholders.
* (This is more a development tool than used for production)
* @param referenceName reference name
* @return AD_Reference_ID
*/
public static int getAD_Reference_ID (String referenceName)
{
int retValue = 0;
String sql = "SELECT AD_Reference_ID,Name,ValidationType,IsActive "
+ "FROM AD_Reference WHERE Name LIKE ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, referenceName);
ResultSet rs = pstmt.executeQuery();
//
int i = 0;
int id = 0;
String refName = "";
String validationType = "";
boolean isActive = false;
while (rs.next())
{
id = rs.getInt(1);
if (i == 0)
retValue = id;
refName = rs.getString(2);
validationType = rs.getString(3);
isActive = rs.getString(4).equals("Y");
CLogger.get().config("AD_Reference Name=" + refName + ", ID=" + id + ", Type=" + validationType + ", Active=" + isActive);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
CLogger.get().log(Level.SEVERE, sql, e);
}
return retValue;
} // getAD_Reference_ID
/**
* Get first AD_Column_ID of matching ColumnName.
* Can have SQL LIKE placeholders.
* (This is more a development tool than used for production)
* @param columnName column name
* @return AD_Column_ID
*/
public static int getAD_Column_ID (String columnName)
{
int retValue = 0;
String sql = "SELECT c.AD_Column_ID,c.ColumnName,t.TableName "
+ "FROM AD_Column c, AD_Table t "
+ "WHERE c.ColumnName LIKE ? AND c.AD_Table_ID=t.AD_Table_ID";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, columnName);
ResultSet rs = pstmt.executeQuery();
//
int i = 0;
int id = 0;
String colName = "";
String tabName = "";
while (rs.next())
{
id = rs.getInt(1);
if (i == 0)
retValue = id;
colName = rs.getString(2);
tabName = rs.getString(3);
CLogger.get().config("Name=" + colName + ", ID=" + id + ", Table=" + tabName);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
CLogger.get().log(Level.SEVERE, sql, e);
}
return retValue;
} // getAD_Column_ID
/**************************************************************************
* Constructor. * Constructor.
* (called from MLookupFactory) * (called from MLookupFactory)
* @param sqlQuery SQL query * @param sqlQuery SQL query
@ -128,90 +214,4 @@ public class MLookupInfo implements Serializable, Cloneable
return null; return null;
} // clone } // clone
/**************************************************************************
* Get first AD_Reference_ID of a matching Reference Name.
* Can have SQL LIKE placeholders.
* (This is more a development tool than used for production)
* @param referenceName reference name
* @return AD_Reference_ID
*/
public static int getAD_Reference_ID (String referenceName)
{
int retValue = 0;
String sql = "SELECT AD_Reference_ID,Name,ValidationType,IsActive "
+ "FROM AD_Reference WHERE Name LIKE ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, referenceName);
ResultSet rs = pstmt.executeQuery();
//
int i = 0;
int id = 0;
String refName = "";
String validationType = "";
boolean isActive = false;
while (rs.next())
{
id = rs.getInt(1);
if (i == 0)
retValue = id;
refName = rs.getString(2);
validationType = rs.getString(3);
isActive = rs.getString(4).equals("Y");
CLogger.get().config("AD_Reference Name=" + refName + ", ID=" + id + ", Type=" + validationType + ", Active=" + isActive);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
CLogger.get().log(Level.SEVERE, sql, e);
}
return retValue;
} // getAD_Reference_ID
/**
* Get first AD_Column_ID of matching ColumnName.
* Can have SQL LIKE placeholders.
* (This is more a development tool than used for production)
* @param columnName column name
* @return AD_Column_ID
*/
public static int getAD_Column_ID (String columnName)
{
int retValue = 0;
String sql = "SELECT c.AD_Column_ID,c.ColumnName,t.TableName "
+ "FROM AD_Column c, AD_Table t "
+ "WHERE c.ColumnName LIKE ? AND c.AD_Table_ID=t.AD_Table_ID";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, columnName);
ResultSet rs = pstmt.executeQuery();
//
int i = 0;
int id = 0;
String colName = "";
String tabName = "";
while (rs.next())
{
id = rs.getInt(1);
if (i == 0)
retValue = id;
colName = rs.getString(2);
tabName = rs.getString(3);
CLogger.get().config("Name=" + colName + ", ID=" + id + ", Table=" + tabName);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
CLogger.get().log(Level.SEVERE, sql, e);
}
return retValue;
} // getAD_Column_ID
} // MLookupInfo } // MLookupInfo

View File

@ -912,14 +912,28 @@ class Restriction implements Serializable
} }
else else
sb.append(ColumnName); sb.append(ColumnName);
//
// NULL Operator
if ((Operator.equals("=") || Operator.equals("!="))
&& (Code == null
|| "NULL".equals (Code.toString().toUpperCase())))
{
if (Operator.equals("="))
sb.append(" IS NULL ");
else
sb.append(" IS NOT NULL ");
}
else
{
sb.append(Operator); sb.append(Operator);
if (Code instanceof String) if (Code instanceof String)
sb.append(DB.TO_STRING(Code.toString())); sb.append(DB.TO_STRING(Code.toString()));
else if (Code instanceof Timestamp) else if (Code instanceof Timestamp)
sb.append(DB.TO_DATE((Timestamp)Code)); sb.append(DB.TO_DATE((Timestamp)Code));
else else
sb.append(Code); sb.append(Code);
// Between // Between
// if (Code_to != null && InfoDisplay_to != null) // if (Code_to != null && InfoDisplay_to != null)
if (MQuery.BETWEEN.equals(Operator)) if (MQuery.BETWEEN.equals(Operator))
@ -932,6 +946,7 @@ class Restriction implements Serializable
else else
sb.append(Code_to); sb.append(Code_to);
} }
}
return sb.toString(); return sb.toString();
} // getSQL } // getSQL

View File

@ -160,28 +160,15 @@ public class MSystem extends X_AD_System
public String getStatisticsInfo (boolean recalc) public String getStatisticsInfo (boolean recalc)
{ {
String s = super.getStatisticsInfo (); String s = super.getStatisticsInfo ();
/*
if (DB.isDerby())
{//jz Derby time out, fix it later
s = "NO Statistics for Derby.";
recalc = false;
}
*/
if (DB.isDerby())
{//jz Derby time out, fix it later
s = "NO Compiere statistics for Derby.";
recalc = false;
}
if (s == null || recalc) if (s == null || recalc)
{ {
//jz to avoid data conversion String sql = "SELECT 'C'||(SELECT COUNT(*) FROM AD_Client)" String sql = "SELECT 'C'||(SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM AD_Client)"
String sql = "SELECT 'C'||(SELECT COUNT(*) FROM AD_Client)" + "||'U'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM AD_User)"
+ "||'U'||(SELECT COUNT(*) FROM AD_User)" + "||'B'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM C_BPartner)"
+ "||'B'||(SELECT COUNT(*) FROM C_BPartner)" + "||'P'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM M_Product)"
+ "||'P'||(SELECT COUNT(*) FROM M_Product)" + "||'I'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM C_Invoice)"
+ "||'I'||(SELECT COUNT(*) FROM C_Invoice)" + "||'L'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM C_InvoiceLine)"
+ "||'M'||(SELECT COUNT(*) FROM M_Transaction)" + "||'M'|| (SELECT " + DB.TO_CHAR("COUNT(*)", DisplayType.Number, Env.getAD_Language(Env.getCtx())) + " FROM M_Transaction)"
+ " FROM AD_System"; + " FROM AD_System";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try

View File

@ -359,6 +359,38 @@ public class MTable extends X_AD_Table
return null; return null;
} // getColumn } // getColumn
/**
* Table has a single Key
* @return true if table has single key column
*/
public boolean isSingleKey()
{
String[] keys = getKeyColumns();
return keys.length == 1;
} // isSingleKey
/**
* Get Key Columns of Table
* @return key columns
*/
public String[] getKeyColumns()
{
getColumns(false);
ArrayList<String> list = new ArrayList<String>();
//
for (int i = 0; i < m_columns.length; i++)
{
MColumn column = m_columns[i];
if (column.isKey())
return new String[]{column.getColumnName()};
if (column.isParent())
list.add(column.getColumnName());
}
String[] retValue = new String[list.size()];
retValue = list.toArray(retValue);
return retValue;
} // getKeyColumns
/************************************************************************** /**************************************************************************
* Get PO Class Instance * Get PO Class Instance
* @param Record_ID record * @param Record_ID record
@ -368,6 +400,11 @@ public class MTable extends X_AD_Table
public PO getPO (int Record_ID, String trxName) public PO getPO (int Record_ID, String trxName)
{ {
String tableName = getTableName(); String tableName = getTableName();
if (Record_ID != 0 && !isSingleKey())
{
log.log(Level.WARNING, "(id) - Multi-Key " + tableName);
return null;
}
Class clazz = getClass(tableName); Class clazz = getClass(tableName);
if (clazz == null) if (clazz == null)
{ {
@ -492,6 +529,8 @@ public class MTable extends X_AD_Table
{ {
pstmt = null; pstmt = null;
} }
if (po == null)
return getPO(0, trxName);
return po; return po;
} // getPO } // getPO
@ -614,4 +653,15 @@ public class MTable extends X_AD_Table
return retValue; return retValue;
} }
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MTable[");
sb.append (get_ID()).append ("-").append (getTableName()).append ("]");
return sb.toString ();
} // toString
} // MTable } // MTable

View File

@ -123,6 +123,48 @@ public class M_Element extends X_AD_Element
return retValue; return retValue;
} // get } // get
/**
* Get Element
* @param ctx context
* @param columnName case insentitive column name
* @return case sensitive column name
*/
public static M_Element getOfColumn (Properties ctx, int AD_Column_ID)
{
if (AD_Column_ID ==0)
return null;
M_Element retValue = null;
String sql = "SELECT * FROM AD_Element e "
+ "WHERE EXISTS (SELECT * FROM AD_Column c "
+ "WHERE c.AD_Element_ID=e.AD_Element_ID AND c.AD_Column_ID=?)";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, AD_Column_ID);
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
retValue = new M_Element (ctx, rs, null);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return retValue;
} // get
/** Logger */ /** Logger */
private static CLogger s_log = CLogger.getCLogger (M_Element.class); private static CLogger s_log = CLogger.getCLogger (M_Element.class);
@ -232,14 +274,35 @@ public class M_Element extends X_AD_Element
sql = new StringBuffer("UPDATE AD_PrintFormatItem pi SET PrintName=") sql = new StringBuffer("UPDATE AD_PrintFormatItem pi SET PrintName=")
.append(DB.TO_STRING(getPrintName())) .append(DB.TO_STRING(getPrintName()))
.append(", Name=").append(DB.TO_STRING(getName())) .append(", Name=").append(DB.TO_STRING(getName()))
.append(" WHERE AD_Client_ID=0") .append(" WHERE IsCentrallyMaintained='Y'")
.append(" AND EXISTS (SELECT * FROM AD_Column c ") .append(" AND EXISTS (SELECT * FROM AD_Column c ")
.append("WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=") .append("WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=")
.append(get_ID()).append(") AND IsCentrallyMaintained='Y'"); .append(get_ID()).append(")");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("PrintFormatItem updated #" + no); log.fine("PrintFormatItem updated #" + no);
// Info Column
sql = new StringBuffer ("UPDATE AD_InfoColumn SET Name=")
.append(DB.TO_STRING(getName()))
.append(", Description=").append(DB.TO_STRING(getDescription()))
.append(", Help=").append(DB.TO_STRING(getHelp()))
.append(" WHERE AD_Element_ID=").append(get_ID())
.append(" AND IsCentrallyMaintained='Y'");
no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("InfoWindow updated #" + no);
} }
return success; return success;
} // afterSave } // afterSave
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("M_Element[");
sb.append (get_ID()).append ("-").append (getColumnName()).append ("]");
return sb.toString ();
} // toString
} // M_Element } // M_Element

View File

@ -178,7 +178,7 @@ public class ModelValidationEngine
* @param type ModelValidator.TYPE_* * @param type ModelValidator.TYPE_*
* @return error message or NULL for no veto * @return error message or NULL for no veto
*/ */
public String fireModelChange (PO po, int type) public String fireModelChange (PO po, int changeType)
{ {
if (po == null || m_modelChangeListeners.size() == 0) if (po == null || m_modelChangeListeners.size() == 0)
return null; return null;
@ -194,10 +194,13 @@ public class ModelValidationEngine
try try
{ {
ModelValidator validator = (ModelValidator)list.get(i); ModelValidator validator = (ModelValidator)list.get(i);
String error = validator.modelChange(po, type); if (validator.getAD_Client_ID() == po.getAD_Client_ID())
{
String error = validator.modelChange(po, changeType);
if (error != null && error.length() > 0) if (error != null && error.length() > 0)
return error; return error;
} }
}
catch (Exception e) catch (Exception e)
{ {
String error = e.getMessage(); String error = e.getMessage();
@ -257,7 +260,7 @@ public class ModelValidationEngine
* @param timing see ModelValidator.TIMING_ constants * @param timing see ModelValidator.TIMING_ constants
* @return error message or null * @return error message or null
*/ */
public String fireDocValidate (PO po, int timing) public String fireDocValidate (PO po, int docTiming)
{ {
if (po == null || m_docValidateListeners.size() == 0) if (po == null || m_docValidateListeners.size() == 0)
return null; return null;
@ -274,10 +277,13 @@ public class ModelValidationEngine
try try
{ {
validator = (ModelValidator)list.get(i); validator = (ModelValidator)list.get(i);
String error = validator.docValidate(po, timing); if (validator.getAD_Client_ID() == po.getAD_Client_ID())
{
String error = validator.docValidate(po, docTiming);
if (error != null && error.length() > 0) if (error != null && error.length() > 0)
return error; return error;
} }
}
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, validator.toString(), e); log.log(Level.SEVERE, validator.toString(), e);
@ -299,4 +305,5 @@ public class ModelValidationEngine
.append("]"); .append("]");
return sb.toString(); return sb.toString();
} // toString } // toString
} // ModelValidatorEngine } // ModelValidatorEngine

View File

@ -26,11 +26,20 @@ public interface ModelValidator
{ {
/** Model Change Type New */ /** Model Change Type New */
public static final int TYPE_NEW = 1; public static final int TYPE_NEW = 1;
public static final int CHANGETYPE_NEW = 1;
/** Model Change Type Change */ /** Model Change Type Change */
public static final int TYPE_CHANGE = 2; public static final int TYPE_CHANGE = 2;
public static final int CHANGETYPE_CHANGE = 2;
/** Model Change Type Delete */ /** Model Change Type Delete */
public static final int TYPE_DELETE = 3; public static final int TYPE_DELETE = 3;
public static final int CHANGETYPE_DELETE = 3;
/** Called before document is prepared */
public static final int TIMING_BEFORE_PREPARE = 1;
public static final int DOCTIMING_BEFORE_PREPARE = 1;
/** Called after document is processed */
public static final int TIMING_AFTER_COMPLETE = 9;
public static final int DOCTIMING_AFTER_COMPLETE = 9;
/** /**
* Initialize Validation * Initialize Validation
@ -81,10 +90,4 @@ public interface ModelValidator
*/ */
public String docValidate (PO po, int timing); public String docValidate (PO po, int timing);
/** Called before document is prepared */
public static final int TIMING_BEFORE_PREPARE = 1;
/** Called after document is processed */
public static final int TIMING_AFTER_COMPLETE = 9;
} // ModelValidator } // ModelValidator

View File

@ -349,7 +349,7 @@ public abstract class PO
{ {
if (index < 0 || index >= get_ColumnCount()) if (index < 0 || index >= get_ColumnCount())
{ {
log.log(Level.SEVERE, "Index invalid - " + index); log.log(Level.WARNING, "Index invalid - " + index);
return null; return null;
} }
if (m_newValues[index] != null) if (m_newValues[index] != null)
@ -394,7 +394,7 @@ public abstract class PO
int index = get_ColumnIndex(columnName); int index = get_ColumnIndex(columnName);
if (index < 0) if (index < 0)
{ {
log.log(Level.SEVERE, "Column not found - " + columnName); log.log(Level.WARNING, "Column not found - " + columnName);
Trace.printStack(); Trace.printStack();
return null; return null;
} }
@ -434,7 +434,7 @@ public abstract class PO
int index = p_info.getColumnIndex(AD_Column_ID); int index = p_info.getColumnIndex(AD_Column_ID);
if (index < 0) if (index < 0)
{ {
log.log(Level.SEVERE, "Not found - AD_Column_ID=" + AD_Column_ID); log.log(Level.WARNING, "Not found - AD_Column_ID=" + AD_Column_ID);
return null; return null;
} }
return get_Value (index); return get_Value (index);
@ -449,7 +449,7 @@ public abstract class PO
{ {
if (index < 0 || index >= get_ColumnCount()) if (index < 0 || index >= get_ColumnCount())
{ {
log.log(Level.SEVERE, "Index invalid - " + index); log.log(Level.WARNING, "Index invalid - " + index);
return null; return null;
} }
return m_oldValues[index]; return m_oldValues[index];
@ -465,7 +465,7 @@ public abstract class PO
int index = get_ColumnIndex(columnName); int index = get_ColumnIndex(columnName);
if (index < 0) if (index < 0)
{ {
log.log(Level.SEVERE, "Column not found - " + columnName); log.log(Level.WARNING, "Column not found - " + columnName);
return null; return null;
} }
return get_ValueOld (index); return get_ValueOld (index);
@ -503,7 +503,7 @@ public abstract class PO
{ {
if (index < 0 || index >= get_ColumnCount()) if (index < 0 || index >= get_ColumnCount())
{ {
log.log(Level.SEVERE, "Index invalid - " + index); log.log(Level.WARNING, "Index invalid - " + index);
return false; return false;
} }
if (m_newValues[index] == null) if (m_newValues[index] == null)
@ -521,7 +521,7 @@ public abstract class PO
int index = get_ColumnIndex(columnName); int index = get_ColumnIndex(columnName);
if (index < 0) if (index < 0)
{ {
log.log(Level.SEVERE, "Column not found - " + columnName); log.log(Level.WARNING, "Column not found - " + columnName);
return false; return false;
} }
return is_ValueChanged (index); return is_ValueChanged (index);
@ -539,7 +539,7 @@ public abstract class PO
{ {
if (index < 0 || index >= get_ColumnCount()) if (index < 0 || index >= get_ColumnCount())
{ {
log.log(Level.SEVERE, "Index invalid - " + index); log.log(Level.WARNING, "Index invalid - " + index);
return null; return null;
} }
Object nValue = m_newValues[index]; Object nValue = m_newValues[index];
@ -579,7 +579,7 @@ public abstract class PO
int index = get_ColumnIndex(columnName); int index = get_ColumnIndex(columnName);
if (index < 0) if (index < 0)
{ {
log.log(Level.SEVERE, "Column not found - " + columnName); log.log(Level.WARNING, "Column not found - " + columnName);
return null; return null;
} }
return get_ValueDifference (index); return get_ValueDifference (index);
@ -594,14 +594,9 @@ public abstract class PO
*/ */
protected final boolean set_Value (String ColumnName, Object value) protected final boolean set_Value (String ColumnName, Object value)
{ {
if (ColumnName.equals("WhereClause") && value instanceof String && value != null) if (value instanceof String && ColumnName.equals("WhereClause")
{ && value.toString().toUpperCase().indexOf("=NULL") != -1)
//jz check if there is '=null' and replace them log.warning("Invalid Null Value - " + ColumnName + "=" + value);
value = ((String)value).replaceAll("=null", " IS NULL ");
value = ((String)value).replaceAll("=NULL", " IS NULL ");
value = ((String)value).replaceAll("!=null", " IS NOT NULL ");
value = ((String)value).replaceAll("!=NULL", " IS NOT NULL ");
}
int index = get_ColumnIndex(ColumnName); int index = get_ColumnIndex(ColumnName);
if (index < 0) if (index < 0)
@ -609,9 +604,11 @@ public abstract class PO
log.log(Level.SEVERE, "Column not found - " + ColumnName); log.log(Level.SEVERE, "Column not found - " + ColumnName);
return false; return false;
} }
//jz
if (ColumnName.endsWith("_ID") && value instanceof String ) if (ColumnName.endsWith("_ID") && value instanceof String )
{
log.severe("Invalid Data Type for " + ColumnName + "=" + value);
value = Integer.parseInt((String)value); value = Integer.parseInt((String)value);
}
return set_Value (index, value); return set_Value (index, value);
} // setValue } // setValue
@ -638,7 +635,7 @@ public abstract class PO
{ {
if (index < 0 || index >= get_ColumnCount()) if (index < 0 || index >= get_ColumnCount())
{ {
log.log(Level.SEVERE, "Index invalid - " + index); log.log(Level.WARNING, "Index invalid - " + index);
return false; return false;
} }
String ColumnName = p_info.getColumnName(index); String ColumnName = p_info.getColumnName(index);
@ -646,7 +643,7 @@ public abstract class PO
// //
if (p_info.isVirtualColumn(index)) if (p_info.isVirtualColumn(index))
{ {
log.log(Level.SEVERE, "Virtual Column" + colInfo); log.log(Level.WARNING, "Virtual Column" + colInfo);
return false; return false;
} }
// //
@ -655,7 +652,7 @@ public abstract class PO
if ( ( ! p_info.isColumnUpdateable(index) ) && ( ! is_new() ) ) if ( ( ! p_info.isColumnUpdateable(index) ) && ( ! is_new() ) )
{ {
colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index); colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index);
log.log(Level.SEVERE, "Column not updateable" + colInfo); log.log(Level.WARNING, "Column not updateable" + colInfo);
return false; return false;
} }
// //
@ -663,7 +660,7 @@ public abstract class PO
{ {
if (p_info.isColumnMandatory(index)) if (p_info.isColumnMandatory(index))
{ {
log.log(Level.SEVERE, "Cannot set mandatory column to null " + colInfo); log.log(Level.WARNING, "Cannot set mandatory column to null " + colInfo);
// Trace.printStack(); // Trace.printStack();
return false; return false;
} }
@ -807,6 +804,10 @@ public abstract class PO
int index = p_info.getColumnIndex(AD_Column_ID); int index = p_info.getColumnIndex(AD_Column_ID);
if (index < 0) if (index < 0)
log.log(Level.SEVERE, "Not found - AD_Column_ID=" + AD_Column_ID); log.log(Level.SEVERE, "Not found - AD_Column_ID=" + AD_Column_ID);
String ColumnName = p_info.getColumnName(index);
if (ColumnName.equals("IsApproved"))
set_ValueNoCheck(ColumnName, value);
else
set_Value (index, value); set_Value (index, value);
} // setValueOfColumn } // setValueOfColumn
@ -1438,16 +1439,28 @@ public abstract class PO
// Search for Primary Key // Search for Primary Key
for (int i = 0; i < p_info.getColumnCount(); i++) for (int i = 0; i < p_info.getColumnCount(); i++)
{ {
if (p_info.isKey(i) && p_info.getColumnName(i).endsWith("_ID")) if (p_info.isKey(i))
{ {
String ColumnName = p_info.getColumnName(i); String ColumnName = p_info.getColumnName(i);
m_KeyColumns = new String[] {ColumnName}; m_KeyColumns = new String[] {ColumnName};
if (p_info.getColumnName(i).endsWith("_ID"))
{
Integer ii = (Integer)get_Value(i); Integer ii = (Integer)get_Value(i);
if (ii == null) if (ii == null)
m_IDs = new Object[] {I_ZERO}; m_IDs = new Object[] {I_ZERO};
else else
m_IDs = new Object[] {ii}; m_IDs = new Object[] {ii};
log.finest("(PK) " + ColumnName + "=" + ii); log.finest("(PK) " + ColumnName + "=" + ii);
}
else
{
Object oo = get_Value(i);
if (oo == null)
m_IDs = new Object[] {null};
else
m_IDs = new Object[] {oo};
log.finest("(PK) " + ColumnName + "=" + oo);
}
return; return;
} }
} // primary key search } // primary key search
@ -1772,7 +1785,7 @@ public abstract class PO
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "beforeSave - " + toString(), e); log.log(Level.WARNING, "beforeSave - " + toString(), e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e.toString(), false);
// throw new DBException(e); // throw new DBException(e);
return false; return false;
@ -1816,7 +1829,7 @@ public abstract class PO
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "afterSave", e); log.log(Level.WARNING, "afterSave", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e.toString(), false);
success = false; success = false;
// throw new DBException(e); // throw new DBException(e);
@ -2088,9 +2101,11 @@ public abstract class PO
else else
{ {
if (m_trxName == null) if (m_trxName == null)
log.log(Level.WARNING, p_info.getTableName() + "." + where); log.log(Level.WARNING, "#" + no
+ " - " + p_info.getTableName() + "." + where);
else else
log.log(Level.WARNING, "[" + m_trxName + "] - " + p_info.getTableName() + "." + where); log.log(Level.WARNING, "#" + no
+ " - [" + m_trxName + "] - " + p_info.getTableName() + "." + where);
} }
return saveFinish (false, ok); return saveFinish (false, ok);
} }
@ -2416,7 +2431,7 @@ public abstract class PO
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "beforeDelete", e); log.log(Level.WARNING, "beforeDelete", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e.toString(), false);
// throw new DBException(e); // throw new DBException(e);
return false; return false;
@ -2522,7 +2537,7 @@ public abstract class PO
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "afterDelete", e); log.log(Level.WARNING, "afterDelete", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e.toString(), false);
success = false; success = false;
// throw new DBException(e); // throw new DBException(e);
@ -2898,7 +2913,7 @@ public abstract class PO
if (success) if (success)
log.fine("success"); log.fine("success");
else else
log.log(Level.SEVERE, "failed"); log.log(Level.WARNING, "failed");
return success; return success;
} }
return false; return false;
@ -2931,7 +2946,7 @@ public abstract class PO
if (success) if (success)
log.fine("success" + (trxName == null ? "" : "[" + trxName + "]")); log.fine("success" + (trxName == null ? "" : "[" + trxName + "]"));
else else
log.log(Level.SEVERE, "failed" + (trxName == null ? "" : "[" + trxName + "]")); log.log(Level.WARNING, "failed" + (trxName == null ? "" : " [" + trxName + "]"));
return success; return success;
} }
return true; return true;

View File

@ -1298,7 +1298,7 @@ public final class Env
URL url = Adempiere.class.getResource("images/" + fileNameInImageDir); URL url = Adempiere.class.getResource("images/" + fileNameInImageDir);
if (url == null) if (url == null)
{ {
s_log.log(Level.WARNING, "Not found: " + fileNameInImageDir); s_log.log(Level.SEVERE, "Not found: " + fileNameInImageDir);
return null; return null;
} }
return new ImageIcon(url); return new ImageIcon(url);

View File

@ -60,8 +60,8 @@ public class GenerateModel
/** File Header */ /** File Header */
public static final String COPY = public static final String COPY =
"/******************************************************************************\n" "/******************************************************************************\n"
+" * Product: Adempiere ERP & CRM Smart Business Solution *\n" +" * Product: Adempiere ERP & CRM Smart Business Solution *\n"
+" * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *\n" +" * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *\n"
+" * This program is free software; you can redistribute it and/or modify it *\n" +" * This program is free software; you can redistribute it and/or modify it *\n"
+" * under the terms version 2 of the GNU General Public License as published *\n" +" * under the terms version 2 of the GNU General Public License as published *\n"
+" * by the Free Software Foundation. This program is distributed in the hope *\n" +" * by the Free Software Foundation. This program is distributed in the hope *\n"

View File

@ -43,7 +43,8 @@ public class Login
public static Properties initTest (boolean isClient) public static Properties initTest (boolean isClient)
{ {
// logger.entering("Env", "initTest"); // logger.entering("Env", "initTest");
Adempiere.startupEnvironment(true); if (!Adempiere.startupEnvironment(true))
System.exit (1);
// Test Context // Test Context
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
Login login = new Login(ctx); Login login = new Login(ctx);
@ -217,6 +218,9 @@ public class Login
// Authentification // Authentification
boolean authenticated = false; boolean authenticated = false;
MSystem system = MSystem.get(m_ctx); MSystem system = MSystem.get(m_ctx);
if (system == null)
throw new IllegalStateException("No System Info");
if (system.isLDAP()) if (system.isLDAP())
{ {
authenticated = system.isLDAP(app_user, app_pwd); authenticated = system.isLDAP(app_user, app_pwd);

View File

@ -379,7 +379,7 @@ public class KeyStoreMgt
StringBuffer cmd = new StringBuffer ("-genkey -keyalg rsa"); StringBuffer cmd = new StringBuffer ("-genkey -keyalg rsa");
cmd.append(" -alias ").append(alias); cmd.append(" -alias ").append(alias);
cmd.append(" -dname \"").append(dname).append("\""); cmd.append(" -dname \"").append(dname).append("\"");
cmd.append(" -keypass ").append(password).append(" -validity 365"); cmd.append(" -keypass ").append(password).append(" -validity 999");
if (fileName.indexOf(' ') != -1) if (fileName.indexOf(' ') != -1)
cmd.append(" -keystore \"").append(fileName).append("\" -storepass ").append(password); cmd.append(" -keystore \"").append(fileName).append("\" -storepass ").append(password);
else else
@ -399,7 +399,7 @@ public class KeyStoreMgt
StringBuffer cmd = new StringBuffer ("-selfcert"); StringBuffer cmd = new StringBuffer ("-selfcert");
cmd.append(" -alias ").append(alias); cmd.append(" -alias ").append(alias);
cmd.append(" -dname \"").append(dname).append("\""); cmd.append(" -dname \"").append(dname).append("\"");
cmd.append(" -keypass ").append(password).append(" -validity 180"); cmd.append(" -keypass ").append(password).append(" -validity 999");
if (fileName.indexOf(' ') != -1) if (fileName.indexOf(' ') != -1)
cmd.append(" -keystore \"").append(fileName).append("\" -storepass ").append(password); cmd.append(" -keystore \"").append(fileName).append("\" -storepass ").append(password);
else else

View File

@ -28,7 +28,7 @@ public class SilentSetup {
return; return;
} }
Ini.setShowLicenseDialog(false); // Ini.setShowLicenseDialog(false);
ConfigurationData data = new ConfigurationData(null); ConfigurationData data = new ConfigurationData(null);
if (!data.load()) return; if (!data.load()) return;
if (!data.test()) if (!data.test())

View File

@ -369,8 +369,6 @@ public class CompiereColor implements Serializable
/** Background */ /** Background */
private ColorBackground m_back = null; private ColorBackground m_back = null;
/** 3D Look */
private boolean m_3d = true;
/** Diry marker for repaining Background */ /** Diry marker for repaining Background */
private boolean m_dirty = true; private boolean m_dirty = true;

View File

@ -46,10 +46,10 @@ public final class Ini implements Serializable
/** Apps User ID */ /** Apps User ID */
public static final String P_UID = "ApplicationUserID"; public static final String P_UID = "ApplicationUserID";
private static final String DEFAULT_UID = "System"; private static final String DEFAULT_UID = "GardenAdmin";
/** Apps Password */ /** Apps Password */
public static final String P_PWD = "ApplicationPassword"; public static final String P_PWD = "ApplicationPassword";
private static final String DEFAULT_PWD = "System"; private static final String DEFAULT_PWD = "GardenAdmin";
/** Store Password */ /** Store Password */
public static final String P_STORE_PWD = "StorePassword"; public static final String P_STORE_PWD = "StorePassword";
private static final boolean DEFAULT_STORE_PWD = true; private static final boolean DEFAULT_STORE_PWD = true;
@ -280,7 +280,6 @@ public final class Ini implements Serializable
{ {
log.config(filename); log.config(filename);
firstTime = true; firstTime = true;
if (isShowLicenseDialog())
if (!IniDialog.accept()) if (!IniDialog.accept())
System.exit(-1); System.exit(-1);
} }
@ -308,6 +307,29 @@ public final class Ini implements Serializable
return firstTime; return firstTime;
} // loadProperties } // loadProperties
/**
* Delete Property file
*/
public static void deletePropertyFile()
{
String fileName = getFileName(s_client);
File file = new File(fileName);
if (file.exists())
{
try
{
if (!file.delete())
file.deleteOnExit();
s_prop = new Properties();
log.config (fileName);
}
catch (Exception e)
{
log.log (Level.WARNING, "Cannot delete Property file", e);
}
}
} // deleteProperties
/** /**
* Load property and set to default, if not existing * Load property and set to default, if not existing
* *
@ -493,8 +515,6 @@ public final class Ini implements Serializable
private static boolean s_client = true; private static boolean s_client = true;
/** IsClient Internal marker */ /** IsClient Internal marker */
private static boolean s_loaded = false; private static boolean s_loaded = false;
/** Show license dialog for first time **/
private static boolean s_license_dialog = true;
/** /**
* Are we in Client Mode ? * Are we in Client Mode ?
@ -514,24 +534,6 @@ public final class Ini implements Serializable
s_client = client; s_client = client;
} // setClient } // setClient
/**
* Set show license dialog for new setup
* @param b
*/
public static void setShowLicenseDialog(boolean b)
{
s_license_dialog = b;
}
/**
* Is show license dialog for new setup
* @return boolean
*/
public static boolean isShowLicenseDialog()
{
return s_license_dialog;
}
/** /**
* Are the properties loaded? * Are the properties loaded?
* @return true if properties loaded. * @return true if properties loaded.

View File

@ -87,6 +87,35 @@ public class Util
} // removeCRLF } // removeCRLF
/**
* Clean - Remove all white spaces
* @param in in
* @return cleaned string
*/
public static String cleanWhitespace (String in)
{
char[] inArray = in.toCharArray();
StringBuffer out = new StringBuffer(inArray.length);
boolean lastWasSpace = false;
for (int i = 0; i < inArray.length; i++)
{
char c = inArray[i];
if (Character.isWhitespace(c))
{
if (!lastWasSpace)
out.append (' ');
lastWasSpace = true;
}
else
{
out.append (c);
lastWasSpace = false;
}
}
return out.toString();
} // cleanWhitespace
/** /**
* Mask HTML content. * Mask HTML content.
* i.e. replace characters with &values; * i.e. replace characters with &values;
@ -498,7 +527,7 @@ public class Util
*/ */
public static String cleanAmp (String in) public static String cleanAmp (String in)
{ {
if (in == null) if (in == null || in.length() == 0)
return in; return in;
int pos = in.indexOf('&'); int pos = in.indexOf('&');
if (pos == -1) if (pos == -1)

View File

@ -559,7 +559,7 @@ public class MPrintFormat extends X_AD_PrintFormat
// Get Column List from Tab // Get Column List from Tab
String sql = "SELECT AD_Column_ID " //, Name, IsDisplayed, SeqNo String sql = "SELECT AD_Column_ID " //, Name, IsDisplayed, SeqNo
+ "FROM AD_Field " + "FROM AD_Field "
+ "WHERE AD_Tab_ID=(SELECT AD_Tab_ID FROM AD_Tab WHERE AD_Table_ID=? AND ROWNUM=1)" + "WHERE AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=?)"
+ " AND IsEncrypted='N' AND ObscureType IS NULL " + " AND IsEncrypted='N' AND ObscureType IS NULL "
+ "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name"; + "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name";
try try