src-db/database/model/triggers/AD_DESKTOP_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 09:28:08 +0000
changeset 785 8dba91261590
parent 756 ae11e4610537
permissions -rw-r--r--
Fix last update of copyright years in database files
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER AD_DESKTOP_TRG">
adrian@94
     3
    <trigger name="AD_DESKTOP_TRG" table="AD_DESKTOP" fires="after" insert="true" update="true" delete="false" foreach="row">
gorkaion@239
     4
      <body><![CDATA[
gorkaion@239
     5
adrian@170
     6
adrian@94
     7
gorka@367
     8
adrian@94
     9
 BEGIN
adrian@94
    10
    /******************************************************************************
adrian@94
    11
    * The contents of this file are subject to the   Compiere License  Version 1.1
adrian@94
    12
    * ("License"); You may not use this file except in compliance with the License
adrian@94
    13
    * You may obtain a copy of the License at http://www.compiere.org/license.html
adrian@94
    14
    * Software distributed under the License is distributed on an  "AS IS"  basis,
adrian@94
    15
    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
adrian@94
    16
    * the specific language governing rights and limitations under the License.
gorkaion@239
    17
    * The Original Code is                  Compiere  ERP &  Business Solution
adrian@94
    18
    * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
adrian@94
    19
    * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
adrian@94
    20
    * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
adrian@94
    21
    * Contributor(s): Openbravo SL
adrian@94
    22
    * Contributions are Copyright (C) 2001-2006 Openbravo S.L.
adrian@94
    23
    ******************************************************************************/
adrian@94
    24
    -- Insert Trigger
adrian@94
    25
    IF INSERTING
adrian@94
    26
    THEN
adrian@94
    27
  INSERT
adrian@94
    28
  INTO AD_Desktop_Trl
adrian@94
    29
    (
adrian@94
    30
      AD_Desktop_ID, AD_Language, AD_Client_ID,
adrian@94
    31
      AD_Org_ID, IsActive, Created,
adrian@94
    32
      CreatedBy, Updated, UpdatedBy,
adrian@94
    33
      Name, Description, Help,
adrian@94
    34
      IsTranslated
adrian@94
    35
    )
adrian@94
    36
  SELECT :new.AD_Desktop_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
    :new.Description, :new.Help, '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
 -- INSERTING
adrian@94
    46
 -- Update Trigger
adrian@94
    47
 IF UPDATING THEN
adrian@94
    48
  -- reset Translation flag
gorka@367
    49
  IF(COALESCE(:old.Name, '.') <> COALESCE(:new.Name,'.')  OR COALESCE(:old.Description,'.') <> COALESCE(:new.Description,'.')
gorka@367
    50
  OR COALESCE(:old.Help,'.') <> COALESCE(:new.Help,'.'))
adrian@94
    51
 THEN
adrian@94
    52
    UPDATE AD_Desktop_Trl
adrian@94
    53
      SET IsTranslated='N'
adrian@94
    54
    WHERE AD_Desktop_ID=:new.AD_Desktop_ID;
adrian@94
    55
  END IF;
adrian@94
    56
 END IF;
adrian@94
    57
-- UPDATING
antonio@735
    58
END AD_DESKTOP_TRG
gorkaion@239
    59
]]></body>
adrian@94
    60
    </trigger>
adrian@94
    61
  </database>