src-db/database/model/triggers/AD_TAB_TRG2.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Mon, 28 Apr 2008 09:28:08 +0000
changeset 785 8dba91261590
parent 756 ae11e4610537
child 1605 8a0fe0193bef
permissions -rw-r--r--
Fix last update of copyright years in database files
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="TRIGGER AD_TAB_TRG2">
adrian@94
     3
    <trigger name="AD_TAB_TRG2" table="AD_TAB" fires="after" insert="true" update="true" delete="true" 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
 v_ID       NUMBER(10);
adrian@94
    26
 v_ID_MAP      NUMBER(10);
adrian@94
    27
 v_WindowName     VARCHAR2(60);
adrian@94
    28
 v_ClassName     VARCHAR2(60);
adrian@94
    29
 v_IsActive      CHAR(1) := 'Y';
gorka@557
    30
 v_Count       NUMBER(10);
adrian@94
    31
BEGIN
adrian@94
    32
  IF (UPDATING) THEN
gorkaion@239
    33
    IF NOT((COALESCE(:old.NAME,'.')<>COALESCE(:NEW.NAME,'.') OR COALESCE(:old.IsActive,'.')<>COALESCE(:NEW.IsActive,'.'))) THEN
adrian@94
    34
      RETURN;
adrian@94
    35
    END IF;
antonio@737
    36
gorka@557
    37
    SELECT MAX(TO_CHAR(ISACTIVE)) INTO v_IsActive
gorka@557
    38
    FROM AD_WINDOW
gorka@557
    39
    WHERE AD_WINDOW_ID = :NEW.AD_WINDOW_ID;
gorka@557
    40
gorka@557
    41
    IF v_IsActive <> 'Y' THEN
gorka@557
    42
      v_IsActive := :NEW.ISACTIVE;
gorka@557
    43
    END IF;
antonio@737
    44
gorka@557
    45
    SELECT AD_MAPPING_FORMAT(TO_CHAR(W.NAME)), AD_MAPPING_FORMAT(TO_CHAR(:new.NAME))
gorka@557
    46
    INTO v_WindowName, v_ClassName
gorka@557
    47
    FROM AD_WINDOW W
gorka@557
    48
    WHERE W.AD_WINDOW_ID = :new.AD_WINDOW_ID;
antonio@737
    49
antonio@737
    50
    SELECT COUNT(*) INTO v_Count
gorka@557
    51
    FROM AD_MODEL_OBJECT
gorka@557
    52
    WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W'
gorka@557
    53
    AND CLASSNAME LIKE 'org.openbravo.erpWindows.%';
antonio@737
    54
gorka@557
    55
    IF v_Count > 0 THEN
antonio@737
    56
      SELECT AD_MODEL_OBJECT_ID INTO v_ID
gorka@557
    57
      FROM AD_MODEL_OBJECT
gorka@557
    58
      WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W'
gorka@557
    59
      AND CLASSNAME LIKE 'org.openbravo.erpWindows.%';
antonio@737
    60
antonio@737
    61
      UPDATE AD_MODEL_OBJECT
gorka@557
    62
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
    63
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
    64
        ISACTIVE = v_IsActive,
antonio@735
    65
        UPDATED = now(),
gorka@557
    66
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
    67
        CLASSNAME = 'org.openbravo.erpWindows.' || v_WindowName || '.' || v_ClassName
gorka@557
    68
      WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W'
antonio@737
    69
      AND CLASSNAME LIKE 'org.openbravo.erpWindows.%';
antonio@737
    70
gorka@557
    71
    ELSE
gorka@557
    72
      Ad_Sequence_Next('AD_Model_Object', :new.AD_Client_ID, v_ID);
gorka@557
    73
      INSERT INTO AD_MODEL_OBJECT (AD_MODEL_OBJECT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
gorka@557
    74
      UPDATED, UPDATEDBY, ACTION, AD_TAB_ID, CLASSNAME, ISDEFAULT)
antonio@735
    75
      VALUES (v_ID, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
    76
      now(), :new.UPDATEDBY, 'W', :new.AD_TAB_ID, 'org.openbravo.erpWindows.' || v_WindowName || '.' || v_ClassName, 'Y');
gorka@557
    77
antonio@737
    78
    END IF;
antonio@737
    79
antonio@737
    80
    SELECT COUNT(*) INTO v_Count
gorka@557
    81
    FROM AD_MODEL_OBJECT_MAPPING
gorka@557
    82
    WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
    83
      SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
    84
    AND MAPPINGNAME LIKE '/%/%_Relation.html';
antonio@737
    85
gorka@557
    86
    IF v_Count > 0 THEN
gorka@557
    87
      UPDATE AD_MODEL_OBJECT_MAPPING
gorka@557
    88
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
    89
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
    90
        ISACTIVE = v_IsActive,
antonio@735
    91
        UPDATED = now(),
gorka@557
    92
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
    93
        MAPPINGNAME = ('/' || v_WindowName || '/' || v_ClassName || '_Relation.html')
gorka@557
    94
      WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
    95
        SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
    96
      AND MAPPINGNAME LIKE '/%/%_Relation.html';
antonio@737
    97
gorka@557
    98
    ELSE
gorka@557
    99
      Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
gorka@557
   100
      INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
gorka@557
   101
      ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   102
      VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   103
      now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Relation.html'), 'Y');
antonio@737
   104
gorka@557
   105
    END IF;
antonio@737
   106
antonio@737
   107
    SELECT COUNT(*) INTO v_Count
gorka@557
   108
    FROM AD_MODEL_OBJECT_MAPPING
gorka@557
   109
    WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   110
      SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
   111
    AND MAPPINGNAME LIKE '/%/%_Edition.html';
antonio@737
   112
gorka@557
   113
    IF v_Count > 0 THEN
gorka@557
   114
      UPDATE AD_MODEL_OBJECT_MAPPING
gorka@557
   115
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
   116
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
   117
        ISACTIVE = v_IsActive,
antonio@735
   118
        UPDATED = now(),
gorka@557
   119
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
   120
        MAPPINGNAME = ('/' || v_WindowName || '/' || v_ClassName || '_Edition.html')
gorka@557
   121
      WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   122
        SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
   123
      AND MAPPINGNAME LIKE '/%/%_Edition.html';
antonio@737
   124
gorka@557
   125
    ELSE
gorka@557
   126
      Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
gorka@557
   127
      INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
gorka@557
   128
      ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   129
      VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   130
      now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Edition.html'), 'N');
antonio@737
   131
gorka@557
   132
    END IF;
antonio@737
   133
antonio@737
   134
    SELECT COUNT(*) INTO v_Count
gorka@557
   135
    FROM AD_MODEL_OBJECT_MAPPING
gorka@557
   136
    WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   137
      SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
antonio@737
   138
    AND MAPPINGNAME LIKE '/%/%_Excel.xls';
antonio@737
   139
antonio@737
   140
    IF v_Count > 0 THEN
gorka@557
   141
      UPDATE AD_MODEL_OBJECT_MAPPING
gorka@557
   142
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
   143
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
   144
        ISACTIVE = v_IsActive,
antonio@735
   145
        UPDATED = now(),
gorka@557
   146
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
   147
        MAPPINGNAME = ('/' || v_WindowName || '/' || v_ClassName || '_Excel.xls')
gorka@557
   148
      WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   149
        SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
antonio@737
   150
      AND MAPPINGNAME LIKE '/%/%_Excel.xls';
antonio@737
   151
gorka@557
   152
    ELSE
gorka@557
   153
      Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
gorka@557
   154
      INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
gorka@557
   155
      ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   156
      VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   157
      now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Excel.xls'), 'N');
antonio@737
   158
gorka@557
   159
    END IF;
antonio@737
   160
antonio@737
   161
    SELECT COUNT(*) INTO v_Count
gorka@557
   162
    FROM AD_MODEL_OBJECT
gorka@557
   163
    WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W'
gorka@557
   164
    AND CLASSNAME LIKE 'org.openbravo.erpCommon.ad_callouts.ComboReloads%';
antonio@737
   165
gorka@557
   166
    IF v_Count > 0 THEN
antonio@737
   167
      UPDATE AD_MODEL_OBJECT
gorka@557
   168
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
   169
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
   170
        ISACTIVE = v_IsActive,
antonio@735
   171
        UPDATED = now(),
gorka@557
   172
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
   173
        CLASSNAME = 'org.openbravo.erpCommon.ad_callouts.ComboReloads' || :new.ad_tab_id
gorka@557
   174
      WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W'
antonio@737
   175
      AND CLASSNAME LIKE 'org.openbravo.erpCommon.ad_callouts.ComboReloads%';
antonio@737
   176
gorka@557
   177
    ELSE
gorka@557
   178
      Ad_Sequence_Next('AD_Model_Object', :new.AD_Client_ID, v_ID);
gorka@557
   179
      INSERT INTO AD_MODEL_OBJECT (AD_MODEL_OBJECT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
gorka@557
   180
      UPDATED, UPDATEDBY, ACTION, AD_TAB_ID, CLASSNAME, ISDEFAULT)
antonio@735
   181
      VALUES (v_ID, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   182
      now(), :new.UPDATEDBY, 'W', :new.AD_TAB_ID, 'org.openbravo.erpCommon.ad_callouts.ComboReloads' || :new.ad_tab_id, 'N');
antonio@737
   183
gorka@557
   184
    END IF;
antonio@737
   185
antonio@737
   186
    SELECT COUNT(*) INTO v_Count
gorka@557
   187
    FROM AD_MODEL_OBJECT_MAPPING
gorka@557
   188
    WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   189
      SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
   190
    AND MAPPINGNAME LIKE '/ad_callouts/ComboReloads%.html';
antonio@737
   191
antonio@737
   192
    IF v_Count > 0 THEN
gorka@557
   193
      UPDATE AD_MODEL_OBJECT_MAPPING
gorka@557
   194
      SET AD_CLIENT_ID = :new.AD_CLIENT_ID,
gorka@557
   195
        AD_ORG_ID = :new.AD_ORG_ID,
gorka@557
   196
        ISACTIVE = v_IsActive,
antonio@735
   197
        UPDATED = now(),
gorka@557
   198
        UPDATEDBY = :new.UPDATEDBY,
gorka@557
   199
        MAPPINGNAME = ('/ad_callouts/ComboReloads' || :new.ad_tab_id || '.html')
gorka@557
   200
      WHERE AD_MODEL_OBJECT_ID IN (
gorka@557
   201
        SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W')
gorka@557
   202
      AND MAPPINGNAME LIKE '/ad_callouts/ComboReloads%.html';
antonio@737
   203
gorka@557
   204
    ELSE
gorka@557
   205
      Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
gorka@557
   206
      INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
gorka@557
   207
      ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   208
      VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   209
      now(), :new.UPDATEDBY, v_ID, ('/ad_callouts/ComboReloads' || :new.ad_tab_id || '.html'), 'N');
antonio@737
   210
gorka@557
   211
    END IF;
antonio@737
   212
gorka@557
   213
 END IF;
antonio@737
   214
gorka@557
   215
 IF (DELETING) THEN
adrian@94
   216
  DELETE FROM AD_MODEL_OBJECT_MAPPING WHERE AD_MODEL_OBJECT_ID IN (
adrian@94
   217
      SELECT AD_MODEL_OBJECT_ID FROM AD_MODEL_OBJECT WHERE AD_MODEL_OBJECT.AD_TAB_ID=:old.AD_TAB_ID AND ACTION = 'W');
adrian@94
   218
  DELETE FROM AD_MODEL_OBJECT WHERE ACTION = 'W' AND AD_MODEL_OBJECT.AD_TAB_ID = :OLD.AD_TAB_ID;
adrian@94
   219
 END IF;
adrian@94
   220
gorka@557
   221
 IF (INSERTING) THEN
adrian@94
   222
     SELECT MAX(TO_CHAR(ISACTIVE)) INTO v_IsActive
adrian@94
   223
  FROM AD_WINDOW
adrian@94
   224
  WHERE AD_WINDOW_ID = :NEW.AD_WINDOW_ID;
adrian@94
   225
gorkaion@239
   226
  IF v_IsActive <> 'Y' THEN
adrian@94
   227
      v_IsActive := :NEW.ISACTIVE;
adrian@94
   228
  END IF;
adrian@94
   229
  SELECT AD_MAPPING_FORMAT(TO_CHAR(W.NAME)), AD_MAPPING_FORMAT(TO_CHAR(:new.NAME))
adrian@94
   230
  INTO v_WindowName, v_ClassName
adrian@94
   231
  FROM AD_WINDOW W
adrian@94
   232
  WHERE W.AD_WINDOW_ID = :new.AD_WINDOW_ID;
adrian@94
   233
adrian@94
   234
  Ad_Sequence_Next('AD_Model_Object', :new.AD_Client_ID, v_ID);
adrian@94
   235
  INSERT INTO AD_MODEL_OBJECT (AD_MODEL_OBJECT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
adrian@94
   236
  UPDATED, UPDATEDBY, ACTION, AD_TAB_ID, CLASSNAME, ISDEFAULT)
antonio@735
   237
  VALUES (v_ID, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   238
  now(), :new.UPDATEDBY, 'W', :new.AD_TAB_ID, 'org.openbravo.erpWindows.' || v_WindowName || '.' || v_ClassName, 'Y');
adrian@94
   239
adrian@94
   240
  Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
adrian@94
   241
  INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
adrian@94
   242
  ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   243
  VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   244
  now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Relation.html'), 'Y');
adrian@94
   245
adrian@94
   246
  Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
adrian@94
   247
  INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
adrian@94
   248
  ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   249
  VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   250
  now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Edition.html'), 'N');
adrian@94
   251
adrian@94
   252
  Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
adrian@94
   253
  INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
adrian@94
   254
  ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   255
  VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   256
  now(), :new.UPDATEDBY, v_ID, ('/' || v_WindowName || '/' || v_ClassName || '_Excel.xls'), 'N');
adrian@94
   257
adrian@94
   258
  Ad_Sequence_Next('AD_Model_Object', :new.AD_Client_ID, v_ID);
adrian@94
   259
  INSERT INTO AD_MODEL_OBJECT (AD_MODEL_OBJECT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
adrian@94
   260
  UPDATED, UPDATEDBY, ACTION, AD_TAB_ID, CLASSNAME, ISDEFAULT)
antonio@735
   261
  VALUES (v_ID, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   262
  now(), :new.UPDATEDBY, 'W', :new.AD_TAB_ID, 'org.openbravo.erpCommon.ad_callouts.ComboReloads' || :new.ad_tab_id, 'N');
adrian@94
   263
adrian@94
   264
  Ad_Sequence_Next('AD_Model_Object_Mapping', :new.AD_Client_ID, v_ID_MAP);
adrian@94
   265
  INSERT INTO AD_MODEL_OBJECT_MAPPING (AD_MODEL_OBJECT_MAPPING_ID, AD_CLIENT_ID, AD_ORG_ID,
adrian@94
   266
  ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_MODEL_OBJECT_ID, MAPPINGNAME, ISDEFAULT)
antonio@735
   267
  VALUES (v_ID_MAP, :new.AD_CLIENT_ID, :new.AD_ORG_ID, v_IsActive, now(), :new.CREATEDBY,
antonio@735
   268
  now(), :new.UPDATEDBY, v_ID, ('/ad_callouts/ComboReloads' || :new.ad_tab_id || '.html'), 'N');
adrian@94
   269
 END IF;
adrian@94
   270
antonio@735
   271
END AD_TAB_TRG2
gorkaion@239
   272
]]></body>
adrian@94
   273
    </trigger>
adrian@94
   274
  </database>