src-trl/src/org/openbravo/translate/Translate_data.xsql
author Asier Lostalé <asier.lostale@openbravo.com>
Wed, 12 Nov 2008 13:14:11 +0000
changeset 1929 ad0353d93b0f
parent 1605 8a0fe0193bef
child 2553 e61d7b9f5942
permissions -rw-r--r--
Merge back modularity branch to trunk.

Due to svn problems it has been merged using patch after updating modularity
with trunk rev 9900. This means that the svn log info for the files modified
in modularity branch will not be available.
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>
asier@1929
    26
      select A.ad_textinterfaces_id, A.tr, '' AS NAME, A.o AS ORDEN, '' as ad_language, '' 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
carlos@0
    53
  <SqlMethod name="existsExpresion" 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 = ?
carlos@0
    67
                                                        union
asier@1929
    68
                                                        select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 2 AS o
asier@1929
    69
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
asier@1929
    70
                                                         where trl.text     = ?
asier@1929
    71
                                                           and t.filename = ?
asier@1929
    72
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
asier@1929
    73
                                                           and trl.ad_language = ?
asier@1929
    74
                                                        union
asier@1929
    75
                                                        select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 3 AS o
asier@1929
    76
                                                          from ad_textinterfaces t,
asier@1929
    77
                                                               ad_module m
carlos@0
    78
                                                         where text = ?
carlos@0
    79
                                                           and filename is null
asier@1929
    80
                                                           and m.ad_module_id = t.ad_module_id
asier@1929
    81
                                                           and m.ad_language = ?
asier@1929
    82
                                                        union
asier@1929
    83
                                                        select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 4 AS o
asier@1929
    84
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
asier@1929
    85
                                                         where trl.text = ?
asier@1929
    86
                                                           and t.filename is null
asier@1929
    87
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
asier@1929
    88
                                                           and trl.ad_language = ?
carlos@0
    89
                                                         order by o) B
carlos@0
    90
                                                 where ad_textinterfaces_id is not null) A)
carlos@0
    91
    </Sql>
carlos@0
    92
    <Parameter name="text"/>
carlos@0
    93
    <Parameter name="filename"/>
asier@1929
    94
    <Parameter name="moduleLang"/>
asier@1929
    95
    
carlos@0
    96
    <Parameter name="text"/>
asier@1929
    97
    <Parameter name="filename"/>
asier@1929
    98
    <Parameter name="moduleLang"/>
asier@1929
    99
    
asier@1929
   100
    <Parameter name="text"/>
asier@1929
   101
    <Parameter name="moduleLang"/>
asier@1929
   102
    
asier@1929
   103
    <Parameter name="text"/>
asier@1929
   104
    <Parameter name="moduleLang"/>
carlos@0
   105
  </SqlMethod>
carlos@0
   106
asier@1929
   107
   <SqlMethod name="getModuleID" type="preparedStatement" return="string">
asier@1929
   108
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   109
    <Sql>
asier@1929
   110
      SELECT AD_MODULE_ID
asier@1929
   111
        FROM AD_MODULE
asier@1929
   112
       WHERE JavaPackage = ?
asier@1929
   113
    </Sql>
asier@1929
   114
    <Parameter name="name"/>
asier@1929
   115
  </SqlMethod>
asier@1929
   116
  
asier@1929
   117
  <SqlMethod name="getModuleLang" type="preparedStatement" return="string">
asier@1929
   118
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   119
    <Sql>
asier@1929
   120
      SELECT AD_LANGUAGE
asier@1929
   121
        FROM AD_MODULE
asier@1929
   122
       WHERE AD_MODULE_ID = ?
asier@1929
   123
    </Sql>
asier@1929
   124
    <Parameter name="module_id"/>
asier@1929
   125
  </SqlMethod>
asier@1929
   126
  
asier@1929
   127
  <SqlMethod name="isInDevelopmentModule" type="preparedStatement" return="boolean">
asier@1929
   128
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   129
    <Sql>
asier@1929
   130
      SELECT COUNT(*) AS TOTAL
asier@1929
   131
        FROM AD_MODULE
asier@1929
   132
       WHERE AD_MODULE_ID = ?
asier@1929
   133
         AND ISINDEVELOPMENT = 'Y'
asier@1929
   134
    </Sql>
asier@1929
   135
    <Parameter name="name"/>
asier@1929
   136
  </SqlMethod>
asier@1929
   137
asier@1929
   138
  <SqlMethod name="isInDevelopmentModulePack" type="preparedStatement" return="boolean">
asier@1929
   139
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@1929
   140
    <Sql>
asier@1929
   141
      SELECT COUNT(*) AS TOTAL
asier@1929
   142
        FROM AD_MODULE
asier@1929
   143
       WHERE JAVAPACKAGE = ?
asier@1929
   144
         AND ISINDEVELOPMENT = 'Y'
asier@1929
   145
    </Sql>
asier@1929
   146
    <Parameter name="pack"/>
asier@1929
   147
  </SqlMethod>
asier@1929
   148
  
carlos@0
   149
  <SqlMethod name="insert" type="preparedStatement" return="rowCount">
carlos@0
   150
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   151
    <Sql>
carlos@0
   152
      insert into ad_textinterfaces
asier@1929
   153
        (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED, AD_MODULE_ID)
carlos@0
   154
      values
asier@1929
   155
        (get_uuid(),'0' ,'0', 'Y', now(), '0', now(), '0', ?, ?, 'Y', ?)
carlos@0
   156
    </Sql>
carlos@0
   157
    <Parameter name="text"/>
carlos@0
   158
    <Parameter name="filename"/>
asier@1929
   159
    <Parameter name="module"/>
carlos@0
   160
  </SqlMethod>
carlos@0
   161
carlos@0
   162
  <SqlMethod name="update" type="preparedStatement" return="rowCount">
carlos@0
   163
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   164
    <Sql>
asier@1929
   165
      update ad_textinterfaces t
asier@134
   166
         set isUsed='Y'
carlos@0
   167
       where ad_textinterfaces_id = ?
asier@1929
   168
         and exists (select 1 
asier@1929
   169
                       from ad_module m
asier@1929
   170
                      where m.ad_module_id = t.ad_module_id
asier@1929
   171
                        and m.isInDevelopment = 'Y')
carlos@0
   172
    </Sql>
carlos@0
   173
    <Parameter name="adTextinterfacesId"/>
carlos@0
   174
  </SqlMethod>
carlos@0
   175
  <SqlMethod name="baseLanguage" type="preparedStatement" return="String" default="">
carlos@0
   176
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   177
    <Sql>
carlos@0
   178
      SELECT AD_LANGUAGE FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISBASELANGUAGE='Y'
carlos@0
   179
    </Sql>
carlos@0
   180
  </SqlMethod>
carlos@0
   181
carlos@0
   182
  <SqlMethod name="systemLanguage" type="preparedStatement" return="multiple">
carlos@0
   183
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   184
    <Sql>
carlos@0
   185
      SELECT AD_LANGUAGE AS NAME FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISSYSTEMLANGUAGE='Y' AND ISBASELANGUAGE='N'
carlos@0
   186
    </Sql>
carlos@0
   187
  </SqlMethod>
asier@134
   188
  
asier@134
   189
  <SqlMethod name="clean" type="preparedStatement" return="rowCount">
asier@134
   190
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@134
   191
    <Sql>
asier@1929
   192
      update ad_textinterfaces t
asier@134
   193
         set isUsed='N'
asier@1929
   194
       where exists (select 1 
asier@1929
   195
                       from ad_module m
asier@1929
   196
                      where m.ad_module_id = t.ad_module_id
asier@1929
   197
                        and m.isInDevelopment = 'Y')  
asier@134
   198
    </Sql>
asier@134
   199
  </SqlMethod>
carlos@0
   200
</SqlClass>