FR [2794312] Location AutoComplete

https://sourceforge.net/tracker/index.php?func=detail&aid=2794312&group_id=176962&atid=879335
FR [2780543] FR - Implement automplete to WLocationDialog
https://sourceforge.net/tracker/index.php?func=detail&aid=2780543&group_id=176962&atid=955896
And also it covers some flaws in InitialClientSetup raised because of the
new flag C_Country.AllowCitiesOutOfList
Thanks to Carlos for supplying the patch.
This commit is contained in:
tspc 2009-09-24 10:59:05 +00:00
parent a96bb62a67
commit 45446b44bd
16 changed files with 4158 additions and 1751 deletions

View File

@ -33,9 +33,9 @@ import java.io.File;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MCity;
import org.compiere.model.MCurrency; import org.compiere.model.MCurrency;
import org.compiere.model.MSetup; import org.compiere.model.MSetup;
import org.compiere.model.X_C_City;
import org.compiere.print.PrintUtil; import org.compiere.print.PrintUtil;
import org.compiere.process.ProcessInfoParameter; import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess; import org.compiere.process.SvrProcess;
@ -168,9 +168,12 @@ public class InitialClientSetup extends SvrProcess
throw new AdempiereException("@NotUnique@ " + p_NormalUserName); throw new AdempiereException("@NotUnique@ " + p_NormalUserName);
// City_ID overrides CityName if both used // City_ID overrides CityName if both used
if (p_CityName != null && p_CityName.length() > 0 && p_C_City_ID > 0) { if (p_C_City_ID > 0) {
X_C_City city = new X_C_City(getCtx(), p_C_City_ID, null); MCity city = MCity.get(getCtx(), p_C_City_ID);
p_CityName = city.getName(); if (! city.getName().equals(p_CityName)) {
log.info("City name changed from " + p_CityName + " to " + city.getName());
p_CityName = city.getName();
}
} }
// Validate existence and read permissions on CoA file // Validate existence and read permissions on CoA file
@ -187,8 +190,10 @@ public class InitialClientSetup extends SvrProcess
// Process // Process
MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS); MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS);
if (! ms.createClient(p_ClientName, p_OrgName, p_AdminUserName, p_NormalUserName)) if (! ms.createClient(p_ClientName, p_OrgName, p_AdminUserName, p_NormalUserName)) {
ms.rollback();
throw new AdempiereException("Create client failed"); throw new AdempiereException("Create client failed");
}
addLog(ms.getInfo()); addLog(ms.getInfo());
@ -197,11 +202,16 @@ public class InitialClientSetup extends SvrProcess
KeyNamePair currency_kp = new KeyNamePair(p_C_Currency_ID, currency.getDescription()); KeyNamePair currency_kp = new KeyNamePair(p_C_Currency_ID, currency.getDescription());
if (!ms.createAccounting(currency_kp, if (!ms.createAccounting(currency_kp,
p_IsUseProductDimension, p_IsUseBPDimension, p_IsUseProjectDimension, p_IsUseCampaignDimension, p_IsUseSalesRegionDimension, p_IsUseProductDimension, p_IsUseBPDimension, p_IsUseProjectDimension, p_IsUseCampaignDimension, p_IsUseSalesRegionDimension,
coaFile)) coaFile)) {
ms.rollback();
throw new AdempiereException("@AccountSetupError@"); throw new AdempiereException("@AccountSetupError@");
}
// Generate Entities // Generate Entities
ms.createEntities(p_C_Country_ID, p_CityName, p_C_Region_ID, p_C_Currency_ID); if (!ms.createEntities(p_C_Country_ID, p_CityName, p_C_Region_ID, p_C_Currency_ID)) {
ms.rollback();
throw new AdempiereException("@AccountSetupError@");
}
addLog(ms.getInfo()); addLog(ms.getInfo());
// Create Print Documents // Create Print Documents
@ -210,4 +220,4 @@ public class InitialClientSetup extends SvrProcess
return "@OK@"; return "@OK@";
} // doIt } // doIt
} // ASPGenerateLevel } // InitialClientSetup

View File

@ -1,429 +1,451 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it * * This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope * * by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. * * See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along * * You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., * * with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
/** Generated Interface for C_Country /** Generated Interface for C_Country
* @author Adempiere (generated) * @author Adempiere (generated)
* @version Release 3.5.4a * @version Release 3.5.4a
*/ */
public interface I_C_Country public interface I_C_Country
{ {
/** TableName=C_Country */ /** TableName=C_Country */
public static final String Table_Name = "C_Country"; public static final String Table_Name = "C_Country";
/** AD_Table_ID=170 */ /** AD_Table_ID=170 */
public static final int Table_ID = MTable.getTable_ID(Table_Name); public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 6 - System - Client /** AccessLevel = 6 - System - Client
*/ */
BigDecimal accessLevel = BigDecimal.valueOf(6); BigDecimal accessLevel = BigDecimal.valueOf(6);
/** Load Meta Data */ /** Load Meta Data */
/** Column name AD_Client_ID */ /** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client. /** Get Client.
* Client/Tenant for this installation. * Client/Tenant for this installation.
*/ */
public int getAD_Client_ID(); public int getAD_Client_ID();
/** Column name AD_Language */ /** Column name AD_Language */
public static final String COLUMNNAME_AD_Language = "AD_Language"; public static final String COLUMNNAME_AD_Language = "AD_Language";
/** Set Language. /** Set Language.
* Language for this entity * Language for this entity
*/ */
public void setAD_Language (String AD_Language); public void setAD_Language (String AD_Language);
/** Get Language. /** Get Language.
* Language for this entity * Language for this entity
*/ */
public String getAD_Language(); public String getAD_Language();
/** Column name AD_Org_ID */ /** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization. /** Set Organization.
* Organizational entity within client * Organizational entity within client
*/ */
public void setAD_Org_ID (int AD_Org_ID); public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization. /** Get Organization.
* Organizational entity within client * Organizational entity within client
*/ */
public int getAD_Org_ID(); public int getAD_Org_ID();
/** Column name C_Country_ID */ /** Column name AllowCitiesOutOfList */
public static final String COLUMNNAME_C_Country_ID = "C_Country_ID"; public static final String COLUMNNAME_AllowCitiesOutOfList = "AllowCitiesOutOfList";
/** Set Country. /** Set AllowCitiesOutOfList.
* Country * A flag which tells if a country accept or not new cities
*/ */
public void setC_Country_ID (int C_Country_ID); public void setAllowCitiesOutOfList (boolean AllowCitiesOutOfList);
/** Get Country. /** Get AllowCitiesOutOfList.
* Country * A flag which tells if a country accept or not new cities
*/ */
public int getC_Country_ID(); public boolean isAllowCitiesOutOfList();
/** Column name C_Currency_ID */ /** Column name CaptureSequence */
public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID"; public static final String COLUMNNAME_CaptureSequence = "CaptureSequence";
/** Set Currency. /** Set CaptureSequence */
* The Currency for this record public void setCaptureSequence (String CaptureSequence);
*/
public void setC_Currency_ID (int C_Currency_ID); /** Get CaptureSequence */
public String getCaptureSequence();
/** Get Currency.
* The Currency for this record /** Column name C_Country_ID */
*/ public static final String COLUMNNAME_C_Country_ID = "C_Country_ID";
public int getC_Currency_ID();
/** Set Country.
public I_C_Currency getC_Currency() throws RuntimeException; * Country
*/
/** Column name CountryCode */ public void setC_Country_ID (int C_Country_ID);
public static final String COLUMNNAME_CountryCode = "CountryCode";
/** Get Country.
/** Set ISO Country Code. * Country
* Upper-case two-letter alphanumeric ISO Country code according to ISO 3166-1 - http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html */
*/ public int getC_Country_ID();
public void setCountryCode (String CountryCode);
/** Column name C_Currency_ID */
/** Get ISO Country Code. public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID";
* Upper-case two-letter alphanumeric ISO Country code according to ISO 3166-1 - http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
*/ /** Set Currency.
public String getCountryCode(); * The Currency for this record
*/
/** Column name Created */ public void setC_Currency_ID (int C_Currency_ID);
public static final String COLUMNNAME_Created = "Created";
/** Get Currency.
/** Get Created. * The Currency for this record
* Date this record was created */
*/ public int getC_Currency_ID();
public Timestamp getCreated();
public I_C_Currency getC_Currency() throws RuntimeException;
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy"; /** Column name CountryCode */
public static final String COLUMNNAME_CountryCode = "CountryCode";
/** Get Created By.
* User who created this records /** Set ISO Country Code.
*/ * Upper-case two-letter alphanumeric ISO Country code according to ISO 3166-1 - http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
public int getCreatedBy(); */
public void setCountryCode (String CountryCode);
/** Column name Description */
public static final String COLUMNNAME_Description = "Description"; /** Get ISO Country Code.
* Upper-case two-letter alphanumeric ISO Country code according to ISO 3166-1 - http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
/** Set Description. */
* Optional short description of the record public String getCountryCode();
*/
public void setDescription (String Description); /** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Description.
* Optional short description of the record /** Get Created.
*/ * Date this record was created
public String getDescription(); */
public Timestamp getCreated();
/** Column name DisplaySequence */
public static final String COLUMNNAME_DisplaySequence = "DisplaySequence"; /** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Set Address Print Format.
* Format for printing this Address /** Get Created By.
*/ * User who created this records
public void setDisplaySequence (String DisplaySequence); */
public int getCreatedBy();
/** Get Address Print Format.
* Format for printing this Address /** Column name Description */
*/ public static final String COLUMNNAME_Description = "Description";
public String getDisplaySequence();
/** Set Description.
/** Column name DisplaySequenceLocal */ * Optional short description of the record
public static final String COLUMNNAME_DisplaySequenceLocal = "DisplaySequenceLocal"; */
public void setDescription (String Description);
/** Set Local Address Format.
* Format for printing this Address locally /** Get Description.
*/ * Optional short description of the record
public void setDisplaySequenceLocal (String DisplaySequenceLocal); */
public String getDescription();
/** Get Local Address Format.
* Format for printing this Address locally /** Column name DisplaySequence */
*/ public static final String COLUMNNAME_DisplaySequence = "DisplaySequence";
public String getDisplaySequenceLocal();
/** Set Address Print Format.
/** Column name ExpressionBankAccountNo */ * Format for printing this Address
public static final String COLUMNNAME_ExpressionBankAccountNo = "ExpressionBankAccountNo"; */
public void setDisplaySequence (String DisplaySequence);
/** Set Bank Account No Format.
* Format of the Bank Account /** Get Address Print Format.
*/ * Format for printing this Address
public void setExpressionBankAccountNo (String ExpressionBankAccountNo); */
public String getDisplaySequence();
/** Get Bank Account No Format.
* Format of the Bank Account /** Column name DisplaySequenceLocal */
*/ public static final String COLUMNNAME_DisplaySequenceLocal = "DisplaySequenceLocal";
public String getExpressionBankAccountNo();
/** Set Local Address Format.
/** Column name ExpressionBankRoutingNo */ * Format for printing this Address locally
public static final String COLUMNNAME_ExpressionBankRoutingNo = "ExpressionBankRoutingNo"; */
public void setDisplaySequenceLocal (String DisplaySequenceLocal);
/** Set Bank Routing No Format.
* Format of the Bank Routing Number /** Get Local Address Format.
*/ * Format for printing this Address locally
public void setExpressionBankRoutingNo (String ExpressionBankRoutingNo); */
public String getDisplaySequenceLocal();
/** Get Bank Routing No Format.
* Format of the Bank Routing Number /** Column name ExpressionBankAccountNo */
*/ public static final String COLUMNNAME_ExpressionBankAccountNo = "ExpressionBankAccountNo";
public String getExpressionBankRoutingNo();
/** Set Bank Account No Format.
/** Column name ExpressionPhone */ * Format of the Bank Account
public static final String COLUMNNAME_ExpressionPhone = "ExpressionPhone"; */
public void setExpressionBankAccountNo (String ExpressionBankAccountNo);
/** Set Phone Format.
* Format of the phone; /** Get Bank Account No Format.
Can contain fixed format elements, Variables: "_lLoOaAcCa09" * Format of the Bank Account
*/ */
public void setExpressionPhone (String ExpressionPhone); public String getExpressionBankAccountNo();
/** Get Phone Format. /** Column name ExpressionBankRoutingNo */
* Format of the phone; public static final String COLUMNNAME_ExpressionBankRoutingNo = "ExpressionBankRoutingNo";
Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/ /** Set Bank Routing No Format.
public String getExpressionPhone(); * Format of the Bank Routing Number
*/
/** Column name ExpressionPostal */ public void setExpressionBankRoutingNo (String ExpressionBankRoutingNo);
public static final String COLUMNNAME_ExpressionPostal = "ExpressionPostal";
/** Get Bank Routing No Format.
/** Set Postal Code Format. * Format of the Bank Routing Number
* Format of the postal code; */
Can contain fixed format elements, Variables: "_lLoOaAcCa09" public String getExpressionBankRoutingNo();
*/
public void setExpressionPostal (String ExpressionPostal); /** Column name ExpressionPhone */
public static final String COLUMNNAME_ExpressionPhone = "ExpressionPhone";
/** Get Postal Code Format.
* Format of the postal code; /** Set Phone Format.
Can contain fixed format elements, Variables: "_lLoOaAcCa09" * Format of the phone;
*/ Can contain fixed format elements, Variables: "_lLoOaAcCa09"
public String getExpressionPostal(); */
public void setExpressionPhone (String ExpressionPhone);
/** Column name ExpressionPostal_Add */
public static final String COLUMNNAME_ExpressionPostal_Add = "ExpressionPostal_Add"; /** Get Phone Format.
* Format of the phone;
/** Set Additional Postal Format. Can contain fixed format elements, Variables: "_lLoOaAcCa09"
* Format of the value; */
Can contain fixed format elements, Variables: "_lLoOaAcCa09" public String getExpressionPhone();
*/
public void setExpressionPostal_Add (String ExpressionPostal_Add); /** Column name ExpressionPostal */
public static final String COLUMNNAME_ExpressionPostal = "ExpressionPostal";
/** Get Additional Postal Format.
* Format of the value; /** Set Postal Code Format.
Can contain fixed format elements, Variables: "_lLoOaAcCa09" * Format of the postal code;
*/ Can contain fixed format elements, Variables: "_lLoOaAcCa09"
public String getExpressionPostal_Add(); */
public void setExpressionPostal (String ExpressionPostal);
/** Column name HasPostal_Add */
public static final String COLUMNNAME_HasPostal_Add = "HasPostal_Add"; /** Get Postal Code Format.
* Format of the postal code;
/** Set Additional Postal code. Can contain fixed format elements, Variables: "_lLoOaAcCa09"
* Has Additional Postal Code */
*/ public String getExpressionPostal();
public void setHasPostal_Add (boolean HasPostal_Add);
/** Column name ExpressionPostal_Add */
/** Get Additional Postal code. public static final String COLUMNNAME_ExpressionPostal_Add = "ExpressionPostal_Add";
* Has Additional Postal Code
*/ /** Set Additional Postal Format.
public boolean isHasPostal_Add(); * Format of the value;
Can contain fixed format elements, Variables: "_lLoOaAcCa09"
/** Column name HasRegion */ */
public static final String COLUMNNAME_HasRegion = "HasRegion"; public void setExpressionPostal_Add (String ExpressionPostal_Add);
/** Set Country has Region. /** Get Additional Postal Format.
* Country contains Regions * Format of the value;
*/ Can contain fixed format elements, Variables: "_lLoOaAcCa09"
public void setHasRegion (boolean HasRegion); */
public String getExpressionPostal_Add();
/** Get Country has Region.
* Country contains Regions /** Column name HasPostal_Add */
*/ public static final String COLUMNNAME_HasPostal_Add = "HasPostal_Add";
public boolean isHasRegion();
/** Set Additional Postal code.
/** Column name IsActive */ * Has Additional Postal Code
public static final String COLUMNNAME_IsActive = "IsActive"; */
public void setHasPostal_Add (boolean HasPostal_Add);
/** Set Active.
* The record is active in the system /** Get Additional Postal code.
*/ * Has Additional Postal Code
public void setIsActive (boolean IsActive); */
public boolean isHasPostal_Add();
/** Get Active.
* The record is active in the system /** Column name HasRegion */
*/ public static final String COLUMNNAME_HasRegion = "HasRegion";
public boolean isActive();
/** Set Country has Region.
/** Column name IsAddressLinesLocalReverse */ * Country contains Regions
public static final String COLUMNNAME_IsAddressLinesLocalReverse = "IsAddressLinesLocalReverse"; */
public void setHasRegion (boolean HasRegion);
/** Set Reverse Local Address Lines.
* Print Local Address in reverse Order /** Get Country has Region.
*/ * Country contains Regions
public void setIsAddressLinesLocalReverse (boolean IsAddressLinesLocalReverse); */
public boolean isHasRegion();
/** Get Reverse Local Address Lines.
* Print Local Address in reverse Order /** Column name IsActive */
*/ public static final String COLUMNNAME_IsActive = "IsActive";
public boolean isAddressLinesLocalReverse();
/** Set Active.
/** Column name IsAddressLinesReverse */ * The record is active in the system
public static final String COLUMNNAME_IsAddressLinesReverse = "IsAddressLinesReverse"; */
public void setIsActive (boolean IsActive);
/** Set Reverse Address Lines.
* Print Address in reverse Order /** Get Active.
*/ * The record is active in the system
public void setIsAddressLinesReverse (boolean IsAddressLinesReverse); */
public boolean isActive();
/** Get Reverse Address Lines.
* Print Address in reverse Order /** Column name IsAddressLinesLocalReverse */
*/ public static final String COLUMNNAME_IsAddressLinesLocalReverse = "IsAddressLinesLocalReverse";
public boolean isAddressLinesReverse();
/** Set Reverse Local Address Lines.
/** Column name IsPostcodeLookup */ * Print Local Address in reverse Order
public static final String COLUMNNAME_IsPostcodeLookup = "IsPostcodeLookup"; */
public void setIsAddressLinesLocalReverse (boolean IsAddressLinesLocalReverse);
/** Set IsPostcodeLookup.
* Does this country have a post code web service /** Get Reverse Local Address Lines.
*/ * Print Local Address in reverse Order
public void setIsPostcodeLookup (boolean IsPostcodeLookup); */
public boolean isAddressLinesLocalReverse();
/** Get IsPostcodeLookup.
* Does this country have a post code web service /** Column name IsAddressLinesReverse */
*/ public static final String COLUMNNAME_IsAddressLinesReverse = "IsAddressLinesReverse";
public boolean isPostcodeLookup();
/** Set Reverse Address Lines.
/** Column name LookupClassName */ * Print Address in reverse Order
public static final String COLUMNNAME_LookupClassName = "LookupClassName"; */
public void setIsAddressLinesReverse (boolean IsAddressLinesReverse);
/** Set LookupClassName.
* The class name of the postcode lookup plugin /** Get Reverse Address Lines.
*/ * Print Address in reverse Order
public void setLookupClassName (String LookupClassName); */
public boolean isAddressLinesReverse();
/** Get LookupClassName.
* The class name of the postcode lookup plugin /** Column name IsPostcodeLookup */
*/ public static final String COLUMNNAME_IsPostcodeLookup = "IsPostcodeLookup";
public String getLookupClassName();
/** Set IsPostcodeLookup.
/** Column name LookupClientID */ * Does this country have a post code web service
public static final String COLUMNNAME_LookupClientID = "LookupClientID"; */
public void setIsPostcodeLookup (boolean IsPostcodeLookup);
/** Set LookupClientID.
* The ClientID or Login submitted to the Lookup URL /** Get IsPostcodeLookup.
*/ * Does this country have a post code web service
public void setLookupClientID (String LookupClientID); */
public boolean isPostcodeLookup();
/** Get LookupClientID.
* The ClientID or Login submitted to the Lookup URL /** Column name LookupClassName */
*/ public static final String COLUMNNAME_LookupClassName = "LookupClassName";
public String getLookupClientID();
/** Set LookupClassName.
/** Column name LookupPassword */ * The class name of the postcode lookup plugin
public static final String COLUMNNAME_LookupPassword = "LookupPassword"; */
public void setLookupClassName (String LookupClassName);
/** Set LookupPassword.
* The password submitted to the Lookup URL /** Get LookupClassName.
*/ * The class name of the postcode lookup plugin
public void setLookupPassword (String LookupPassword); */
public String getLookupClassName();
/** Get LookupPassword.
* The password submitted to the Lookup URL /** Column name LookupClientID */
*/ public static final String COLUMNNAME_LookupClientID = "LookupClientID";
public String getLookupPassword();
/** Set LookupClientID.
/** Column name LookupUrl */ * The ClientID or Login submitted to the Lookup URL
public static final String COLUMNNAME_LookupUrl = "LookupUrl"; */
public void setLookupClientID (String LookupClientID);
/** Set LookupUrl.
* The URL of the web service that the plugin connects to in order to retrieve postcode data /** Get LookupClientID.
*/ * The ClientID or Login submitted to the Lookup URL
public void setLookupUrl (String LookupUrl); */
public String getLookupClientID();
/** Get LookupUrl.
* The URL of the web service that the plugin connects to in order to retrieve postcode data /** Column name LookupPassword */
*/ public static final String COLUMNNAME_LookupPassword = "LookupPassword";
public String getLookupUrl();
/** Set LookupPassword.
/** Column name MediaSize */ * The password submitted to the Lookup URL
public static final String COLUMNNAME_MediaSize = "MediaSize"; */
public void setLookupPassword (String LookupPassword);
/** Set Media Size.
* Java Media Size /** Get LookupPassword.
*/ * The password submitted to the Lookup URL
public void setMediaSize (String MediaSize); */
public String getLookupPassword();
/** Get Media Size.
* Java Media Size /** Column name LookupUrl */
*/ public static final String COLUMNNAME_LookupUrl = "LookupUrl";
public String getMediaSize();
/** Set LookupUrl.
/** Column name Name */ * The URL of the web service that the plugin connects to in order to retrieve postcode data
public static final String COLUMNNAME_Name = "Name"; */
public void setLookupUrl (String LookupUrl);
/** Set Name.
* Alphanumeric identifier of the entity /** Get LookupUrl.
*/ * The URL of the web service that the plugin connects to in order to retrieve postcode data
public void setName (String Name); */
public String getLookupUrl();
/** Get Name.
* Alphanumeric identifier of the entity /** Column name MediaSize */
*/ public static final String COLUMNNAME_MediaSize = "MediaSize";
public String getName();
/** Set Media Size.
/** Column name RegionName */ * Java Media Size
public static final String COLUMNNAME_RegionName = "RegionName"; */
public void setMediaSize (String MediaSize);
/** Set Region.
* Name of the Region /** Get Media Size.
*/ * Java Media Size
public void setRegionName (String RegionName); */
public String getMediaSize();
/** Get Region.
* Name of the Region /** Column name Name */
*/ public static final String COLUMNNAME_Name = "Name";
public String getRegionName();
/** Set Name.
/** Column name Updated */ * Alphanumeric identifier of the entity
public static final String COLUMNNAME_Updated = "Updated"; */
public void setName (String Name);
/** Get Updated.
* Date this record was updated /** Get Name.
*/ * Alphanumeric identifier of the entity
public Timestamp getUpdated(); */
public String getName();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; /** Column name RegionName */
public static final String COLUMNNAME_RegionName = "RegionName";
/** Get Updated By.
* User who updated this records /** Set Region.
*/ * Name of the Region
public int getUpdatedBy(); */
} public void setRegionName (String RegionName);
/** Get Region.
* Name of the Region
*/
public String getRegionName();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,132 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.io.Serializable;
import java.sql.ResultSet;
import java.util.Comparator;
import java.util.Properties;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
/**
* Location City Model (Value Object)
*
* @author Mario Calderon / Carlos Ruiz
*/
public final class MCity extends X_C_City
implements Comparator, Serializable
{
/**
*
*/
private static final long serialVersionUID = -8905525315954621942L;
/**
* Get City (cached)
* @param ctx context
* @param C_City_ID ID
* @return City
*/
public static MCity get (Properties ctx, int C_City_ID)
{
Integer key = new Integer (C_City_ID);
MCity r = s_Cities.get(key);
if (r != null)
return r;
r = new MCity (ctx, C_City_ID, null);
if (r.getC_City_ID() == C_City_ID)
{
s_Cities.put(key, r);
return r;
}
return null;
} // get
/** City Cache */
private static CCache<Integer,MCity> s_Cities = new CCache<Integer,MCity>("C_City", 20);;
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MCity.class);
/** Region Cache */
/**************************************************************************
* Create empty City
* @param ctx context
* @param C_City_ID id
* @param trxName transaction
*/
public MCity (Properties ctx, int C_City_ID, String trxName)
{
super (ctx, C_City_ID, trxName);
if (C_City_ID == 0)
{
}
} // MCity
/**
* Create City from current row in ResultSet
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MCity (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MCity
/**
* Parent Constructor
* @param Region Region
* @param CityName City Name
*/
public MCity (MRegion region, String cityName)
{
super (region.getCtx(), 0, region.get_TrxName());
setC_Region_ID(region.getC_Region_ID());
setName(cityName);
} // MCity
/**
* Return Name
* @return Name
*/
public String toString()
{
return getName();
} // toString
/**
* Compare
* @param o1 object 1
* @param o2 object 2
* @return -1,0, 1
*/
public int compare(Object o1, Object o2)
{
String s1 = o1.toString();
if (s1 == null)
s1 = "";
String s2 = o2.toString();
if (s2 == null)
s2 = "";
return s1.compareTo(s2);
} // compare
} // MCity

View File

@ -27,6 +27,7 @@ import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
/** /**
@ -37,6 +38,7 @@ import org.compiere.util.Util;
* *
* @author Michael Judd (Akuna Ltd) * @author Michael Judd (Akuna Ltd)
* <li>BF [ 2695078 ] Country is not translated on invoice * <li>BF [ 2695078 ] Country is not translated on invoice
* <li>FR [2794312 ] Location AutoComplete - check if allow cities out of list
*/ */
public class MLocation extends X_C_Location implements Comparator public class MLocation extends X_C_Location implements Comparator
{ {
@ -203,6 +205,10 @@ public class MLocation extends X_C_Location implements Comparator
*/ */
public MCountry getCountry() public MCountry getCountry()
{ {
// Reset country if not match
if (m_c != null && m_c.get_ID() != getC_Country_ID())
m_c = null;
// Load
if (m_c == null) if (m_c == null)
{ {
if (getC_Country_ID() != 0) if (getC_Country_ID() != 0)
@ -257,14 +263,17 @@ public class MLocation extends X_C_Location implements Comparator
{ {
m_r = region; m_r = region;
if (region == null) if (region == null)
{
super.setC_Region_ID(0); super.setC_Region_ID(0);
}
else else
{ {
super.setC_Region_ID(m_r.getC_Region_ID()); super.setC_Region_ID(m_r.getC_Region_ID());
setRegionName(m_r.getName());
if (m_r.getC_Country_ID() != getC_Country_ID()) if (m_r.getC_Country_ID() != getC_Country_ID())
{ {
log.info("Region(" + region + ") C_Country_ID=" + region.getC_Country_ID() log.info("Region(" + region + ") C_Country_ID=" + region.getC_Country_ID()
+ " - From C_Country_ID=" + getC_Country_ID()); + " - From C_Country_ID=" + getC_Country_ID());
setC_Country_ID(region.getC_Country_ID()); setC_Country_ID(region.getC_Country_ID());
} }
} }
@ -297,6 +306,10 @@ public class MLocation extends X_C_Location implements Comparator
*/ */
public MRegion getRegion() public MRegion getRegion()
{ {
// Reset region if not match
if (m_r != null && m_r.get_ID() != getC_Region_ID())
m_r = null;
//
if (m_r == null && getC_Region_ID() != 0) if (m_r == null && getC_Region_ID() != 0)
m_r = MRegion.get(getCtx(), getC_Region_ID()); m_r = MRegion.get(getCtx(), getC_Region_ID());
return m_r; return m_r;
@ -594,9 +607,23 @@ public class MLocation extends X_C_Location implements Comparator
if (!m_c.isHasRegion()) if (!m_c.isHasRegion())
setC_Region_ID(0); setC_Region_ID(0);
} }
if (getC_City_ID() <= 0 && getCity() != null && getCity().length() > 0) {
int city_id = DB.getSQLValue(
get_TrxName(),
"SELECT C_City_ID FROM C_City WHERE C_Country_ID=? AND COALESCE(C_Region_ID,0)=? AND Name=?",
new Object[] {getC_Country_ID(), getC_Region_ID(), getCity()});
if (city_id > 0)
setC_City_ID(city_id);
}
//check city
if (m_c != null && !m_c.isAllowCitiesOutOfList() && getC_City_ID()<=0) {
log.saveError("CityNotFound", Msg.translate(getCtx(), "CityNotFound"));
return false;
}
return true; return true;
} // geforeSave } // beforeSave
/** /**
* After Save * After Save

View File

@ -1319,4 +1319,14 @@ public final class MSetup
{ {
return m_info.toString(); return m_info.toString();
} }
/**
* Rollback Internal Transaction
*/
public void rollback() {
try {
m_trx.rollback();
m_trx.close();
} catch (Exception e) {}
}
} // MSetup } // MSetup

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,7 @@ import org.compiere.util.Msg;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: VSetup.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ * @version $Id: VSetup.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
* @deprecated
*/ */
public class VSetup extends CPanel public class VSetup extends CPanel
implements FormPanel, ActionListener, Runnable implements FormPanel, ActionListener, Runnable

View File

@ -0,0 +1,290 @@
package org.compiere.grid.ed;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseListener;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListModel;
import javax.swing.Timer;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import org.compiere.util.CLogger;
/**
* @author Santhosh Kumar T - santhosh@in.fiorano.com
* <li>Initial contribution - http://www.jroller.com/santhosh/date/20050620#file_path_autocompletion
* @author Teo Sarca , www.arhipac.ro
* <li>added timed triggering
* <li>refactored
* @author Cristina Ghita , www.arhipac.ro
* <li>refactored
*/
public abstract class AutoCompleter implements MouseListener
{
private static final long serialVersionUID = -5135462631871597277L;
private static final String AUTOCOMPLETER = "AUTOCOMPLETER"; //NOI18N
private static final int PopupDelayMillis = 500;
protected final CLogger log = CLogger.getCLogger(getClass());
final JList listBox = new JList();
final JTextComponent textBox;
final private JPopupMenu popup = new JPopupMenu();
private boolean m_empty = false;
private final Timer timer = new Timer(PopupDelayMillis, new ActionListener(){
public void actionPerformed(ActionEvent e)
{
showPopup();
}
});
public AutoCompleter(JTextComponent comp)
{
textBox = comp;
textBox.putClientProperty(AUTOCOMPLETER, this);
JScrollPane scroll = new JScrollPane(listBox);
scroll.setBorder(null);
listBox.setFocusable( false );
listBox.addMouseListener(this);
scroll.getVerticalScrollBar().setFocusable( false );
scroll.getHorizontalScrollBar().setFocusable( false );
popup.setBorder(BorderFactory.createLineBorder(Color.black));
popup.add(scroll);
if(textBox instanceof JTextField)
{
textBox.registerKeyboardAction(showAction, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), JComponent.WHEN_FOCUSED);
textBox.getDocument().addDocumentListener(documentListener);
}
textBox.registerKeyboardAction(upAction, KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), JComponent.WHEN_FOCUSED);
textBox.registerKeyboardAction(hidePopupAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED);
popup.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e)
{
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
{
textBox.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
}
public void popupMenuCanceled(PopupMenuEvent e)
{
}
});
listBox.setRequestFocusEnabled(false);
}
public boolean isEmpty()
{
return m_empty;
}
public void setEmpty(boolean empty)
{
m_empty = empty;
}
private static final Action acceptAction = new AbstractAction()
{
private static final long serialVersionUID = -3950389799318995148L;
public void actionPerformed(ActionEvent e)
{
JComponent tf = (JComponent)e.getSource();
AutoCompleter completer = (AutoCompleter)tf.getClientProperty(AUTOCOMPLETER);
completer.popup.setVisible(false);
if (completer.listBox.getSelectedValue() == null)
{
String txt = completer.textBox.getText();
ListModel lm = completer.listBox.getModel();
for (int index = 0; index < lm.getSize(); index++)
{
if (startsWithIgnoreCase(lm.getElementAt(index).toString(), txt))
{
completer.acceptedListItem(lm.getElementAt(index));
break;
}
}
}
else
{
completer.acceptedListItem(completer.listBox.getSelectedValue());
}
}
};
private final DocumentListener documentListener = new DocumentListener()
{
public void insertUpdate(DocumentEvent e)
{
showPopupDelayed();
}
public void removeUpdate(DocumentEvent e)
{
showPopupDelayed();
}
public void changedUpdate(DocumentEvent e)
{
}
};
private void showPopupDelayed()
{
log.finest("showPopupDelayed..");
timer.setRepeats(false);
timer.start();
}
private void showPopup()
{
log.finest("showPopup");
popup.setVisible(false);
if (textBox.isEnabled() && updateListData() && listBox.getModel().getSize() != 0)
{
setEmpty(false);
if(!(textBox instanceof JTextField))
{
textBox.getDocument().addDocumentListener(documentListener);
}
textBox.registerKeyboardAction(acceptAction, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_FOCUSED);
int size = listBox.getModel().getSize();
listBox.setVisibleRowCount(size<10 ? size : 10);
int x = 0;
try{
int pos = Math.min(textBox.getCaret().getDot(), textBox.getCaret().getMark());
x = textBox.getUI().modelToView(textBox, pos).x;
} catch(BadLocationException e){
// this should never happen!!!
e.printStackTrace();
}
popup.show(textBox, x, textBox.getHeight());
}
else
{
popup.setVisible(false);
setEmpty(true);
}
textBox.requestFocus();
}
static Action showAction = new AbstractAction()
{
private static final long serialVersionUID = 8868536979000734628L;
public void actionPerformed(ActionEvent e)
{
JComponent tf = (JComponent)e.getSource();
AutoCompleter completer = (AutoCompleter)tf.getClientProperty(AUTOCOMPLETER);
if(tf.isEnabled())
{
if(completer.popup.isVisible())
completer.selectNextPossibleValue();
else
completer.showPopup();
}
}
};
private static final Action upAction = new AbstractAction()
{
private static final long serialVersionUID = 2200136359410394434L;
public void actionPerformed(ActionEvent e)
{
JComponent tf = (JComponent)e.getSource();
AutoCompleter completer = (AutoCompleter)tf.getClientProperty(AUTOCOMPLETER);
if(tf.isEnabled())
{
if(completer.popup.isVisible())
completer.selectPreviousPossibleValue();
}
}
};
private static final Action hidePopupAction = new AbstractAction()
{
private static final long serialVersionUID = -5683983067872135654L;
public void actionPerformed(ActionEvent e)
{
JComponent tf = (JComponent)e.getSource();
AutoCompleter completer = (AutoCompleter)tf.getClientProperty(AUTOCOMPLETER);
if(tf.isEnabled())
completer.popup.setVisible(false);
}
};
/**
* Selects the next item in the list. It won't change the selection if the
* currently selected item is already the last item.
*/
protected void selectNextPossibleValue()
{
int si = listBox.getSelectedIndex();
if(si < listBox.getModel().getSize() - 1){
listBox.setSelectedIndex(si + 1);
listBox.ensureIndexIsVisible(si + 1);
}
}
/**
* Selects the previous item in the list. It won't change the selection if the
* currently selected item is already the first item.
*/
protected void selectPreviousPossibleValue()
{
int si = listBox.getSelectedIndex();
if(si > 0){
listBox.setSelectedIndex(si - 1);
listBox.ensureIndexIsVisible(si - 1);
}
}
/**
* Checks if str1 starts with str2 (ignores case, trim whitespaces, strip diacritics)
* @param str1
* @param str2
* @return true if str1 starts with str2
*/
protected static boolean startsWithIgnoreCase(String str1, String str2)
{
String s1 = org.compiere.util.Util.stripDiacritics(str1.toUpperCase()).trim();
String s2 = org.compiere.util.Util.stripDiacritics(str2.toUpperCase()).trim();
return s1.startsWith(s2);
}
/**
* Update list model depending on the data in textfield
* @return
*/
protected abstract boolean updateListData();
/**
* User has selected some item in the list. Update textfield accordingly...
* @param selected
*/
protected abstract void acceptedListItem(Object selected);
}

View File

@ -0,0 +1,242 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid.ed;
import java.awt.Color;
import java.awt.event.MouseEvent;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.text.JTextComponent;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MSysConfig;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
*
* @author Cristina Ghita , www.arhipac.ro
*
*/
public class CityAutoCompleter extends AutoCompleter
{
public static final CityVO ITEM_More = new CityVO(-1, "...", -1, "");
private final int m_maxRows = MSysConfig.getIntValue("LOCATION_MAX_CITY_ROWS", 7);
private CityVO m_city = null;
private final int m_windowNo;
private ArrayList<CityVO> list = new ArrayList<CityVO>();
private ArrayList<CityVO> listShow = new ArrayList<CityVO>();
public CityAutoCompleter(JTextComponent comp, int windowNo)
{
super(comp);
this.m_windowNo = windowNo;
listBox.setVisibleRowCount(m_maxRows);
setCity(null);
}
@Override
protected void acceptedListItem(Object selected)
{
if (selected == null || selected == ITEM_More)
{
setCity(null);
return;
}
CityVO item = (CityVO) selected;
setCity(item);
Env.setContext(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Region_ID", String.valueOf(item.C_Region_ID));
textBox.setText(item.CityName);
}
@Override
protected boolean updateListData()
{
String search = textBox.getText();
if (m_city != null && m_city.CityName.compareTo(search) != 0)
{
setCity(null);
}
listShow.clear();
boolean truncated = false;
search = search.toUpperCase();
int i = 0;
for (CityVO vo : list) {
if (vo.CityName.toUpperCase().startsWith(search)) {
if (i > 0 && i == m_maxRows+1)
{
listShow.add(ITEM_More);
truncated = true;
break;
}
listShow.add(vo);
i++;
}
}
this.listBox.setListData(listShow.toArray());
//if there is no city on the list return false, to not show the popup
if (listShow.isEmpty())
{
return false;
}
else
{
CityVO city = (CityVO) listShow.get(0);
if (city.CityName.equalsIgnoreCase(search))
{
m_city = city;
return true;
}
}
//if the list has only one item, but that item is not equals with m_city
//return false to not show any popup
if (!truncated && listShow.size() == 1
&& m_city != null && listShow.get(0).equals(this.m_city))
{
log.finest("nothing to do 1");
return false;
}
return true;
}
public void fillList()
{
// Carlos Ruiz - globalqss - improve to avoid going to the database on every keystroke
list.clear();
listShow.clear();
ArrayList<Object> params = new ArrayList<Object>();
final StringBuffer sql = new StringBuffer(
"SELECT cy.C_City_ID, cy.Name, cy.C_Region_ID, r.Name"
+" FROM C_City cy"
+" LEFT OUTER JOIN C_Region r ON (r.C_Region_ID=cy.C_Region_ID)"
+" WHERE cy.AD_Client_ID IN (0,?)");
params.add(getAD_Client_ID());
if (getC_Region_ID() > 0)
{
sql.append(" AND cy.C_Region_ID=?");
params.add(getC_Region_ID());
}
if (getC_Country_ID() > 0)
{
sql.append(" AND cy.C_Country_ID=?");
params.add(getC_Country_ID());
}
sql.append(" ORDER BY cy.Name, r.Name");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
DB.setParameters(pstmt, params);
rs = pstmt.executeQuery();
int i = 0;
while(rs.next())
{
CityVO vo = new CityVO(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getString(4));
list.add(vo);
if (i <= m_maxRows) {
listShow.add(vo);
} else if (i == m_maxRows + 1 && i > 0) {
listShow.add(ITEM_More);
}
i++;
}
}
catch (SQLException e)
{
throw new DBException(e, sql.toString());
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
//
this.listBox.setListData(listShow.toArray());
}
private void setCity(CityVO vo)
{
m_city = vo;
log.finest("C_City_ID="+m_city);
if (m_city == null) {
textBox.setBackground(new Color(230, 230, 255));
} else {
textBox.setBackground(Color.WHITE);
}
}
public int getC_City_ID()
{
return m_city != null ? m_city.C_City_ID : -1;
}
public int getAD_Client_ID()
{
return Env.getAD_Client_ID(Env.getCtx());
}
public int getC_Country_ID()
{
return Env.getContextAsInt(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Country_ID");
}
public int getC_Region_ID()
{
return Env.getContextAsInt(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Region_ID");
}
public CityVO getCity()
{
return m_city;
}
public void mouseEntered(MouseEvent e)
{
// nothing to do
}
public void mouseExited(MouseEvent e)
{
// nothing to do
}
public void mousePressed(MouseEvent e)
{
// nothing to do
}
public void mouseReleased(MouseEvent e)
{
// nothing to do
}
public void mouseClicked(MouseEvent e)
{
if(e == null || listBox.getSelectedValue().equals(ITEM_More))
{
setCity(null);
return;
}
CityVO item = (CityVO)listBox.getSelectedValue();
setCity(item);
Env.setContext(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Region_ID", String.valueOf(item.C_Region_ID));
textBox.setText(item.CityName);
}
}

View File

@ -0,0 +1,84 @@
/**
*
*/
package org.compiere.grid.ed;
/**
* @author Teo Sarca , www.arhipac.ro
*
*/
public class CityVO
{
public final int C_City_ID;
public final String CityName;
public final int C_Region_ID;
public final String RegionName;
public CityVO(int city_ID, String cityName, int region_ID, String regionName)
{
super();
C_City_ID = city_ID;
CityName = cityName;
C_Region_ID = region_ID;
RegionName = regionName;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + C_City_ID;
result = prime * result + C_Region_ID;
result = prime * result + ((CityName == null) ? 0 : CityName.hashCode());
result = prime * result + ((RegionName == null) ? 0 : RegionName.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CityVO other = (CityVO) obj;
if (C_City_ID != other.C_City_ID)
return false;
if (C_Region_ID != other.C_Region_ID)
return false;
if (CityName == null)
{
if (other.CityName != null)
return false;
}
else if (!CityName.equals(other.CityName))
return false;
if (RegionName == null)
{
if (other.RegionName != null)
return false;
}
else if (!RegionName.equals(other.RegionName))
return false;
return true;
}
@Override
public String toString()
{
StringBuffer sb = new StringBuffer();
if (this.CityName != null)
{
sb.append(this.CityName);
}
if (this.RegionName != null)
{
sb.append(" (").append(this.RegionName).append(")");
}
return sb.toString();
}
}

View File

@ -35,6 +35,7 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel; import org.compiere.apps.ConfirmPanel;
import org.compiere.model.MCountry; import org.compiere.model.MCountry;
@ -63,22 +64,21 @@ import com.akunagroup.uk.postcode.Postcode;
* <li>BF [ 1831060 ] Location dialog should use Address1, Address2 ... elements * <li>BF [ 1831060 ] Location dialog should use Address1, Address2 ... elements
* @author Michael Judd, Akuna Ltd (UK) * @author Michael Judd, Akuna Ltd (UK)
* <li>FR [ 1741222 ] - Webservice connector for address lookups * <li>FR [ 1741222 ] - Webservice connector for address lookups
* @author Cristina Ghita, www.arhipac.ro
* <li>FR [ 2794312 ] Location AutoComplete
*/ */
public class VLocationDialog extends CDialog public class VLocationDialog extends CDialog
implements ActionListener implements ActionListener
{ {
/** Lookup result */
//private Object[][] data = null;
/** /**
* *
*/ */
private static final long serialVersionUID = 6593340606631477392L; private static final long serialVersionUID = 6952838437136830975L;
/** Lookup result header */ /** Lookup result header */
private Object[] header = null; private Object[] header = null;
//private int m_WindowNo = 0; private int m_WindowNo = 0;
/** /**
* Constructor * Constructor
@ -108,6 +108,10 @@ public class VLocationDialog extends CDialog
else else
setTitle(Msg.getMsg(Env.getCtx(), "LocationUpdate")); setTitle(Msg.getMsg(Env.getCtx(), "LocationUpdate"));
// Reset TAB_INFO context
Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Region_ID", null);
Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Country_ID", null);
// Current Country // Current Country
MCountry.setDisplayLanguage(Env.getAD_Language(Env.getCtx())); MCountry.setDisplayLanguage(Env.getAD_Language(Env.getCtx()));
fCountry = new CComboBox(MCountry.getCountries(Env.getCtx())); fCountry = new CComboBox(MCountry.getCountries(Env.getCtx()));
@ -115,16 +119,21 @@ public class VLocationDialog extends CDialog
m_origCountry_ID = m_location.getC_Country_ID(); m_origCountry_ID = m_location.getC_Country_ID();
// Current Region // Current Region
fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), m_origCountry_ID)); fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), m_origCountry_ID));
if (m_location.getCountry().isHasRegion()) if (m_location.getCountry().isHasRegion()) {
lRegion.setText(m_location.getCountry().getRegionName()); // name for region if ( m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null
&& m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName).trim().length() > 0)
lRegion.setText(m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName));
else
lRegion.setText(Msg.getMsg(Env.getCtx(), "Region"));
}
fRegion.setSelectedItem(m_location.getRegion()); fRegion.setSelectedItem(m_location.getRegion());
// //
fOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
initLocation(); initLocation();
fCountry.addActionListener(this); fCountry.addActionListener(this);
fOnline.addActionListener(this); fOnline.addActionListener(this);
fRegion.addActionListener(this);
AEnv.positionCenterWindow(frame, this); AEnv.positionCenterWindow(frame, this);
} // VLocationDialog } // VLocationDialog
private boolean m_change = false; private boolean m_change = false;
@ -156,7 +165,8 @@ public class VLocationDialog extends CDialog
private CTextField fAddress2 = new CTextField(20); // length=60 private CTextField fAddress2 = new CTextField(20); // length=60
private CTextField fAddress3 = new CTextField(20); // length=60 private CTextField fAddress3 = new CTextField(20); // length=60
private CTextField fAddress4 = new CTextField(20); // length=60 private CTextField fAddress4 = new CTextField(20); // length=60
private CTextField fCity = new CTextField(15); // length=60 private CTextField fCity = new CTextField(20); // length=60
private CityAutoCompleter fCityAutoCompleter;
private CComboBox fCountry; private CComboBox fCountry;
private CComboBox fRegion; private CComboBox fRegion;
private CTextField fPostal = new CTextField(5); // length=10 private CTextField fPostal = new CTextField(5); // length=10
@ -167,6 +177,18 @@ public class VLocationDialog extends CDialog
private Insets labelInsets = new Insets(2,15,2,0); // top,left,bottom,right private Insets labelInsets = new Insets(2,15,2,0); // top,left,bottom,right
private Insets fieldInsets = new Insets(2,5,2,10); private Insets fieldInsets = new Insets(2,5,2,10);
private boolean isCityMandatory = false;
private boolean isRegionMandatory = false;
private boolean isAddress1Mandatory = false;
private boolean isAddress2Mandatory = false;
private boolean isAddress3Mandatory = false;
private boolean isAddress4Mandatory = false;
private boolean isPostalMandatory = false;
private boolean isPostalAddMandatory = false;
private boolean inCountryAction;
private boolean inOKAction;
/** /**
* Static component init * Static component init
* @throws Exception * @throws Exception
@ -184,6 +206,8 @@ public class VLocationDialog extends CDialog
southPanel.add(confirmPanel, BorderLayout.NORTH); southPanel.add(confirmPanel, BorderLayout.NORTH);
// //
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
//
fCityAutoCompleter = new CityAutoCompleter(fCity, m_WindowNo);
} // jbInit } // jbInit
/** /**
@ -192,17 +216,41 @@ public class VLocationDialog extends CDialog
private void initLocation() private void initLocation()
{ {
MCountry country = m_location.getCountry(); MCountry country = m_location.getCountry();
log.fine(country.getName() + ", Region=" + country.isHasRegion() + " " + country.getDisplaySequence() log.fine(country.getName() + ", Region=" + country.isHasRegion() + " " + country.getCaptureSequence()
+ ", C_Location_ID=" + m_location.getC_Location_ID()); + ", C_Location_ID=" + m_location.getC_Location_ID());
// new Region // new Country
if (m_location.getC_Country_ID() != s_oldCountry_ID && country.isHasRegion()) if (country.getC_Country_ID() != s_oldCountry_ID)
{ {
fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), country.getC_Country_ID())); fRegion.removeAllItems();
if (m_location.getRegion() != null) if (country.isHasRegion()) {
fRegion.setSelectedItem(m_location.getRegion()); for (MRegion region : MRegion.getRegions(Env.getCtx(), country.getC_Country_ID())) {
lRegion.setText(country.getRegionName()); fRegion.addItem(region);
}
if ( m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null
&& m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName).trim().length() > 0)
lRegion.setText(m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName));
else
lRegion.setText(Msg.getMsg(Env.getCtx(), "Region"));
}
s_oldCountry_ID = m_location.getC_Country_ID(); s_oldCountry_ID = m_location.getC_Country_ID();
} }
if (m_location.getC_Region_ID() > 0 && m_location.getC_Region().getC_Country_ID() == country.getC_Country_ID()) {
fRegion.setSelectedItem(m_location.getC_Region());
} else {
fRegion.setSelectedItem(null);
m_location.setC_Region_ID(0);
}
if (country.isHasRegion() && m_location.getC_Region_ID() > 0)
{
Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Region_ID", String.valueOf(m_location.getC_Region_ID()));
} else {
Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Region_ID", "0");
}
Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Country_ID", String.valueOf(country.get_ID()));
fCityAutoCompleter.fillList();
gbc.anchor = GridBagConstraints.NORTHWEST; gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridy = 0; // line gbc.gridy = 0; // line
@ -212,43 +260,65 @@ public class VLocationDialog extends CDialog
gbc.fill = GridBagConstraints.HORIZONTAL; gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 0; gbc.weightx = 0;
gbc.weighty = 0; gbc.weighty = 0;
mainPanel.removeAll();
mainPanel.add(Box.createVerticalStrut(5), gbc); // top gap mainPanel.add(Box.createVerticalStrut(5), gbc); // top gap
int line = 1; int line = 1;
addLine(line++, lAddress1, fAddress1);
addLine(line++, lAddress2, fAddress2);
addLine(line++, lAddress3, fAddress3);
addLine(line++, lAddress4, fAddress4);
// sequence of City Postal Region - @P@ @C@ - @C@, @R@ @P@ // sequence of City Postal Region - @P@ @C@ - @C@, @R@ @P@
String ds = country.getDisplaySequence(); String ds = country.getCaptureSequence();
if (ds == null || ds.length() == 0) if (ds == null || ds.length() == 0)
{ {
log.log(Level.SEVERE, "DisplaySequence empty - " + country); log.log(Level.SEVERE, "CaptureSequence empty - " + country);
ds = ""; // @C@, @P@ ds = ""; // @C@, @P@
} }
isCityMandatory = false;
isRegionMandatory = false;
isAddress1Mandatory = false;
isAddress2Mandatory = false;
isAddress3Mandatory = false;
isAddress4Mandatory = false;
isPostalMandatory = false;
isPostalAddMandatory = false;
StringTokenizer st = new StringTokenizer(ds, "@", false); StringTokenizer st = new StringTokenizer(ds, "@", false);
while (st.hasMoreTokens()) while (st.hasMoreTokens())
{ {
String s = st.nextToken(); String s = st.nextToken();
if (s.startsWith("C")) if (s.startsWith("CO")) {
// Country Last
addLine(line++, lCountry, fCountry);
// disable online if this country doesn't have post code lookup
if (m_location.getCountry().isPostcodeLookup()) {
addLine(line++, lOnline, fOnline);
}
} else if (s.startsWith("A1")) {
addLine(line++, lAddress1, fAddress1);
isAddress1Mandatory = s.endsWith("!");
} else if (s.startsWith("A2")) {
addLine(line++, lAddress2, fAddress2);
isAddress2Mandatory = s.endsWith("!");
} else if (s.startsWith("A3")) {
addLine(line++, lAddress3, fAddress3);
isAddress3Mandatory = s.endsWith("!");
} else if (s.startsWith("A4")) {
addLine(line++, lAddress4, fAddress4);
isAddress4Mandatory = s.endsWith("!");
} else if (s.startsWith("C")) {
addLine(line++, lCity, fCity); addLine(line++, lCity, fCity);
else if (s.startsWith("P")) isCityMandatory = s.endsWith("!");
} else if (s.startsWith("P")) {
addLine(line++, lPostal, fPostal); addLine(line++, lPostal, fPostal);
else if (s.startsWith("A")) isPostalMandatory = s.endsWith("!");
} else if (s.startsWith("A")) {
addLine(line++, lPostalAdd, fPostalAdd); addLine(line++, lPostalAdd, fPostalAdd);
else if (s.startsWith("R") && m_location.getCountry().isHasRegion()) isPostalAddMandatory = s.endsWith("!");
} else if (s.startsWith("R") && m_location.getCountry().isHasRegion()) {
addLine(line++, lRegion, fRegion); addLine(line++, lRegion, fRegion);
isRegionMandatory = s.endsWith("!");
}
} }
addLine(line++, lOnline, fOnline);
fOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
// Country Last
addLine(line++, lCountry, fCountry);
// Fill it // Fill it
if (m_location.getC_Location_ID() != 0) if (m_location.getC_Location_ID() != 0)
{ {
@ -261,21 +331,16 @@ public class VLocationDialog extends CDialog
fPostalAdd.setText(m_location.getPostal_Add()); fPostalAdd.setText(m_location.getPostal_Add());
if (m_location.getCountry().isHasRegion()) if (m_location.getCountry().isHasRegion())
{ {
lRegion.setText(m_location.getCountry().getRegionName()); if ( m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName) != null
&& m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName).trim().length() > 0)
lRegion.setText(m_location.getCountry().get_Translation(MCountry.COLUMNNAME_RegionName));
else
lRegion.setText(Msg.getMsg(Env.getCtx(), "Region"));
fRegion.setSelectedItem(m_location.getRegion()); fRegion.setSelectedItem(m_location.getRegion());
} }
// disable online if this country doesn't have post code lookup if (!fCountry.getSelectedItem().equals(country))
if (m_location.getCountry().isPostcodeLookup()) { fCountry.setSelectedItem(country);
fOnline.setEnabled(true);
fOnline.setVisible(true);
}
else {
fOnline.setEnabled(false);
fOnline.setVisible(false);
}
fCountry.setSelectedItem(country);
} }
// Update UI // Update UI
pack(); pack();
@ -308,6 +373,15 @@ public class VLocationDialog extends CDialog
} // addLine } // addLine
@Override
public void dispose()
{
if (!m_change && m_location != null && !m_location.is_new())
{
m_location = new MLocation(m_location.getCtx(), m_location.get_ID(), null);
}
super.dispose();
}
/** /**
* ActionListener * ActionListener
@ -317,9 +391,32 @@ public class VLocationDialog extends CDialog
{ {
if (e.getActionCommand().equals(ConfirmPanel.A_OK)) if (e.getActionCommand().equals(ConfirmPanel.A_OK))
{ {
action_OK(); inOKAction = true;
m_change = true;
dispose(); if (m_location.getCountry().isHasRegion() && fRegion.getSelectedItem() == null) {
if (fCityAutoCompleter.getC_Region_ID() > 0 && fCityAutoCompleter.getC_Region_ID() != m_location.getC_Region_ID()) {
fRegion.setSelectedItem(MRegion.get(Env.getCtx(), fCityAutoCompleter.getC_Region_ID()));
m_location.setRegion(MRegion.get(Env.getCtx(), fCityAutoCompleter.getC_Region_ID()));
}
}
String msg = validate_OK();
if (msg != null) {
ADialog.error(0, this, "FillMandatory", Msg.parseTranslation(Env.getCtx(), msg));
inOKAction = false;
return;
}
if (action_OK())
{
m_change = true;
dispose();
}
else
{
ADialog.error(m_WindowNo, this, "CityNotFound");
}
inOKAction = false;
} }
else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
{ {
@ -330,34 +427,27 @@ public class VLocationDialog extends CDialog
// Country Changed - display in new Format // Country Changed - display in new Format
else if (e.getSource() == fCountry) else if (e.getSource() == fCountry)
{ {
inCountryAction = true;
// Modifier for Mouse selection is 16 - for any key selection 0 // Modifier for Mouse selection is 16 - for any key selection 0
MCountry c = (MCountry)fCountry.getSelectedItem(); MCountry c = (MCountry)fCountry.getSelectedItem();
m_location.setCountry(c); m_location.setCountry(c);
// refresh online button for new country
if (c.isPostcodeLookup()) {
fOnline.setEnabled(true);
fOnline.setVisible(true);
}
else {
fOnline.setEnabled(false);
fOnline.setVisible(false);
}
// update the region name if regions are enabled for this country
if (c.isHasRegion())
{
lRegion.setText(c.getRegionName());
fRegion.setSelectedItem(m_location.getRegion());
// TODO: fix bug that occurs when the new region name is shorter than the old region name
}
// refresh
mainPanel.removeAll();
initLocation(); initLocation();
fCountry.requestFocus(); // allows to use Keybord selection fCountry.requestFocus(); // allows to use Keyboard selection
inCountryAction = false;
}
// Region Changed
else if (e.getSource() == fRegion)
{
if (inCountryAction || inOKAction)
return;
MRegion r = (MRegion)fRegion.getSelectedItem();
m_location.setRegion(r);
m_location.setC_City_ID(0);
m_location.setCity(null);
initLocation();
fRegion.requestFocus(); // allows to use Keyboard selection
} }
else if (e.getSource() == fOnline) else if (e.getSource() == fOnline)
{ {
@ -371,16 +461,51 @@ public class VLocationDialog extends CDialog
} }
} // actionPerformed } // actionPerformed
// LCO - address 1, region and city required
private String validate_OK() {
String fields = "";
if (isAddress1Mandatory && fAddress1.getText().trim().length() == 0) {
fields = fields + " " + "@Address1@, ";
}
if (isAddress2Mandatory && fAddress2.getText().trim().length() == 0) {
fields = fields + " " + "@Address2@, ";
}
if (isAddress3Mandatory && fAddress3.getText().trim().length() == 0) {
fields = fields + " " + "@Address3@, ";
}
if (isAddress4Mandatory && fAddress4.getText().trim().length() == 0) {
fields = fields + " " + "@Address4@, ";
}
if (isCityMandatory && fCity.getText().trim().length() == 0) {
fields = fields + " " + "@C_City_ID@, ";
}
if (isRegionMandatory && fRegion.getSelectedItem() == null) {
fields = fields + " " + "@C_Region_ID@, ";
}
if (isPostalMandatory && fPostal.getText().trim().length() == 0) {
fields = fields + " " + "@Postal@, ";
}
if (isPostalAddMandatory && fPostalAdd.getText().trim().length() == 0) {
fields = fields + " " + "@PostalAdd@, ";
}
if (fields.trim().length() > 0)
return fields.substring(0, fields.length() -2);
return null;
}
/** /**
* OK - check for changes (save them) & Exit * OK - check for changes (save them) & Exit
*/ */
private void action_OK() private boolean action_OK()
{ {
m_location.setAddress1(fAddress1.getText()); m_location.setAddress1(fAddress1.getText());
m_location.setAddress2(fAddress2.getText()); m_location.setAddress2(fAddress2.getText());
m_location.setAddress3(fAddress3.getText()); m_location.setAddress3(fAddress3.getText());
m_location.setAddress4(fAddress4.getText()); m_location.setAddress4(fAddress4.getText());
m_location.setCity(fCity.getText()); m_location.setCity(fCity.getText());
m_location.setC_City_ID(fCityAutoCompleter.getC_City_ID());
m_location.setPostal(fPostal.getText()); m_location.setPostal(fPostal.getText());
m_location.setPostal_Add(fPostalAdd.getText()); m_location.setPostal_Add(fPostalAdd.getText());
// Country/Region // Country/Region
@ -394,7 +519,14 @@ public class VLocationDialog extends CDialog
else else
m_location.setC_Region_ID(0); m_location.setC_Region_ID(0);
// Save changes // Save changes
m_location.save(); if(m_location.save())
{
return true;
}
else
{
return false;
}
} // actionOK } // actionOK
/** /**
@ -452,111 +584,113 @@ public class VLocationDialog extends CDialog
return ""; return "";
} }
/**
* Fills the location field using the information retrieved from postcode
* servers.
*
* @param ctx
* Context
* @param pkeyData
* Lookup results
* @param windowNo
* Window No.
* @param tab
* Tab
* @param field
* Field
*/
private void fillLocation(HashMap<String, Object> postcodeData, MCountry country) {
// If it's not empty warn the user. /**
if (fAddress1 != null || fAddress2 != null * Fills the location field using the information retrieved from postcode
|| fAddress3 != null * servers.
|| fAddress4 != null || fCity != null) { *
String warningMsg = "Existing address information will be overwritten. Proceed?"; * @param ctx
String warningTitle = "Warning"; * Context
int response = JOptionPane.showConfirmDialog(null, warningMsg, * @param pkeyData
warningTitle, JOptionPane.YES_NO_OPTION); * Lookup results
if (response == JOptionPane.NO_OPTION) * @param windowNo
return; * Window No.
} * @param tab
* Tab
* @param field
Set<String> pcodeKeys = postcodeData.keySet(); * Field
Iterator<String> iterator = pcodeKeys.iterator(); */
header = null; private void fillLocation(HashMap<String, Object> postcodeData, MCountry country) {
// Allocate the header array // If it's not empty warn the user.
header = new Object[pcodeKeys.size()]; if (fAddress1 != null || fAddress2 != null
|| fAddress3 != null
String headerStr = null; || fAddress4 != null || fCity != null) {
String warningMsg = "Existing address information will be overwritten. Proceed?";
// need to check how many records returned String warningTitle = "Warning";
// TODO - check number of records returns - size() method is incorrect int response = JOptionPane.showConfirmDialog(null, warningMsg,
if (pcodeKeys.size() > 2) warningTitle, JOptionPane.YES_NO_OPTION);
{ if (response == JOptionPane.NO_OPTION)
// TODO: Implement ResultData Grid and get return (for premises level data) return;
System.out.println("Too many postcodes returned from Postcode Lookup - need to Implement ResultData");
} else
{
for (int i = 0; (headerStr = (iterator.hasNext() ? iterator.next() : null)) != null
|| iterator.hasNext(); i++) {
header[i] = headerStr;
Postcode values = (Postcode) postcodeData.get(headerStr);
// Overwrite the values in location field.
fAddress1.setText(values.getStreet1());
fAddress2.setText(values.getStreet2());
fAddress3.setText(values.getStreet3());
fAddress4.setText(values.getStreet4());
fCity.setText(values.getCity());
fPostal.setText(values.getPostcode());
// Do region lookup
if (country.isHasRegion())
{
// get all regions for this country
MRegion[] regions = MRegion.getRegions(country.getCtx(), country.getC_Country_ID());
// If regions were loaded
if ( regions.length > 0)
{
// loop through regions array to attempt a region match - don't finish loop if region found
boolean found = false;
for (i = 0; i < regions.length && !found; i++)
{
if (regions[i].getName().equals(values.getRegion()) )
{
// found Region
fRegion.setSelectedItem(regions[i]);
log.fine("Found region: " + regions[i].getName());
found = true;
}
}
if (!found)
{
// add new region
MRegion region = new MRegion(country, values.getRegion());
if (region.save())
{
log.fine("Added new region from web service: " + values.getRegion());
// clears cache
Env.reset(false);
//reload regions to combo box
fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), country.getC_Country_ID()));
// select region
fRegion.setSelectedItem(values);
} else
log.severe("Error saving new region: " + region.getName());
}
} else
log.severe("Region lookup failed for Country: " + country.getName());
}
}
}
} }
Set<String> pcodeKeys = postcodeData.keySet();
Iterator<String> iterator = pcodeKeys.iterator();
header = null;
// Allocate the header array
header = new Object[pcodeKeys.size()];
String headerStr = null;
// need to check how many records returned
// TODO - check number of records returns - size() method is incorrect
if (pcodeKeys.size() > 2)
{
// TODO: Implement ResultData Grid and get return (for premises level data)
System.out.println("Too many postcodes returned from Postcode Lookup - need to Implement ResultData");
} else
{
for (int i = 0; (headerStr = (iterator.hasNext() ? iterator.next() : null)) != null
|| iterator.hasNext(); i++) {
header[i] = headerStr;
Postcode values = (Postcode) postcodeData.get(headerStr);
// Overwrite the values in location field.
fAddress1.setText(values.getStreet1());
fAddress2.setText(values.getStreet2());
fAddress3.setText(values.getStreet3());
fAddress4.setText(values.getStreet4());
fCity.setText(values.getCity());
fPostal.setText(values.getPostcode());
// Do region lookup
if (country.isHasRegion())
{
// get all regions for this country
MRegion[] regions = MRegion.getRegions(country.getCtx(), country.getC_Country_ID());
// If regions were loaded
if ( regions.length > 0)
{
// loop through regions array to attempt a region match - don't finish loop if region found
boolean found = false;
for (i = 0; i < regions.length && !found; i++)
{
if (regions[i].getName().equals(values.getRegion()) )
{
// found Region
fRegion.setSelectedItem(regions[i]);
log.fine("Found region: " + regions[i].getName());
found = true;
}
}
if (!found)
{
// add new region
MRegion region = new MRegion(country, values.getRegion());
if (region.save())
{
log.fine("Added new region from web service: " + values.getRegion());
// clears cache
Env.reset(false);
//reload regions to combo box
fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), country.getC_Country_ID()));
// select region
fRegion.setSelectedItem(values);
} else
log.severe("Error saving new region: " + region.getName());
}
} else
log.severe("Region lookup failed for Country: " + country.getName());
}
}
}
}
} // VLocationDialog } // VLocationDialog

View File

@ -0,0 +1,498 @@
-- 22.05.2009 10:25:55 EEST
-- Location AutoComplete - http://sourceforge.net/tracker/?func=detail&aid=2794312&group_id=176962&atid=879335
INSERT INTO AD_Element (UpdatedBy,AD_Element_ID,IsActive,CreatedBy,ColumnName,Name,Description,Updated,Created,AD_Client_ID,AD_Org_ID,PrintName,EntityType) VALUES (0,53838,'Y',0,'AllowCitiesOutOfList','AllowCitiesOutOfList','A flag which tells if a country accept or not new cities',TO_DATE('2009-05-22 10:25:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-22 10:25:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Allow Cities Out Of List','D')
;
-- 22.05.2009 10:25:55 EEST
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Name,Description,Help,PrintName,PO_PrintName,PO_Name,PO_Description,PO_Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Name,t.Description,t.Help,t.PrintName,t.PO_PrintName,t.PO_Name,t.PO_Description,t.PO_Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53838 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 22.05.2009 10:28:40 EEST
INSERT INTO AD_Column (AD_Column_ID,IsParent,AD_Client_ID,AD_Org_ID,IsAutocomplete,AD_Table_ID,FieldLength,Created,CreatedBy,Updated,Version,DefaultValue,IsActive,Description,ColumnName,IsKey,AD_Reference_ID,IsTranslated,IsMandatory,IsIdentifier,SeqNo,IsSelectionColumn,IsSyncDatabase,AD_Element_ID,IsUpdateable,EntityType,Name,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,IsAllowLogging) VALUES (57650,'N',0,0,'N',170,1,TO_DATE('2009-05-22 10:28:37','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2009-05-22 10:28:37','YYYY-MM-DD HH24:MI:SS'),0,'Y','Y','A flag which tells if a country accept or not new cities','AllowCitiesOutOfList','N',20,'N','N','N',0,'N','N',53838,'Y','U','AllowCitiesOutOfList',0,'N','N','Y')
;
-- 22.05.2009 10:28:40 EEST
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57650 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 22.05.2009 10:28:41 EEST
INSERT INTO AD_Field (IsFieldOnly,DisplayLength,AD_Field_ID,IsEncrypted,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,UpdatedBy,IsActive,Created,IsSameLine,IsHeading,CreatedBy,AD_Client_ID,Updated,Description,AD_Org_ID,IsReadOnly,IsCentrallyMaintained,EntityType) VALUES ('N',1,57035,'N','AllowCitiesOutOfList',135,57650,'N',0,'Y',TO_DATE('2009-05-22 10:28:40','YYYY-MM-DD HH24:MI:SS'),'N','N',0,0,TO_DATE('2009-05-22 10:28:40','YYYY-MM-DD HH24:MI:SS'),'A flag which tells if a country accept or not new cities',0,'N','Y','U')
;
-- 22.05.2009 10:28:41 EEST
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57035 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 22.05.2009 10:28:42 EEST
ALTER TABLE C_Country ADD AllowCitiesOutOfList CHAR(1) DEFAULT 'Y' CHECK (AllowCitiesOutOfList IN ('Y','N'))
;
-- 22.05.2009 10:29:08 EEST
UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2009-05-22 10:29:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57650
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=342
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=343
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=345
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=10893
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=10892
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=10891
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=346
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=347
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=348
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=344
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=11184
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=10895
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=10894
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=5753
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5752
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=51000
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:32:17 EEST
INSERT INTO AD_Element (UpdatedBy,AD_Element_ID,IsActive,CreatedBy,ColumnName,Name,Updated,Created,AD_Client_ID,AD_Org_ID,PrintName,EntityType) VALUES (0,53839,'Y',0,'CaptureSequence','CaptureSequence',TO_DATE('2009-05-22 10:32:16','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-22 10:32:16','YYYY-MM-DD HH24:MI:SS'),0,0,'Capture Sequence','D')
;
-- 22.05.2009 10:32:17 EEST
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Name,Description,Help,PrintName,PO_PrintName,PO_Name,PO_Description,PO_Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Name,t.Description,t.Help,t.PrintName,t.PO_PrintName,t.PO_Name,t.PO_Description,t.PO_Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53839 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 22.05.2009 10:32:49 EEST
INSERT INTO AD_Column (AD_Column_ID,IsParent,AD_Client_ID,AD_Org_ID,IsAutocomplete,AD_Table_ID,FieldLength,Created,CreatedBy,Updated,Version,IsActive,ColumnName,IsKey,AD_Reference_ID,IsTranslated,IsMandatory,IsIdentifier,SeqNo,IsSelectionColumn,IsSyncDatabase,AD_Element_ID,IsUpdateable,EntityType,Name,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,IsAllowLogging) VALUES (57651,'N',0,0,'N',170,20,TO_DATE('2009-05-22 10:32:48','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2009-05-22 10:32:48','YYYY-MM-DD HH24:MI:SS'),1,'Y','CaptureSequence','N',10,'N','N','N',0,'N','N',53839,'Y','D','CaptureSequence',0,'N','N','Y')
;
-- 22.05.2009 10:32:49 EEST
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57651 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 22.05.2009 10:32:50 EEST
INSERT INTO AD_Field (IsFieldOnly,DisplayLength,AD_Field_ID,IsEncrypted,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,UpdatedBy,IsActive,Created,IsSameLine,IsHeading,CreatedBy,AD_Client_ID,Updated,AD_Org_ID,IsReadOnly,IsCentrallyMaintained,EntityType) VALUES ('N',20,57036,'N','CaptureSequence',135,57651,'N',0,'Y',TO_DATE('2009-05-22 10:32:49','YYYY-MM-DD HH24:MI:SS'),'N','N',0,0,TO_DATE('2009-05-22 10:32:49','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D')
;
-- 22.05.2009 10:32:50 EEST
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57036 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 22.05.2009 10:32:51 EEST
ALTER TABLE C_Country ADD CaptureSequence NVARCHAR2(20) DEFAULT NULL
;
-- 22.05.2009 10:33:44 EEST
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=57036
;
-- 22.05.2009 10:35:10 EEST
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2009-05-22 10:35:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:35:47 EEST
UPDATE AD_Field SET IsSameLine='N',Updated=TO_DATE('2009-05-22 10:35:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=51003
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=51002
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=51004
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=51001
;
-- 22.05.2009 10:37:10 EEST
UPDATE AD_Field SET IsSameLine='Y', EntityType='D',Updated=TO_DATE('2009-05-22 10:37:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 27.05.2009 11:21:49 EEST
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','The city does not exist and can not be created from here.',0,'Y',TO_DATE('2009-05-27 11:21:48','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-27 11:21:48','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','CityNotFound',53078)
;
-- 27.05.2009 11:21:49 EEST
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53078 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 27.05.2009 11:22:10 EEST
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Orasul nu exista si nu paote fi creat de aici.',Updated=TO_DATE('2009-05-27 11:22:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53078 AND AD_Language='ro_RO'
;
-- 27.05.2009 11:22:16 EEST
UPDATE AD_Message_Trl SET MsgText='Orasul nu exista si nu poate fi creat de aici.',Updated=TO_DATE('2009-05-27 11:22:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53078 AND AD_Language='ro_RO'
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=57036
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=10892
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10891
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=346
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=347
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=348
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=344
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11184
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=10895
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=10894
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5753
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5752
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=51000
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=51003
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=51002
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=51004
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=51001
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Element SET Name='Use Postcode Lookup', PrintName='Use Postcode Lookup',Updated=TO_DATE('2009-09-17 21:37:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Column SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service', AD_Element_ID=51000 WHERE UPPER(ColumnName)='ISPOSTCODELOOKUP' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Element_ID=51000 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Field SET Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51000) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:06 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Use Postcode Lookup', Name='Use Postcode Lookup' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=51000)
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Element SET Name='Lookup ClassName', PrintName='Lookup ClassName',Updated=TO_DATE('2009-09-17 21:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Column SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider', AD_Element_ID=51001 WHERE UPPER(ColumnName)='LOOKUPCLASSNAME' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Element_ID=51001 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Field SET Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51001) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Lookup ClassName', Name='Lookup ClassName' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=51001)
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Element SET Name='Lookup Client ID', PrintName='Lookup Client ID',Updated=TO_DATE('2009-09-17 21:37:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Column SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider', AD_Element_ID=51002 WHERE UPPER(ColumnName)='LOOKUPCLIENTID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Element_ID=51002 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Field SET Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51002) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Lookup Client ID', Name='Lookup Client ID' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=51002)
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Element SET Name='Lookup Password', PrintName='Lookup Password',Updated=TO_DATE('2009-09-17 21:37:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Column SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider', AD_Element_ID=51004 WHERE UPPER(ColumnName)='LOOKUPPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Element_ID=51004 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Field SET Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51004) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Lookup Password', Name='Lookup Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=51004)
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Element SET Name='Lookup URL', PrintName='Lookup URL',Updated=TO_DATE('2009-09-17 21:37:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Column SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data', AD_Element_ID=51003 WHERE UPPER(ColumnName)='LOOKUPURL' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Element_ID=51003 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Field SET Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51003) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Lookup URL', Name='Lookup URL' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=51003)
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Element SET Description='A flag which tells if a country accept or not new cities when capturing locations', Name='Allow Cities out of List', PrintName='Allow Cities out of List',Updated=TO_DATE('2009-09-17 21:38:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Column SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Process_Para SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL, AD_Element_ID=53838 WHERE UPPER(ColumnName)='ALLOWCITIESOUTOFLIST' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Process_Para SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Element_ID=53838 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Field SET Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53838) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Allow Cities out of List', Name='Allow Cities out of List' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=53838)
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Element SET Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.', Name='Capture Sequence',Updated=TO_DATE('2009-09-17 21:45:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Column SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Process_Para SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.', AD_Element_ID=53839 WHERE UPPER(ColumnName)='CAPTURESEQUENCE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Process_Para SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Element_ID=53839 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Field SET Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53839) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Capture Sequence', Name='Capture Sequence' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=53839)
;
-- Sep 17, 2009 9:50:35 PM COT
UPDATE AD_Column SET FieldLength=60,Updated=TO_DATE('2009-09-17 21:50:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57651
;
-- Sep 17, 2009 9:50:41 PM COT
ALTER TABLE C_Country MODIFY CaptureSequence NVARCHAR2(60) DEFAULT NULL
;
-- Sep 17, 2009 9:51:38 PM COT
UPDATE AD_Field SET DisplayLength=40,Updated=TO_DATE('2009-09-17 21:51:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57036
;
update c_country set capturesequence = '@A1@ @A2@ @A3@ @A4@ ' || displaysequence || ' @CO@'
;
-- Sep 17, 2009 9:56:09 PM COT
UPDATE C_Country SET CaptureSequence='@CO@ @R!@ @C!@ @A1!@ @A2@ @A3@ @A4@ @P@',Updated=TO_DATE('2009-09-17 21:56:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 9:57:12 PM COT
UPDATE C_Country SET HasRegion='Y', RegionName='Department',Updated=TO_DATE('2009-09-17 21:57:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 9:57:21 PM COT
UPDATE C_Country SET AllowCitiesOutOfList='Y',Updated=TO_DATE('2009-09-17 21:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 10:00:20 PM COT
UPDATE C_Country_Trl SET IsTranslated='Y',RegionName='Departamento',Updated=TO_DATE('2009-09-17 22:00:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156 AND AD_Language LIKE 'es_%'
;
-- 22-sep-2009 14:02:27 COT
-- FR [2794312] - Location AutoComplete
-- Deprecate form Initial Client Setup
UPDATE AD_Form SET IsActive='N',Updated=TO_DATE('2009-09-22 14:02:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=102
;
-- 22-sep-2009 14:02:30 COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2009-09-22 14:02:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=225
;
-- 22-sep-2009 14:07:20 COT
-- FR [2794312] - Location AutoComplete
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50035,'S',TO_DATE('2009-09-22 14:07:19','YYYY-MM-DD HH24:MI:SS'),100,'Number of rows to show on city autocomplete feature on Location window','D','Y','LOCATION_MAX_CITY_ROWS',TO_DATE('2009-09-22 14:07:19','YYYY-MM-DD HH24:MI:SS'),100,'7')
;

View File

@ -0,0 +1,497 @@
-- 22.05.2009 10:25:55 EEST
-- Location AutoComplete - http://sourceforge.net/tracker/?func=detail&aid=2794312&group_id=176962&atid=879335
INSERT INTO AD_Element (UpdatedBy,AD_Element_ID,IsActive,CreatedBy,ColumnName,Name,Description,Updated,Created,AD_Client_ID,AD_Org_ID,PrintName,EntityType) VALUES (0,53838,'Y',0,'AllowCitiesOutOfList','AllowCitiesOutOfList','A flag which tells if a country accept or not new cities',TO_TIMESTAMP('2009-05-22 10:25:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-22 10:25:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Allow Cities Out Of List','D')
;
-- 22.05.2009 10:25:55 EEST
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Name,Description,Help,PrintName,PO_PrintName,PO_Name,PO_Description,PO_Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Name,t.Description,t.Help,t.PrintName,t.PO_PrintName,t.PO_Name,t.PO_Description,t.PO_Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53838 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 22.05.2009 10:28:40 EEST
INSERT INTO AD_Column (AD_Column_ID,IsParent,AD_Client_ID,AD_Org_ID,IsAutocomplete,AD_Table_ID,FieldLength,Created,CreatedBy,Updated,Version,DefaultValue,IsActive,Description,ColumnName,IsKey,AD_Reference_ID,IsTranslated,IsMandatory,IsIdentifier,SeqNo,IsSelectionColumn,IsSyncDatabase,AD_Element_ID,IsUpdateable,EntityType,Name,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,IsAllowLogging) VALUES (57650,'N',0,0,'N',170,1,TO_TIMESTAMP('2009-05-22 10:28:37','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2009-05-22 10:28:37','YYYY-MM-DD HH24:MI:SS'),0,'Y','Y','A flag which tells if a country accept or not new cities','AllowCitiesOutOfList','N',20,'N','N','N',0,'N','N',53838,'Y','U','AllowCitiesOutOfList',0,'N','N','Y')
;
-- 22.05.2009 10:28:40 EEST
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57650 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 22.05.2009 10:28:41 EEST
INSERT INTO AD_Field (IsFieldOnly,DisplayLength,AD_Field_ID,IsEncrypted,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,UpdatedBy,IsActive,Created,IsSameLine,IsHeading,CreatedBy,AD_Client_ID,Updated,Description,AD_Org_ID,IsReadOnly,IsCentrallyMaintained,EntityType) VALUES ('N',1,57035,'N','AllowCitiesOutOfList',135,57650,'N',0,'Y',TO_TIMESTAMP('2009-05-22 10:28:40','YYYY-MM-DD HH24:MI:SS'),'N','N',0,0,TO_TIMESTAMP('2009-05-22 10:28:40','YYYY-MM-DD HH24:MI:SS'),'A flag which tells if a country accept or not new cities',0,'N','Y','U')
;
-- 22.05.2009 10:28:41 EEST
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57035 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 22.05.2009 10:28:42 EEST
ALTER TABLE C_Country ADD COLUMN AllowCitiesOutOfList CHAR(1) DEFAULT 'Y' CHECK (AllowCitiesOutOfList IN ('Y','N'))
;
-- 22.05.2009 10:29:08 EEST
UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2009-05-22 10:29:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57650
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=342
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=343
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=345
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=10893
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=10892
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=10891
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=346
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=347
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=348
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=344
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=11184
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=10895
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=10894
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=5753
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5752
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=51000
;
-- 22.05.2009 10:30:52 EEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:32:17 EEST
INSERT INTO AD_Element (UpdatedBy,AD_Element_ID,IsActive,CreatedBy,ColumnName,Name,Updated,Created,AD_Client_ID,AD_Org_ID,PrintName,EntityType) VALUES (0,53839,'Y',0,'CaptureSequence','CaptureSequence',TO_TIMESTAMP('2009-05-22 10:32:16','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-22 10:32:16','YYYY-MM-DD HH24:MI:SS'),0,0,'Capture Sequence','D')
;
-- 22.05.2009 10:32:17 EEST
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Name,Description,Help,PrintName,PO_PrintName,PO_Name,PO_Description,PO_Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Name,t.Description,t.Help,t.PrintName,t.PO_PrintName,t.PO_Name,t.PO_Description,t.PO_Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53839 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 22.05.2009 10:32:49 EEST
INSERT INTO AD_Column (AD_Column_ID,IsParent,AD_Client_ID,AD_Org_ID,IsAutocomplete,AD_Table_ID,FieldLength,Created,CreatedBy,Updated,Version,IsActive,ColumnName,IsKey,AD_Reference_ID,IsTranslated,IsMandatory,IsIdentifier,SeqNo,IsSelectionColumn,IsSyncDatabase,AD_Element_ID,IsUpdateable,EntityType,Name,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,IsAllowLogging) VALUES (57651,'N',0,0,'N',170,20,TO_TIMESTAMP('2009-05-22 10:32:48','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2009-05-22 10:32:48','YYYY-MM-DD HH24:MI:SS'),1,'Y','CaptureSequence','N',10,'N','N','N',0,'N','N',53839,'Y','D','CaptureSequence',0,'N','N','Y')
;
-- 22.05.2009 10:32:49 EEST
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57651 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 22.05.2009 10:32:50 EEST
INSERT INTO AD_Field (IsFieldOnly,DisplayLength,AD_Field_ID,IsEncrypted,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,UpdatedBy,IsActive,Created,IsSameLine,IsHeading,CreatedBy,AD_Client_ID,Updated,AD_Org_ID,IsReadOnly,IsCentrallyMaintained,EntityType) VALUES ('N',20,57036,'N','CaptureSequence',135,57651,'N',0,'Y',TO_TIMESTAMP('2009-05-22 10:32:49','YYYY-MM-DD HH24:MI:SS'),'N','N',0,0,TO_TIMESTAMP('2009-05-22 10:32:49','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D')
;
-- 22.05.2009 10:32:50 EEST
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57036 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 22.05.2009 10:32:51 EEST
ALTER TABLE C_Country ADD COLUMN CaptureSequence VARCHAR(20) DEFAULT NULL
;
-- 22.05.2009 10:33:44 EEST
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=57036
;
-- 22.05.2009 10:35:10 EEST
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2009-05-22 10:35:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:35:47 EEST
UPDATE AD_Field SET IsSameLine='N',Updated=TO_TIMESTAMP('2009-05-22 10:35:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=51003
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=51002
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=51004
;
-- 22.05.2009 10:36:41 EEST
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=51001
;
-- 22.05.2009 10:37:10 EEST
UPDATE AD_Field SET IsSameLine='Y', EntityType='D',Updated=TO_TIMESTAMP('2009-05-22 10:37:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57035
;
-- 27.05.2009 11:21:49 EEST
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','The city does not exist and can not be created from here.',0,'Y',TO_TIMESTAMP('2009-05-27 11:21:48','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-27 11:21:48','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','CityNotFound',53078)
;
-- 27.05.2009 11:21:49 EEST
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53078 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 27.05.2009 11:22:10 EEST
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Orasul nu exista si nu paote fi creat de aici.',Updated=TO_TIMESTAMP('2009-05-27 11:22:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53078 AND AD_Language='ro_RO'
;
-- 27.05.2009 11:22:16 EEST
UPDATE AD_Message_Trl SET MsgText='Orasul nu exista si nu poate fi creat de aici.',Updated=TO_TIMESTAMP('2009-05-27 11:22:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53078 AND AD_Language='ro_RO'
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=57036
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=10892
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10891
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=346
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=347
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=348
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=344
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11184
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=10895
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=10894
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5753
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5752
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=51000
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=57035
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=51003
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=51002
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=51004
;
-- Sep 17, 2009 9:35:45 PM COT
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=51001
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Element SET Name='Use Postcode Lookup', PrintName='Use Postcode Lookup',Updated=TO_TIMESTAMP('2009-09-17 21:37:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Column SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Element_ID=51000
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service', AD_Element_ID=51000 WHERE UPPER(ColumnName)='ISPOSTCODELOOKUP' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostcodeLookup', Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Element_ID=51000 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:05 PM COT
UPDATE AD_Field SET Name='Use Postcode Lookup', Description='Does this country have a post code web service', Help='Enable the IsPostcodeLookup if you wish to configure a post code lookup web service' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51000) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:06 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Use Postcode Lookup', Name='Use Postcode Lookup' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=51000)
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Element SET Name='Lookup ClassName', PrintName='Lookup ClassName',Updated=TO_TIMESTAMP('2009-09-17 21:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Column SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Element_ID=51001
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider', AD_Element_ID=51001 WHERE UPPER(ColumnName)='LOOKUPCLASSNAME' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClassName', Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Element_ID=51001 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_Field SET Name='Lookup ClassName', Description='The class name of the postcode lookup plugin', Help='Enter the class name of the post code lookup plugin for your postcode web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51001) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:19 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Lookup ClassName', Name='Lookup ClassName' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=51001)
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Element SET Name='Lookup Client ID', PrintName='Lookup Client ID',Updated=TO_TIMESTAMP('2009-09-17 21:37:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Column SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Element_ID=51002
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider', AD_Element_ID=51002 WHERE UPPER(ColumnName)='LOOKUPCLIENTID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupClientID', Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Element_ID=51002 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_Field SET Name='Lookup Client ID', Description='The ClientID or Login submitted to the Lookup URL', Help='Enter the ClientID or Login for your account provided by the post code web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51002) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:31 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Lookup Client ID', Name='Lookup Client ID' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=51002)
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Element SET Name='Lookup Password', PrintName='Lookup Password',Updated=TO_TIMESTAMP('2009-09-17 21:37:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Column SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Element_ID=51004
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider', AD_Element_ID=51004 WHERE UPPER(ColumnName)='LOOKUPPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupPassword', Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Element_ID=51004 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_Field SET Name='Lookup Password', Description='The password submitted to the Lookup URL', Help='Enter the password for your account provided by the post code web service provider' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51004) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:38 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Lookup Password', Name='Lookup Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=51004)
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Element SET Name='Lookup URL', PrintName='Lookup URL',Updated=TO_TIMESTAMP('2009-09-17 21:37:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Column SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Element_ID=51003
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data', AD_Element_ID=51003 WHERE UPPER(ColumnName)='LOOKUPURL' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Process_Para SET ColumnName='LookupUrl', Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Element_ID=51003 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_Field SET Name='Lookup URL', Description='The URL of the web service that the plugin connects to in order to retrieve postcode data', Help='Enter the URL of the web service that the plugin connects to in order to retrieve postcode data' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=51003) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:37:50 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Lookup URL', Name='Lookup URL' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=51003)
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Element SET Description='A flag which tells if a country accept or not new cities when capturing locations', Name='Allow Cities out of List', PrintName='Allow Cities out of List',Updated=TO_TIMESTAMP('2009-09-17 21:38:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Column SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Element_ID=53838
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Process_Para SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL, AD_Element_ID=53838 WHERE UPPER(ColumnName)='ALLOWCITIESOUTOFLIST' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Process_Para SET ColumnName='AllowCitiesOutOfList', Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Element_ID=53838 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_Field SET Name='Allow Cities out of List', Description='A flag which tells if a country accept or not new cities when capturing locations', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53838) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:38:21 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Allow Cities out of List', Name='Allow Cities out of List' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=53838)
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Element SET Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.', Name='Capture Sequence',Updated=TO_TIMESTAMP('2009-09-17 21:45:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Column SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Element_ID=53839
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Process_Para SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.', AD_Element_ID=53839 WHERE UPPER(ColumnName)='CAPTURESEQUENCE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Process_Para SET ColumnName='CaptureSequence', Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Element_ID=53839 AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_Field SET Name='Capture Sequence', Description=NULL, Help='The Capture Sequence defines the fields to be used when capturing an address on this country. The following notations are used: @CO@=Country, @C@=City, @P@=Postal, @A@=PostalAdd, @R@=Region, @A1@=Address 1 to @A4@=Address 4. Country is always mandatory, add a bang ! to make another field mandatory, for example @C!@ makes city mandatory, @A1!@ makes Address 1 mandatory.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53839) AND IsCentrallyMaintained='Y'
;
-- Sep 17, 2009 9:45:01 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Capture Sequence', Name='Capture Sequence' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=53839)
;
-- Sep 17, 2009 9:50:35 PM COT
UPDATE AD_Column SET FieldLength=60,Updated=TO_TIMESTAMP('2009-09-17 21:50:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57651
;
-- Sep 17, 2009 9:50:41 PM COT
insert into t_alter_column values('c_country','CaptureSequence','VARCHAR(60)',null,'NULL')
;
-- Sep 17, 2009 9:51:38 PM COT
UPDATE AD_Field SET DisplayLength=40,Updated=TO_TIMESTAMP('2009-09-17 21:51:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57036
;
update c_country set capturesequence = '@A1@ @A2@ @A3@ @A4@ ' || displaysequence || ' @CO@'
;
-- Sep 17, 2009 9:56:09 PM COT
UPDATE C_Country SET CaptureSequence='@CO@ @R!@ @C!@ @A1!@ @A2@ @A3@ @A4@ @P@',Updated=TO_TIMESTAMP('2009-09-17 21:56:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 9:57:12 PM COT
UPDATE C_Country SET HasRegion='Y', RegionName='Department',Updated=TO_TIMESTAMP('2009-09-17 21:57:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 9:57:17 PM COT
UPDATE C_Country SET AllowCitiesOutOfList='Y',Updated=TO_TIMESTAMP('2009-09-17 21:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156
;
-- Sep 17, 2009 10:00:20 PM COT
UPDATE C_Country_Trl SET IsTranslated='Y',RegionName='Departamento',Updated=TO_TIMESTAMP('2009-09-17 22:00:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=156 AND AD_Language LIKE 'es_%'
;
-- 22-sep-2009 14:02:27 COT
-- FR [2794312] - Location AutoComplete
-- Deprecate form Initial Client Setup
UPDATE AD_Form SET IsActive='N',Updated=TO_TIMESTAMP('2009-09-22 14:02:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=102
;
-- 22-sep-2009 14:02:30 COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2009-09-22 14:02:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=225
;
-- 22-sep-2009 14:07:20 COT
-- FR [2794312] - Location AutoComplete
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50035,'S',TO_TIMESTAMP('2009-09-22 14:07:19','YYYY-MM-DD HH24:MI:SS'),100,'Number of rows to show on city autocomplete feature on Location window','D','Y','LOCATION_MAX_CITY_ROWS',TO_TIMESTAMP('2009-09-22 14:07:19','YYYY-MM-DD HH24:MI:SS'),100,'7')
;

View File

@ -1,154 +1,154 @@
/****************************************************************************** /******************************************************************************
* Product: Posterita Ajax UI * * Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope * * by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. * * See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along * * You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ * * or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import org.zkoss.zk.ui.event.InputEvent; import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
/** /**
* Auto-complete with combobox. * Auto-complete with combobox.
* Based on ZK's Auto-complete * Based on ZK's Auto-complete
* *
* @author Niraj Sohun * @author Niraj Sohun
* Aug 20, 2007 * Aug 20, 2007
*/ */
public class AutoComplete extends Combobox public class AutoComplete extends Combobox
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 2642639623099513816L; private static final long serialVersionUID = 2642639623099513816L;
/** comboItems All menu labels */ /** comboItems All menu labels */
private String[] comboItems; private String[] comboItems;
/** strDescription Description of menu items */ /** strDescription Description of menu items */
private String[] strDescription; private String[] strDescription;
/** /**
* Set menu labels * Set menu labels
* *
* @param vals Menu labels * @param vals Menu labels
*/ */
public void setDict(String[] vals) public void setDict(String[] vals)
{ {
comboItems = vals; comboItems = vals;
if (comboItems != null) if (comboItems != null)
{ {
Arrays.sort(comboItems); Arrays.sort(comboItems);
} }
} }
/** /**
* Set description of menu items * Set description of menu items
* *
* @param vals Description of menu items * @param vals Description of menu items
*/ */
public void setDescription(String[] vals) public void setDescription(String[] vals)
{ {
strDescription = vals; strDescription = vals;
} }
/** /**
* Constructor * Constructor
*/ */
public AutoComplete() public AutoComplete()
{ {
if (comboItems != null) if (comboItems != null)
refresh(""); refresh("");
} }
public AutoComplete(String value) public AutoComplete(String value)
{ {
super.setValue(value); super.setValue(value);
} }
public void setValue(String value) public void setValue(String value)
{ {
super.setValue(value); super.setValue(value);
refresh(value); refresh(value);
} }
/** /**
* Event handler responsible to reducing number of items * Event handler responsible to reducing number of items
* Method is invoked each time something is typed in the combobox * Method is invoked each time something is typed in the combobox
* *
* @param evt The event * @param evt The event
*/ */
public void onChanging(InputEvent evt) public void onChanging(InputEvent evt)
{ {
if (!evt.isChangingBySelectBack()) if (!evt.isChangingBySelectBack())
{ {
refresh(evt.getValue()); refresh(evt.getValue());
} }
} }
/** /**
* Refresh comboitem based on the specified value. * Refresh comboitem based on the specified value.
*/ */
private void refresh(String val) private void refresh(String val)
{ {
if ((val == null) || (val.trim().length() == 0)) { if (comboItems == null || val == null) {
super.getChildren().clear(); super.getChildren().clear();
return; return;
} }
String compare = val.toLowerCase().trim(); String compare = val.toLowerCase().trim();
Iterator<?> it = getItems().iterator(); Iterator<?> it = getItems().iterator();
for (int i = 0; i < comboItems.length; i++) for (int i = 0; i < comboItems.length; i++)
{ {
boolean match = false; boolean match = false;
if (compare.length() < 3) if (compare.length() < 3)
{ {
match = comboItems[i].toLowerCase().startsWith(compare); match = comboItems[i].toLowerCase().startsWith(compare);
} }
else else
{ {
match = comboItems[i].toLowerCase().contains(compare); match = comboItems[i].toLowerCase().contains(compare);
} }
if (match) if (match)
{ {
Comboitem comboitem = null; Comboitem comboitem = null;
if (it != null && it.hasNext()) { if (it != null && it.hasNext()) {
comboitem = ((Comboitem)it.next()); comboitem = ((Comboitem)it.next());
} else { } else {
it = null; it = null;
comboitem = new Comboitem(); comboitem = new Comboitem();
super.appendChild(comboitem); super.appendChild(comboitem);
} }
comboitem.setLabel(comboItems[i]); comboitem.setLabel(comboItems[i]);
comboitem.setDescription(strDescription[i]); comboitem.setDescription(strDescription[i]);
} }
} }
while (it != null && it.hasNext()) { while (it != null && it.hasNext()) {
it.next(); it.next();
it.remove(); it.remove();
} }
} }
} }

View File

@ -0,0 +1,245 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.window;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.adempiere.exceptions.DBException;
import org.adempiere.webui.component.AutoComplete;
import org.compiere.grid.ed.CityVO;
import org.compiere.model.MSysConfig;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zul.Timer;
/**
* @author Cristina Ghita - www.arhipac.ro
*
*/
public class WAutoCompleterCity extends AutoComplete implements EventListener
{
/**
*
*/
private static final long serialVersionUID = 318310285903469314L;
private static final int PopupDelayMillis = 500;
private final Timer timer = new Timer(PopupDelayMillis);
private CityVO m_city = null;
private ArrayList<CityVO> m_cities = new ArrayList<CityVO>();
private ArrayList<CityVO> m_citiesShow = new ArrayList<CityVO>();
private final int m_maxRows = MSysConfig.getIntValue("LOCATION_MAX_CITY_ROWS", 7);
public static final CityVO ITEM_More = new CityVO(-1, "...", -1, "");
private final int m_windowNo;
public WAutoCompleterCity(int m_windowNo)
{
super();
this.m_windowNo = m_windowNo;
this.addEventListener(Events.ON_SELECT, this);
}
private void showPopupDelayed()
{
timer.setRepeats(false);
timer.start();
}
@Override
public void onChanging(InputEvent evt)
{
showPopupDelayed();
refreshData(evt.getValue());
super.onChanging(evt);
}
public void refreshData(String val)
{
String search = val;
if (m_city != null && m_city.CityName.compareTo(search) != 0)
{
setCity(null);
}
m_citiesShow.clear();
this.removeAllItems();
this.setDict(null);
this.setDescription(null);
boolean truncated = false;
search = search.toUpperCase();
int i = 0;
for (CityVO vo : m_cities) {
if (vo.CityName.toUpperCase().startsWith(search)) {
if (i > 0 && i == m_maxRows+1)
{
m_citiesShow.add(ITEM_More);
truncated = true;
break;
}
m_citiesShow.add(vo);
i++;
}
}
//if there is no city on the list return false, to not show the popup
if (m_citiesShow.isEmpty())
{
return;
}
else
{
CityVO city = (CityVO) m_citiesShow.get(0);
if (city.CityName.equalsIgnoreCase(search))
{
m_city = city;
return;
}
}
//if the list has only one item, but that item is not equals with m_city
//return false to not show any popup
if (!truncated && m_citiesShow.size() == 1
&& m_city != null && m_citiesShow.get(0).equals(this.m_city))
{
return;
}
String[] cityValues = new String[m_citiesShow.size()];
String[] cityDesc = new String[m_citiesShow.size()];
i = 0;
for (CityVO vo : m_citiesShow) {
cityValues[i] = vo.CityName;
cityDesc[i] = vo.RegionName;
i++;
}
//
this.removeAllItems();
this.setDict(cityValues);
this.setDescription(cityDesc);
}
public void fillList()
{
// Carlos Ruiz - globalqss - improve to avoid going to the database on every keystroke
m_cities.clear();
m_citiesShow.clear();
ArrayList<Object> params = new ArrayList<Object>();
final StringBuffer sql = new StringBuffer(
"SELECT cy.C_City_ID, cy.Name, cy.C_Region_ID, r.Name"
+" FROM C_City cy"
+" LEFT OUTER JOIN C_Region r ON (r.C_Region_ID=cy.C_Region_ID)"
+" WHERE cy.AD_Client_ID IN (0,?)");
params.add(getAD_Client_ID());
if (getC_Region_ID() > 0)
{
sql.append(" AND cy.C_Region_ID=?");
params.add(getC_Region_ID());
}
if (getC_Country_ID() > 0)
{
sql.append(" AND cy.C_Country_ID=?");
params.add(getC_Country_ID());
}
sql.append(" ORDER BY cy.Name, r.Name");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
DB.setParameters(pstmt, params);
rs = pstmt.executeQuery();
int i = 0;
while(rs.next())
{
CityVO vo = new CityVO(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getString(4));
m_cities.add(vo);
if (i <= m_maxRows) {
m_citiesShow.add(vo);
} else if (i == m_maxRows + 1 && i > 0) {
m_citiesShow.add(ITEM_More);
}
i++;
}
}
catch (SQLException e)
{
throw new DBException(e, sql.toString());
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
refreshData("");
}
private void setCity(CityVO vo)
{
m_city = vo;
}
public int getC_City_ID()
{
return m_city != null ? m_city.C_City_ID : -1;
}
public int getAD_Client_ID()
{
return Env.getAD_Client_ID(Env.getCtx());
}
public int getC_Country_ID()
{
return Env.getContextAsInt(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Country_ID");
}
public int getC_Region_ID()
{
return Env.getContextAsInt(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Region_ID");
}
public void onEvent(Event event) throws Exception
{
System.out.println("Event: " + event.getName());
event.toString();
int index = this.getSelectedIndex();
System.out.println("Index = " +index );
if (index>=0)
{
CityVO city = (CityVO) m_citiesShow.get(index);
if(event == null || city.equals(ITEM_More))
{
setCity(null);
return;
}
setCity(city);
Env.setContext(Env.getCtx(), m_windowNo, Env.TAB_INFO, "C_Region_ID", String.valueOf(city.C_Region_ID));
this.setText(city.CityName);
}
}
}