src-db/database/model/triggers/S_RESOURCEASSIGNMENT_TRG.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Wed, 23 Apr 2008 17:34:12 +0000
changeset 756 ae11e4610537
parent 735 database/model/triggers/S_RESOURCEASSIGNMENT_TRG.xml@daced7e311c9
child 771 f0f606b4acf4
permissions -rw-r--r--
Moved database folder to src-db folder
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER S_RESOURCEASSIGNMENT_TRG">
adrian@94
     3
    <trigger name="S_RESOURCEASSIGNMENT_TRG" table="S_RESOURCEASSIGNMENT" fires="after" 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
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: S_ResourceAssignment_Trg.sql,v 1.2 2003/03/19 06:46:56 jjanke Exp $
adrian@94
    28
    ***
adrian@94
    29
    * Title: S_Resource Assignment
adrian@94
    30
    * Description:
adrian@94
    31
    *   Syncronize Resource Assugnment with Expense Reports
adrian@94
    32
    ************************************************************************/
adrian@94
    33
    v_Description NVARCHAR2(255) ;
adrian@94
    34
BEGIN
adrian@94
    35
  NULL;
adrian@94
    36
  /**
adrian@94
    37
  IF (INSERTING OR UPDATING) THEN
adrian@94
    38
  v_Description:=:new.Name;
gorkaion@239
    39
  IF (:new.Description IS NOT NULL AND LENGTH(:new.Description) > 0) THEN
adrian@94
    40
  v_Description:=v_Description || ' (' || :new.Description || ')';
adrian@94
    41
  END IF;
adrian@94
    42
  -- Update Expense Line
adrian@94
    43
  UPDATE S_TimeExpenseLine
adrian@94
    44
  SET  Description=v_Description,
adrian@94
    45
  Qty=:new.Qty
adrian@94
    46
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    47
  AND (Description <> v_Description OR Qty <> :new.Qty);
adrian@94
    48
  -- Update Order Line
adrian@94
    49
  UPDATE C_OrderLine
adrian@94
    50
  SET  Description=v_Description,
adrian@94
    51
  QtyOrdered=:new.Qty
adrian@94
    52
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    53
  AND (Description <> v_Description OR QtyOrdered <> :new.Qty);
adrian@94
    54
  -- Update Invoice Line
adrian@94
    55
  UPDATE C_InvoiceLine
adrian@94
    56
  SET  Description=v_Description,
adrian@94
    57
  QtyInvoiced=:new.Qty
adrian@94
    58
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    59
  AND (Description <> v_Description OR QtyInvoiced <> :new.Qty);
adrian@94
    60
  END IF;
adrian@94
    61
  **/
antonio@735
    62
END S_RESOURCEASSIGNMENT_TRG
gorkaion@239
    63
]]></body>
adrian@94
    64
    </trigger>
adrian@94
    65
  </database>