IDEMPIERE-158 Make selection of login languages more flexible

This commit is contained in:
David Peñuela 2012-10-23 17:32:04 -05:00
parent 1461cf652e
commit 7b7f63f405
6 changed files with 159 additions and 3 deletions

View File

@ -0,0 +1,36 @@
-- Oct 19, 2012 10:16:51 AM COT
-- IDEMPIERE-158 Make selection of login languages more flexible
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,Description,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsLoginLocale',200192,'D','Login Locale',NULL,'Login Locale','0c0807db-3938-4f20-8937-3efa0b77f774',0,TO_DATE('2012-10-19 10:16:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-19 10:16:49','YYYY-MM-DD HH24:MI:SS'),0,0,0,'Y')
;
-- Oct 19, 2012 10:16:51 AM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200192 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 10:21:04 AM COT
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,111,200709,'D','N','N','N',0,'N',1,'N',20,'N','N',200192,'N','Y','e576ec6f-1106-4807-ae4c-fba78b88b854','N','Y','N','IsLoginLocale','N','Login Locale','Y',0,TO_DATE('2012-10-19 10:21:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-10-19 10:21:03','YYYY-MM-DD HH24:MI:SS'),0,0,0)
;
-- Oct 19, 2012 10:21:04 AM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200709 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 10:21:24 AM COT
ALTER TABLE AD_Language ADD IsLoginLocale CHAR(1) DEFAULT 'N' CHECK (IsLoginLocale IN ('Y','N'))
;
-- Oct 19, 2012 11:44:48 AM COT
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines) VALUES (0,'N',112,0,'N','N',200709,60,'Y',200654,'N','D','Login Locale','Y','N','e6657fb8-9911-4b00-b5f9-1d75171af2bf',0,0,TO_DATE('2012-10-19 11:44:46','YYYY-MM-DD HH24:MI:SS'),0,0,TO_DATE('2012-10-19 11:44:46','YYYY-MM-DD HH24:MI:SS'),'Y','Y',60,2,1,1)
;
-- Oct 19, 2012 11:44:48 AM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200654 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
UPDATE AD_Language
SET IsLoginLocale = 'Y'
WHERE AD_Language IN (SELECT DISTINCT AD_Language FROM AD_Message_Trl)
;
SELECT register_migration_script('941_IDEMPIERE-158.sql') FROM dual
;

View File

@ -0,0 +1,36 @@
-- Oct 19, 2012 10:16:51 AM COT
-- IDEMPIERE-158 Make selection of login languages more flexible
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,Description,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsLoginLocale',200192,'D','Login Locale',NULL,'Login Locale','0c0807db-3938-4f20-8937-3efa0b77f774',0,TO_TIMESTAMP('2012-10-19 10:16:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-19 10:16:49','YYYY-MM-DD HH24:MI:SS'),0,0,0,'Y')
;
-- Oct 19, 2012 10:16:51 AM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200192 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 10:21:04 AM COT
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,111,200709,'D','N','N','N',0,'N',1,'N',20,'N','N',200192,'N','Y','e576ec6f-1106-4807-ae4c-fba78b88b854','N','Y','N','IsLoginLocale','N','Login Locale','Y',0,TO_TIMESTAMP('2012-10-19 10:21:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-10-19 10:21:03','YYYY-MM-DD HH24:MI:SS'),0,0,0)
;
-- Oct 19, 2012 10:21:04 AM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200709 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 10:21:24 AM COT
ALTER TABLE AD_Language ADD COLUMN IsLoginLocale CHAR(1) DEFAULT 'N' CHECK (IsLoginLocale IN ('Y','N'))
;
-- Oct 19, 2012 11:44:48 AM COT
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines) VALUES (0,'N',112,0,'N','N',200709,60,'Y',200654,'N','D','Login Locale','Y','N','e6657fb8-9911-4b00-b5f9-1d75171af2bf',0,0,TO_TIMESTAMP('2012-10-19 11:44:46','YYYY-MM-DD HH24:MI:SS'),0,0,TO_TIMESTAMP('2012-10-19 11:44:46','YYYY-MM-DD HH24:MI:SS'),'Y','Y',60,2,1,1)
;
-- Oct 19, 2012 11:44:48 AM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200654 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
UPDATE AD_Language
SET IsLoginLocale = 'Y'
WHERE AD_Language IN (SELECT DISTINCT AD_Language FROM AD_Message_Trl)
;
SELECT register_migration_script('941_IDEMPIERE-158.sql') FROM dual
;

View File

@ -31,7 +31,7 @@ public interface I_AD_Language
public static final String Table_Name = "AD_Language";
/** AD_Table_ID=111 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 111;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -71,6 +71,15 @@ public interface I_AD_Language
/** Get Language ID */
public int getAD_Language_ID();
/** Column name AD_Language_UU */
public static final String COLUMNNAME_AD_Language_UU = "AD_Language_UU";
/** Set AD_Language_UU */
public void setAD_Language_UU (String AD_Language_UU);
/** Get AD_Language_UU */
public String getAD_Language_UU();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
@ -165,6 +174,15 @@ public interface I_AD_Language
*/
public boolean isDecimalPoint();
/** Column name IsLoginLocale */
public static final String COLUMNNAME_IsLoginLocale = "IsLoginLocale";
/** Set Login Locale */
public void setIsLoginLocale (boolean IsLoginLocale);
/** Get Login Locale */
public boolean isLoginLocale();
/** Column name IsSystemLanguage */
public static final String COLUMNNAME_IsSystemLanguage = "IsSystemLanguage";

View File

@ -30,7 +30,7 @@ public class X_AD_Language extends PO implements I_AD_Language, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20121019L;
/** Standard Constructor */
public X_AD_Language (Properties ctx, int AD_Language_ID, String trxName)
@ -114,6 +114,20 @@ public class X_AD_Language extends PO implements I_AD_Language, I_Persistent
return ii.intValue();
}
/** Set AD_Language_UU.
@param AD_Language_UU AD_Language_UU */
public void setAD_Language_UU (String AD_Language_UU)
{
set_Value (COLUMNNAME_AD_Language_UU, AD_Language_UU);
}
/** Get AD_Language_UU.
@return AD_Language_UU */
public String getAD_Language_UU ()
{
return (String)get_Value(COLUMNNAME_AD_Language_UU);
}
/** Set ISO Country Code.
@param CountryCode
Upper-case two-letter alphanumeric ISO Country code according to ISO 3166-1 - http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
@ -196,6 +210,27 @@ public class X_AD_Language extends PO implements I_AD_Language, I_Persistent
return false;
}
/** Set Login Locale.
@param IsLoginLocale Login Locale */
public void setIsLoginLocale (boolean IsLoginLocale)
{
set_Value (COLUMNNAME_IsLoginLocale, Boolean.valueOf(IsLoginLocale));
}
/** Get Login Locale.
@return Login Locale */
public boolean isLoginLocale ()
{
Object oo = get_Value(COLUMNNAME_IsLoginLocale);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set System Language.
@param IsSystemLanguage
The screens, etc. are maintained in this Language

View File

@ -1104,6 +1104,37 @@ public final class Env
return AD_Languages;
}
public static ArrayList<String> getLoginLanguages()
{
ArrayList<String> AD_Languages = new ArrayList<String>();
String sql = "SELECT AD_Language FROM AD_Language WHERE IsLoginLocale = 'Y'";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
rs = pstmt.executeQuery();
while (rs.next())
{
String AD_Language = rs.getString(1);
// called to add the language to supported in case it's not added
Language.getLanguage(AD_Language);
AD_Languages.add(AD_Language);
}
}
catch (SQLException e)
{
getLogger().log(Level.SEVERE, "", e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return AD_Languages;
}
/**
* Verify Language.
* Check that language is supported by the system

View File

@ -341,7 +341,7 @@ public class LoginPanel extends Window implements EventListener<Event>
// Update Language List
lstLanguage.getItems().clear();
ArrayList<String> supported = Env.getSupportedLanguages();
ArrayList<String> supported = Env.getLoginLanguages();
String[] availableLanguages = Language.getNames();
for (String langName : availableLanguages) {
Language language = Language.getLanguage(langName);