src-db/database/model/triggers/MA_PC_CASE_TRG.xml
author Mikel Irurita <mikel.irurita@openbravo.com>
Thu, 28 Jul 2011 12:36:33 +0200
changeset 13320 021aea273863
parent 13319 178a991820b0
permissions -rw-r--r--
Related to issue 18065: update year in the license text
mikel@13319
     1
<?xml version="1.0"?>
mikel@13319
     2
  <database name="TRIGGER MA_PC_CASE_TRG">
mikel@13319
     3
    <trigger name="MA_PC_CASE_TRG" table="MA_PC_CASE" fires="after" insert="true" update="true" delete="false" foreach="row">
mikel@13319
     4
      <body><![CDATA[
mikel@13319
     5
mikel@13319
     6
/*************************************************************************
mikel@13319
     7
* The contents of this file are subject to the Openbravo  Public  License
mikel@13319
     8
* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
mikel@13319
     9
* Version 1.1  with a permitted attribution clause; you may not  use this
mikel@13319
    10
* file except in compliance with the License. You  may  obtain  a copy of
mikel@13319
    11
* the License at http://www.openbravo.com/legal/license.html
mikel@13319
    12
* Software distributed under the License  is  distributed  on  an "AS IS"
mikel@13319
    13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
mikel@13319
    14
* License for the specific  language  governing  rights  and  limitations
mikel@13319
    15
* under the License.
mikel@13319
    16
* The Original Code is Openbravo ERP.
mikel@13319
    17
* The Initial Developer of the Original Code is Openbravo SLU
mikel@13320
    18
* All portions are Copyright (C) 2010-2011 Openbravo SLU
mikel@13319
    19
* All Rights Reserved.
mikel@13319
    20
* Contributor(s):  ______________________________________.
mikel@13319
    21
************************************************************************/
mikel@13319
    22
mikel@13319
    23
  v_AttrSetValueType M_Product.AttrSetValueType%TYPE;
mikel@13319
    24
mikel@13319
    25
BEGIN
mikel@13319
    26
  IF AD_isTriggerEnabled()='N' THEN RETURN;
mikel@13319
    27
  END IF;
mikel@13319
    28
  IF (INSERTING OR UPDATING) THEN
mikel@13319
    29
   --Does not allow to change the attribute set value
mikel@13319
    30
   -- for products which attribute set value type is Fixed
mikel@13319
    31
   IF (:NEW.M_PRODUCT_ID IS NOT NULL AND COALESCE(:new.M_AttributeSetInstance_ID,'0')!='0') THEN
mikel@13319
    32
    SELECT ATTRSETVALUETYPE 
mikel@13319
    33
    INTO v_AttrSetValueType
mikel@13319
    34
    FROM M_PRODUCT 
mikel@13319
    35
    WHERE M_PRODUCT_ID=:NEW.M_PRODUCT_ID;
mikel@13319
    36
    IF (v_AttrSetValueType='F') THEN
mikel@13319
    37
     RAISE_APPLICATION_ERROR(-20000, '@AttrSetValueFixed@');
mikel@13319
    38
    END IF;
mikel@13319
    39
   END IF;
mikel@13319
    40
  END IF;
mikel@13319
    41
END MA_PC_CASE_TRG
mikel@13319
    42
]]></body>
mikel@13319
    43
    </trigger>
mikel@13319
    44
  </database>