database/model/triggers/AD_PROCESS_PARA_TRG.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Tue, 22 Apr 2008 13:22:11 +0000
changeset 735 daced7e311c9
parent 239 a30acae847e1
permissions -rw-r--r--
Structure after exporting from PostgreSQL with new dbsourcemanager
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
/*************************************************************************
adrian@94
    10
* The contents of this file are subject to the Compiere License
adrian@94
    11
* Version 2.5.0 ("License"); You may not use this file except in
adrian@94
    12
* compliance with the License. You may obtain a copy of the License at
adrian@94
    13
* http://www.compiere.org/license.html
adrian@94
    14
* Software distributed under the License is distributed on an
adrian@94
    15
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
adrian@94
    16
* implied. See the License for the specific language governing rights
adrian@94
    17
* and limitations under the License.
gorkaion@239
    18
* The Original Code is  Compiere  ERP &  Business Solution
adrian@94
    19
* The Initial Developer of the Original Code is Jorg Janke  and ComPiere,
adrian@94
    20
Inc.
adrian@94
    21
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
adrian@94
    22
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
adrian@94
    23
* All Rights Reserved.
adrian@94
    24
* Contributor(s): Openbravo SL
adrian@94
    25
* Contributions are Copyright (C) 1999-2005 Openbravo, S.L
adrian@94
    26
*************************************************************************
adrian@94
    27
* $Id: AD_Process_Para_Trg.sql,v 1.3 2002/10/21 04:49:47 jjanke Exp $
adrian@94
    28
***
adrian@94
    29
* Title: Parameter Trigger
adrian@94
    30
* Description:
adrian@94
    31
*   Translation
adrian@94
    32
************************************************************************/
adrian@94
    33
BEGIN
adrian@94
    34
  -- Insert AD_Process_Para Trigger
adrian@94
    35
  --  for Translation
adrian@94
    36
  IF (INSERTING)
adrian@94
    37
  THEN
adrian@94
    38
    --  Create Translation Row
adrian@94
    39
    INSERT INTO AD_Process_Para_Trl
adrian@94
    40
                (AD_Process_Para_ID, AD_Language, AD_Client_ID, AD_Org_ID,
adrian@94
    41
                 IsActive, Created, CreatedBy, Updated, UpdatedBy, NAME,
adrian@94
    42
                 Description, HELP, IsTranslated)
adrian@94
    43
      SELECT :NEW.AD_Process_Para_ID, AD_Language, :NEW.AD_Client_ID,
adrian@94
    44
             :NEW.AD_Org_ID, :NEW.IsActive, :NEW.Created, :NEW.CreatedBy,
adrian@94
    45
             :NEW.Updated, :NEW.UpdatedBy, :NEW.NAME, :NEW.Description,
adrian@94
    46
             :NEW.HELP, 'N'
adrian@94
    47
        FROM AD_Language
adrian@94
    48
       WHERE IsActive = 'Y' AND IsSystemLanguage = 'Y';
adrian@94
    49
  END IF;
adrian@94
    50
adrian@94
    51
-- Inserting
adrian@94
    52
-- AD_Process_Para update trigger
adrian@94
    53
--  synchronize name,...
adrian@94
    54
  IF (UPDATING)
adrian@94
    55
  THEN
gorkaion@239
    56
    IF (   COALESCE (:OLD.NAME, '.') <> COALESCE (:NEW.NAME, '.')
gorkaion@239
    57
        OR COALESCE (:OLD.Description, '.') <>
adrian@94
    58
                                              COALESCE (:NEW.Description, '.')
gorkaion@239
    59
        OR COALESCE (:OLD.HELP, '.') <> COALESCE (:NEW.HELP, '.')
adrian@94
    60
       )
adrian@94
    61
    THEN
adrian@94
    62
      UPDATE AD_Process_Para_Trl
adrian@94
    63
         SET IsTranslated = 'N',
antonio@735
    64
             Updated = now()
adrian@94
    65
       WHERE AD_Process_Para_ID = :NEW.AD_Process_Para_ID;
adrian@94
    66
    END IF;
adrian@94
    67
  END IF;
adrian@94
    68
-- Updating
antonio@735
    69
END AD_PROCESS_PARA_TRG
gorkaion@239
    70
]]></body>
adrian@94
    71
    </trigger>
adrian@94
    72
  </database>