src-db/database/model/triggers/S_TIMEEXPENSE_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 799 fef2c5e2feb7
child 2078 cf88ca44cdd2
permissions -rw-r--r--
Merge r2.5x intro trunk
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER S_TIMEEXPENSE_TRG">
adrian@94
     3
    <trigger name="S_TIMEEXPENSE_TRG" table="S_TIMEEXPENSE" fires="before" insert="true" update="true" delete="true" foreach="row">
gorkaion@239
     4
      <body><![CDATA[
gorkaion@239
     5
adrian@170
     6
adrian@94
     7
adrian@94
     8
juanpablo@1605
     9
  v_ID    varchar2(32);
adrian@94
    10
  v_RO    NUMBER;
asier@799
    11
/*************************************************************************
asier@799
    12
* The contents of this file are subject to the Openbravo  Public  License
asier@799
    13
* Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
asier@799
    14
* Version 1.1  with a permitted attribution clause; you may not  use this
asier@799
    15
* file except in compliance with the License. You  may  obtain  a copy of
asier@799
    16
* the License at http://www.openbravo.com/legal/license.html
asier@799
    17
* Software distributed under the License  is  distributed  on  an "AS IS"
asier@799
    18
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
asier@799
    19
* License for the specific  language  governing  rights  and  limitations
asier@799
    20
* under the License.
asier@799
    21
* The Original Code is Openbravo ERP.
asier@799
    22
* The Initial Developer of the Original Code is Openbravo SL
asier@799
    23
* All portions are Copyright (C) 2001-2008 Openbravo SL
asier@799
    24
* All Rights Reserved.
asier@799
    25
* Contributor(s):  ______________________________________.
asier@799
    26
************************************************************************/
asier@799
    27
adrian@94
    28
BEGIN
adrian@94
    29
adrian@94
    30
 IF (INSERTING) THEN
adrian@94
    31
  IF (:NEW.PROCESSED = 'Y') THEN
adrian@94
    32
  RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted');
adrian@94
    33
 END IF;
adrian@94
    34
 ELSE
adrian@94
    35
   IF (UPDATING AND :OLD.PROCESSED = 'Y') THEN
gorkaion@239
    36
  IF (:NEW.DocumentNo<>:OLD.DocumentNo
gorkaion@239
    37
          OR :NEW.C_BPartner_ID<>:OLD.C_BPartner_ID
gorkaion@239
    38
          OR :NEW.DATEREPORT<>:OLD.DATEREPORT)
gorkaion@239
    39
          OR :NEW.AD_ORG_ID<>:OLD.AD_ORG_ID THEN
adrian@94
    40
       RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted');
adrian@94
    41
     END IF;
adrian@94
    42
  END IF;
adrian@94
    43
 END IF;
adrian@94
    44
antonio@735
    45
END S_TIMEEXPENSE_TRG
gorkaion@239
    46
]]></body>
adrian@94
    47
    </trigger>
adrian@94
    48
  </database>