modules/org.openbravo.userinterface.selector/src-db/database/model/triggers/OBUISEL_SELECTOR_TRL_TRG.xml
author Unai Martirena <unai.martirena@openbravo.com>
Thu, 05 May 2016 18:36:37 +0200
changeset 28834 a504afa60379
parent 27632 82269ada63ec
permissions -rw-r--r--
Remove Qty parameter from M_RESERVATION_POST and M_RESERVE_STOCK_AUTO

They are not needed any more. The qty of the reservation is changed in java processes, so we don't need to change in the Stored Procedures
<?xml version="1.0"?>
  <database name="TRIGGER OBUISEL_SELECTOR_TRL_TRG">
    <trigger name="OBUISEL_SELECTOR_TRL_TRG" table="OBUISEL_SELECTOR" fires="after" insert="true" update="true" delete="false" foreach="row">
      <body><![CDATA[

/*************************************************************************
* The contents of this file are subject to the Openbravo  Public  License
* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
* Version 1.1  with a permitted attribution clause; you may not  use this
* file except in compliance with the License. You  may  obtain  a copy of
* the License at http://www.openbravo.com/legal/license.html
* 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 Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2010 Openbravo SLU
* All Rights Reserved.
* Contributor(s):  ______________________________________.
************************************************************************/

BEGIN
    
    IF AD_isTriggerEnabled()='N' THEN RETURN;
    END IF;

    -- Insert trl entries for module language
    IF INSERTING THEN
        INSERT
            INTO OBUISEL_Selector_Trl
            (
            OBUISEL_Selector_Trl_ID, OBUISEL_Selector_ID, AD_Language_ID, AD_Client_ID,
            AD_Org_ID, IsActive, Created,
            CreatedBy, Updated, UpdatedBy,
            Name, Description, Help,
            IsTranslated
            )
        SELECT get_uuid(), :new.OBUISEL_Selector_ID,
            AD_Language.AD_Language_ID, :new.AD_Client_ID, :new.AD_Org_ID,
            :new.IsActive, :new.Created, :new.CreatedBy,
            :new.Updated, :new.UpdatedBy, :new.Name,
            :new.Description, :new.Help, 'N'
            FROM AD_Language, AD_Module M
            WHERE AD_Language.IsActive='Y'
            AND IsSystemLanguage='Y'
            AND M.AD_Module_ID = :new.AD_Module_ID
            AND M.AD_Language != AD_Language.AD_Language;
    END IF;
    
    -- Set trl entries to not translated
    IF UPDATING THEN
        IF (
            COALESCE(:old.Name, '.') <> COALESCE(:NEW.Name, '.')
            OR COALESCE(:old.Description, '.') <> COALESCE(:NEW.Description, '.')
            OR COALESCE(:old.Help, '.') <> COALESCE(:NEW.Help, '.'))
        THEN
            UPDATE OBUISEL_Selector_Trl
            SET IsTranslated='N',
                Updated=now()
            WHERE OBUISEL_Selector_ID=:new.OBUISEL_Selector_ID;
        END IF;
    END IF;
END OBUISEL_SELECTOR_TRL_TRG
]]></body>
    </trigger>
  </database>