Search in sources :

Example 1 with MCountry

use of org.compiere.model.MCountry in project adempiere by adempiere.

the class XML method genCountryList.

private StringBuffer genCountryList(StringBuffer result) {
    result.append("<c_country>\n");
    result.append("  <default>\n");
    MCountry defaultCountry = MCountry.getDefault(getCtx());
    result = defaultCountry.get_xmlString(result);
    result.append("  </default>\n");
    MCountry[] theseCountries = MCountry.getCountries(getCtx());
    for (int i = 0; i < theseCountries.length; i++) {
        result = theseCountries[i].get_xmlString(result);
    }
    result.append("</c_country>\n");
    return result;
}
Also used : MCountry(org.compiere.model.MCountry)

Example 2 with MCountry

use of org.compiere.model.MCountry in project adempiere by adempiere.

the class WLocation method getCountry.

//  fillform
/**
	 *  Get Country Pick-List
	 *
	 *  @param location location model
	 *  @param ws window status
	 *  @return Select Field with Countries
	 */
private select getCountry(MLocation location, WWindowStatus ws) {
    MCountry[] countries = MCountry.getCountries(location.getCtx());
    int comp = location.getC_Country_ID();
    if (comp == 0)
        comp = Env.getContextAsInt(ws.ctx, "C_Country_ID");
    option[] options = new option[countries.length];
    for (int i = 0; i < countries.length; i++) {
        options[i] = new option(String.valueOf(countries[i].getC_Country_ID()));
        options[i].addElement(countries[i].getName());
        if (comp == countries[i].getC_Country_ID())
            options[i].setSelected(true);
    }
    select select = new select(P_C_COUNTRY_ID, options);
    return select;
}
Also used : MCountry(org.compiere.model.MCountry) org.apache.ecs.xhtml.select(org.apache.ecs.xhtml.select) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option)

Example 3 with MCountry

use of org.compiere.model.MCountry in project adempiere by adempiere.

the class VLocationDialog method actionPerformed.

/**
	 *	ActionListener
	 *  @param e ActionEvent
	 */
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
        inOKAction = true;
        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)) {
        m_change = false;
        dispose();
    } else //	Country Changed - display in new Format
    if (e.getSource() == fCountry) {
        inCountryAction = true;
        //	Modifier for Mouse selection is 16  - for any key selection 0
        MCountry c = (MCountry) fCountry.getSelectedItem();
        m_location.setCountry(c);
        initLocation();
        //	allows to use Keyboard selection
        fCountry.requestFocus();
        inCountryAction = false;
    } else //		Region Changed 
    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();
        //	allows to use Keyboard selection
        fRegion.requestFocus();
    } else if (e.getSource() == fOnline) {
        // check to see if we have a postcode lookup plugin for this country
        MCountry c = (MCountry) fCountry.getSelectedItem();
        if (c.isPostcodeLookup()) {
            lookupPostcode(c, fPostal.getText());
        }
    } else if (e.getSource() == bUrl) {
        Env.startBrowser(DefaultContextProvider.GOOGLE_MAPS_URL_PREFIX + getCurrentLocation());
    }
}
Also used : MCountry(org.compiere.model.MCountry) MRegion(org.compiere.model.MRegion)

Example 4 with MCountry

use of org.compiere.model.MCountry in project adempiere by adempiere.

the class VLocationDialog method getCurrentLocation.

/**
	 * 	Get edited Value (MLocation)
	 *	@return location
	 */
private String getCurrentLocation() {
    m_location.setAddress1(fAddress1.getText());
    m_location.setAddress2(fAddress2.getText());
    m_location.setAddress3(fAddress3.getText());
    m_location.setAddress4(fAddress4.getText());
    m_location.setCity(fCity.getText());
    m_location.setPostal(fPostal.getText());
    m_location.setPostal_Add(fPostalAdd.getText());
    //  Country/Region
    MCountry c = (MCountry) fCountry.getSelectedItem();
    m_location.setCountry(c);
    if (m_location.getCountry().isHasRegion()) {
        MRegion r = (MRegion) fRegion.getSelectedItem();
        m_location.setRegion(r);
    } else
        m_location.setC_Region_ID(0);
    return m_location.toString().replace(" ", "%");
}
Also used : MCountry(org.compiere.model.MCountry) MRegion(org.compiere.model.MRegion)

Example 5 with MCountry

use of org.compiere.model.MCountry in project adempiere by adempiere.

the class InitialClientSetup method main.

public static void main(String[] args) {
    Adempiere.startupEnvironment(false);
    CLogMgt.setLevel(Level.CONFIG);
    String propFileName = Adempiere.getAdempiereHome() + File.separatorChar + "clientsetup.properties";
    if (args.length > 0)
        propFileName = args[0];
    ProcessInfo pi = new ProcessInfo("Initial Client Setup", 53161);
    pi.setAD_Client_ID(0);
    pi.setAD_User_ID(100);
    Properties prop = new Properties();
    try {
        prop.load(new FileInputStream(propFileName));
        pi.addParameter("ClientName", prop.getProperty("ClientName"), prop.getProperty("ClientName"));
        pi.addParameter("OrgValue", prop.getProperty("OrgValue"), prop.getProperty("OrgValue"));
        pi.addParameter("OrgName", prop.getProperty("OrgName"), prop.getProperty("OrgName"));
        pi.addParameter("AdminUserName", prop.getProperty("AdminUserName"), prop.getProperty("AdminUserName"));
        pi.addParameter("NormalUserName", prop.getProperty("NormalUserName"), prop.getProperty("NormalUserName"));
        if (prop.getProperty("CurrencyCode") != null) {
            MCurrency currency = MCurrency.get(Env.getCtx(), prop.getProperty("CurrencyCode"));
            if (currency != null)
                pi.addParameter("C_Currency_ID", currency.getC_Currency_ID(), currency.getISO_Code());
        }
        if (prop.getProperty("CountryCode") != null) {
            MCountry country = MCountry.get(Env.getCtx(), prop.getProperty("CountryCode"));
            if (country != null)
                pi.addParameter("C_Country_ID", country.getC_Country_ID(), country.getCountryCode());
        }
        pi.addParameter("C_Region_ID", prop.getProperty("C_Region_ID"), prop.getProperty("C_Region_ID"));
        pi.addParameter("CityName", prop.getProperty("CityName"), prop.getProperty("CityName"));
        pi.addParameter("C_City_ID", prop.getProperty("C_City_ID"), prop.getProperty("C_City_ID"));
        pi.addParameter("Postal", prop.getProperty("Postal"), prop.getProperty("Postal"));
        pi.addParameter("Address1", prop.getProperty("Address1"), prop.getProperty("Address1"));
        pi.addParameter("IsUseBPDimension", prop.getProperty("IsUseBPDimension"), prop.getProperty("IsUseBPDimension"));
        pi.addParameter("IsUseProductDimension", prop.getProperty("IsUseProductDimension"), prop.getProperty("IsUseProductDimension"));
        pi.addParameter("IsUseProjectDimension", prop.getProperty("IsUseProjectDimension"), prop.getProperty("IsUseProjectDimension"));
        pi.addParameter("IsUseCampaignDimension", prop.getProperty("IsUseCampaignDimension"), prop.getProperty("IsUseCampaignDimension"));
        pi.addParameter("IsUseSalesRegionDimension", prop.getProperty("IsUseSalesRegionDimension"), prop.getProperty("IsUseSalesRegionDimension"));
        pi.addParameter("CoAFile", prop.getProperty("CoAFile"), prop.getProperty("CoAFile"));
        pi.addParameter("Phone", prop.getProperty("Phone"), prop.getProperty("Phone"));
        pi.addParameter("Phone2", prop.getProperty("Phone2"), prop.getProperty("Phone2"));
        pi.addParameter("Fax", prop.getProperty("Fax"), prop.getProperty("Fax"));
        pi.addParameter("EMail", prop.getProperty("EMail"), prop.getProperty("EMail"));
        pi.addParameter("TaxID", prop.getProperty("TaxID"), prop.getProperty("TaxID"));
        pi.addParameter("Logo", prop.getProperty("Logo"), prop.getProperty("Logo"));
        pi.addParameter("StartDate", prop.getProperty("StartDate"), prop.getProperty("StartDate"));
        pi.addParameter("HistoryYears", prop.getProperty("HistoryYears"), prop.getProperty("HistoryYears"));
        pi.addParameter("DUNS", prop.getProperty("DUNS"), prop.getProperty("DUNS"));
        pi.addParameter("BankName", prop.getProperty("BankName"), prop.getProperty("BankName"));
        pi.addParameter("RoutingNo", prop.getProperty("RoutingNo"), prop.getProperty("RoutingNo"));
        pi.addParameter("AccountNo", prop.getProperty("AccountNo"), prop.getProperty("AccountNo"));
    } catch (Exception e) {
    // TODO: handle exception
    }
    InitialClientSetup setup = new InitialClientSetup();
    setup.startProcess(Env.getCtx(), pi, null);
}
Also used : MCountry(org.compiere.model.MCountry) MCurrency(org.compiere.model.MCurrency) ProcessInfo(org.compiere.process.ProcessInfo) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) AdempiereException(org.adempiere.exceptions.AdempiereException)

Aggregations

MCountry (org.compiere.model.MCountry)16 MRegion (org.compiere.model.MRegion)9 org.apache.ecs.xhtml.option (org.apache.ecs.xhtml.option)3 Properties (java.util.Properties)2 StringTokenizer (java.util.StringTokenizer)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)2 MCurrency (org.compiere.model.MCurrency)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 ServletException (javax.servlet.ServletException)1 HttpSession (javax.servlet.http.HttpSession)1 Row (org.adempiere.webui.component.Row)1 MCity (org.compiere.model.MCity)1 MLanguage (org.compiere.model.MLanguage)1 MLocation (org.compiere.model.MLocation)1 MSetup (org.compiere.model.MSetup)1 Query (org.compiere.model.Query)1