From 704343fe22a8bf960124fab0ff09a8722a767a1d Mon Sep 17 00:00:00 2001 From: Elaine Tan <51374241+etantg@users.noreply.github.com> Date: Wed, 23 Nov 2022 17:24:57 +0800 Subject: [PATCH] IDEMPIERE-5453 Payment Selection > Payment Selection Line allows the same invoice to be added several times for payment (#1574) --- .../oracle/202211211751_IDEMPIERE-5453.sql | 19 +++++++++++++++++++ .../202211211751_IDEMPIERE-5453.sql | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 migration/iD10/oracle/202211211751_IDEMPIERE-5453.sql create mode 100644 migration/iD10/postgresql/202211211751_IDEMPIERE-5453.sql diff --git a/migration/iD10/oracle/202211211751_IDEMPIERE-5453.sql b/migration/iD10/oracle/202211211751_IDEMPIERE-5453.sql new file mode 100644 index 0000000000..f34c6c682e --- /dev/null +++ b/migration/iD10/oracle/202211211751_IDEMPIERE-5453.sql @@ -0,0 +1,19 @@ +-- IDEMPIERE-5453 Payment Selection > Payment Selection Line allows the same invoice to be added several times for payment +SELECT register_migration_script('202211211751_IDEMPIERE-5453.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Nov 21, 2022, 5:51:09 PM SGT +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200172,'C_PaySelectionLine Invoice','S','C_Invoice.DocStatus IN (''CO'', ''CL'') AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl +INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID) +LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID) +WHERE C_Invoice.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive=''Y'' +AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN (''VO'',''RE'')) ) +AND C_Invoice.C_Invoice_ID NOT IN (SELECT psl.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=@C_PaySelection_ID@)',0,0,'Y',TO_TIMESTAMP('2022-11-21 17:51:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-21 17:51:07','YYYY-MM-DD HH24:MI:SS'),100,'D','04bd5d22-5d36-4436-b587-3d9ecae182cc') +; + +-- Nov 21, 2022, 5:51:24 PM SGT +UPDATE AD_Column SET AD_Val_Rule_ID=200172,Updated=TO_TIMESTAMP('2022-11-21 17:51:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5639 +; + diff --git a/migration/iD10/postgresql/202211211751_IDEMPIERE-5453.sql b/migration/iD10/postgresql/202211211751_IDEMPIERE-5453.sql new file mode 100644 index 0000000000..1623494e68 --- /dev/null +++ b/migration/iD10/postgresql/202211211751_IDEMPIERE-5453.sql @@ -0,0 +1,16 @@ +-- IDEMPIERE-5453 Payment Selection > Payment Selection Line allows the same invoice to be added several times for payment +SELECT register_migration_script('202211211751_IDEMPIERE-5453.sql') FROM dual; + +-- Nov 21, 2022, 5:51:09 PM SGT +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200172,'C_PaySelectionLine Invoice','S','C_Invoice.DocStatus IN (''CO'', ''CL'') AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl +INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID) +LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID) +WHERE C_Invoice.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive=''Y'' +AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN (''VO'',''RE'')) ) +AND C_Invoice.C_Invoice_ID NOT IN (SELECT psl.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=@C_PaySelection_ID@)',0,0,'Y',TO_TIMESTAMP('2022-11-21 17:51:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-21 17:51:07','YYYY-MM-DD HH24:MI:SS'),100,'D','04bd5d22-5d36-4436-b587-3d9ecae182cc') +; + +-- Nov 21, 2022, 5:51:24 PM SGT +UPDATE AD_Column SET AD_Val_Rule_ID=200172,Updated=TO_TIMESTAMP('2022-11-21 17:51:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5639 +; +