modules/org.openbravo.client.querylist/src-db/database/model/functions/OBCQL_LANGUAGE_CREATE.xml
author Harpreet Singh <harpreet@openbravo.com>
Fri, 10 Dec 2010 19:47:45 +0100
changeset 9091 c4f1a5c7d7c2
permissions -rw-r--r--
Added 3.0 modules to modules dir and changed the VERSION number
<?xml version="1.0"?>
  <database name="FUNCTION OBCQL_LANGUAGE_CREATE">
    <function name="OBCQL_LANGUAGE_CREATE" type="NULL">
      <parameter name="ep_instance_id" type="VARCHAR" mode="in">
        <default/>
      </parameter>
      <body><![CDATA[/*************************************************************************
* The contents of this file are subject to the Openbravo  Public  License
* Version  1.1  (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 SLU
* All portions are Copyright (C) 2010 Openbravo SLU
* All Rights Reserved.
* Contributor(s):  ______________________________________.
************************************************************************/

  v_rowcount NUMBER;

BEGIN

  INSERT INTO obcql_query_column_trl
           (obcql_query_column_trl_id , obcql_query_column_id, ad_language,
            ad_client_id              , ad_org_id            , isactive   ,
            created                   , createdby            , updated    ,
            updatedby                 , name                 ,
            istranslated)
    SELECT get_uuid()                , qc.obcql_query_column_id, l.ad_language,
           qc.ad_client_id           , qc.ad_org_id            , qc.isactive,
           now()                     , qc.createdby            , now()        ,
           qc.updatedby              , qc.name                 ,
           'N'
    FROM obcql_query_column qc, ad_language l, ad_module m, obcql_widget_query wq, obkmo_widget_class wc
    WHERE l.isactive = 'Y'
      AND l.issystemlanguage = 'Y'
      AND wq.obcql_widget_query_id = qc.obcql_widget_query_id
      AND wc.obkmo_widget_class_id = wq.obkmo_widget_class_id
      AND m.ad_module_id = wc.ad_module_id
      AND m.ad_language != l.ad_language
      AND NOT EXISTS (SELECT 1 
                      FROM obcql_query_column_trl t
                      WHERE t.obcql_query_column_id = qc.obcql_query_column_id
                        AND t.ad_language = l.ad_language);

  v_rowcount:=SQL%ROWCOUNT;
  DBMS_OUTPUT.PUT_LINE('- OBCQL_LANGUAGE_CREATE: OBCQL_Query_Column_Trl ' || v_rowcount) ;
END OBCQL_LANGUAGE_CREATE
]]></body>
    </function>
  </database>