src-db/database/model/triggers/S_RESOURCEASSIGNMENT_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 06:36:50 +0000
changeset 781 d68cf344696f
parent 778 6150609a1a0a
child 785 8dba91261590
permissions -rw-r--r--
Update copyright years in database files
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[
juanpablo@771
     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@781
    20
    * Contributions are Copyright (C) 2001-2008 Openbravo, S.
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: S_ResourceAssignment_Trg.sql,v 1.2 2003/03/19 06:46:56 jjanke Exp $
adrian@94
    26
    ***
adrian@94
    27
    * Title: S_Resource Assignment
adrian@94
    28
    * Description:
adrian@94
    29
    *   Syncronize Resource Assugnment with Expense Reports
adrian@94
    30
    ************************************************************************/
adrian@94
    31
    v_Description NVARCHAR2(255) ;
adrian@94
    32
BEGIN
adrian@94
    33
  NULL;
adrian@94
    34
  /**
adrian@94
    35
  IF (INSERTING OR UPDATING) THEN
adrian@94
    36
  v_Description:=:new.Name;
gorkaion@239
    37
  IF (:new.Description IS NOT NULL AND LENGTH(:new.Description) > 0) THEN
adrian@94
    38
  v_Description:=v_Description || ' (' || :new.Description || ')';
adrian@94
    39
  END IF;
adrian@94
    40
  -- Update Expense Line
adrian@94
    41
  UPDATE S_TimeExpenseLine
adrian@94
    42
  SET  Description=v_Description,
adrian@94
    43
  Qty=:new.Qty
adrian@94
    44
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    45
  AND (Description <> v_Description OR Qty <> :new.Qty);
adrian@94
    46
  -- Update Order Line
adrian@94
    47
  UPDATE C_OrderLine
adrian@94
    48
  SET  Description=v_Description,
adrian@94
    49
  QtyOrdered=:new.Qty
adrian@94
    50
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    51
  AND (Description <> v_Description OR QtyOrdered <> :new.Qty);
adrian@94
    52
  -- Update Invoice Line
adrian@94
    53
  UPDATE C_InvoiceLine
adrian@94
    54
  SET  Description=v_Description,
adrian@94
    55
  QtyInvoiced=:new.Qty
adrian@94
    56
  WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
gorkaion@239
    57
  AND (Description <> v_Description OR QtyInvoiced <> :new.Qty);
adrian@94
    58
  END IF;
adrian@94
    59
  **/
antonio@735
    60
END S_RESOURCEASSIGNMENT_TRG
gorkaion@239
    61
]]></body>
adrian@94
    62
    </trigger>
adrian@94
    63
  </database>