ad_desktop_trg.sql

来自「Java写的ERP系统」· SQL 代码 · 共 43 行

SQL
43
字号
CREATE OR REPLACE TRIGGER AD_Desktop_Trg
AFTER INSERT OR UPDATE
	ON AD_Desktop
FOR EACH ROW
BEGIN
/*************************************************************************
 * The contents of this file are subject to the Compiere License.  You may
 * obtain a copy of the License at http://www.compiere.org/CPL/   Software
 * is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for details. Code: Compiere ERP+CPM Extensions
 * Copyright (C) 1999-2001 Jorg Janke, Compiere, Inc. All Rights Reserved.
 *************************************************************************
 ************************************************************************/

	--	Insert Trigger 
	IF INSERTING THEN
    	INSERT INTO AD_Desktop_Trl
        	(AD_Desktop_ID, AD_Language, AD_Client_ID, AD_Org_ID,
	        IsActive, Created, CreatedBy, Updated, UpdatedBy,
    	    Name, Description, Help, IsTranslated)
	    SELECT :new.AD_Desktop_ID, AD_Language, :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
   		WHERE	IsActive = 'Y' AND IsSystemLanguage = 'Y';
	END IF;	-- INSERTING

	--	Update Trigger
	IF UPDATING THEN
	--	reset Translation flag
		IF (:old.Name <> :new.Name 
				OR :old.Description <> :new.Description 
				OR :old.Help <> :new.Help) THEN
			UPDATE	AD_Desktop_Trl
			SET		IsTranslated='N'
			WHERE	AD_Desktop_ID = :new.AD_Desktop_ID;
		END IF;

	END IF;	-- UPDATING

END AD_Desktop_Trg;
/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?