author | Gorka Ion Damián <gorkaion.damian@openbravo.com> |
Fri, 14 Dec 2007 16:21:33 +0000 | |
changeset 239 | a30acae847e1 |
parent 170 | 4b5493776a7f |
child 735 | daced7e311c9 |
permissions | -rw-r--r-- |
adrian@94 | 1 |
<?xml version="1.0"?> |
adrian@94 | 2 |
<database name="TRIGGER M_INVENTORYLINE2_TRG"> |
adrian@94 | 3 |
<trigger name="M_INVENTORYLINE2_TRG" table="M_INVENTORYLINE" fires="before" insert="true" update="true" delete="false" foreach="row"> |
gorkaion@239 | 4 |
<body><![CDATA[ |
gorkaion@239 | 5 |
|
adrian@170 | 6 |
|
adrian@94 | 7 |
|
adrian@94 | 8 |
|
adrian@94 | 9 |
/************************************************************************* |
adrian@94 | 10 |
* The contents of this file are subject to the Openbravo Public License |
adrian@94 | 11 |
* Version 1.0 (the "License"), being the Mozilla Public License |
adrian@94 | 12 |
* Version 1.1 with a permitted attribution clause; you may not use this |
adrian@94 | 13 |
* file except in compliance with the License. You may obtain a copy of |
adrian@94 | 14 |
* the License at http://www.openbravo.com/legal/license.html |
adrian@94 | 15 |
* Software distributed under the License is distributed on an "AS IS" |
adrian@94 | 16 |
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
adrian@94 | 17 |
* License for the specific language governing rights and limitations |
adrian@94 | 18 |
* under the License. |
adrian@94 | 19 |
* The Original Code is Openbravo ERP. |
adrian@94 | 20 |
* The Initial Developer of the Original Code is Openbravo SL |
adrian@94 | 21 |
* All portions are Copyright (C) 2001-2006 Openbravo SL |
adrian@94 | 22 |
* All Rights Reserved. |
adrian@94 | 23 |
* Contributor(s): ______________________________________. |
adrian@94 | 24 |
************************************************************************/ |
adrian@94 | 25 |
BEGIN IF(UPDATING) |
gorkaion@239 | 26 |
THEN IF NOT((COALESCE(:OLD.M_Product_Uom_ID, 0) <> COALESCE(:NEW.M_Product_Uom_ID, 0) |
gorkaion@239 | 27 |
OR COALESCE(:OLD.QuantityOrderBook, 0) <> COALESCE(:NEW.QuantityOrderBook, 0))) |
adrian@94 | 28 |
THEN RETURN; |
adrian@94 | 29 |
END IF; |
adrian@94 | 30 |
END IF; |
adrian@94 | 31 |
IF(UPDATING OR INSERTING) THEN |
adrian@94 | 32 |
IF(:NEW.M_Product_Uom_ID IS NOT NULL AND :NEW.QuantityOrderBook IS NULL) THEN |
adrian@94 | 33 |
:NEW.QuantityOrderBook:=0; |
adrian@94 | 34 |
ELSIF(:NEW.M_Product_Uom_ID IS NULL AND :NEW.QuantityOrderBook IS NOT NULL) THEN |
adrian@94 | 35 |
:NEW.QuantityOrderBook:=NULL; |
adrian@94 | 36 |
END IF; |
adrian@94 | 37 |
END IF; |
adrian@94 | 38 |
END M_InventoryLine2_Trg |
adrian@94 | 39 |
|
adrian@170 | 40 |
|
gorkaion@239 | 41 |
|
gorkaion@239 | 42 |
]]></body> |
adrian@94 | 43 |
</trigger> |
adrian@94 | 44 |
</database> |