Package org.compiere.model
Class MPeriod
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_C_Period
org.compiere.model.MPeriod
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_C_Period
,I_Persistent
,Evaluatee
,ImmutablePOSupport
Calendar Period Model
- Version:
- $Id: MPeriod.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- BF [ 1779438 ] Minor auto period control bug
- BF [ 1893486 ] Auto Period Control return that period is always open, victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
- FR [ 2520591 ] Support multiples calendar for Org
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_C_Period
PERIODTYPE_AD_Reference_ID, PERIODTYPE_AdjustmentPeriod, PERIODTYPE_StandardCalendarPeriod
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_C_Period
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_C_Period_ID, COLUMNNAME_C_Period_UU, COLUMNNAME_C_Year_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_EndDate, COLUMNNAME_IsActive, COLUMNNAME_Name, COLUMNNAME_PeriodNo, COLUMNNAME_PeriodType, COLUMNNAME_Processing, COLUMNNAME_StartDate, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMPeriod
(Properties ctx, int C_Period_ID, String trxName) Standard ConstructorMPeriod
(Properties ctx, String C_Period_UU, String trxName) UUID based ConstructorMPeriod
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMPeriod
(Properties ctx, MPeriod copy) Copy constructorMPeriod
(Properties ctx, MPeriod copy, String trxName) Copy constructorCopy constructorParent constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
afterSave
(boolean newRecord, boolean success) After Saveprotected boolean
beforeSave
(boolean newRecord) Before Save.static MPeriod
findByCalendar
(Properties ctx, Timestamp DateAcct, int C_Calendar_ID) Deprecated.static MPeriod
findByCalendar
(Properties ctx, Timestamp DateAcct, int C_Calendar_ID, String trxName) Find standard Period of DateAcctstatic MPeriod
get
(int C_Period_ID) Get Period from Cache (immutable)static MPeriod
get
(Properties ctx, int C_Period_ID) Get Period from Cache (immutable)static MPeriod
get
(Properties ctx, Timestamp DateAcct) Deprecated.static MPeriod
get
(Properties ctx, Timestamp DateAcct, int AD_Org_ID) Deprecated.static MPeriod
get
(Properties ctx, Timestamp DateAcct, int AD_Org_ID, String trxName) Find standard Period of DateAcct based on Client Calendarint
Get Calendar of Periodstatic int
getC_Calendar_ID
(Properties ctx, int AD_Org_ID) Get Calendar for Organizationstatic int
getC_Period_ID
(Properties ctx, Timestamp DateAcct) Deprecated.static int
getC_Period_ID
(Properties ctx, Timestamp DateAcct, int AD_Org_ID) Find valid standard Period of DateAcct based on Client Calendarstatic MPeriod
getCopy
(Properties ctx, int C_Period_ID, String trxName) Get updateable copy of MPeriod from cachestatic MPeriod
getFirstInYear
(Properties ctx, Timestamp DateAcct) Deprecated.static MPeriod
getFirstInYear
(Properties ctx, Timestamp DateAcct, int AD_Org_ID) Find first Year Period of DateAcct based on Client CalendargetPeriodControl
(String DocBaseType) Get Period ControlgetPeriodControls
(boolean requery) Get Period Controlboolean
Is the period has un-posted documentsboolean
hasUnpostedDocs
(int periodControlID) Is this period has un-posted documentsboolean
isInPeriod
(Timestamp date) Is Date In this Periodboolean
Deprecated.boolean
Is Period Open for Doc Base Typeboolean
Is Period Open for Doc Base Typestatic boolean
isOpen
(Properties ctx, int tableID, int recordID, String trxName) Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)static boolean
isOpen
(Properties ctx, int tableID, int recordID, String trxName, boolean forPosting) Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)static boolean
isOpen
(Properties ctx, Timestamp DateAcct, String DocBaseType) Deprecated.static boolean
isOpen
(Properties ctx, Timestamp DateAcct, String DocBaseType, int AD_Org_ID) Is standard Period Open for Document Base Typestatic boolean
isOpen
(Properties ctx, Timestamp DateAcct, String DocBaseType, int AD_Org_ID, boolean forPosting) Is standard Period Open for Document Base Typeboolean
Standard Periodmark PO as immutablestatic void
testPeriodOpen
(Properties ctx, Timestamp dateAcct, int C_DocType_ID) Deprecated.static void
testPeriodOpen
(Properties ctx, Timestamp dateAcct, int C_DocType_ID, int AD_Org_ID) Convenient method for testing if a period is openstatic void
testPeriodOpen
(Properties ctx, Timestamp dateAcct, String docBaseType) Deprecated.static void
testPeriodOpen
(Properties ctx, Timestamp dateAcct, String docBaseType, int AD_Org_ID) Convenient method for testing if a period is opentoString()
String RepresentationMethods inherited from class org.compiere.model.X_C_Period
get_AccessLevel, getC_Period_ID, getC_Period_UU, getC_Year, getC_Year_ID, getEndDate, getKeyNamePair, getName, getPeriodNo, getPeriodType, getStartDate, initPO, isProcessing, setC_Period_ID, setC_Period_UU, setC_Year_ID, setEndDate, setName, setPeriodNo, setPeriodType, setProcessing, setStartDate
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_C_Period
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Constructor Details
-
MPeriod
UUID based Constructor- Parameters:
ctx
- ContextC_Period_UU
- UUID keytrxName
- Transaction
-
MPeriod
Standard Constructor- Parameters:
ctx
- contextC_Period_ID
- idtrxName
- transaction
-
MPeriod
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MPeriod
Parent constructor- Parameters:
year
- yearPeriodNo
- noname
- namestartDate
- startendDate
- end
-
MPeriod
Copy constructor- Parameters:
copy
-
-
MPeriod
Copy constructor- Parameters:
ctx
-copy
-
-
MPeriod
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
get
Get Period from Cache (immutable)- Parameters:
C_Period_ID
- id- Returns:
- MPeriod
-
get
Get Period from Cache (immutable)- Parameters:
ctx
- contextC_Period_ID
- id- Returns:
- MPeriod
-
get
Deprecated.Find standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- active Period or null
-
get
Find standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- Organization- Returns:
- active Period or null
-
get
Deprecated. -
getCopy
Get updateable copy of MPeriod from cache- Parameters:
ctx
-C_Period_ID
-trxName
-- Returns:
- MPeriod
-
findByCalendar
@Deprecated public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID) Deprecated.- Parameters:
ctx
-DateAcct
-C_Calendar_ID
-- Returns:
- MPeriod
-
findByCalendar
public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID, String trxName) Find standard Period of DateAcct- Parameters:
ctx
-DateAcct
-C_Calendar_ID
-trxName
-- Returns:
- MPeriod or null
-
getC_Period_ID
Deprecated.Find valid standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- C_Period_ID or 0
-
getC_Period_ID
Find valid standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- Organization- Returns:
- C_Period_ID or 0
-
isOpen
Deprecated.Is standard Period Open for Document Base Type- Parameters:
ctx
- contextDateAcct
- dateDocBaseType
- base type- Returns:
- true if open
-
isOpen
Is standard Period Open for Document Base Type- Parameters:
ctx
- contextDateAcct
- dateDocBaseType
- base type (X_C_DocType.DOCBASETYPE_*)AD_Org_ID
- Organization- Returns:
- true if open
-
isOpen
public static boolean isOpen(Properties ctx, Timestamp DateAcct, String DocBaseType, int AD_Org_ID, boolean forPosting) Is standard Period Open for Document Base Type- Parameters:
ctx
- contextDateAcct
- dateDocBaseType
- base type (X_C_DocType.DOCBASETYPE_*)AD_Org_ID
- OrganizationforPosting
- - true to check if the period is open for posting, false is for DocAction- Returns:
- true if open
-
isOpen
Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)- Parameters:
ctx
- contexttableID
-recordID
-trxName
-- Returns:
- true if open
-
isOpen
public static boolean isOpen(Properties ctx, int tableID, int recordID, String trxName, boolean forPosting) Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)- Parameters:
ctx
- contexttableID
-recordID
-trxName
-forPosting
- - true to check if the period is open for posting, false is for DocAction- Returns:
- true if open
-
getFirstInYear
Deprecated.Find first Year Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- active first Period
-
getFirstInYear
Find first Year Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- organization- Returns:
- active first Period
-
getPeriodControls
Get Period Control- Parameters:
requery
- true to re-query from DB- Returns:
- period controls
-
getPeriodControl
Get Period Control- Parameters:
DocBaseType
- Document Base Type (X_C_DocType.DOCBASETYPE_*)- Returns:
- period control or null
-
isInPeriod
Is Date In this Period- Parameters:
date
- date- Returns:
- true if date is in this period
-
isOpen
Deprecated.since 3.3.1b; useisOpen(String, Timestamp)
insteadIs Period Open for Doc Base Type- Parameters:
DocBaseType
- document base type- Returns:
- true if open
-
isOpen
Is Period Open for Doc Base Type- Parameters:
DocBaseType
- document base type (X_C_DocType.DOCBASETYPE_*)dateAcct
- date; Applies only for "Auto Period Control":- if not null, date should be in auto period range (today - OpenHistory, today+OpenHistory)
- if null, this period should be in auto period range
- Returns:
- true if open
- Since:
- 3.3.1b
-
isOpen
Is Period Open for Doc Base Type- Parameters:
DocBaseType
- document base typedateAcct
- date; Applies only for "Auto Period Control":- if not null, date should be in auto period range (today - OpenHistory, today+OpenHistory)
- if null, this period should be in auto period range
forPosting
- - true to check if the period is open for posting, false is for DocAction- Returns:
- true if open
-
isStandardPeriod
public boolean isStandardPeriod()Standard Period- Returns:
- true if this is of standard calendar periods type (PERIODTYPE_StandardCalendarPeriod)
-
beforeSave
protected boolean beforeSave(boolean newRecord) Before Save. Truncate Dates- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success) After Save -
toString
String Representation- Overrides:
toString
in classX_C_Period
- Returns:
- info
-
testPeriodOpen
@Deprecated public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType) throws PeriodClosedException Deprecated.Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-docBaseType
-- Throws:
PeriodClosedException
- if period is closed- See Also:
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType, int AD_Org_ID) throws PeriodClosedException Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-docBaseType
- X_C_DocType.DOCBASETYPE_*AD_Org_ID
- Organization- Throws:
PeriodClosedException
- if period is closed- See Also:
-
testPeriodOpen
@Deprecated public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID) throws PeriodClosedException Deprecated.Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-C_DocType_ID
-- Throws:
PeriodClosedException
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID, int AD_Org_ID) throws PeriodClosedException Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-C_DocType_ID
-AD_Org_ID
- Organization- Throws:
PeriodClosedException
-
getC_Calendar_ID
public int getC_Calendar_ID()Get Calendar of Period- Returns:
- C_Calendar_ID
-
getC_Calendar_ID
Get Calendar for Organization- Parameters:
ctx
- ContextAD_Org_ID
- Organization- Returns:
- C_Calendar_ID
-
markImmutable
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
hasUnpostedDocs
public boolean hasUnpostedDocs()Is the period has un-posted documents- Returns:
- boolean - true if there is at least 1 un-posted document in this period
-
hasUnpostedDocs
public boolean hasUnpostedDocs(int periodControlID) Is this period has un-posted documents- Parameters:
periodControlID
- C_PeriodControl_ID. If > 0, check only documents with the period control's DocBaseType- Returns:
- boolean - true if there is at least 1 un-posted document in this period
-
isOpen(String, Timestamp)
instead