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