src-db/database/model/triggers/C_DOCTYPE_COPY_TRG.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Wed, 23 Apr 2008 17:34:12 +0000
changeset 756 ae11e4610537
parent 735 database/model/triggers/C_DOCTYPE_COPY_TRG.xml@daced7e311c9
permissions -rw-r--r--
Moved database folder to src-db folder
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER C_DOCTYPE_COPY_TRG">
adrian@94
     3
    <trigger name="C_DOCTYPE_COPY_TRG" table="C_DOCTYPE_COPY" fires="after" insert="true" update="true" delete="false" foreach="row">
gorkaion@239
     4
      <body><![CDATA[
gorkaion@239
     5
adrian@170
     6
adrian@94
     7
adrian@94
     8
adrian@94
     9
    /*************************************************************************
adrian@94
    10
    * The contents of this file are subject to the Openbravo  Public  License
adrian@94
    11
    * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
adrian@94
    12
    * Version 1.1  with a permitted attribution clause; you may not  use this
adrian@94
    13
    * file except in compliance with the License. You  may  obtain  a copy of
adrian@94
    14
    * the License at http://www.openbravo.com/legal/license.html
adrian@94
    15
    * Software distributed under the License  is  distributed  on  an "AS IS"
adrian@94
    16
    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
adrian@94
    17
    * License for the specific  language  governing  rights  and  limitations
adrian@94
    18
    * under the License.
adrian@94
    19
    * The Original Code is Openbravo ERP.
adrian@94
    20
    * The Initial Developer of the Original Code is Openbravo SL
adrian@94
    21
    * All portions are Copyright (C) 2001-2006 Openbravo SL
adrian@94
    22
    * All Rights Reserved.
adrian@94
    23
    * Contributor(s):  ______________________________________.
adrian@94
    24
    ************************************************************************/
adrian@94
    25
    BEGIN  IF INSERTING
adrian@94
    26
    THEN
adrian@94
    27
    --  Create Translation Row
adrian@94
    28
  INSERT
adrian@94
    29
  INTO C_DOCTYPE_COPY_Trl
adrian@94
    30
    (
adrian@94
    31
      C_DOCTYPE_COPY_ID, AD_Language, AD_Client_ID,
adrian@94
    32
      AD_Org_ID, IsActive, Created,
adrian@94
    33
      CreatedBy, Updated, UpdatedBy,
adrian@94
    34
      Name, IsTranslated
adrian@94
    35
    )
adrian@94
    36
  SELECT :new.C_DOCTYPE_COPY_ID,
adrian@94
    37
    AD_Language, :new.AD_Client_ID, :new.AD_Org_ID,
adrian@94
    38
    :new.IsActive, :new.Created, :new.CreatedBy,
adrian@94
    39
    :new.Updated, :new.UpdatedBy, :new.Name,
adrian@94
    40
     'N'
adrian@94
    41
  FROM AD_Language
adrian@94
    42
  WHERE IsActive='Y'
adrian@94
    43
    AND IsSystemLanguage='Y';
adrian@94
    44
 END IF;
adrian@94
    45
 IF UPDATING THEN
adrian@94
    46
  IF(:new.name!=:old.name) THEN
adrian@94
    47
    UPDATE C_DOCTYPE_COPY_Trl
adrian@94
    48
      SET IsTranslated='N'
adrian@94
    49
      --  Updated=SysDate
adrian@94
    50
    WHERE C_DOCTYPE_COPY_ID=:new.C_DOCTYPE_COPY_ID;
adrian@94
    51
  END IF;
adrian@94
    52
 END IF;
adrian@94
    53
 -- Updating
antonio@735
    54
END C_DOCTYPE_COPY_TRG
gorkaion@239
    55
]]></body>
adrian@94
    56
    </trigger>
adrian@94
    57
  </database>