src-trl/src/org/openbravo/translate/Translate_data.xsql
author Stefan Hühner <stefan.huehner@openbravo.com>
Fri, 09 Jan 2009 14:12:47 +0000
changeset 2553 e61d7b9f5942
parent 1929 ad0353d93b0f
child 5067 e13fc21ebf9c
permissions -rw-r--r--
Fixed 6818
Remove unused copy of all .xml/.jasper files to src-loc/design/en_US
-> WebContent size goes down by about 15mb
- do some unrelated cleanup on the src-trl files on the way
- unused fields, xsql-files, variables
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->


<SqlClass name="TranslateData" package="org.openbravo.translate">
  <SqlMethod name="select" type="preparedStatement" return="multiple">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      select A.ad_textinterfaces_id, A.tr, '' AS NAME, '' AS TOTAL
        from (select tt.ad_textinterfaces_id AS ad_textinterfaces_id, trim(tt.text) AS tr, 1 AS o
                from ad_textinterfaces_trl tt
               where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
                                                   from ad_textinterfaces t
                                                  where t.text     = ?
                                                    and t.filename = ?)
                 and tt.ad_language = ?
               union
              select tt.ad_textinterfaces_id AS id, trim(tt.text) AS tr, 2 AS o
                from ad_textinterfaces_trl tt
               where tt.ad_textinterfaces_id =  (select min(ad_textinterfaces_id)
                                                   from ad_textinterfaces t
                                                  where t.text =  ?
                                                    and t.filename is null)
                 and tt.ad_language = ?
               order by o) A
      group by A.ad_textinterfaces_id, A.tr, A.o
      order by A.o
    </Sql>
    <Parameter name="string"/>
    <Parameter name="filename"/>
    <Parameter name="languajeFin"/>
    <Parameter name="string"/>
    <Parameter name="languajeFin"/>
  </SqlMethod>

  <SqlMethod name="existsExpresion" type="preparedStatement" return="rowCount">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
         update ad_textinterfaces
           set isUsed = 'Y'
         where ad_textinterfaces_id = ( select min(A.ad_textinterfaces_id)
                                          from (select B.*
                                                from (select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 1 AS o
                                                          from ad_textinterfaces t,
                                                               ad_module m
                                                         where text     = ?
                                                           and filename = ?
                                                           and m.ad_module_id = t.ad_module_id
                                                           and m.ad_language = ?
                                                        union
                                                        select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 2 AS o
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
                                                         where trl.text     = ?
                                                           and t.filename = ?
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
                                                           and trl.ad_language = ?
                                                        union
                                                        select min(ad_textinterfaces_id) AS ad_textinterfaces_id, 3 AS o
                                                          from ad_textinterfaces t,
                                                               ad_module m
                                                         where text = ?
                                                           and filename is null
                                                           and m.ad_module_id = t.ad_module_id
                                                           and m.ad_language = ?
                                                        union
                                                        select min(t.ad_textinterfaces_id) AS ad_textinterfaces_id, 4 AS o
                                                          from ad_textinterfaces t, ad_textinterfaces_trl trl
                                                         where trl.text = ?
                                                           and t.filename is null
                                                           and trl.ad_textinterfaces_id = t.ad_textinterfaces_id
                                                           and trl.ad_language = ?
                                                         order by o) B
                                                 where ad_textinterfaces_id is not null) A)
    </Sql>
    <Parameter name="text"/>
    <Parameter name="filename"/>
    <Parameter name="moduleLang"/>
    
    <Parameter name="text"/>
    <Parameter name="filename"/>
    <Parameter name="moduleLang"/>
    
    <Parameter name="text"/>
    <Parameter name="moduleLang"/>
    
    <Parameter name="text"/>
    <Parameter name="moduleLang"/>
  </SqlMethod>

   <SqlMethod name="getModuleID" type="preparedStatement" return="string">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      SELECT AD_MODULE_ID
        FROM AD_MODULE
       WHERE JavaPackage = ?
    </Sql>
    <Parameter name="name"/>
  </SqlMethod>
  
  <SqlMethod name="getModuleLang" type="preparedStatement" return="string">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      SELECT AD_LANGUAGE
        FROM AD_MODULE
       WHERE AD_MODULE_ID = ?
    </Sql>
    <Parameter name="module_id"/>
  </SqlMethod>
  
  <SqlMethod name="isInDevelopmentModule" type="preparedStatement" return="boolean">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      SELECT COUNT(*) AS TOTAL
        FROM AD_MODULE
       WHERE AD_MODULE_ID = ?
         AND ISINDEVELOPMENT = 'Y'
    </Sql>
    <Parameter name="name"/>
  </SqlMethod>

  <SqlMethod name="isInDevelopmentModulePack" type="preparedStatement" return="boolean">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      SELECT COUNT(*) AS TOTAL
        FROM AD_MODULE
       WHERE JAVAPACKAGE = ?
         AND ISINDEVELOPMENT = 'Y'
    </Sql>
    <Parameter name="pack"/>
  </SqlMethod>
  
  <SqlMethod name="insert" type="preparedStatement" return="rowCount">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      insert into ad_textinterfaces
        (AD_TEXTINTERFACES_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, TEXT, FILENAME, ISUSED, AD_MODULE_ID)
      values
        (get_uuid(),'0' ,'0', 'Y', now(), '0', now(), '0', ?, ?, 'Y', ?)
    </Sql>
    <Parameter name="text"/>
    <Parameter name="filename"/>
    <Parameter name="module"/>
  </SqlMethod>

  <SqlMethod name="update" type="preparedStatement" return="rowCount">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      update ad_textinterfaces t
         set isUsed='Y'
       where ad_textinterfaces_id = ?
         and exists (select 1 
                       from ad_module m
                      where m.ad_module_id = t.ad_module_id
                        and m.isInDevelopment = 'Y')
    </Sql>
    <Parameter name="adTextinterfacesId"/>
  </SqlMethod>

  <SqlMethod name="systemLanguage" type="preparedStatement" return="multiple">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      SELECT AD_LANGUAGE AS NAME FROM AD_LANGUAGE WHERE ISACTIVE='Y' AND ISSYSTEMLANGUAGE='Y' AND ISBASELANGUAGE='N'
    </Sql>
  </SqlMethod>
  
  <SqlMethod name="clean" type="preparedStatement" return="rowCount">
    <SqlMethodComment>Return the translation of a text</SqlMethodComment>
    <Sql>
      update ad_textinterfaces t
         set isUsed='N'
       where exists (select 1 
                       from ad_module m
                      where m.ad_module_id = t.ad_module_id
                        and m.isInDevelopment = 'Y')  
    </Sql>
  </SqlMethod>
</SqlClass>