IDEMPIERE-4723 - Clean up code -> MI/MPa classes (#793)

This commit is contained in:
Diego Ruiz 2021-07-24 07:26:36 +02:00 committed by GitHub
parent 298dbab9d0
commit 02d5263742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 14 additions and 135 deletions

View File

@ -60,7 +60,6 @@ public class MIMPProcessor
super(ctx, EXP_ReplicationProcessor_ID, trxName);
if (EXP_ReplicationProcessor_ID == 0)
{
//setValue (/*client.getName() + " - " +*/ "Default Import Processor");
setName (/*client.getName() + " - " +*/ "Default Import Processor");
setFrequencyType (FREQUENCYTYPE_Hour);
setFrequency (1);
@ -147,7 +146,6 @@ public class MIMPProcessor
.append(" FROM ").append(X_IMP_ProcessorParameter.Table_Name)
.append(" WHERE ").append(X_IMP_ProcessorParameter.COLUMNNAME_IMP_Processor_ID).append("=?") // # 1
.append(" AND IsActive = ?") // # 2
//.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_)
;
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -1904,7 +1904,6 @@ public class MInOut extends X_M_InOut implements DocAction
if (product != null
&& line.getM_Locator_ID() == 0)
{
//MWarehouse w = MWarehouse.get(getCtx(), getM_Warehouse_ID());
line.setM_Warehouse_ID(getM_Warehouse_ID());
line.setM_Locator_ID(inTrx ? Env.ZERO : line.getMovementQty()); // default Locator
needSave = true;

View File

@ -271,18 +271,11 @@ public class MInfoWindow extends X_AD_InfoWindow
{
if (i != 0) // can also use if i>0
sql.append(",");
sql.append(mColumns[i].getSelectClause());//getColumnSQL()); // Normal and Virtual Column
sql.append(mColumns[i].getSelectClause()); // Normal and Virtual Column
}
sql.append(" FROM ").append(fromsql)//getTableName())
//.append(" WHERE ")
//.append(getWhereClause(false))
sql.append(" FROM ").append(fromsql)
.append(oclause);
//.append("ORDER BY SeqNo"); //.append(get_WhereClause(false));
//
// int index = -1;
//if (CLogMgt.isLevelFinest())
//log.finest(getWhereClause(true));
log.info("Generated SQL -- getSql: "+ sql.toString());
return sql.toString();
@ -299,7 +292,6 @@ public class MInfoWindow extends X_AD_InfoWindow
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
pstmt = DB.prepareStatement(countSql, null);
// pstmt.setString(1, p_tableName);
rs = pstmt.executeQuery();
while (rs.next())
{
@ -308,10 +300,7 @@ public class MInfoWindow extends X_AD_InfoWindow
}
catch (SQLException e)
{
//ADialog.error(WindowNo, c, AD_Message)
//Env.getUi().showError(0, null, sql.toString() + "<br> " + e.getMessage());
log.log(Level.SEVERE, sql, e);
// String error = e.toString();
// show error to user and return: TODO
return false;
}

View File

@ -26,11 +26,6 @@ public class MInfoWindowAccess extends X_AD_InfoWindow_Access {
super(ctx, 0, trxName);
if (ignored != 0)
throw new IllegalArgumentException("Multi-Key");
else
{
// setAD_InfoWindow_ID (0);
// setAD_Role_ID (0);
}
}
/**

View File

@ -54,11 +54,8 @@ public class MPAttributeLookup extends Lookup
public MPAttributeLookup(Properties ctx, int WindowNo)
{
super(DisplayType.TableDir, WindowNo);
// m_ctx = ctx;
} // MPAttribute
// /** Properties */
// private Properties m_ctx;
/** No Instance Value */
private static KeyNamePair NO_INSTANCE = new KeyNamePair (0,"");

View File

@ -121,9 +121,6 @@ public class MPackage extends X_M_Package
super (ctx, M_Package_ID, trxName);
if (M_Package_ID == 0)
{
// setM_Shipper_ID (0);
// setDocumentNo (null);
// setM_InOut_ID (0);
setShipDate (new Timestamp(System.currentTimeMillis()));
MClientInfo clientInfo = MClientInfo.get(ctx, getAD_Client_ID());
@ -577,7 +574,6 @@ public class MPackage extends X_M_Package
st.setSalesRep_ID(ioOut.getSalesRep_ID());
st.setShipDate(getShipDate());
st.setShipperAccount(getShipperAccount());
// st.setShippingRespMessage(ShippingRespMessage);
st.setSurcharges(getSurcharges());
st.setTrackingInfo(getTrackingInfo());
st.setTrackingNo(getTrackingNo());

View File

@ -45,8 +45,6 @@ public class MPackageLine extends X_M_PackageLine
super (ctx, M_PackageLine_ID, trxName);
if (M_PackageLine_ID == 0)
{
// setM_Package_ID (0);
// setM_InOutLine_ID (0);
setQty (Env.ZERO);
}
} // MPackageLine

View File

@ -186,12 +186,6 @@ public class MPasswordRule extends X_AD_PasswordRule {
WordListDictionary dict = new WordListDictionary(awl);
DictionarySubstringRule dictRule = new DictionarySubstringRule(dict);
/*if (getDictWordLength() > 0) {//when update library to passay. this method is miss
dictRule.setWordLength(getDictWordLength()); // size of words to check in the password
} else{
dictRule.setWordLength(DictionarySubstringRule.DEFAULT_WORD_LENGTH);
}*/
if (isDictMatchBackwards()) {
dictRule.setMatchBackwards(true); // match dictionary words backwards
}

View File

@ -45,7 +45,6 @@ public class MPaySchedule extends X_C_PaySchedule
super(ctx, C_PaySchedule_ID, trxName);
if (C_PaySchedule_ID == 0)
{
// setC_PaymentTerm_ID (0); // Parent
setPercentage (Env.ZERO);
setDiscount (Env.ZERO);
setDiscountDays (0);

View File

@ -47,9 +47,6 @@ public class MPaySelection extends X_C_PaySelection
super(ctx, C_PaySelection_ID, trxName);
if (C_PaySelection_ID == 0)
{
// setC_BankAccount_ID (0);
// setName (null); // @#Date@
// setPayDate (new Timestamp(System.currentTimeMillis())); // @#Date@
setTotalAmt (Env.ZERO);
setIsApproved (false);
setProcessed (false);

View File

@ -523,9 +523,6 @@ public class MPaySelectionCheck extends X_C_PaySelectionCheck
super(ctx, C_PaySelectionCheck_ID, trxName);
if (C_PaySelectionCheck_ID == 0)
{
// setC_PaySelection_ID (0);
// setC_BPartner_ID (0);
// setPaymentRule (null);
setPayAmt (Env.ZERO);
setDiscountAmt(Env.ZERO);
setWriteOffAmt(Env.ZERO);

View File

@ -48,10 +48,6 @@ public class MPaySelectionLine extends X_C_PaySelectionLine
super(ctx, C_PaySelectionLine_ID, trxName);
if (C_PaySelectionLine_ID == 0)
{
// setC_PaySelection_ID (0);
// setPaymentRule (null); // S
// setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM C_PaySelectionLine WHERE C_PaySelection_ID=@C_PaySelection_ID@
// setC_Invoice_ID (0);
setIsSOTrx (false);
setOpenAmt(Env.ZERO);
setPayAmt (Env.ZERO);

View File

@ -193,7 +193,6 @@ public class MPayment extends X_C_Payment
setIsAllocated(false);
setIsOnline(false);
setIsDelayedCapture (false);
// setC_BPartner_ID(0);
setC_Invoice_ID(0);
setC_Order_ID(0);
setC_Charge_ID(0);
@ -530,24 +529,17 @@ public class MPayment extends X_C_Payment
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor"));
else
{
// Validate before trying to process
// String msg = pp.validate();
// if (msg!=null && msg.trim().length()>0) {
// setErrorMessage(Msg.getMsg(getCtx(), msg));
// } else {
// Process if validation succeeds
approved = pp.processCC();
if (approved)
setErrorMessage(null);
approved = pp.processCC();
if (approved)
setErrorMessage(null);
else
{
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
setErrorMessage("From " + getCreditCardName() + ": " + getR_VoidMsg());
else
{
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
setErrorMessage("From " + getCreditCardName() + ": " + getR_VoidMsg());
else
setErrorMessage("From " + getCreditCardName() + ": " + getR_RespMsg());
}
// }
setErrorMessage("From " + getCreditCardName() + ": " + getR_RespMsg());
}
}
}
catch (Exception e)
@ -679,7 +671,6 @@ public class MPayment extends X_C_Payment
return false;
}
// @Trifon - CashPayments
//if ( getTenderType().equals("X") ) {
if ( isCashbookTrx()) {
// Cash Book Is mandatory
if ( getC_CashBook_ID() <= 0 ) {
@ -887,7 +878,6 @@ public class MPayment extends X_C_Payment
+ " INNER JOIN C_Payment p ON (al.C_Payment_ID=p.C_Payment_ID) "
+ "WHERE al.C_Payment_ID=?"
+ " AND ah.IsActive='Y' AND al.IsActive='Y'";
// + " AND al.C_Invoice_ID IS NOT NULL";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
@ -908,8 +898,6 @@ public class MPayment extends X_C_Payment
rs = null;
pstmt = null;
}
// log.fine("getAllocatedAmt - " + retValue);
// ? ROUND(NVL(v_AllocatedAmt,0), 2);
return retValue;
} // getAllocatedAmt
@ -919,18 +907,6 @@ public class MPayment extends X_C_Payment
*/
public boolean testAllocation()
{
// Cash Trx always allocated!!! WHY???
/* @Trifon - CashPayments
if (isCashTrx())
{
if (!isAllocated())
{
setIsAllocated(true);
return true;
}
return false;
}
*/
//
BigDecimal alloc = getAllocatedAmt();
if (alloc == null)
@ -1540,8 +1516,6 @@ public class MPayment extends X_C_Payment
*/
public void setC_DocType_ID (int C_DocType_ID)
{
// if (getDocumentNo() != null && getC_DocType_ID() != C_DocType_ID)
// setDocumentNo(null);
super.setC_DocType_ID(C_DocType_ID);
} // setC_DocType_ID
@ -2035,11 +2009,6 @@ public class MPayment extends X_C_Payment
testAllocation();
}
// Project update
if (getC_Project_ID() != 0)
{
// MProject project = new MProject(getCtx(), getC_Project_ID());
}
// Update BP for Prepayments
if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0 && getC_Charge_ID() == 0 && MPaymentAllocate.get(this).length == 0 && !createdAllocationRecords)
{
@ -2083,7 +2052,6 @@ public class MPayment extends X_C_Payment
m_processMsg += " @CounterDoc@: @C_Payment_ID@=" + counter.getDocumentNo();
// @Trifon - CashPayments
//if ( getTenderType().equals("X") ) {
if ( isCashbookTrx()) {
// Create Cash Book entry
if ( getC_CashBook_ID() <= 0 ) {
@ -2108,14 +2076,6 @@ public class MPayment extends X_C_Payment
m_processMsg = info.toString();
// Amount
BigDecimal amt = this.getPayAmt();
/*
MDocType dt = MDocType.get(getCtx(), invoice.getC_DocType_ID());
if (MDocType.DOCBASETYPE_APInvoice.equals( dt.getDocBaseType() )
|| MDocType.DOCBASETYPE_ARCreditMemo.equals( dt.getDocBaseType() )
) {
amt = amt.negate();
}
*/
cl.setAmount( amt );
//
cl.setDiscountAmt( Env.ZERO );
@ -2216,7 +2176,7 @@ public class MPayment extends X_C_Payment
return null;
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, get_TrxName());
// MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
if (log.isLoggable(Level.INFO)) log.info("Counter BP=" + counterBP.getName());
// Document Type
@ -2517,10 +2477,6 @@ public class MPayment extends X_C_Payment
*/
protected void deAllocate(boolean accrual)
{
// if (getC_Order_ID() != 0) setC_Order_ID(0); // IDEMPIERE-1764
// if (getC_Invoice_ID() == 0)
// return;
// De-Allocate all
MAllocationHdr[] allocations = MAllocationHdr.getOfPayment(getCtx(),
getC_Payment_ID(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("#" + allocations.length);
@ -2925,10 +2881,7 @@ public class MPayment extends X_C_Payment
*/
public File createPDF (File file)
{
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.PAYMENT, getC_Payment_ID());
// if (re == null)
return null;
// return re.getPDF(file);
return null;
} // createPDF

View File

@ -62,8 +62,6 @@ public class MPaymentAllocate extends X_C_PaymentAllocate
super (ctx, C_PaymentAllocate_ID, trxName);
if (C_PaymentAllocate_ID == 0)
{
// setC_Payment_ID (0); // Parent
// setC_Invoice_ID (0);
setAmount (Env.ZERO);
setDiscountAmt (Env.ZERO);
setOverUnderAmt (Env.ZERO);

View File

@ -57,7 +57,6 @@ public class MPaymentBatch extends X_C_PaymentBatch
super(ctx, C_PaymentBatch_ID, trxName);
if (C_PaymentBatch_ID == 0)
{
// setName (null);
setProcessed (false);
setProcessing (false);
}

View File

@ -46,11 +46,6 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
super (ctx, C_PaymentProcessor_ID, trxName);
if (C_PaymentProcessor_ID == 0)
{
// setC_BankAccount_ID (0); // Parent
// setUserID (null);
// setPassword (null);
// setHostAddress (null);
// setHostPort (0);
setCommission (Env.ZERO);
setAcceptVisa (false);
setAcceptMC (false);
@ -64,7 +59,6 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
setAcceptATM (false);
setAcceptDirectDeposit(false);
setAcceptDirectDebit(false);
// setName (null);
}
} // MPaymentProcessor

View File

@ -137,17 +137,6 @@ public class MPaymentTerm extends X_C_PaymentTerm
setIsValid(true);
return validMsg;
}
// Allow schedules with just one record
// if (m_schedule.length == 1)
// {
// setIsValid(false);
// if (m_schedule[0].isValid())
// {
// m_schedule[0].setIsValid(false);
// m_schedule[0].saveEx();
// }
// return "@Invalid@ @Count@ # = 1 (@C_PaySchedule_ID@)";
// }
// Add up
BigDecimal total = Env.ZERO;

View File

@ -244,12 +244,6 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor"));
else
{
// Validate before trying to process
// String msg = pp.validate();
// if (msg!=null && msg.trim().length()>0) {
// setErrorMessage(Msg.getMsg(getCtx(), msg));
// } else {
// Process if validation succeeds
approved = pp.processCC();
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
@ -287,7 +281,6 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
else
setErrorMessage("From " + getCreditCardName() + ": " + getR_RespMsg());
}
// }
}
}
catch (Exception e)

View File

@ -111,8 +111,6 @@ public class MPaymentValidate
{
if (mm < 1 || mm > 12)
return "CreditCardExpMonth";
// if (yy < 0 || yy > EXP_YEAR)
// return "CreditCardExpYear";
// Today's date
Calendar cal = Calendar.getInstance();