IDEMPIERE-4743 - Clean up dead code (#722)

This commit is contained in:
Diego Ruiz 2021-06-16 09:10:41 +02:00 committed by GitHub
parent 401707361d
commit 756cf807f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 6 additions and 280 deletions

View File

@ -47,11 +47,6 @@ public class MAging extends X_T_Aging
super (ctx, T_Aging_ID, trxName);
if (T_Aging_ID == 0)
{
// setAD_PInstance_ID (0);
// setC_BP_Group_ID (0);
// setC_BPartner_ID (0);
// setC_Currency_ID (0);
//
setDueAmt (Env.ZERO);
setDue0 (Env.ZERO);
setDue0_7 (Env.ZERO);
@ -79,8 +74,6 @@ public class MAging extends X_T_Aging
//
setIsListInvoices (false);
setIsSOTrx (false);
// setDueDate (new Timestamp(System.currentTimeMillis()));
// setStatementDate (new Timestamp(System.currentTimeMillis()));
}
} // T_Aging
@ -114,10 +107,7 @@ public class MAging extends X_T_Aging
setAD_Org_ID(AD_Org_ID);
setIsSOTrx (IsSOTrx);
// Optional
// setC_Invoice_ID (C_Invoice_ID); // may be zero
set_ValueNoCheck ("C_Invoice_ID", Integer.valueOf(C_Invoice_ID));
// setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID); // may be zero
set_Value ("C_InvoicePaySchedule_ID", Integer.valueOf(C_InvoicePaySchedule_ID));
setIsListInvoices(C_Invoice_ID != 0);
//
@ -154,10 +144,7 @@ public class MAging extends X_T_Aging
setC_BP_Group_ID (C_BP_Group_ID);
setIsSOTrx (IsSOTrx);
// Optional
// setC_Invoice_ID (C_Invoice_ID); // may be zero
set_ValueNoCheck ("C_Invoice_ID", Integer.valueOf(C_Invoice_ID));
// setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID); // may be zero
set_Value ("C_InvoicePaySchedule_ID", Integer.valueOf(C_InvoicePaySchedule_ID));
setIsListInvoices(C_Invoice_ID != 0);
//

View File

@ -51,10 +51,6 @@ public class MAlert extends X_AD_Alert
super (ctx, AD_Alert_ID, trxName);
if (AD_Alert_ID == 0)
{
// setAD_AlertProcessor_ID (0);
// setName (null);
// setAlertMessage (null);
// setAlertSubject (null);
setEnforceClientSecurity (true); // Y
setEnforceRoleSecurity (true); // Y
setIsValid (true); // Y

View File

@ -170,12 +170,10 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
super (ctx, C_AllocationHdr_ID, trxName);
if (C_AllocationHdr_ID == 0)
{
// setDocumentNo (null);
setDateTrx (new Timestamp(System.currentTimeMillis()));
setDateAcct (getDateTrx());
setDocAction (DOCACTION_Complete); // CO
setDocStatus (DOCSTATUS_Drafted); // DR
// setC_Currency_ID (0);
setDocAction (DOCACTION_Complete);
setDocStatus (DOCSTATUS_Drafted);
setApprovalAmt (Env.ZERO);
setIsApproved (false);
setIsManual (false);

View File

@ -52,7 +52,6 @@ public class MAllocationLine extends X_C_AllocationLine
super (ctx, C_AllocationLine_ID, trxName);
if (C_AllocationLine_ID == 0)
{
// setC_AllocationHdr_ID (0);
setAmount (Env.ZERO);
setDiscountAmt (Env.ZERO);
setWriteOffAmt (Env.ZERO);

View File

@ -252,7 +252,7 @@ public class MArchive extends X_AD_Archive {
if (this.getRecord_ID() > 0) {
path.append(this.getRecord_ID()).append(File.separator);
}
// path = path + this.get_ID() + ".pdf";
return path.toString();
}

View File

@ -20,9 +20,7 @@ import org.compiere.util.Msg;
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
*/
@SuppressWarnings("serial")
public class MAsset extends X_A_Asset
//implements MAssetType.Model //commented by @win
{
public class MAsset extends X_A_Asset {
/** ChangeType - Asset Group changed */
public static final int CHANGETYPE_setAssetGroup = Table_ID * 100 + 1;
@ -67,12 +65,6 @@ public class MAsset extends X_A_Asset
if (A_Asset_ID == 0)
{
setA_Asset_Status(A_ASSET_STATUS_New);
//commented out by @win
/*
setA_Asset_Type("MFX");
setA_Asset_Type_ID(1); // MFX
*/
//end comment by @win
}
} // MAsset
@ -146,10 +138,6 @@ public class MAsset extends X_A_Asset
setValue(inventoryNo);
}
setA_Asset_CreateDate(ifa.getAssetServiceDate());
//setAssetServiceDate(ifa.getAssetServiceDate()); //commented by @win
/* commented by @win
setA_Asset_Class_ID(ifa.getA_Asset_Class_ID());
*/ // commented by @win
MProduct product = ifa.getProduct();
if (product != null) {
setM_Product_ID(product.getM_Product_ID());
@ -222,8 +210,6 @@ public class MAsset extends X_A_Asset
// Product
setM_Product_ID(product.getM_Product_ID());
// Guarantee & Version
//setGuaranteeDate(TimeUtil.addDays(shipment.getMovementDate(), product.getGuaranteeDays()));
setVersionNo(product.getVersionNo());
// ASI
if (invLine.getM_AttributeSetInstance_ID() != 0)
@ -234,14 +220,6 @@ public class MAsset extends X_A_Asset
//setSerNo(invLine.getSerNo());
setQty(qty);
// Costs:
//setA_Asset_Cost(costs); //commented by @win, set at asset addition
// Activity
/*
if (invLine.getC_Activity_ID() > 0)
setC_Activity_ID(invLine.getC_Activity_ID());
*/
if (inventory.getC_Activity_ID() > 0)
setC_Activity_ID(inventory.getC_Activity_ID());
@ -300,13 +278,6 @@ public class MAsset extends X_A_Asset
*/
public void setAssetGroup(MAssetGroup assetGroup) {
setA_Asset_Group_ID(assetGroup.getA_Asset_Group_ID());
/* commented out by @win
setA_Asset_Type_ID(assetGroup.getA_Asset_Type_ID());
setGZ_TipComponenta(assetGroup.getGZ_TipComponenta()); // TODO: move to GZ
MAssetType assetType = MAssetType.get(getCtx(), assetGroup.getA_Asset_Type_ID());
assetType.update(SetGetUtil.wrap(this), true);
*/ //end commet by @win
}
public MAssetGroup getAssetGroup() {
@ -347,14 +318,6 @@ public class MAsset extends X_A_Asset
{
setA_Asset_Group_ID(MAssetGroup.getDefault_ID(SetGetUtil.wrap(this)));
}
/* @win temporary commented out
if (getA_Asset_Class_ID() <= 0 && getA_Asset_Group_ID() > 0)
{
MAssetGroup.updateAsset(SetGetUtil.wrap(this), getA_Asset_Group_ID());
}
*/
//end @win comment
// Copy fields from C_BPartner_Location
if (is_ValueChanged(COLUMNNAME_C_BPartner_Location_ID) && getC_BPartner_Location_ID() > 0)
@ -375,28 +338,10 @@ public class MAsset extends X_A_Asset
asi.saveEx();
setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
}
// TODO: With the lines below, after creating the asset, the whole system goes much slower ???
// else if (is_ValueChanged(COLUMNNAME_SerNo) && getM_AttributeSetInstance_ID() > 0) {
// asi = new MAttributeSetInstance(getCtx(), getM_AttributeSetInstance_ID(), get_TrxName());
// asi.setSerNo(getSerNo());
// asi.setDescription();
// asi.saveEx();
// }
// else if ((newRecord || is_ValueChanged(COLUMNNAME_M_AttributeSetInstance_ID)) && getM_AttributeSetInstance_ID() > 0) {
// asi = new MAttributeSetInstance(getCtx(), getM_AttributeSetInstance_ID(), get_TrxName());
// setASI(asi);
// }
//
// Update status
updateStatus();
// Validate AssetType
//@win commented out
//MAssetType.validate(this);
//@win end
//
return true;
} // beforeSave
@ -518,20 +463,12 @@ public class MAsset extends X_A_Asset
{
String status = getA_Asset_Status();
setProcessed(!status.equals(A_ASSET_STATUS_New));
// setIsDisposed(!status.equals(A_ASSET_STATUS_New) && !status.equals(A_ASSET_STATUS_Activated));
setIsDisposed(status.equals(A_ASSET_STATUS_Disposed));
setIsFullyDepreciated(status.equals(A_ASSET_STATUS_Depreciated));
if(isFullyDepreciated() || status.equals(A_ASSET_STATUS_Disposed))
{
setIsDepreciated(false);
}
/* commented by @win
MAssetClass assetClass = MAssetClass.get(getCtx(), getA_Asset_Class_ID());
if (assetClass != null && assetClass.isDepreciated())
{
setIsDepreciated(true);
}
*/ //end comment by @win
if (status.equals(A_ASSET_STATUS_Activated) || getAssetActivationDate() == null)
{
setAssetActivationDate(getAssetServiceDate());

View File

@ -81,30 +81,12 @@ public class MAssetAddition extends X_A_Asset_Addition
setA_CapvsExp(A_CAPVSEXP_Capital);
}
//
// Check suspect asset values (UseLife, Amount etc):
/* arhipac: teo_sarca: TODO need to integrate
if (hasZeroValues() && (!m_confirmed_AssetValues && !isProcessed() && is_UserEntry()))
{
String msg = "@AssetValueAmt@="+getAssetValueAmt()
+ "\n@DeltaUseLifeYears@="+getDeltaUseLifeYears()
+ "\n@DeltaUseLifeYears_F@="+getDeltaUseLifeYears_F()+"\n";
m_confirmed_AssetValues = UIFactory.getUI().ask(get_WindowNo(), null, "Confirm", Msg.parseTranslation(getCtx(), msg), true);
if (!m_confirmed_AssetValues)
{
throw new AssetCheckDocumentException(msg);
}
}
*/
// set approved
setIsApproved();
return true;
} // beforeSave
// private boolean m_confirmed_AssetValues = false;
/**
* Create Asset and asset Addition from MMatchInv.
* MAssetAddition is saved.
@ -308,7 +290,6 @@ public class MAssetAddition extends X_A_Asset_Addition
Timestamp dateAcct = ifa.getDateAcct();
if (dateAcct != null)
{
//dateAcct = UseLifeImpl.getDateAcct(dateAcct, 1); //commented by @win -- i don't see why i should add 1 month
if (log.isLoggable(Level.FINE)) log.fine("DateAcct=" + dateAcct);
setDateAcct(dateAcct);
}
@ -410,27 +391,6 @@ public class MAssetAddition extends X_A_Asset_Addition
}
query += qMatchInv_from + M_MatchInv_ID;
/*
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(query, trxName);
DB.setParameters(pstmt, params);
rs = pstmt.executeQuery();
updateColumns(models, columnNames, rs);
}
catch (SQLException e)
{
throw new DBException(e, query);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
*/
SetGetUtil.updateColumns(model, null, query, trxName);
s_log.fine("Leaving: RETURN TRUE");
@ -511,7 +471,6 @@ public class MAssetAddition extends X_A_Asset_Addition
public boolean unlockIt()
{
if (log.isLoggable(Level.INFO)) log.info("unlockIt - " + toString());
// setProcessing(false);
return true;
} // unlockIt
@ -544,17 +503,6 @@ public class MAssetAddition extends X_A_Asset_Addition
MAsset asset = getA_Asset(true);
// Additions may be made only on sites that depreciates FA
// (WARNING: FA sites scrapped / sold not depreciate)
/* @win temporary comment as some assets are not depreciated
if(!isA_CreateAsset() && !asset.isDepreciated())
{
m_processMsg = "@AssetIsNotDepreciating@";
return DocAction.STATUS_Invalid;
}
*/
// If new assets (not renewals) must have nonzero values
if (isA_CreateAsset() && hasZeroValues())
{
@ -686,15 +634,7 @@ public class MAssetAddition extends X_A_Asset_Addition
}
}
if (log.isLoggable(Level.FINE)) log.fine("workfile: " + assetwk);
//
// Can not upgrade a previous period
/*
if (!isA_CreateAsset() && assetwk.isDepreciated(getDateAcct()))
{
throw new AssetAlreadyDepreciatedException();
}
*/
//
for (MDepreciationWorkfile assetworkFile : MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName()))
{
if (A_SOURCETYPE_Imported.equals(getA_SourceType()) && assetworkFile.getC_AcctSchema_ID() != getI_FixedAsset().getC_AcctSchema_ID())
@ -754,37 +694,8 @@ public class MAssetAddition extends X_A_Asset_Addition
assetworkFile.buildDepreciation();
}
MAssetChange.createAddition(this, assetwk);
// Accumulated depreciation (if any):
/*
if (isA_Accumulated_Depr_Adjust())
{
Collection<MDepreciationExp> expenses = MDepreciationExp.createDepreciation(assetwk,
1, // PeriodNo
getDateAcct(),
getA_Accumulated_Depr(), getA_Accumulated_Depr_F(),
null, // Accum Amt
null, // Accum Amt (F)
null, // Help
null);
for (MDepreciationExp exp : expenses)
{
exp.setA_Asset_Addition_ID(getA_Asset_Addition_ID());
exp.process();
}
if (isA_CreateAsset() && isA_Accumulated_Depr_Adjust())
{
assetwk.setA_Current_Period(getA_Period_Start());
assetwk.saveEx();
}
}
*/
//
updateSourceDocument(false);
@ -895,8 +806,6 @@ public class MAssetAddition extends X_A_Asset_Addition
{
MAsset asset = getA_Asset(true);
asset.changeStatus(MAsset.A_ASSET_STATUS_New, getDateAcct());
//asset.isDepreciated();
//asset.setIsDepreciated(true);
asset.saveEx();

View File

@ -97,7 +97,6 @@ public class MAssetChange extends X_A_Asset_Change
*/
public static MAssetChange createAndSave(Properties ctx, String changeType, PO[] pos, String trxName) {
return null;
//~ return create(ctx, changeType, pos, true, trxName);
}
public static MAssetChange create(Properties ctx, String changeType, PO[] pos, boolean save, String trxName) {
@ -124,23 +123,6 @@ public class MAssetChange extends X_A_Asset_Change
if (po == null) {
return;
}
/* arhipac: teo_sarca: TODO need to integrate
for(int idx = 0; idx < po.get_ColumnCount_P(); idx++) {
//~ if(!po.is_ValueChanged(idx)) {
//~ continue;
//~ }
String colName = po.get_ColumnName_P(idx);
int idx2 = get_ColumnIndex(colName);
if(idx2 < 0) {
if(CLogMgt.isLevelFine()) log.fine("Setting " + colName + ": SKIP (idx2 < 0)");
continue;
}
Object value = po.get_Value(idx2);
set_Value(colName, value);
if(CLogMgt.isLevelFine()) log.fine("Setting " + colName + "=" + value + " (from " + po.getClass() + ", idx=" + idx + ", idx2=" + idx2 + ")");
}
*/
//
if (log.isLoggable(Level.FINE)) log.fine("Leaving: po=" + po);
}

View File

@ -132,21 +132,13 @@ public class MAssetGroup extends X_A_Asset_Group implements ImmutablePOSupport
public static int getDefault_ID(SetGetModel m)
{
int AD_Client_ID = SetGetUtil.get_AttrValueAsInt(m, "AD_Client_ID");
/* commented by @win
int A_AssetType_ID = SetGetUtil.get_AttrValueAsInt(m, MAssetType.COLUMNNAME_A_Asset_Type_ID);
*/
final String sql = "SELECT "+COLUMNNAME_A_Asset_Group_ID
+ " FROM "+Table_Name
+ " WHERE AD_Client_ID=?"
// + " AND NVL("+COLUMNNAME_A_Asset_Type_ID+",0) IN (0,?)" //commented by @win
+ " ORDER BY "+COLUMNNAME_IsDefault+" DESC"
+", "+COLUMNNAME_A_Asset_Group_ID+" ASC" // default first, older first
;
/* modify by @win
int id = DB.getSQLValueEx(null, sql, AD_Client_ID, A_AssetType_ID);
*/
int id = DB.getSQLValueEx(null, sql, AD_Client_ID);
// modify by @win
return id;
}
@ -157,31 +149,6 @@ public class MAssetGroup extends X_A_Asset_Group implements ImmutablePOSupport
*/
public static void updateAsset(SetGetModel m, int A_Asset_Group_ID)
{
/* commented by @win
int i = (Integer) m.get_AttrValue(MAsset.COLUMNNAME_A_Asset_Type_ID);
MAssetType type = MAssetType.get(m.getCtx(), m.get_AttrValue(MAsset.COLUMNNAME_A_Asset_Type_ID));
if (type == null)
return;
if (A_Asset_Group_ID > 0)
{
if (!type.isFixedAsset())
{
return;
}
MAssetGroup assetGrp = MAssetGroup.get(m.getCtx(), A_Asset_Group_ID);
int A_Asset_Class_ID = assetGrp.getA_Asset_Class_ID();
if (A_Asset_Class_ID > 0)
{
m.set_AttrValue(MAsset.COLUMNNAME_A_Asset_Class_ID, A_Asset_Class_ID);
}
}
else
{
A_Asset_Group_ID = MAssetGroup.getDefault_ID(SetGetUtil.wrap(m));
m.set_AttrValue(MAsset.COLUMNNAME_A_Asset_Group_ID, A_Asset_Group_ID);
}
*/
if (A_Asset_Group_ID < 0) {
A_Asset_Group_ID = MAssetGroup.getDefault_ID(SetGetUtil.wrap(m));
m.set_AttrValue(MAsset.COLUMNNAME_A_Asset_Group_ID, A_Asset_Group_ID);
@ -193,15 +160,6 @@ public class MAssetGroup extends X_A_Asset_Group implements ImmutablePOSupport
protected boolean beforeSave (boolean newRecord)
{
/* commented by @win
MAssetType type = MAssetType.get(getCtx(), getA_Asset_Type_ID());
if (type != null)
{
type.update(SetGetUtil.wrap(this), newRecord == true);
}
*/
//end commented by @win
return true;
}

View File

@ -78,13 +78,6 @@ public class MAssetGroupAcct extends X_A_Asset_Group_Acct
return m_parent;
}
/* commented by @win
public int getA_Asset_Class_ID()
{
return getParent().getA_Asset_Class_ID();
}
*/
public Timestamp getAssetServiceDate()
{
return null;

View File

@ -129,9 +129,6 @@ implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -143,10 +140,6 @@ implements DocAction
MAsset asset = MAsset.get(getCtx(), getA_Asset_ID(), get_TrxName());
asset.setA_Asset_RevalDate(this.getDateDoc());
asset.saveEx();
//rebuild depreciation
/* commented out by @win, deprecating existing design
assetwk.buildDepreciation();
*/
// User Validation
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
@ -245,13 +238,4 @@ implements DocAction
{
return null;
}
/** Before save
* @param newRecord
* @return true on success
*/
//protected boolean beforeSave (boolean newRecord)
//{
//return true;
//}
}

View File

@ -191,9 +191,6 @@ implements DocAction
return status;
}
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -210,9 +207,6 @@ implements DocAction
@SuppressWarnings("unused")
MDepreciationWorkfile wk = MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
/* commented out by @win, deprecating existing design
wk.buildDepreciation();
*/
// User Validation
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);

View File

@ -16,10 +16,6 @@ public class MAssetUse extends X_A_Asset_Use
public MAssetUse (Properties ctx, int A_Asset_Use_ID, String trxName)
{
super (ctx, A_Asset_Use_ID, trxName);
if (A_Asset_Use_ID == 0)
{
// empty block
}
} // MAssetUse
/**

View File

@ -81,8 +81,6 @@ public class MAssignmentSlot implements Comparator<Object>
setName(name);
setDescription(description);
setStatus(status);
//
// log.fine( toString());
} // MAssignmentSlot
/**
@ -93,7 +91,6 @@ public class MAssignmentSlot implements Comparator<Object>
{
setStatus(assignment.isConfirmed() ? STATUS_Confirmed : STATUS_NotConfirmed);
setMAssignment(assignment);
// log.fine( toString());
} // MAssignmentSlot
@ -562,14 +559,12 @@ public class MAssignmentSlot implements Comparator<Object>
// after end |---| x
if (compare.after(end))
{
// System.out.println("InSlot-false Compare=" + compare + " after end " + end);
return false;
}
// start x---|
if (!endTime && compare.equals(start))
{
// System.out.println("InSlot-true Compare=" + compare + " = Start=" + start);
return true;
}
@ -577,13 +572,11 @@ public class MAssignmentSlot implements Comparator<Object>
// end |---x
if (endTime && compare.equals(end))
{
// System.out.println("InSlot-true Compare=" + compare + " = End=" + end);
return true;
}
// between start/end |-x-|
if (compare.before(end))
{
// System.out.println("InSlot-true Compare=" + compare + " before end " + end);
return true;
}
return false;