IDEMPIERE-2134 Issues found on Payment Selection process - fix NPE replace it with a proper message

This commit is contained in:
Nicolas Micoud 2019-09-17 14:01:52 +02:00
parent bac7f08495
commit 72ab1de774
3 changed files with 22 additions and 0 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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);