src-db/database/model/triggers/S_RESOURCEASSIGNMENT_TRG.xml
changeset 756 ae11e4610537
parent 735 daced7e311c9
child 771 f0f606b4acf4
equal deleted inserted replaced
755:16b55e593268 756:ae11e4610537
       
     1 <?xml version="1.0"?>
       
     2   <database name="TRIGGER S_RESOURCEASSIGNMENT_TRG">
       
     3     <trigger name="S_RESOURCEASSIGNMENT_TRG" table="S_RESOURCEASSIGNMENT" fires="after" insert="true" update="true" delete="true" foreach="row">
       
     4       <body><![CDATA[
       
     5 
       
     6 
       
     7 
       
     8 
       
     9     /*************************************************************************
       
    10     * The contents of this file are subject to the Compiere License
       
    11     * Version 2.5.0 ("License"); You may not use this file except in
       
    12     * compliance with the License. You may obtain a copy of the License at
       
    13     * http://www.compiere.org/license.html
       
    14     * Software distributed under the License is distributed on an
       
    15     * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
       
    16     * implied. See the License for the specific language governing rights
       
    17     * and limitations under the License.
       
    18     * The Original Code is  Compiere  ERP &  Business Solution
       
    19     * The Initial Developer of the Original Code is Jorg Janke  and ComPiere,
       
    20     Inc.
       
    21     * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
       
    22     * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
       
    23     * All Rights Reserved.
       
    24     * Contributor(s): Openbravo SL
       
    25     * Contributions are Copyright (C) 1999-2005 Openbravo, S.L
       
    26     *************************************************************************
       
    27     * $Id: S_ResourceAssignment_Trg.sql,v 1.2 2003/03/19 06:46:56 jjanke Exp $
       
    28     ***
       
    29     * Title: S_Resource Assignment
       
    30     * Description:
       
    31     *   Syncronize Resource Assugnment with Expense Reports
       
    32     ************************************************************************/
       
    33     v_Description NVARCHAR2(255) ;
       
    34 BEGIN
       
    35   NULL;
       
    36   /**
       
    37   IF (INSERTING OR UPDATING) THEN
       
    38   v_Description:=:new.Name;
       
    39   IF (:new.Description IS NOT NULL AND LENGTH(:new.Description) > 0) THEN
       
    40   v_Description:=v_Description || ' (' || :new.Description || ')';
       
    41   END IF;
       
    42   -- Update Expense Line
       
    43   UPDATE S_TimeExpenseLine
       
    44   SET  Description=v_Description,
       
    45   Qty=:new.Qty
       
    46   WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
       
    47   AND (Description <> v_Description OR Qty <> :new.Qty);
       
    48   -- Update Order Line
       
    49   UPDATE C_OrderLine
       
    50   SET  Description=v_Description,
       
    51   QtyOrdered=:new.Qty
       
    52   WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
       
    53   AND (Description <> v_Description OR QtyOrdered <> :new.Qty);
       
    54   -- Update Invoice Line
       
    55   UPDATE C_InvoiceLine
       
    56   SET  Description=v_Description,
       
    57   QtyInvoiced=:new.Qty
       
    58   WHERE S_ResourceAssignment_ID=:new.S_ResourceAssignment_ID
       
    59   AND (Description <> v_Description OR QtyInvoiced <> :new.Qty);
       
    60   END IF;
       
    61   **/
       
    62 END S_RESOURCEASSIGNMENT_TRG
       
    63 ]]></body>
       
    64     </trigger>
       
    65   </database>