src-trl/src/org/openbravo/translate/Translate_data.xsql
author Asier Lostalé <asier.lostale@openbravo.com>
Tue, 27 Nov 2007 12:34:41 +0000
changeset 134 590ce3de05b4
parent 0 0247c26f10c6
child 1605 8a0fe0193bef
permissions -rw-r--r--
bug fixed: [1838522] Translate process doesn't updates date but a new 'isUsed' field
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>
carlos@0
    26
      select A.ad_textinterfaces_id, A.tr, '' AS NAME, A.o AS ORDEN
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>
carlos@0
    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
carlos@0
    61
                                                          from ad_textinterfaces
carlos@0
    62
                                                         where text     = ?
carlos@0
    63
                                                           and filename = ?
carlos@0
    64
                                                        union
carlos@0
    65
                                                        select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 2 AS o
carlos@0
    66
                                                          from ad_textinterfaces
carlos@0
    67
                                                         where text = ?
carlos@0
    68
                                                           and filename is null
carlos@0
    69
                                                         order by o) B
carlos@0
    70
                                                 where ad_textinterfaces_id is not null) A)
carlos@0
    71
    </Sql>
carlos@0
    72
    <Parameter name="text"/>
carlos@0
    73
    <Parameter name="filename"/>
carlos@0
    74
    <Parameter name="text"/>
carlos@0
    75
  </SqlMethod>
carlos@0
    76
carlos@0
    77
  <SqlMethod name="insert" type="preparedStatement" return="rowCount">
carlos@0
    78
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
    79
    <Sql>
carlos@0
    80
      insert into ad_textinterfaces
asier@134
    81
        (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED)
carlos@0
    82
      values
asier@134
    83
        (Ad_Get_Next_Sequence('AD_TextInterfaces',1),0 ,0, 'Y', now(), 0, now(), 0, ?, ?, 'Y')
carlos@0
    84
    </Sql>
carlos@0
    85
    <Parameter name="text"/>
carlos@0
    86
    <Parameter name="filename"/>
carlos@0
    87
  </SqlMethod>
carlos@0
    88
carlos@0
    89
  <SqlMethod name="update" type="preparedStatement" return="rowCount">
carlos@0
    90
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
    91
    <Sql>
carlos@0
    92
      update ad_textinterfaces
asier@134
    93
         set isUsed='Y'
carlos@0
    94
       where ad_textinterfaces_id = ?
carlos@0
    95
    </Sql>
carlos@0
    96
    <Parameter name="adTextinterfacesId"/>
carlos@0
    97
  </SqlMethod>
carlos@0
    98
  <SqlMethod name="baseLanguage" type="preparedStatement" return="String" default="">
carlos@0
    99
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   100
    <Sql>
carlos@0
   101
      SELECT AD_LANGUAGE FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISBASELANGUAGE='Y'
carlos@0
   102
    </Sql>
carlos@0
   103
  </SqlMethod>
carlos@0
   104
carlos@0
   105
  <SqlMethod name="systemLanguage" type="preparedStatement" return="multiple">
carlos@0
   106
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
carlos@0
   107
    <Sql>
carlos@0
   108
      SELECT AD_LANGUAGE AS NAME FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISSYSTEMLANGUAGE='Y' AND ISBASELANGUAGE='N'
carlos@0
   109
    </Sql>
carlos@0
   110
  </SqlMethod>
asier@134
   111
  
asier@134
   112
  <SqlMethod name="clean" type="preparedStatement" return="rowCount">
asier@134
   113
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
asier@134
   114
    <Sql>
asier@134
   115
      update ad_textinterfaces
asier@134
   116
         set isUsed='N'
asier@134
   117
    </Sql>
asier@134
   118
  </SqlMethod>
carlos@0
   119
</SqlClass>