IDEMPIERE-4723 - Clean up code -> MP* classes (#796)

This commit is contained in:
Diego Ruiz 2021-07-27 07:34:04 +02:00 committed by GitHub
parent f5dc3ba2c8
commit 40e411f693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 2 additions and 256 deletions

View File

@ -71,8 +71,6 @@ public class MPInstance extends X_AD_PInstance
// New Process
if (AD_PInstance_ID == 0)
{
// setAD_Process_ID (0); // parent
// setRecord_ID (0);
setIsProcessing (false);
}
} // MPInstance
@ -249,7 +247,6 @@ public class MPInstance extends X_AD_PInstance
P_Date, P_ID, P_Number, P_Msg, AD_Table_ID, Record_ID);
m_log.add(logEntry);
// save it to DB ?
// log.saveEx();
return logEntry;
} // addLog

View File

@ -102,12 +102,7 @@ public class MPOS extends X_C_POS implements ImmutablePOSupport
super (ctx, C_POS_ID, trxName);
if (C_POS_ID == 0)
{
// setName (null);
// setSalesRep_ID (0);
// setC_CashBook_ID (0);
// setM_PriceList_ID (0);
setIsModifyPrice (false); // N
// setM_Warehouse_ID (0);
}
} // MPOS

View File

@ -495,11 +495,6 @@ public class MPeriod extends X_C_Period implements ImmutablePOSupport
super (ctx, C_Period_ID, trxName);
if (C_Period_ID == 0)
{
// setC_Period_ID (0); // PK
// setC_Year_ID (0); // Parent
// setName (null);
// setPeriodNo (0);
// setStartDate (new Timestamp(System.currentTimeMillis()));
setPeriodType (PERIODTYPE_StandardCalendarPeriod);
}
} // MPeriod
@ -623,7 +618,6 @@ public class MPeriod extends X_C_Period implements ImmutablePOSupport
getPeriodControls(false);
for (int i = 0; i < m_controls.length; i++)
{
// log.fine("getPeriodControl - " + 1 + " - " + m_controls[i]);
if (DocBaseType.equals(m_controls[i].getDocBaseType()))
return m_controls[i];
}

View File

@ -47,8 +47,6 @@ public class MPeriodControl extends X_C_PeriodControl implements ImmutablePOSupp
super(ctx, C_PeriodControl_ID, trxName);
if (C_PeriodControl_ID == 0)
{
// setC_Period_ID (0);
// setDocBaseType (null);
setPeriodAction (PERIODACTION_NoAction);
setPeriodStatus (PERIODSTATUS_NeverOpened);
}

View File

@ -44,12 +44,6 @@ public class MPreference extends X_AD_Preference
public MPreference(Properties ctx, int AD_Preference_ID, String trxName)
{
super(ctx, AD_Preference_ID, trxName);
if (AD_Preference_ID == 0)
{
// setAD_Preference_ID (0);
// setAttribute (null);
// setValue (null);
}
} // MPreference
/**

View File

@ -229,8 +229,6 @@ public class MPriceList extends X_M_PriceList implements ImmutablePOSupport
setIsSOPriceList (false);
setIsTaxIncluded (false);
setPricePrecision (2); // 2
// setName (null);
// setC_Currency_ID (0);
}
} // MPriceList

View File

@ -48,13 +48,6 @@ public class MPriceListVersion extends X_M_PriceList_Version implements Immutabl
public MPriceListVersion(Properties ctx, int M_PriceList_Version_ID, String trxName)
{
super(ctx, M_PriceList_Version_ID, trxName);
if (M_PriceList_Version_ID == 0)
{
// setName (null); // @#Date@
// setM_PriceList_ID (0);
// setValidFrom (TimeUtil.getDay(null)); // @#Date@
// setM_DiscountSchema_ID (0);
}
} // MPriceListVersion
/**

View File

@ -82,52 +82,6 @@ public class MPrivateAccess extends X_AD_Private_Access
*/
public static String getLockedRecordWhere (int AD_Table_ID, int AD_User_ID)
{
//[ 1644094 ] MPrivateAccess.getLockedRecordWhere inefficient
/*
ArrayList<Integer> list = new ArrayList<Integer>();
PreparedStatement pstmt = null;
String sql = "SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID=? AND AD_User_ID<>? AND IsActive='Y'";
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Table_ID);
pstmt.setInt(2, AD_User_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(Integer.valueOf(rs.getInt(1)));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
s_log.log(Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
//
if (list.size() == 0)
return null;
if (list.size() == 1)
return "<>" + list.get(0);
//
StringBuilder sb = new StringBuilder(" NOT IN(");
for (int i = 0; i < list.size(); i++)
{
if (i > 0)
sb.append(",");
sb.append(list.get(i));
}
sb.append(")");
return sb.toString();*/
String whereClause = " NOT IN ( SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = "
+AD_Table_ID+" AND AD_User_ID <> "+AD_User_ID+" AND IsActive = 'Y' )";
return whereClause;

View File

@ -170,8 +170,6 @@ public class MProcess extends X_AD_Process implements ImmutablePOSupport
super (ctx, AD_Process_ID, trxName);
if (AD_Process_ID == 0)
{
// setValue (null);
// setName (null);
setIsReport (false);
setAccessLevel (ACCESSLEVEL_All);
setEntityType (ENTITYTYPE_UserMaintained);

View File

@ -49,8 +49,6 @@ public class MProcessAccess extends X_AD_Process_Access
throw new IllegalArgumentException("Multi-Key");
else
{
// setAD_Process_ID (0);
// setAD_Role_ID (0);
setIsReadWrite (true);
}
} // MProcessAccess

View File

@ -89,13 +89,8 @@ public class MProcessPara extends X_AD_Process_Para implements ImmutablePOSuppor
super (ctx, AD_Process_Para_ID, trxName);
if (AD_Process_Para_ID == 0)
{
// setAD_Process_ID (0); Parent
// setName (null);
// setColumnName (null);
setFieldLength (0);
setSeqNo (0);
// setAD_Reference_ID (0);
setIsCentrallyMaintained (true);
setIsRange (false);
setIsMandatory (false);

View File

@ -224,12 +224,6 @@ public class MProduct extends X_M_Product implements ImmutablePOSupport
super (ctx, M_Product_ID, trxName);
if (M_Product_ID == 0)
{
// setValue (null);
// setName (null);
// setM_Product_Category_ID (0);
// setC_TaxCategory_ID (0);
// setC_UOM_ID (0);
//
setProductType (PRODUCTTYPE_Item); // I
setIsBOM (false); // N
setIsInvoicePrintDetails (false);
@ -667,7 +661,6 @@ public class MProduct extends X_M_Product implements ImmutablePOSupport
// Reset Stocked if not Item
//AZ Goodwill: Bug Fix isStocked always return false
//if (isStocked() && !PRODUCTTYPE_Item.equals(getProductType()))
if (!PRODUCTTYPE_Item.equals(getProductType()))
setIsStocked(false);
@ -781,7 +774,6 @@ public class MProduct extends X_M_Product implements ImmutablePOSupport
+ "FROM M_Product p "
+ "WHERE p.M_Product_ID=a.M_Product_ID) "
+ "WHERE IsActive='Y'"
// + " AND GuaranteeDate > getDate()"
+ " AND M_Product_ID=" + getM_Product_ID();
int no = DB.executeUpdate(sql, get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("Asset Description updated #" + no);
@ -825,29 +817,6 @@ public class MProduct extends X_M_Product implements ImmutablePOSupport
// delete costing
MCost.delete(this);
// [ 1674225 ] Delete Product: Costing deletion error
/*MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(getCtx(),getAD_Client_ID(), get_TrxName());
for(int i=0; i<mass.length; i++)
{
// Get Cost Elements
MCostElement[] ces = MCostElement.getMaterialWithCostingMethods(this);
MCostElement ce = null;
for(int j=0; j<ces.length; j++)
{
if(MCostElement.COSTINGMETHOD_StandardCosting.equals(ces[i].getCostingMethod()))
{
ce = ces[i];
break;
}
}
if(ce == null)
continue;
MCost mcost = MCost.get(this, 0, mass[i], 0, ce.getM_CostElement_ID());
mcost.delete(true, get_TrxName());
}*/
//
return true;
} // beforeDelete

View File

@ -66,7 +66,6 @@ public class MProductBOM extends X_M_Product_BOM
.setOrderBy("Line")
.list();
// s_log.fine("getBOMLines - #" + list.size() + " - M_Product_ID=" + M_Product_ID);
MProductBOM[] retValue = new MProductBOM[list.size()];
list.toArray(retValue);
return retValue;
@ -88,9 +87,6 @@ public class MProductBOM extends X_M_Product_BOM
super (ctx, M_Product_BOM_ID, trxName);
if (M_Product_BOM_ID == 0)
{
// setM_Product_ID (0); // parent
// setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_Product_BOM WHERE M_Product_ID=@M_Product_ID@
// setM_ProductBOM_ID(0);
setBOMQty (Env.ZERO); // 1
}
} // MProductBOM

View File

@ -146,8 +146,6 @@ public class MProductCategory extends X_M_Product_Category implements ImmutableP
super(ctx, M_Product_Category_ID, trxName);
if (M_Product_Category_ID == 0)
{
// setName (null);
// setValue (null);
setMMPolicy (MMPOLICY_FiFo); // F
setPlannedMargin (Env.ZERO);
setIsDefault (false);

View File

@ -116,12 +116,6 @@ public class MProductDownload extends X_M_ProductDownload implements ImmutablePO
String trxName)
{
super (ctx, M_ProductDownload_ID, trxName);
if (M_ProductDownload_ID == 0)
{
// setM_Product_ID (0);
// setName (null);
// setDownloadURL (null);
}
} // MProductDownload
/**

View File

@ -68,9 +68,6 @@ public class MProductPO extends X_M_Product_PO
throw new IllegalArgumentException("Multi-Key");
else
{
// setM_Product_ID (0); // @M_Product_ID@
// setC_BPartner_ID (0); // 0
// setVendorProductNo (null); // @Value@
setIsCurrentVendor (true); // Y
}
} // MProduct_PO

View File

@ -237,47 +237,6 @@ public class MProductPricing extends AbstractProductPricing
if (m_M_Product_ID == 0)
return false;
// Get Price List
/**
if (m_M_PriceList_ID == 0)
{
String sql = "SELECT M_PriceList_ID, IsTaxIncluded "
+ "FROM M_PriceList pl"
+ " INNER JOIN M_Product p ON (pl.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID=? "
+ "ORDER BY IsDefault DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql);
pstmt.setInt(1, m_M_Product_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
m_M_PriceList_ID = rs.getInt(1);
m_isTaxIncluded = "Y".equals(rs.getString(2));
}
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "calculatePL (PL)", e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
}
/** **/
if (m_M_PriceList_ID == 0)
{
log.log(Level.SEVERE, "No PriceList");
@ -520,47 +479,6 @@ public class MProductPricing extends AbstractProductPricing
if (m_M_Product_ID == 0)
return false;
// Get Price List
/**
if (m_M_PriceList_ID == 0)
{
String sql = "SELECT M_PriceList_ID, IsTaxIncluded "
+ "FROM M_PriceList pl"
+ " INNER JOIN M_Product p ON (pl.AD_Client_ID=p.AD_Client_ID) "
+ "WHERE M_Product_ID=? "
+ "ORDER BY IsDefault DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql);
pstmt.setInt(1, m_M_Product_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
m_M_PriceList_ID = rs.getInt(1);
m_isTaxIncluded = "Y".equals(rs.getString(2));
}
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "calculatePL (PL)", e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
}
/** **/
if (m_M_PriceList_ID == 0)
{
log.log(Level.SEVERE, "No PriceList");

View File

@ -36,10 +36,8 @@ public class MProductionLine extends X_M_ProductionLine {
super (ctx, M_ProductionLine_ID, trxName);
if (M_ProductionLine_ID == 0)
{
setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_ProductionLine WHERE M_Production_ID=@M_Production_ID@
setLine (0);
setM_AttributeSetInstance_ID (0);
// setM_Locator_ID (0); // @M_Locator_ID@
// setM_Product_ID (0);
setM_ProductionLine_ID (0);
setM_Production_ID (0);
setMovementQty (Env.ZERO);

View File

@ -89,9 +89,6 @@ public class MProject extends X_C_Project
super (ctx, C_Project_ID, trxName);
if (C_Project_ID == 0)
{
// setC_Project_ID(0);
// setValue (null);
// setC_Currency_ID (0);
setCommittedAmt (Env.ZERO);
setCommittedQty (Env.ZERO);
setInvoicedAmt (Env.ZERO);
@ -100,7 +97,6 @@ public class MProject extends X_C_Project
setPlannedMarginAmt (Env.ZERO);
setPlannedQty (Env.ZERO);
setProjectBalanceAmt (Env.ZERO);
// setProjectCategory(PROJECTCATEGORY_General);
setProjInvoiceRule(PROJINVOICERULE_None);
setProjectLineLevel(PROJECTLINELEVEL_Project);
setIsCommitCeiling (false);

View File

@ -53,11 +53,6 @@ public class MProjectIssue extends X_C_ProjectIssue
super (ctx, C_ProjectIssue_ID, trxName);
if (C_ProjectIssue_ID == 0)
{
// setC_Project_ID (0);
// setLine (0);
// setM_Locator_ID (0);
// setM_Product_ID (0);
// setMovementDate (new Timestamp(System.currentTimeMillis()));
setMovementQty (Env.ZERO);
setPosted (false);
setProcessed (false);
@ -87,9 +82,6 @@ public class MProjectIssue extends X_C_ProjectIssue
setLine (getNextLine());
m_parent = project;
//
// setM_Locator_ID (0);
// setM_Product_ID (0);
//
setMovementDate (new Timestamp(System.currentTimeMillis()));
setMovementQty (Env.ZERO);
setPosted (false);

View File

@ -50,8 +50,6 @@ public class MProjectLine extends X_C_ProjectLine
super (ctx, C_ProjectLine_ID, trxName);
if (C_ProjectLine_ID == 0)
{
// setC_Project_ID (0);
// setC_ProjectLine_ID (0);
setLine (0);
setIsPrinted(true);
setProcessed(false);

View File

@ -51,14 +51,10 @@ public class MProjectPhase extends X_C_ProjectPhase
super (ctx, C_ProjectPhase_ID, trxName);
if (C_ProjectPhase_ID == 0)
{
// setC_ProjectPhase_ID (0); // PK
// setC_Project_ID (0); // Parent
// setC_Phase_ID (0); // FK
setCommittedAmt (Env.ZERO);
setIsCommitCeiling (false);
setIsComplete (false);
setSeqNo (0);
// setName (null);
setQty (Env.ZERO);
}
} // MProjectPhase

View File

@ -46,11 +46,7 @@ public class MProjectTask extends X_C_ProjectTask
super (ctx, C_ProjectTask_ID, trxName);
if (C_ProjectTask_ID == 0)
{
// setC_ProjectTask_ID (0); // PK
// setC_ProjectPhase_ID (0); // Parent
// setC_Task_ID (0); // FK
setSeqNo (0);
// setName (null);
setQty (Env.ZERO);
}
} // MProjectTask

View File

@ -87,13 +87,6 @@ public class MProjectType extends X_C_ProjectType implements ImmutablePOSupport
public MProjectType (Properties ctx, int C_ProjectType_ID, String trxName)
{
super (ctx, C_ProjectType_ID, trxName);
/**
if (C_ProjectType_ID == 0)
{
setC_ProjectType_ID (0);
setName (null);
}
**/
} // MProjectType
/**
@ -272,8 +265,6 @@ public class MProjectType extends X_C_ProjectType implements ImmutablePOSupport
trunc = "MM";
else if (MGoal.MEASUREDISPLAY_Week.equals(MeasureDisplay))
trunc = "W";
// else if (MGoal.MEASUREDISPLAY_Day.equals(MeasureDisplay))
// ;
orderBy = "TRUNC(" + dateColumn + ",'" + trunc + "')";
groupBy = orderBy + ", 0 ";
sb.append(groupBy)
@ -341,8 +332,7 @@ public class MProjectType extends X_C_ProjectType implements ImmutablePOSupport
trunc = "MM";
else if (MGoal.MEASUREDISPLAY_Week.equals(MeasureDisplay))
trunc = "W";
// else if (MGoal.MEASUREDISPLAY_Day.equals(MeasureDisplay))
// trunc = "D";
where = "TRUNC(" + dateColumn + ",'" + trunc
+ "')=TRUNC(" + DB.TO_DATE(date) + ",'" + trunc + "')";
}

View File

@ -50,9 +50,6 @@ public class MProjectTypePhase extends X_C_Phase
super (ctx, C_Phase_ID, trxName);
if (C_Phase_ID == 0)
{
// setC_Phase_ID (0); // PK
// setC_ProjectType_ID (0); // Parent
// setName (null);
setSeqNo (0);
setStandardQty (Env.ZERO);
}

View File

@ -39,9 +39,6 @@ public class MProjectTypeTask extends X_C_Task
super (ctx, C_Task_ID, trxName);
if (C_Task_ID == 0)
{
// setC_Task_ID (0); // PK
// setC_Phase_ID (0); // Parent
// setName (null);
setSeqNo (0);
setStandardQty (Env.ZERO);
}