diff --git a/migration/i6.2/oracle/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql b/migration/i6.2/oracle/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql new file mode 100644 index 0000000000..adc1141baa --- /dev/null +++ b/migration/i6.2/oracle/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2134 - Issues found on Payment Selection process : PayAmt is null +-- 2019-09-16 09:28:03 +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Could not find Payment Amount for some invoices, maybe currency rate is not configured',0,0,'Y',TO_DATE('2019-09-16 09:28:02','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-09-16 09:28:02','YYYY-MM-DD HH24:MI:SS'),0,200563,'PaySelectionPayAmtIsNull','D','6a5563d2-ddcc-4244-a6e8-3a85d93e08b1') +; + +SELECT register_migration_script('201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql') FROM dual +; diff --git a/migration/i6.2/postgresql/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql b/migration/i6.2/postgresql/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql new file mode 100644 index 0000000000..fa9d5fd70c --- /dev/null +++ b/migration/i6.2/postgresql/201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-2134 - Issues found on Payment Selection process : PayAmt is null +-- 2019-09-16 09:28:03 +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Could not find Payment Amount for some invoices, maybe currency rate is not configured',0,0,'Y',TO_TIMESTAMP('2019-09-16 09:28:02','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-09-16 09:28:02','YYYY-MM-DD HH24:MI:SS'),0,200563,'PaySelectionPayAmtIsNull','D','6a5563d2-ddcc-4244-a6e8-3a85d93e08b1') +; + +SELECT register_migration_script('201909160930_IDEMPIERE-2134_FixPayAmtIsNull.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/compiere/process/PaySelectionCreateFrom.java b/org.adempiere.base.process/src/org/compiere/process/PaySelectionCreateFrom.java index 4e2870c8cc..052cbc9443 100644 --- a/org.adempiere.base.process/src/org/compiere/process/PaySelectionCreateFrom.java +++ b/org.adempiere.base.process/src/org/compiere/process/PaySelectionCreateFrom.java @@ -25,6 +25,7 @@ import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; +import org.compiere.model.MInvoice; import org.compiere.model.MPaySelection; import org.compiere.model.MPaySelectionLine; import org.compiere.model.X_C_Order; @@ -271,6 +272,10 @@ public class PaySelectionCreateFrom extends SvrProcess { int C_Invoice_ID = rs.getInt(1); BigDecimal PayAmt = rs.getBigDecimal(2); + + if (PayAmt == null) + return "@Error@ @PaySelectionPayAmtIsNull@ (" + new MInvoice(getCtx(), C_Invoice_ID, get_TrxName()).getDocumentInfo() + ")"; + if (C_Invoice_ID == 0 || Env.ZERO.compareTo(PayAmt) == 0) continue; BigDecimal DiscountAmt = rs.getBigDecimal(3);