BF [ 1739022 ] Print Dunning Letters: null pointer

http://sourceforge.net/tracker/?func=detail&atid=879332&aid=1739022&group_id=176962
This commit is contained in:
teo_sarca 2007-06-18 12:57:54 +00:00
parent d41823c1db
commit 806388c22d
1 changed files with 20 additions and 5 deletions

View File

@ -26,6 +26,8 @@ import org.compiere.util.*;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MDunningRunEntry.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $ * @version $Id: MDunningRunEntry.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
*
* @author Teo Sarca, BF [ 1739022 ]
*/ */
public class MDunningRunEntry extends X_C_DunningRunEntry public class MDunningRunEntry extends X_C_DunningRunEntry
{ {
@ -179,6 +181,18 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
} }
/**
* Get Parent
* @return Dunning Run
*/
private MDunningRun getParent()
{
if (m_parent == null)
m_parent = new MDunningRun(getCtx(), getC_DunningRun_ID (), get_TrxName());
return m_parent;
} // getParent
@Override
protected boolean beforeSave (boolean newRecord) protected boolean beforeSave (boolean newRecord)
{ {
// Set Amt // Set Amt
@ -190,13 +204,14 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
theseLines[i].setProcessed (true); theseLines[i].setProcessed (true);
theseLines[i].save (get_TrxName()); theseLines[i].save (get_TrxName());
} }
if (m_parent.getLevel ().isSetCreditStop () || m_parent.getLevel ().isSetPaymentTerm ()) MDunningRun parent = getParent();
if (parent.getLevel ().isSetCreditStop () || parent.getLevel ().isSetPaymentTerm ())
{ {
MBPartner thisBPartner = MBPartner.get (getCtx(), getC_BPartner_ID()); MBPartner thisBPartner = MBPartner.get (getCtx(), getC_BPartner_ID());
if (m_parent.getLevel ().isSetCreditStop ()) if (parent.getLevel ().isSetCreditStop ())
thisBPartner.setSOCreditStatus (X_C_BPartner.SOCREDITSTATUS_CreditStop); thisBPartner.setSOCreditStatus (X_C_BPartner.SOCREDITSTATUS_CreditStop);
if (m_parent.getLevel ().isSetPaymentTerm ()) if (parent.getLevel ().isSetPaymentTerm ())
thisBPartner.setC_PaymentTerm_ID (m_parent.getLevel().getC_PaymentTerm_ID ()); thisBPartner.setC_PaymentTerm_ID (parent.getLevel().getC_PaymentTerm_ID ());
thisBPartner.save (); thisBPartner.save ();
} }
} }