From f24ff19805d581013598c74069956833b1c6239b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 1 Jun 2013 15:17:02 -0500 Subject: [PATCH] IDEMPIERE-985 NPE In Callout for Payment Window --- .../src/org/compiere/model/CalloutPayment.java | 14 ++++++++++++-- .../compiere/model/CalloutPaymentAllocate.java | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java index 312e495fec..34a5a9d048 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java @@ -363,14 +363,24 @@ public class CalloutPayment extends CalloutEngine + ", C_Currency_ID=" + C_Currency_Invoice_ID); // Get Info from Tab BigDecimal PayAmt = (BigDecimal)mTab.getValue ("PayAmt"); + if (PayAmt == null) + PayAmt = Env.ZERO; BigDecimal DiscountAmt = (BigDecimal)mTab.getValue ("DiscountAmt"); + if (DiscountAmt == null) + DiscountAmt = Env.ZERO; BigDecimal WriteOffAmt = (BigDecimal)mTab.getValue ("WriteOffAmt"); + if (WriteOffAmt == null) + WriteOffAmt = Env.ZERO; BigDecimal OverUnderAmt = (BigDecimal)mTab.getValue ("OverUnderAmt"); + if (OverUnderAmt == null) + OverUnderAmt = Env.ZERO; if (log.isLoggable(Level.FINE)) log.fine ("Pay=" + PayAmt + ", Discount=" + DiscountAmt + ", WriteOff=" + WriteOffAmt + ", OverUnderAmt=" + OverUnderAmt); // Get Currency Info - int C_Currency_ID = ((Integer)mTab.getValue ("C_Currency_ID")) - .intValue (); + Integer curr_int = (Integer) mTab.getValue ("C_Currency_ID"); + if (curr_int == null) + curr_int = Integer.valueOf(0); + int C_Currency_ID = curr_int.intValue (); MCurrency currency = MCurrency.get (ctx, C_Currency_ID); Timestamp ConvDate = (Timestamp)mTab.getValue ("DateTrx"); int C_ConversionType_ID = 0; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java index 9982b85f21..30d5ff6c21 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java @@ -151,10 +151,18 @@ public class CalloutPaymentAllocate extends CalloutEngine if (C_Invoice_ID == 0) return ""; // Get Info from Tab - BigDecimal Amount = (BigDecimal)mTab.getValue("Amount"); - BigDecimal DiscountAmt = (BigDecimal)mTab.getValue("DiscountAmt"); - BigDecimal WriteOffAmt = (BigDecimal)mTab.getValue("WriteOffAmt"); - BigDecimal OverUnderAmt = (BigDecimal)mTab.getValue("OverUnderAmt"); + BigDecimal Amount = (BigDecimal)mTab.getValue ("Amount"); + if (Amount == null) + Amount = Env.ZERO; + BigDecimal DiscountAmt = (BigDecimal)mTab.getValue ("DiscountAmt"); + if (DiscountAmt == null) + DiscountAmt = Env.ZERO; + BigDecimal WriteOffAmt = (BigDecimal)mTab.getValue ("WriteOffAmt"); + if (WriteOffAmt == null) + WriteOffAmt = Env.ZERO; + BigDecimal OverUnderAmt = (BigDecimal)mTab.getValue ("OverUnderAmt"); + if (OverUnderAmt == null) + OverUnderAmt = Env.ZERO; BigDecimal InvoiceAmt = (BigDecimal)mTab.getValue("InvoiceAmt"); if (log.isLoggable(Level.FINE)) log.fine("Amt=" + Amount + ", Discount=" + DiscountAmt + ", WriteOff=" + WriteOffAmt + ", OverUnder=" + OverUnderAmt