From 0423542a2f86355296b8439e7290655a579a6155 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 20 Mar 2008 00:46:18 +0000 Subject: [PATCH] FR [ 1920314 ] Make configurable the changelog for insert --- base/src/org/compiere/model/PO.java | 28 ++++++++++--------- .../331b-trunk/124_placeholder_branch350.sql | 0 migration/331b-trunk/125_FR1920314.sql | 5 ++++ .../postgresql/124_placeholder_branch350.sql | 0 .../331b-trunk/postgresql/125_FR1920314.sql | 5 ++++ 5 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 migration/331b-trunk/124_placeholder_branch350.sql create mode 100644 migration/331b-trunk/125_FR1920314.sql create mode 100644 migration/331b-trunk/postgresql/124_placeholder_branch350.sql create mode 100644 migration/331b-trunk/postgresql/125_FR1920314.sql diff --git a/base/src/org/compiere/model/PO.java b/base/src/org/compiere/model/PO.java index 2fbef10e6e..77bef4d75f 100644 --- a/base/src/org/compiere/model/PO.java +++ b/base/src/org/compiere/model/PO.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -2412,23 +2412,25 @@ public abstract class PO throw new DBException(e); // fini } - // Change Log - Only - if (session != null + // Change Log - Only + String insertLog = MSysConfig.getValue("SYSTEM_INSERT_CHANGELOG", "Y", getAD_Client_ID()); + if ( session != null && m_IDs.length == 1 && !p_info.isEncrypted(i) // not encrypted && !p_info.isVirtualColumn(i) // no virtual column && !"Password".equals(columnName) - // && p_info.getColumn(i).IsKey // log all record - to log just ID uncomment this line + && (insertLog.equalsIgnoreCase("Y")) + || (insertLog.equalsIgnoreCase("K") && p_info.getColumn(i).IsKey) ) - { - // change log on new - MChangeLog cLog = session.changeLog ( - m_trxName, AD_ChangeLog_ID, - p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID, - get_ID(), getAD_Client_ID(), getAD_Org_ID(), null, value, MChangeLog.EVENTCHANGELOG_Insert); - if (cLog != null) - AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID(); - } + { + // change log on new + MChangeLog cLog = session.changeLog ( + m_trxName, AD_ChangeLog_ID, + p_info.getAD_Table_ID(), p_info.getColumn(i).AD_Column_ID, + get_ID(), getAD_Client_ID(), getAD_Org_ID(), null, value, MChangeLog.EVENTCHANGELOG_Insert); + if (cLog != null) + AD_ChangeLog_ID = cLog.getAD_ChangeLog_ID(); + } } // Custom Columns diff --git a/migration/331b-trunk/124_placeholder_branch350.sql b/migration/331b-trunk/124_placeholder_branch350.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/migration/331b-trunk/125_FR1920314.sql b/migration/331b-trunk/125_FR1920314.sql new file mode 100644 index 0000000000..07a723af6a --- /dev/null +++ b/migration/331b-trunk/125_FR1920314.sql @@ -0,0 +1,5 @@ +-- Mar 19, 2008 7:17:07 PM COT +-- 1920314 - Make configurable the changelog for insert +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50015,'C',TO_DATE('2008-03-19 19:17:05','YYYY-MM-DD HH24:MI:SS'),100,'Keep change log for inserts: Y - Yes, N - No, K - just the key _ID','D','Y','SYSTEM_INSERT_CHANGELOG',TO_DATE('2008-03-19 19:17:05','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; + diff --git a/migration/331b-trunk/postgresql/124_placeholder_branch350.sql b/migration/331b-trunk/postgresql/124_placeholder_branch350.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/migration/331b-trunk/postgresql/125_FR1920314.sql b/migration/331b-trunk/postgresql/125_FR1920314.sql new file mode 100644 index 0000000000..901a935fa1 --- /dev/null +++ b/migration/331b-trunk/postgresql/125_FR1920314.sql @@ -0,0 +1,5 @@ +-- Mar 19, 2008 7:17:07 PM COT +-- 1920314 - Make configurable the changelog for insert +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50015,'C',TO_TIMESTAMP('2008-03-19 19:17:05','YYYY-MM-DD HH24:MI:SS'),100,'Keep change log for inserts: Y - Yes, N - No, K - just the key _ID','D','Y','SYSTEM_INSERT_CHANGELOG',TO_TIMESTAMP('2008-03-19 19:17:05','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; +