src-db/database/model/triggers/AD_PROCESS_PARA_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Thu, 24 Apr 2008 19:34:53 +0000
changeset 771 f0f606b4acf4
parent 756 ae11e4610537
child 778 6150609a1a0a
permissions -rw-r--r--
Update database files with the correct license
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER AD_PROCESS_PARA_TRG">
adrian@94
     3
    <trigger name="AD_PROCESS_PARA_TRG" table="AD_PROCESS_PARA" 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
/*************************************************************************
juanpablo@771
    10
* The contents of this file are subject to the Compiere Public
juanpablo@771
    11
* License 1.1 ("License"); You may not use this file except in
juanpablo@771
    12
* compliance with the License. You may obtain a copy of the License in
juanpablo@771
    13
* the legal folder of your Openbravo installation.
juanpablo@771
    14
adrian@94
    15
* Software distributed under the License is distributed on an
adrian@94
    16
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
adrian@94
    17
* implied. See the License for the specific language governing rights
juanpablo@771
    18
adrian@94
    19
* and limitations under the License.
juanpablo@771
    20
* The Original Code is  Compiere  ERP \&  Business Solution
juanpablo@771
    21
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
juanpablo@771
    22
adrian@94
    23
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
adrian@94
    24
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
adrian@94
    25
* All Rights Reserved.
adrian@94
    26
* Contributor(s): Openbravo SL
juanpablo@771
    27
juanpablo@771
    28
* Contributions are Copyright (C) 1999-2008 Openbravo, S.L
juanpablo@771
    29
*
juanpablo@771
    30
* Specifically, this derivative work is based upon the following Compiere
juanpablo@771
    31
* file and version.
adrian@94
    32
*************************************************************************
adrian@94
    33
* $Id: AD_Process_Para_Trg.sql,v 1.3 2002/10/21 04:49:47 jjanke Exp $
adrian@94
    34
***
adrian@94
    35
* Title: Parameter Trigger
adrian@94
    36
* Description:
adrian@94
    37
*   Translation
adrian@94
    38
************************************************************************/
adrian@94
    39
BEGIN
adrian@94
    40
  -- Insert AD_Process_Para Trigger
adrian@94
    41
  --  for Translation
adrian@94
    42
  IF (INSERTING)
adrian@94
    43
  THEN
adrian@94
    44
    --  Create Translation Row
adrian@94
    45
    INSERT INTO AD_Process_Para_Trl
adrian@94
    46
                (AD_Process_Para_ID, AD_Language, AD_Client_ID, AD_Org_ID,
adrian@94
    47
                 IsActive, Created, CreatedBy, Updated, UpdatedBy, NAME,
adrian@94
    48
                 Description, HELP, IsTranslated)
adrian@94
    49
      SELECT :NEW.AD_Process_Para_ID, AD_Language, :NEW.AD_Client_ID,
adrian@94
    50
             :NEW.AD_Org_ID, :NEW.IsActive, :NEW.Created, :NEW.CreatedBy,
adrian@94
    51
             :NEW.Updated, :NEW.UpdatedBy, :NEW.NAME, :NEW.Description,
adrian@94
    52
             :NEW.HELP, 'N'
adrian@94
    53
        FROM AD_Language
adrian@94
    54
       WHERE IsActive = 'Y' AND IsSystemLanguage = 'Y';
adrian@94
    55
  END IF;
adrian@94
    56
adrian@94
    57
-- Inserting
adrian@94
    58
-- AD_Process_Para update trigger
adrian@94
    59
--  synchronize name,...
adrian@94
    60
  IF (UPDATING)
adrian@94
    61
  THEN
gorkaion@239
    62
    IF (   COALESCE (:OLD.NAME, '.') <> COALESCE (:NEW.NAME, '.')
gorkaion@239
    63
        OR COALESCE (:OLD.Description, '.') <>
adrian@94
    64
                                              COALESCE (:NEW.Description, '.')
gorkaion@239
    65
        OR COALESCE (:OLD.HELP, '.') <> COALESCE (:NEW.HELP, '.')
adrian@94
    66
       )
adrian@94
    67
    THEN
adrian@94
    68
      UPDATE AD_Process_Para_Trl
adrian@94
    69
         SET IsTranslated = 'N',
antonio@735
    70
             Updated = now()
adrian@94
    71
       WHERE AD_Process_Para_ID = :NEW.AD_Process_Para_ID;
adrian@94
    72
    END IF;
adrian@94
    73
  END IF;
adrian@94
    74
-- Updating
antonio@735
    75
END AD_PROCESS_PARA_TRG
gorkaion@239
    76
]]></body>
adrian@94
    77
    </trigger>
adrian@94
    78
  </database>