src-db/database/model/triggers/S_EXPENSETYPE_TRG.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 09:28:08 +0000
changeset 785 8dba91261590
parent 781 d68cf344696f
child 799 fef2c5e2feb7
permissions -rw-r--r--
Fix last update of copyright years in database files
<?xml version="1.0"?>
  <database name="TRIGGER S_EXPENSETYPE_TRG">
    <trigger name="S_EXPENSETYPE_TRG" table="S_EXPENSETYPE" fires="after" insert="true" update="true" delete="false" foreach="row">
      <body><![CDATA[
    /*************************************************************************
    * The contents of this file are subject to the Compiere Public
    * License 1.1 ("License"); You may not use this file except in
    * compliance with the License. You may obtain a copy of the License in
    * the legal folder of your Openbravo installation.
    * Software distributed under the License is distributed on an
    * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
    * implied. See the License for the specific language governing rights
    * and limitations under the License.
    * The Original Code is  Compiere  ERP &  Business Solution
    * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
    * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
    * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
    * All Rights Reserved.
    * Contributor(s): Openbravo SL
    * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.
    *
    * Specifically, this derivative work is based upon the following Compiere
    * file and version.
    *************************************************************************
    * $Id: S_ExpenseType_Trg.sql,v 1.3 2003/02/07 05:49:59 jjanke Exp $
    ***
    * Title: S_Expense Type
    * Description:
    *   Syncronize Resource with Product
    ************************************************************************/
    NextNo M_Product.M_Product_ID%TYPE;
BEGIN
  IF(INSERTING) THEN
    AD_Sequence_Next('M_Product', :new.AD_Client_ID, NextNo) ;
    INSERT
    INTO M_PRODUCT
      (
        M_Product_ID, AD_Client_ID, AD_Org_ID,
        IsActive, Created, CreatedBy,
        Updated, UpdatedBy, Value,
        Name, Description, DOCUMENTNOTE,
        HELP, UPC, SKU,
        C_UOM_ID, SALESREP_ID, ISSUMMARY,
        ProductType, ISSTOCKED, ISPURCHASED,
        ISSOLD, ISBOM, ISINVOICEPRINTDETAILS,
        ISPICKLISTPRINTDETAILS, ISVERIFIED, C_REVENUERECOGNITION_ID,
        M_Product_Category_ID, CLASSIFICATION, VOLUME,
        WEIGHT, SHELFWIDTH, SHELFHEIGHT,
        SHELFDEPTH, UNITSPERPALLET, C_TaxCategory_ID,
        S_Resource_ID, S_ExpenseType_ID, DISCONTINUED,
        DISCONTINUEDBY
      )
      VALUES
      (
        NextNo, :new.AD_Client_ID, :new.AD_Org_ID,
        :new.IsActive, :new.Created, :new.CreatedBy,
        :new.Updated, :new.UpdatedBy, :new.Value,
        :new.Name, :new.Description, null,
        null, null, null,
        :new.C_UOM_ID, null,  'N',  'E',
         'N',  'N',  'Y',
         'N', 'N', 'N',
         'N', null, :new.M_Product_Category_ID,
        null, 0, 0,
        0, 0, 0,
        0, :new.C_TaxCategory_ID, null,
        :new.S_ExpenseType_ID, 'N', null
      )
      ;
  ELSIF(UPDATING) THEN
    UPDATE M_Product
      SET IsActive=:new.IsActive,
      Updated=:new.Updated,
      UpdatedBy=:new.UpdatedBy,
      Value=:new.Value,
      Name=:new.Name,
      Description=:new.Description,
      C_UOM_ID=:new.C_UOM_ID,
      M_Product_Category_ID=:new.M_Product_Category_ID,
      C_TaxCategory_ID=:new.C_TaxCategory_ID
    WHERE S_ExpenseType_ID=:new.S_ExpenseType_ID;
  END IF;
END S_EXPENSETYPE_TRG
]]></body>
    </trigger>
  </database>