src-trl/src/org/openbravo/translate/Translate_data.xsql
author Antonio Moreno <antonio.moreno@openbravo.com>
Tue, 22 Sep 2009 18:39:13 +0200
changeset 5067 e13fc21ebf9c
parent 2553 e61d7b9f5942
child 5935 89419c2a9a0c
permissions -rw-r--r--
Fixed issue 10705. Translation will no longer behave randomly.
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
carlos@0
     3
 *************************************************************************
carlos@0
     4
 * The contents of this file are subject to the Openbravo  Public  License
carlos@0
     5
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
     7
 * file except in compliance with the License. You  may  obtain  a copy of
carlos@0
     8
 * the License at http://www.openbravo.com/legal/license.html 
carlos@0
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    11
 * License for the specific  language  governing  rights  and  limitations
carlos@0
    12
 * under the License. 
carlos@0
    13
 * The Original Code is Openbravo ERP. 
carlos@0
    14
 * The Initial Developer of the Original Code is Openbravo SL 
carlos@0
    15
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
carlos@0
    16
 * All Rights Reserved. 
carlos@0
    17
 * Contributor(s):  ______________________________________.
carlos@0
    18
 ************************************************************************
carlos@0
    19
-->
carlos@0
    20
carlos@0
    21
carlos@0
    22
<SqlClass name="TranslateData" package="org.openbravo.translate">
carlos@0
    23
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    24
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
    25
    <Sql>
stefan@2553
    26
      select A.ad_textinterfaces_id, A.tr, '' AS NAME, '' AS TOTAL
carlos@0
    27
        from (select tt.ad_textinterfaces_id AS ad_textinterfaces_id, trim(tt.text) AS tr, 1 AS o
carlos@0
    28
                from ad_textinterfaces_trl tt
carlos@0
    29
               where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
carlos@0
    30
                                                   from ad_textinterfaces t
carlos@0
    31
                                                  where t.text     = ?
carlos@0
    32
                                                    and t.filename = ?)
carlos@0
    33
                 and tt.ad_language = ?
carlos@0
    34
               union
carlos@0
    35
              select tt.ad_textinterfaces_id AS id, trim(tt.text) AS tr, 2 AS o
carlos@0
    36
                from ad_textinterfaces_trl tt
carlos@0
    37
               where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
carlos@0
    38
                                                   from ad_textinterfaces t
carlos@0
    39
                                                  where t.text =  ?
carlos@0
    40
                                                    and t.filename is null)
carlos@0
    41
                 and tt.ad_language = ?
carlos@0
    42
               order by o) A
carlos@0
    43
      group by A.ad_textinterfaces_id, A.tr, A.o
carlos@0
    44
      order by A.o
carlos@0
    45
    </Sql>
carlos@0
    46
    <Parameter name="string"/>
carlos@0
    47
    <Parameter name="filename"/>
carlos@0
    48
    <Parameter name="languajeFin"/>
carlos@0
    49
    <Parameter name="string"/>
carlos@0
    50
    <Parameter name="languajeFin"/>
carlos@0
    51
  </SqlMethod>
carlos@0
    52
antonio@5067
    53
  <SqlMethod name="existsExpresionModFile" type="preparedStatement" return="rowCount">
carlos@0
    54
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
    55
    <Sql>
asier@1929
    56
         update ad_textinterfaces
asier@134
    57
           set isUsed = 'Y'
carlos@0
    58
         where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
carlos@0
    59
                                          from (select B.*
carlos@0
    60
                                                from (select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 1 AS o
asier@1929
    61
                                                          from ad_textinterfaces t,
asier@1929
    62
                                                               ad_module m
carlos@0
    63
                                                         where text     = ?
carlos@0
    64
                                                           and filename = ?
asier@1929
    65
                                                           and m.ad_module_id = t.ad_module_id
asier@1929
    66
                                                           and m.ad_language = ?
antonio@5067
    67
                                                         order by o) B
antonio@5067
    68
                                                 where ad_textinterfaces_id is not null) A)
antonio@5067
    69
    </Sql>
antonio@5067
    70
    <Parameter name="text"/>
antonio@5067
    71
    <Parameter name="filename"/>
antonio@5067
    72
    <Parameter name="moduleLang"/>
antonio@5067
    73
  </SqlMethod>
antonio@5067
    74
  
antonio@5067
    75
  <SqlMethod name="existsExpresionNoModFile" type="preparedStatement" return="rowCount">
antonio@5067
    76
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
antonio@5067
    77
    <Sql>
antonio@5067
    78
         update ad_textinterfaces
antonio@5067
    79
           set isUsed = 'Y'
antonio@5067
    80
         where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
antonio@5067
    81
                                          from (select B.*
antonio@5067
    82
                                                from (select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 2 AS o
asier@1929
    83
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
asier@1929
    84
                                                         where trl.text     = ?
asier@1929
    85
                                                           and t.filename = ?
asier@1929
    86
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
asier@1929
    87
                                                           and trl.ad_language = ?
antonio@5067
    88
                                                         order by o) B
antonio@5067
    89
                                                 where ad_textinterfaces_id is not null) A)
antonio@5067
    90
    </Sql>
antonio@5067
    91
    
antonio@5067
    92
    <Parameter name="text"/>
antonio@5067
    93
    <Parameter name="filename"/>
antonio@5067
    94
    <Parameter name="moduleLang"/>
antonio@5067
    95
  </SqlMethod>
antonio@5067
    96
  
antonio@5067
    97
  <SqlMethod name="existsExpresionModNoFile" type="preparedStatement" return="rowCount">
antonio@5067
    98
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
antonio@5067
    99
    <Sql>
antonio@5067
   100
         update ad_textinterfaces
antonio@5067
   101
           set isUsed = 'Y'
antonio@5067
   102
         where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
antonio@5067
   103
                                          from (select B.*
antonio@5067
   104
                                                from (select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 3 AS o
asier@1929
   105
                                                          from ad_textinterfaces t,
asier@1929
   106
                                                               ad_module m
carlos@0
   107
                                                         where text = ?
carlos@0
   108
                                                           and filename is null
asier@1929
   109
                                                           and m.ad_module_id = t.ad_module_id
asier@1929
   110
                                                           and m.ad_language = ?
antonio@5067
   111
                                                         order by o) B
antonio@5067
   112
                                                 where ad_textinterfaces_id is not null) A)
antonio@5067
   113
    </Sql>
antonio@5067
   114
    <Parameter name="text"/>
antonio@5067
   115
    <Parameter name="moduleLang"/>
antonio@5067
   116
  </SqlMethod>
antonio@5067
   117
  
antonio@5067
   118
  <SqlMethod name="existsExpresionNoModNoFile" type="preparedStatement" return="rowCount">
antonio@5067
   119
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
antonio@5067
   120
    <Sql>
antonio@5067
   121
         update ad_textinterfaces
antonio@5067
   122
           set isUsed = 'Y'
antonio@5067
   123
         where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
antonio@5067
   124
                                          from (select B.*
antonio@5067
   125
                                                from (select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 4 AS o
asier@1929
   126
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
asier@1929
   127
                                                         where trl.text = ?
asier@1929
   128
                                                           and t.filename is null
asier@1929
   129
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
asier@1929
   130
                                                           and trl.ad_language = ?
carlos@0
   131
                                                         order by o) B
carlos@0
   132
                                                 where ad_textinterfaces_id is not null) A)
carlos@0
   133
    </Sql>
asier@1929
   134
    
asier@1929
   135
    <Parameter name="text"/>
asier@1929
   136
    <Parameter name="moduleLang"/>
carlos@0
   137
  </SqlMethod>
carlos@0
   138
asier@1929
   139
   <SqlMethod name="getModuleID" type="preparedStatement" return="string">
asier@1929
   140
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   141
    <Sql>
asier@1929
   142
      SELECT AD_MODULE_ID
asier@1929
   143
        FROM AD_MODULE
asier@1929
   144
       WHERE JavaPackage = ?
asier@1929
   145
    </Sql>
asier@1929
   146
    <Parameter name="name"/>
asier@1929
   147
  </SqlMethod>
asier@1929
   148
  
asier@1929
   149
  <SqlMethod name="getModuleLang" type="preparedStatement" return="string">
asier@1929
   150
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   151
    <Sql>
asier@1929
   152
      SELECT AD_LANGUAGE
asier@1929
   153
        FROM AD_MODULE
asier@1929
   154
       WHERE AD_MODULE_ID = ?
asier@1929
   155
    </Sql>
asier@1929
   156
    <Parameter name="module_id"/>
asier@1929
   157
  </SqlMethod>
asier@1929
   158
  
asier@1929
   159
  <SqlMethod name="isInDevelopmentModule" type="preparedStatement" return="boolean">
asier@1929
   160
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   161
    <Sql>
asier@1929
   162
      SELECT COUNT(*) AS TOTAL
asier@1929
   163
        FROM AD_MODULE
asier@1929
   164
       WHERE AD_MODULE_ID = ?
asier@1929
   165
         AND ISINDEVELOPMENT = 'Y'
asier@1929
   166
    </Sql>
asier@1929
   167
    <Parameter name="name"/>
asier@1929
   168
  </SqlMethod>
asier@1929
   169
asier@1929
   170
  <SqlMethod name="isInDevelopmentModulePack" type="preparedStatement" return="boolean">
asier@1929
   171
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   172
    <Sql>
asier@1929
   173
      SELECT COUNT(*) AS TOTAL
asier@1929
   174
        FROM AD_MODULE
asier@1929
   175
       WHERE JAVAPACKAGE = ?
asier@1929
   176
         AND ISINDEVELOPMENT = 'Y'
asier@1929
   177
    </Sql>
asier@1929
   178
    <Parameter name="pack"/>
asier@1929
   179
  </SqlMethod>
asier@1929
   180
  
carlos@0
   181
  <SqlMethod name="insert" type="preparedStatement" return="rowCount">
carlos@0
   182
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   183
    <Sql>
carlos@0
   184
      insert into ad_textinterfaces
asier@1929
   185
        (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED, AD_MODULE_ID)
carlos@0
   186
      values
asier@1929
   187
        (get_uuid(),'0' ,'0', 'Y', now(), '0', now(), '0', ?, ?, 'Y', ?)
carlos@0
   188
    </Sql>
carlos@0
   189
    <Parameter name="text"/>
carlos@0
   190
    <Parameter name="filename"/>
asier@1929
   191
    <Parameter name="module"/>
carlos@0
   192
  </SqlMethod>
carlos@0
   193
carlos@0
   194
  <SqlMethod name="update" type="preparedStatement" return="rowCount">
carlos@0
   195
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   196
    <Sql>
asier@1929
   197
      update ad_textinterfaces t
asier@134
   198
         set isUsed='Y'
carlos@0
   199
       where ad_textinterfaces_id = ?
asier@1929
   200
         and exists (select 1 
asier@1929
   201
                       from ad_module m
asier@1929
   202
                      where m.ad_module_id = t.ad_module_id
asier@1929
   203
                        and m.isInDevelopment = 'Y')
carlos@0
   204
    </Sql>
carlos@0
   205
    <Parameter name="adTextinterfacesId"/>
carlos@0
   206
  </SqlMethod>
carlos@0
   207
carlos@0
   208
  <SqlMethod name="systemLanguage" type="preparedStatement" return="multiple">
carlos@0
   209
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   210
    <Sql>
carlos@0
   211
      SELECT AD_LANGUAGE AS NAME FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISSYSTEMLANGUAGE='Y' AND ISBASELANGUAGE='N'
carlos@0
   212
    </Sql>
carlos@0
   213
  </SqlMethod>
asier@134
   214
  
asier@134
   215
  <SqlMethod name="clean" type="preparedStatement" return="rowCount">
asier@134
   216
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@134
   217
    <Sql>
asier@1929
   218
      update ad_textinterfaces t
asier@134
   219
         set isUsed='N'
asier@1929
   220
       where exists (select 1 
asier@1929
   221
                       from ad_module m
asier@1929
   222
                      where m.ad_module_id = t.ad_module_id
asier@1929
   223
                        and m.isInDevelopment = 'Y')  
asier@134
   224
    </Sql>
asier@134
   225
  </SqlMethod>
carlos@0
   226
</SqlClass>