src-db/database/model/triggers/M_MOVEMENT_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 09:28:08 +0000
changeset 785 8dba91261590
parent 756 ae11e4610537
child 1605 8a0fe0193bef
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 M_MOVEMENT_TRG">
adrian@94
     3
    <trigger name="M_MOVEMENT_TRG" table="M_MOVEMENT" fires="after" insert="false" update="true" delete="true" foreach="row">
gorkaion@239
     4
      <body><![CDATA[
gorkaion@239
     5
adrian@170
     6
adrian@94
     7
gorka@401
     8
adrian@94
     9
/*************************************************************************
adrian@94
    10
    * The contents of this file are subject to the Openbravo  Public  License
adrian@94
    11
    * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
adrian@94
    12
    * Version 1.1  with a permitted attribution clause; you may not  use this
adrian@94
    13
    * file except in compliance with the License. You  may  obtain  a copy of
adrian@94
    14
    * the License at http://www.openbravo.com/legal/license.html
adrian@94
    15
    * Software distributed under the License  is  distributed  on  an "AS IS"
adrian@94
    16
    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
adrian@94
    17
    * License for the specific  language  governing  rights  and  limitations
adrian@94
    18
    * under the License.
adrian@94
    19
    * The Original Code is Openbravo ERP.
adrian@94
    20
    * The Initial Developer of the Original Code is Openbravo SL
adrian@94
    21
    * All portions are Copyright (C) 2007 Openbravo SL
adrian@94
    22
    * All Rights Reserved.
adrian@94
    23
    * Contributor(s):  ______________________________________.
adrian@94
    24
    ************************************************************************/
gorkaion@280
    25
v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
adrian@94
    26
BEGIN
adrian@94
    27
  IF (:old.PROCESSED = 'Y' AND(
gorkaion@280
    28
     (COALESCE(:old.MOVEMENTDATE, v_DateNull) <> COALESCE(:new.MOVEMENTDATE, v_DateNull))
gorkaion@239
    29
     OR (COALESCE(:old.AD_ORGTRX_ID, 0) <> COALESCE(:new.AD_ORGTRX_ID, 0))
gorka@401
    30
     OR (COALESCE(:old.DOCUMENTNO, '.') <> COALESCE(:new.DOCUMENTNO, '.'))
gorka@401
    31
     OR(COALESCE(:old.AD_ORG_ID, 0) <> COALESCE(:new.AD_ORG_ID, 0))
gorka@401
    32
     OR(COALESCE(:old.AD_CLIENT_ID, 0) <> COALESCE(:new.AD_CLIENT_ID, 0)))) THEN
adrian@94
    33
    RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
adrian@94
    34
  END IF;
antonio@735
    35
END M_MOVEMENT_TRG
gorkaion@239
    36
]]></body>
adrian@94
    37
    </trigger>
adrian@94
    38
  </database>