src-trl/src/org/openbravo/translate/Translate_data.xsql
changeset 32608 f8c3d0a4f7a4
parent 9072 79e55dfc8af0
child 32665 2148091224be
equal deleted inserted replaced
32607:b9227826b5dc 32608:f8c3d0a4f7a4
    10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    11  * License for the specific  language  governing  rights  and  limitations
    11  * License for the specific  language  governing  rights  and  limitations
    12  * under the License. 
    12  * under the License. 
    13  * The Original Code is Openbravo ERP. 
    13  * The Original Code is Openbravo ERP. 
    14  * The Initial Developer of the Original Code is Openbravo SLU 
    14  * The Initial Developer of the Original Code is Openbravo SLU 
    15  * All portions are Copyright (C) 2001-2010 Openbravo SLU 
    15  * All portions are Copyright (C) 2001-2017 Openbravo SLU 
    16  * All Rights Reserved. 
    16  * All Rights Reserved. 
    17  * Contributor(s):  ______________________________________.
    17  * Contributor(s):  ______________________________________.
    18  ************************************************************************
    18  ************************************************************************
    19 -->
    19 -->
    20 
    20 
    21 
    21 
    22 <SqlClass name="TranslateData" package="org.openbravo.translate">
    22 <SqlClass name="TranslateData" package="org.openbravo.translate">
    23   <SqlMethod name="select" type="preparedStatement" return="multiple">
    23   <SqlMethod name="getTextInterfaces" type="preparedStatement" return="multiple">
    24     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    24       <Sql>
    25     <Sql>
    25       select ad_textinterfaces_id as id, isUsed as tr, text, t.ad_module_id as module, filename, m.ad_language as lang, '' as name,'' as javapackage
    26       select A.ad_textinterfaces_id, A.tr, '' AS NAME, '' AS TOTAL
    26         from ad_textinterfaces t, ad_module m
    27         from (select tt.ad_textinterfaces_id AS ad_textinterfaces_id, trim(tt.text) AS tr, 1 AS o
    27        where t.ad_module_id = m.ad_module_id
    28                 from ad_textinterfaces_trl tt
    28        order by text, case when filename is not null then 0 else 1 end
    29                where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
       
    30                                                    from ad_textinterfaces t
       
    31                                                   where t.text     = ?
       
    32                                                     and t.filename = ?)
       
    33                  and tt.ad_language = ?
       
    34                union
       
    35               select tt.ad_textinterfaces_id AS id, trim(tt.text) AS tr, 2 AS o
       
    36                 from ad_textinterfaces_trl tt
       
    37                where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
       
    38                                                    from ad_textinterfaces t
       
    39                                                   where t.text =  ?
       
    40                                                     and t.filename is null)
       
    41                  and tt.ad_language = ?
       
    42                order by o) A
       
    43       group by A.ad_textinterfaces_id, A.tr, A.o
       
    44       order by A.o
       
    45     </Sql>
    29     </Sql>
    46     <Parameter name="string"/>
       
    47     <Parameter name="filename"/>
       
    48     <Parameter name="languajeFin"/>
       
    49     <Parameter name="string"/>
       
    50     <Parameter name="languajeFin"/>
       
    51   </SqlMethod>
       
    52 
       
    53   <SqlMethod name="existsExpresionModFile" type="preparedStatement" return="rowCount">
       
    54     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
    55     <Sql>
       
    56          update ad_textinterfaces
       
    57            set isUsed = 'Y'
       
    58          where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
       
    59                                           from (select B.*
       
    60                                                 from (select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 1 AS o
       
    61                                                           from ad_textinterfaces t,
       
    62                                                                ad_module m
       
    63                                                          where text     = ?
       
    64                                                            and filename = ?
       
    65                                                            and m.ad_module_id = t.ad_module_id
       
    66                                                            and m.ad_language = ?
       
    67                                                          order by o) B
       
    68                                                  where ad_textinterfaces_id is not null) A)
       
    69     </Sql>
       
    70     <Parameter name="text"/>
       
    71     <Parameter name="filename"/>
       
    72     <Parameter name="moduleLang"/>
       
    73   </SqlMethod>
    30   </SqlMethod>
    74   
    31   
    75   <SqlMethod name="existsExpresionNoModFile" type="preparedStatement" return="rowCount">
    32   <SqlMethod name="getModulesInDevelopment" type="preparedStatement" return="multiple">
    76     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
    77     <Sql>
    33     <Sql>
    78          update ad_textinterfaces
    34       select AD_Module_id as id, name, javapackage, AD_LANGUAGE as lang
    79            set isUsed = 'Y'
    35         from AD_Module
    80          where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
    36        where isInDevelopment = 'Y'
    81                                           from (select B.*
    37        order by 1
    82                                                 from (select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 2 AS o
       
    83                                                           from ad_textinterfaces t, ad_textinterfaces_trl trl
       
    84                                                          where trl.text     = ?
       
    85                                                            and t.filename = ?
       
    86                                                            and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
       
    87                                                            and trl.ad_language = ?
       
    88                                                          order by o) B
       
    89                                                  where ad_textinterfaces_id is not null) A)
       
    90     </Sql>
    38     </Sql>
    91     
       
    92     <Parameter name="text"/>
       
    93     <Parameter name="filename"/>
       
    94     <Parameter name="moduleLang"/>
       
    95   </SqlMethod>
    39   </SqlMethod>
    96   
    40   
    97   <SqlMethod name="existsExpresionModNoFile" type="preparedStatement" return="rowCount">
    41   <SqlMethod name="insert" type="preparedStatement" connection="true" return="rowCount">
    98     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
    99     <Sql>
       
   100          update ad_textinterfaces
       
   101            set isUsed = 'Y'
       
   102          where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
       
   103                                           from (select B.*
       
   104                                                 from (select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 3 AS o
       
   105                                                           from ad_textinterfaces t,
       
   106                                                                ad_module m
       
   107                                                          where text = ?
       
   108                                                            and filename is null
       
   109                                                            and m.ad_module_id = t.ad_module_id
       
   110                                                            and m.ad_language = ?
       
   111                                                          order by o) B
       
   112                                                  where ad_textinterfaces_id is not null) A)
       
   113     </Sql>
       
   114     <Parameter name="text"/>
       
   115     <Parameter name="moduleLang"/>
       
   116   </SqlMethod>
       
   117   
       
   118   <SqlMethod name="existsExpresionNoModNoFile" type="preparedStatement" return="rowCount">
       
   119     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   120     <Sql>
       
   121          update ad_textinterfaces
       
   122            set isUsed = 'Y'
       
   123          where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
       
   124                                           from (select B.*
       
   125                                                 from (select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 4 AS o
       
   126                                                           from ad_textinterfaces t, ad_textinterfaces_trl trl
       
   127                                                          where trl.text = ?
       
   128                                                            and t.filename is null
       
   129                                                            and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
       
   130                                                            and trl.ad_language = ?
       
   131                                                          order by o) B
       
   132                                                  where ad_textinterfaces_id is not null) A)
       
   133     </Sql>
       
   134     
       
   135     <Parameter name="text"/>
       
   136     <Parameter name="moduleLang"/>
       
   137   </SqlMethod>
       
   138 
       
   139    <SqlMethod name="getModuleID" type="preparedStatement" return="string">
       
   140     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   141     <Sql>
       
   142       SELECT AD_MODULE_ID
       
   143         FROM AD_MODULE
       
   144        WHERE JavaPackage = ?
       
   145     </Sql>
       
   146     <Parameter name="name"/>
       
   147   </SqlMethod>
       
   148   
       
   149   <SqlMethod name="getModuleLang" type="preparedStatement" return="string">
       
   150     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   151     <Sql>
       
   152       SELECT AD_LANGUAGE
       
   153         FROM AD_MODULE
       
   154        WHERE AD_MODULE_ID = ?
       
   155     </Sql>
       
   156     <Parameter name="module_id"/>
       
   157   </SqlMethod>
       
   158   
       
   159   <SqlMethod name="isInDevelopmentModule" type="preparedStatement" return="boolean">
       
   160     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   161     <Sql>
       
   162       SELECT COUNT(*) AS TOTAL
       
   163         FROM AD_MODULE
       
   164        WHERE AD_MODULE_ID = ?
       
   165          AND ISINDEVELOPMENT = 'Y'
       
   166     </Sql>
       
   167     <Parameter name="name"/>
       
   168   </SqlMethod>
       
   169 
       
   170   <SqlMethod name="isInDevelopmentModulePack" type="preparedStatement" return="boolean">
       
   171     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   172     <Sql>
       
   173       SELECT COUNT(*) AS TOTAL
       
   174         FROM AD_MODULE
       
   175        WHERE JAVAPACKAGE = ?
       
   176          AND ISINDEVELOPMENT = 'Y'
       
   177     </Sql>
       
   178     <Parameter name="pack"/>
       
   179   </SqlMethod>
       
   180   
       
   181   <SqlMethod name="insert" type="preparedStatement" return="rowCount">
       
   182     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   183     <Sql>
    42     <Sql>
   184       insert into ad_textinterfaces
    43       insert into ad_textinterfaces
   185         (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED, AD_MODULE_ID)
    44         (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED, AD_MODULE_ID)
   186       values
    45       values
   187         (get_uuid(),'0' ,'0', 'Y', now(), '0', now(), '0', ?, ?, 'Y', ?)
    46         (get_uuid(),'0' ,'0', 'Y', now(), '0', now(), '0', ?, ?, 'Y', ?)
   189     <Parameter name="text"/>
    48     <Parameter name="text"/>
   190     <Parameter name="filename"/>
    49     <Parameter name="filename"/>
   191     <Parameter name="module"/>
    50     <Parameter name="module"/>
   192   </SqlMethod>
    51   </SqlMethod>
   193 
    52 
   194   <SqlMethod name="update" type="preparedStatement" return="rowCount">
    53   <SqlMethod name="update" type="preparedStatement" connection="true" return="rowCount">
   195     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   196     <Sql>
    54     <Sql>
   197       update ad_textinterfaces t
    55       update ad_textinterfaces t
   198          set isUsed='Y'
    56          set isUsed='Y', updated=now(), updatedBy = '0'
   199        where ad_textinterfaces_id = ?
    57        where ad_textinterfaces_id = ?
   200          and exists (select 1 
       
   201                        from ad_module m
       
   202                       where m.ad_module_id = t.ad_module_id
       
   203                         and m.isInDevelopment = 'Y')
       
   204     </Sql>
    58     </Sql>
   205     <Parameter name="adTextinterfacesId"/>
    59     <Parameter name="adTextinterfacesId"/>
   206   </SqlMethod>
    60   </SqlMethod>
   207 
    61 
   208   <SqlMethod name="systemLanguage" type="preparedStatement" return="multiple">
       
   209     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   210     <Sql>
       
   211       SELECT AD_LANGUAGE AS NAME FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISSYSTEMLANGUAGE='Y' AND ISBASELANGUAGE='N'
       
   212     </Sql>
       
   213   </SqlMethod>
       
   214   
       
   215   <SqlMethod name="clean" type="preparedStatement" return="rowCount">
    62   <SqlMethod name="clean" type="preparedStatement" return="rowCount">
   216     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   217     <Sql>
    63     <Sql>
   218       update ad_textinterfaces t
    64       update ad_textinterfaces t
   219          set isUsed='N'
    65          set isUsed='N', updated=now(), updatedBy = '0'
   220        where exists (select 1 
    66        where exists (select 1 
   221                        from ad_module m
    67                        from ad_module m
   222                       where m.ad_module_id = t.ad_module_id
    68                       where m.ad_module_id = t.ad_module_id
   223                         and m.isInDevelopment = 'Y')  
    69                         and m.isInDevelopment = 'Y')  
   224     </Sql>
    70     </Sql>
   225   </SqlMethod>
    71   </SqlMethod>
   226   
    72   
   227   <SqlMethod name="remove" type="preparedStatement" return="rowCount">
    73   <SqlMethod name="remove" type="preparedStatement" return="rowCount">
   228     <SqlMethodComment>Return the translation of a text</SqlMethodComment>
       
   229     <Sql>
    74     <Sql>
   230       delete from ad_textinterfaces t
    75       delete from ad_textinterfaces t
   231        where isUsed='N'
    76        where isUsed='N'
   232          and exists (select 1 
    77          and exists (select 1 
   233                        from ad_module m
    78                        from ad_module m