src-db/database/model/triggers/C_CURRENCY_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 09:28:08 +0000
changeset 785 8dba91261590
parent 781 d68cf344696f
child 799 fef2c5e2feb7
permissions -rw-r--r--
Fix last update of copyright years in database files
gorka@367
     1
<?xml version="1.0"?>
gorka@367
     2
  <database name="TRIGGER C_CURRENCY_TRG">
gorka@367
     3
    <trigger name="C_CURRENCY_TRG" table="C_CURRENCY" fires="after" insert="true" update="true" delete="false" foreach="row">
gorka@367
     4
      <body><![CDATA[
juanpablo@771
     5
    /*************************************************************************
juanpablo@771
     6
    * The contents of this file are subject to the Compiere Public
juanpablo@771
     7
    * License 1.1 ("License"); You may not use this file except in
juanpablo@771
     8
    * compliance with the License. You may obtain a copy of the License in
juanpablo@771
     9
    * the legal folder of your Openbravo installation.
gorka@367
    10
    * Software distributed under the License is distributed on an
gorka@367
    11
    * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
gorka@367
    12
    * implied. See the License for the specific language governing rights
gorka@367
    13
    * and limitations under the License.
juanpablo@778
    14
    * The Original Code is  Compiere  ERP &  Business Solution
juanpablo@771
    15
    * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
gorka@367
    16
    * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
gorka@367
    17
    * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
gorka@367
    18
    * All Rights Reserved.
gorka@367
    19
    * Contributor(s): Openbravo SL
juanpablo@785
    20
    * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.
juanpablo@771
    21
    *
juanpablo@771
    22
    * Specifically, this derivative work is based upon the following Compiere
juanpablo@771
    23
    * file and version.
gorka@367
    24
    *************************************************************************
gorka@367
    25
    * Insert Translation
gorka@367
    26
    */
gorka@367
    27
    BEGIN  IF INSERTING
gorka@367
    28
    THEN
gorka@367
    29
    --  Create Translation Row
gorka@367
    30
  INSERT
gorka@367
    31
  INTO C_CURRENCY_Trl
gorka@367
    32
    (
gorka@367
    33
      C_CURRENCY_ID, AD_Language, AD_Client_ID,
gorka@367
    34
      AD_Org_ID, IsActive, Created,
gorka@367
    35
      CreatedBy, Updated, UpdatedBy,
gorka@367
    36
      IsTranslated, CurSymbol, Description
gorka@367
    37
    )
gorka@367
    38
  SELECT :new.C_CURRENCY_ID,
gorka@367
    39
    AD_Language, :new.AD_Client_ID, :new.AD_Org_ID,
gorka@367
    40
    :new.IsActive, :new.Created, :new.CreatedBy,
antonio@737
    41
    :new.Updated, :new.UpdatedBy,
gorka@370
    42
    'N', :new.CurSymbol, :new.Description
gorka@367
    43
  FROM AD_Language
gorka@367
    44
  WHERE IsActive='Y'
gorka@367
    45
    AND IsSystemLanguage='Y';
gorka@367
    46
 END IF;
gorka@367
    47
 -- Inserting
gorka@367
    48
 IF UPDATING THEN
gorka@367
    49
  IF(COALESCE(:old.CurSymbol, '.') <> COALESCE(:NEW.CurSymbol, '.')
gorka@367
    50
  OR COALESCE(:old.Description, '.') <> COALESCE(:NEW.Description, '.'))
gorka@367
    51
 THEN
gorka@367
    52
    -- Translation
gorka@367
    53
    UPDATE C_CURRENCY_Trl
gorka@367
    54
      SET IsTranslated='N',
antonio@735
    55
      Updated=now()
gorka@367
    56
    WHERE C_CURRENCY_ID=:new.C_CURRENCY_ID;
gorka@367
    57
  END IF;
gorka@367
    58
 END IF;
gorka@367
    59
-- Updating
antonio@735
    60
END C_CURRENCY_TRG
gorka@367
    61
]]></body>
gorka@367
    62
    </trigger>
gorka@367
    63
  </database>