<?xml version="1.0"?>
<database name="TRIGGER C_DOCTYPE_COPY_TRG">
<trigger name="C_DOCTYPE_COPY_TRG" table="C_DOCTYPE_COPY" 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.0 (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 SL
* All portions are Copyright (C) 2001-2006 Openbravo SL
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************/
BEGIN IF INSERTING
THEN
-- Create Translation Row
INSERT
INTO C_DOCTYPE_COPY_Trl
(
C_DOCTYPE_COPY_ID, AD_Language, AD_Client_ID,
AD_Org_ID, IsActive, Created,
CreatedBy, Updated, UpdatedBy,
Name, IsTranslated
)
SELECT :new.C_DOCTYPE_COPY_ID,
AD_Language, :new.AD_Client_ID, :new.AD_Org_ID,
:new.IsActive, :new.Created, :new.CreatedBy,
:new.Updated, :new.UpdatedBy, :new.Name,
'N'
FROM AD_Language
WHERE IsActive='Y'
AND IsSystemLanguage='Y';
END IF;
IF UPDATING THEN
IF(:new.name!=:old.name) THEN
UPDATE C_DOCTYPE_COPY_Trl
SET IsTranslated='N'
-- Updated=SysDate
WHERE C_DOCTYPE_COPY_ID=:new.C_DOCTYPE_COPY_ID;
END IF;
END IF;
-- Updating
END C_DOCTYPE_COPY_TRG
]]></body>
</trigger>
</database>