src-db/database/model/triggers/M_PRODUCT_TRG.xml
changeset 799 fef2c5e2feb7
parent 756 ae11e4610537
child 1067 4a05c922c488
equal deleted inserted replaced
798:4994e5a604bb 799:fef2c5e2feb7
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2   <database name="TRIGGER M_PRODUCT_TRG">
     2   <database name="TRIGGER M_PRODUCT_TRG">
     3     <trigger name="M_PRODUCT_TRG" table="M_PRODUCT" fires="after" insert="true" update="true" delete="true" foreach="row">
     3     <trigger name="M_PRODUCT_TRG" table="M_PRODUCT" fires="after" insert="true" update="true" delete="true" foreach="row">
     4       <body><![CDATA[
     4       <body><![CDATA[
     5 
     5 /*************************************************************************
     6 
     6   * The contents of this file are subject to the Compiere Public
     7 
     7   * License 1.1 ("License"); You may not use this file except in
     8 
     8   * compliance with the License. You may obtain a copy of the License in
     9 
     9   * the legal folder of your Openbravo installation.
    10 
    10   * Software distributed under the License is distributed on an
    11     /*************************************************************************
    11   * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
    12     * The contents of this file are subject to the Openbravo  Public  License
    12   * implied. See the License for the specific language governing rights
    13     * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
    13   * and limitations under the License.
    14     * Version 1.1  with a permitted attribution clause; you may not  use this
    14   * The Original Code is  Compiere  ERP &  Business Solution
    15     * file except in compliance with the License. You  may  obtain  a copy of
    15   * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
    16     * the License at http://www.openbravo.com/legal/license.html
    16   * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
    17     * Software distributed under the License  is  distributed  on  an "AS IS"
    17   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
    18     * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    18   * All Rights Reserved.
    19     * License for the specific  language  governing  rights  and  limitations
    19   * Contributor(s): Openbravo SL
    20     * under the License.
    20   * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.
    21     * The Original Code is Openbravo ERP.
    21   *
    22     * The Initial Developer of the Original Code is Openbravo SL
    22   * Specifically, this derivative work is based upon the following Compiere
    23     * All portions are Copyright (C) 2001-2006 Openbravo SL
    23   * file and version.
    24     * All Rights Reserved.
    24   *************************************************************************/
    25     * Contributor(s):  ______________________________________.
       
    26     ************************************************************************/
       
    27 
    25 
    28    TYPE RECORD IS REF CURSOR;
    26    TYPE RECORD IS REF CURSOR;
    29    Cur_Defaults RECORD;
    27    Cur_Defaults RECORD;
    30 
    28 
    31     v_xTree_ID    NUMBER;
    29     v_xTree_ID    NUMBER;
    75              :new.AD_Client_ID, :new.AD_ORG_ID, 'Y', now(), :new.CreatedBy, now(), :new.UpdatedBy,
    73              :new.AD_Client_ID, :new.AD_ORG_ID, 'Y', now(), :new.CreatedBy, now(), :new.UpdatedBy,
    76              Cur_Defaults.P_Revenue_Acct, Cur_Defaults.P_Expense_Acct, Cur_Defaults.P_Asset_Acct, Cur_Defaults.P_COGS_Acct,
    74              Cur_Defaults.P_Revenue_Acct, Cur_Defaults.P_Expense_Acct, Cur_Defaults.P_Asset_Acct, Cur_Defaults.P_COGS_Acct,
    77     Cur_Defaults.P_PurchasePriceVariance_Acct, Cur_Defaults.P_InvoicePriceVariance_Acct,
    75     Cur_Defaults.P_PurchasePriceVariance_Acct, Cur_Defaults.P_InvoicePriceVariance_Acct,
    78     Cur_Defaults.P_TradeDiscountRec_Acct, Cur_Defaults.P_TradeDiscountGrant_Acct);
    76     Cur_Defaults.P_TradeDiscountRec_Acct, Cur_Defaults.P_TradeDiscountGrant_Acct);
    79 
    77 
    80    --  Costing
    78    END LOOP;
    81    INSERT INTO M_Product_Costing
       
    82     (M_Product_ID, C_AcctSchema_ID,
       
    83              AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
       
    84     CurrentCostPrice, CostStandard, FutureCostPrice,
       
    85     CostStandardPOQty,CostStandardPOAmt,CostStandardCumQty,CostStandardCumAmt,
       
    86     CostAverage, CostAverageCumQty, CostAverageCumAmt,
       
    87     PriceLastPO, PriceLastInv,
       
    88     TotalInvQty, TotalInvAmt)
       
    89          VALUES
       
    90              (:new.M_Product_ID, Cur_Defaults.C_AcctSchema_ID,
       
    91              :new.AD_Client_ID, :new.AD_ORG_ID, 'Y', now(), :new.CreatedBy, now(), :new.UpdatedBy,
       
    92              0,0,0,  0,0,0,0,  0,0,0,  0,0,  0,0);
       
    93     END LOOP;
       
    94 
    79 
    95 
    80 
    96      --  Create Translation Row
    81      --  Create Translation Row
    97      INSERT INTO M_Product_Trl
    82      INSERT INTO M_Product_Trl
    98          (M_Product_ID, AD_Language, AD_Client_ID, AD_Org_ID,
    83          (M_Product_ID, AD_Language, AD_Client_ID, AD_Org_ID,