[ 2616330 ] Use MPeriod.testPeriodOpen instead of isOpen
https://sourceforge.net/tracker/index.php?func=detail&aid=2616330&group_id=176962&atid=879335 Implemented for MInvoice and MAllocationHdr
This commit is contained in:
parent
672d637e71
commit
ec11810ad2
|
@ -305,11 +305,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
log.warning ("No transaction");
|
||||
if (isPosted())
|
||||
{
|
||||
if (!MPeriod.isOpen(getCtx(), getDateTrx(), MDocType.DOCBASETYPE_PaymentAllocation, getAD_Org_ID()))
|
||||
{
|
||||
log.warning ("Period Closed");
|
||||
return false;
|
||||
}
|
||||
MPeriod.testPeriodOpen(getCtx(), getDateTrx(), MDocType.DOCBASETYPE_PaymentAllocation, getAD_Org_ID());
|
||||
setPosted(false);
|
||||
MFactAcct.deleteEx (Table_ID, get_ID(), trxName);
|
||||
}
|
||||
|
@ -394,11 +390,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
return DocAction.STATUS_Invalid;
|
||||
|
||||
// Std Period open?
|
||||
if (!MPeriod.isOpen(getCtx(), getDateAcct(), MDocType.DOCBASETYPE_PaymentAllocation, getAD_Org_ID()))
|
||||
{
|
||||
m_processMsg = "@PeriodClosed@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), MDocType.DOCBASETYPE_PaymentAllocation, getAD_Org_ID());
|
||||
getLines(false);
|
||||
if (m_lines.length == 0)
|
||||
{
|
||||
|
@ -713,8 +705,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
throw new IllegalStateException("Allocation already reversed (not active)");
|
||||
|
||||
// Can we delete posting
|
||||
if (!MPeriod.isOpen(getCtx(), getDateTrx(), MPeriodControl.DOCBASETYPE_PaymentAllocation, getAD_Org_ID()))
|
||||
throw new IllegalStateException("@PeriodClosed@");
|
||||
MPeriod.testPeriodOpen(getCtx(), getDateTrx(), MPeriodControl.DOCBASETYPE_PaymentAllocation, getAD_Org_ID());
|
||||
|
||||
// Set Inactive
|
||||
setIsActive (false);
|
||||
|
|
|
@ -1371,14 +1371,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
|
||||
if (m_processMsg != null)
|
||||
return DocAction.STATUS_Invalid;
|
||||
MDocType dt = MDocType.get(getCtx(), getC_DocTypeTarget_ID());
|
||||
|
||||
// Std Period open?
|
||||
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID()))
|
||||
{
|
||||
m_processMsg = "@PeriodClosed@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID());
|
||||
|
||||
// Lines
|
||||
MInvoiceLine[] lines = getLines(true);
|
||||
if (lines.length == 0)
|
||||
|
@ -2036,7 +2031,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return null;
|
||||
|
||||
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null);
|
||||
MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
|
||||
// MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
|
||||
log.info("Counter BP=" + counterBP.getName());
|
||||
|
||||
// Document Type
|
||||
|
@ -2202,12 +2197,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
if (m_processMsg != null)
|
||||
return false;
|
||||
|
||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID()))
|
||||
{
|
||||
m_processMsg = "@PeriodClosed@";
|
||||
return false;
|
||||
}
|
||||
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
|
||||
//
|
||||
MAllocationHdr[] allocations = MAllocationHdr.getOfInvoice(getCtx(),
|
||||
getC_Invoice_ID(), get_TrxName());
|
||||
|
|
Loading…
Reference in New Issue