src-db/database/model/triggers/AD_PROCESS_PARA_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Fri, 25 Apr 2008 14:02:35 +0000
changeset 778 6150609a1a0a
parent 771 f0f606b4acf4
child 781 d68cf344696f
permissions -rw-r--r--
Remove empty lines in 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[
adrian@94
     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.
adrian@94
    10
* Software distributed under the License is distributed on an
adrian@94
    11
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
adrian@94
    12
* implied. See the License for the specific language governing rights
adrian@94
    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.
adrian@94
    16
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
adrian@94
    17
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
adrian@94
    18
* All Rights Reserved.
adrian@94
    19
* Contributor(s): Openbravo SL
juanpablo@771
    20
* Contributions are Copyright (C) 1999-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.
adrian@94
    24
*************************************************************************
adrian@94
    25
* $Id: AD_Process_Para_Trg.sql,v 1.3 2002/10/21 04:49:47 jjanke Exp $
adrian@94
    26
***
adrian@94
    27
* Title: Parameter Trigger
adrian@94
    28
* Description:
adrian@94
    29
*   Translation
adrian@94
    30
************************************************************************/
adrian@94
    31
BEGIN
adrian@94
    32
  -- Insert AD_Process_Para Trigger
adrian@94
    33
  --  for Translation
adrian@94
    34
  IF (INSERTING)
adrian@94
    35
  THEN
adrian@94
    36
    --  Create Translation Row
adrian@94
    37
    INSERT INTO AD_Process_Para_Trl
adrian@94
    38
                (AD_Process_Para_ID, AD_Language, AD_Client_ID, AD_Org_ID,
adrian@94
    39
                 IsActive, Created, CreatedBy, Updated, UpdatedBy, NAME,
adrian@94
    40
                 Description, HELP, IsTranslated)
adrian@94
    41
      SELECT :NEW.AD_Process_Para_ID, AD_Language, :NEW.AD_Client_ID,
adrian@94
    42
             :NEW.AD_Org_ID, :NEW.IsActive, :NEW.Created, :NEW.CreatedBy,
adrian@94
    43
             :NEW.Updated, :NEW.UpdatedBy, :NEW.NAME, :NEW.Description,
adrian@94
    44
             :NEW.HELP, 'N'
adrian@94
    45
        FROM AD_Language
adrian@94
    46
       WHERE IsActive = 'Y' AND IsSystemLanguage = 'Y';
adrian@94
    47
  END IF;
adrian@94
    48
adrian@94
    49
-- Inserting
adrian@94
    50
-- AD_Process_Para update trigger
adrian@94
    51
--  synchronize name,...
adrian@94
    52
  IF (UPDATING)
adrian@94
    53
  THEN
gorkaion@239
    54
    IF (   COALESCE (:OLD.NAME, '.') <> COALESCE (:NEW.NAME, '.')
gorkaion@239
    55
        OR COALESCE (:OLD.Description, '.') <>
adrian@94
    56
                                              COALESCE (:NEW.Description, '.')
gorkaion@239
    57
        OR COALESCE (:OLD.HELP, '.') <> COALESCE (:NEW.HELP, '.')
adrian@94
    58
       )
adrian@94
    59
    THEN
adrian@94
    60
      UPDATE AD_Process_Para_Trl
adrian@94
    61
         SET IsTranslated = 'N',
antonio@735
    62
             Updated = now()
adrian@94
    63
       WHERE AD_Process_Para_ID = :NEW.AD_Process_Para_ID;
adrian@94
    64
    END IF;
adrian@94
    65
  END IF;
adrian@94
    66
-- Updating
antonio@735
    67
END AD_PROCESS_PARA_TRG
gorkaion@239
    68
]]></body>
adrian@94
    69
    </trigger>
adrian@94
    70
  </database>