[ 1761918 ] Error creating periods for a year with per. created partial
- refactoring - NPE [ https://sourceforge.net/forum/message.php?msg_id=6404099 ]
This commit is contained in:
parent
b997e612c6
commit
8538db5ec8
|
@ -95,12 +95,26 @@ public class MPeriod extends X_C_Period
|
||||||
*/
|
*/
|
||||||
public static MPeriod get (Properties ctx, Timestamp DateAcct, int AD_Org_ID)
|
public static MPeriod get (Properties ctx, Timestamp DateAcct, int AD_Org_ID)
|
||||||
{
|
{
|
||||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
|
||||||
if (DateAcct == null)
|
if (DateAcct == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int C_Calendar_ID = getC_Calendar_ID(ctx,AD_Org_ID);
|
int C_Calendar_ID = getC_Calendar_ID(ctx,AD_Org_ID);
|
||||||
|
|
||||||
|
return findByCalendar(ctx, DateAcct, C_Calendar_ID);
|
||||||
|
} // get
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param DateAcct
|
||||||
|
* @param C_Calendar_ID
|
||||||
|
* @return MPeriod
|
||||||
|
*/
|
||||||
|
public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct,
|
||||||
|
int C_Calendar_ID) {
|
||||||
|
|
||||||
|
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||||
// Search in Cache first
|
// Search in Cache first
|
||||||
Iterator<MPeriod> it = s_cache.values().iterator();
|
Iterator<MPeriod> it = s_cache.values().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
|
@ -152,7 +166,7 @@ public class MPeriod extends X_C_Period
|
||||||
s_log.warning("No Standard Period for " + DateAcct
|
s_log.warning("No Standard Period for " + DateAcct
|
||||||
+ " (AD_Client_ID=" + AD_Client_ID + ")");
|
+ " (AD_Client_ID=" + AD_Client_ID + ")");
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find valid standard Period of DateAcct based on Client Calendar
|
* Find valid standard Period of DateAcct based on Client Calendar
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class MYear extends X_C_Year
|
||||||
cal.add(Calendar.DAY_OF_YEAR, -1);
|
cal.add(Calendar.DAY_OF_YEAR, -1);
|
||||||
Timestamp end = new Timestamp(cal.getTimeInMillis());
|
Timestamp end = new Timestamp(cal.getTimeInMillis());
|
||||||
//
|
//
|
||||||
MPeriod period = MPeriod.get(getCtx(), start, getAD_Org_ID());
|
MPeriod period = MPeriod.findByCalendar(getCtx(), start, getC_Calendar_ID());
|
||||||
if (period == null)
|
if (period == null)
|
||||||
{
|
{
|
||||||
period = new MPeriod (this, month+1, name, start, end);
|
period = new MPeriod (this, month+1, name, start, end);
|
||||||
|
|
Loading…
Reference in New Issue