Fixes issue 0016049: Months appear in english
authorAdrián Romero <adrianromero@openbravo.com>
Fri, 04 Mar 2011 18:11:49 +0100
changeset 11029 715982f134f9
parent 11028 268243d4b031
child 11030 54035895d104
Fixes issue 0016049: Months appear in english
It has been added a new parameter for the Create Periods process to set the language the month names are going to be created
src-db/database/model/functions/C_YEARPERIODS.xml
src-db/database/sourcedata/AD_PROCESS_PARA.xml
src-db/database/sourcedata/AD_VAL_RULE.xml
--- a/src-db/database/model/functions/C_YEARPERIODS.xml	Fri Mar 04 17:19:37 2011 +0100
+++ b/src-db/database/model/functions/C_YEARPERIODS.xml	Fri Mar 04 18:11:49 2011 +0100
@@ -46,6 +46,7 @@
     v_Year_Str VARCHAR(20) ;
     v_User_ID VARCHAR2(32);
     v_year_num NUMBER;
+    v_language VARCHAR2(6);
   BEGIN
     --  Update AD_PInstance
     --  DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing');
@@ -67,8 +68,13 @@
       ORDER BY p.SeqNo
       )
     LOOP
+      IF Cur_Parameter.ParameterName = 'AD_LANGUAGE_ID' THEN
+        SELECT AD_LANGUAGE INTO v_language FROM AD_LANGUAGE WHERE AD_LANGUAGE_ID = Cur_Parameter.P_String;
+	v_language = COALESCE(v_language, 'en_US');
+      END IF;
       v_Year_ID:=Cur_Parameter.Record_ID;
     END LOOP; -- Get Parameter
+    
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Year_ID) ;
     --  Get C_Year Record
     DBMS_OUTPUT.PUT_LINE('Get Year info') ;
@@ -87,7 +93,7 @@
     WHERE C_Year_ID=v_Year_ID;
     -- Check the format
     DBMS_OUTPUT.PUT_LINE('Checking format') ;
-    v_ResultStr:='Year not numeric: '||v_Year_Str;
+    v_ResultStr:='Year not numeric: '||v_Year_Str;    
     BEGIN
     SELECT TO_NUMBER(v_Year_Str) INTO v_year_num FROM DUAL;
      -- Postgres hack
@@ -131,7 +137,10 @@
             v_NextNo, v_Client_ID, v_Org_ID, 'Y',
             now(), v_User_ID, now(), v_User_ID,
             v_Year_ID, v_MonthNo, TO_DATE(ADD_MONTHS(v_StartDate, v_MonthNo-1)), 'S',
-	        (SELECT SUBSTR(name, 1,3) || '-' || SUBSTR(year,3,2) FROM AD_MONTH, C_YEAR WHERE TO_NUMBER(value)=v_MonthNo AND c_year_id=v_Year_ID)
+	        (SELECT SUBSTR(COALESCE(AD_MONTH_TRL.NAME, AD_MONTH.NAME), 1,3) || '-' || SUBSTR(C_YEAR.YEAR,3,2) 
+                 FROM AD_MONTH LEFT OUTER JOIN AD_MONTH_TRL ON AD_MONTH.AD_MONTH_ID = AD_MONTH_TRL.AD_MONTH_ID AND AD_MONTH_TRL.AD_LANGUAGE = v_language, C_YEAR 
+                 WHERE  TO_NUMBER(AD_MONTH.VALUE) = v_MonthNo
+                 AND C_YEAR.C_YEAR_ID = v_Year_ID)
            );
         DBMS_OUTPUT.PUT_LINE('Month Added') ;
       END IF;
--- a/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Fri Mar 04 17:19:37 2011 +0100
+++ b/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Fri Mar 04 18:11:49 2011 +0100
@@ -5146,6 +5146,24 @@
 <!--3AC22B0F80264CF09D52044F198C75BD-->  <AD_ELEMENT_ID><![CDATA[193]]></AD_ELEMENT_ID>
 <!--3AC22B0F80264CF09D52044F198C75BD--></AD_PROCESS_PARA>
 
+<!--6E19A05CE9564C15BA5FAA118C005859--><AD_PROCESS_PARA>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_PROCESS_PARA_ID><![CDATA[6E19A05CE9564C15BA5FAA118C005859]]></AD_PROCESS_PARA_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <NAME><![CDATA[Language]]></NAME>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_PROCESS_ID><![CDATA[100]]></AD_PROCESS_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_VAL_RULE_ID><![CDATA[E2628841519247358C005033E0C9AF61]]></AD_VAL_RULE_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <COLUMNNAME><![CDATA[AD_LANGUAGE_ID]]></COLUMNNAME>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT AD_LANGUAGE_ID FROM AD_LANGUAGE WHERE AD_LANGUAGE = @#AD_LANGUAGE@]]></DEFAULTVALUE>
+<!--6E19A05CE9564C15BA5FAA118C005859--></AD_PROCESS_PARA>
+
 <!--70B21DAE5E064CEF822273BDF43B64E4--><AD_PROCESS_PARA>
 <!--70B21DAE5E064CEF822273BDF43B64E4-->  <AD_PROCESS_PARA_ID><![CDATA[70B21DAE5E064CEF822273BDF43B64E4]]></AD_PROCESS_PARA_ID>
 <!--70B21DAE5E064CEF822273BDF43B64E4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_VAL_RULE.xml	Fri Mar 04 17:19:37 2011 +0100
+++ b/src-db/database/sourcedata/AD_VAL_RULE.xml	Fri Mar 04 18:11:49 2011 +0100
@@ -1703,6 +1703,18 @@
 <!--DC79E946854746F1A7965DCADF1D76FE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--DC79E946854746F1A7965DCADF1D76FE--></AD_VAL_RULE>
 
+<!--E2628841519247358C005033E0C9AF61--><AD_VAL_RULE>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_VAL_RULE_ID><![CDATA[E2628841519247358C005033E0C9AF61]]></AD_VAL_RULE_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E2628841519247358C005033E0C9AF61-->  <NAME><![CDATA[AD_Language_System]]></NAME>
+<!--E2628841519247358C005033E0C9AF61-->  <DESCRIPTION><![CDATA[List of the Openbravo ERP System Languages]]></DESCRIPTION>
+<!--E2628841519247358C005033E0C9AF61-->  <TYPE><![CDATA[S]]></TYPE>
+<!--E2628841519247358C005033E0C9AF61-->  <CODE><![CDATA[AD_LANGUAGE.ISSYSTEMLANGUAGE='Y']]></CODE>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E2628841519247358C005033E0C9AF61--></AD_VAL_RULE>
+
 <!--FDA7BA9355A6468DAF67E1C5288990A6--><AD_VAL_RULE>
 <!--FDA7BA9355A6468DAF67E1C5288990A6-->  <AD_VAL_RULE_ID><![CDATA[FDA7BA9355A6468DAF67E1C5288990A6]]></AD_VAL_RULE_ID>
 <!--FDA7BA9355A6468DAF67E1C5288990A6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>