From d74f7933ba9eb60dc2dcc2bdf34fbcc5dfbdbea7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 20 Nov 2012 17:30:16 -0500 Subject: [PATCH] IDEMPIERE-385 Resolve M_Storage locking and data consistency / M_StorageReservation requires IsSOTrx part of they key / PO.java need changes to manage Boolean on multi-column primary key --- .../oracle/201211191100_IDEMPIERE-385_DB.sql | 20 +++++++++++++++++++ .../201211191100_IDEMPIERE-385_DB.sql | 20 +++++++++++++++++++ .../src/org/compiere/model/PO.java | 17 ++++++++++++++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/migration/i1.0a-release/oracle/201211191100_IDEMPIERE-385_DB.sql b/migration/i1.0a-release/oracle/201211191100_IDEMPIERE-385_DB.sql index 8f02f679e0..42099a2a2d 100644 --- a/migration/i1.0a-release/oracle/201211191100_IDEMPIERE-385_DB.sql +++ b/migration/i1.0a-release/oracle/201211191100_IDEMPIERE-385_DB.sql @@ -370,6 +370,26 @@ SELECT s.ad_client_id, mp.name ; +-- Nov 20, 2012 5:06:02 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N', IsToolbarButton='N',Updated=TO_DATE('2012-11-20 17:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640 +; + +-- Nov 20, 2012 5:28:27 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_DATE('2012-11-20 17:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640 +; + +-- Nov 20, 2012 5:28:36 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +ALTER TABLE M_StorageReservation MODIFY IsSOTrx CHAR(1) DEFAULT 'Y' +; + +-- Nov 20, 2012 5:28:36 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE M_StorageReservation SET IsSOTrx='Y' WHERE IsSOTrx IS NULL +; + SELECT register_migration_script('201211191100_IDEMPIERE-385_DB.sql') FROM dual ; diff --git a/migration/i1.0a-release/postgresql/201211191100_IDEMPIERE-385_DB.sql b/migration/i1.0a-release/postgresql/201211191100_IDEMPIERE-385_DB.sql index 445c187546..2ba964a533 100644 --- a/migration/i1.0a-release/postgresql/201211191100_IDEMPIERE-385_DB.sql +++ b/migration/i1.0a-release/postgresql/201211191100_IDEMPIERE-385_DB.sql @@ -489,6 +489,26 @@ SELECT s.ad_client_id, mp.name ; +-- Nov 20, 2012 5:06:02 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2012-11-20 17:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640 +; + +-- Nov 20, 2012 5:28:27 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2012-11-20 17:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640 +; + +-- Nov 20, 2012 5:28:36 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +INSERT INTO t_alter_column values('m_storagereservation','IsSOTrx','CHAR(1)',null,'Y') +; + +-- Nov 20, 2012 5:28:36 PM COT +-- IDEMPIERE-385 Resolve M_Storage locking and data consistency +UPDATE M_StorageReservation SET IsSOTrx='Y' WHERE IsSOTrx IS NULL +; + SELECT register_migration_script('201211191100_IDEMPIERE-385_DB.sql') FROM dual ; diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 4b01542060..2cb3ee21d9 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -1319,6 +1319,8 @@ public abstract class PO Object oo = m_IDs[i]; if (oo instanceof Integer) pstmt.setInt(i+1, ((Integer)m_IDs[i]).intValue()); + else if (oo instanceof Boolean) + pstmt.setString(i+1, ((Boolean) m_IDs[i] ? "Y" : "N")); else pstmt.setString(i+1, m_IDs[i].toString()); } @@ -2953,8 +2955,19 @@ public abstract class PO { if (m_KeyColumns[i].endsWith("_ID")) sb.append(m_IDs[i]); - else - sb.append("'").append(m_IDs[i]).append("'"); + else { + sb.append("'"); + if (m_IDs[i] instanceof Boolean) { + if ((Boolean) m_IDs[i]) { + sb.append("Y"); + } else { + sb.append("N"); + } + } else { + sb.append(m_IDs[i]); + } + sb.append("'"); + } } else sb.append("?");