IDEMPIERE-4723 - Clean up code -> remaining org.adempiere.base/src/org/compiere/model/ classes (#846)

This commit is contained in:
Diego Ruiz 2021-08-21 09:21:35 +02:00 committed by GitHub
parent 0167c91424
commit 2f0e426771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2 additions and 169 deletions

View File

@ -816,7 +816,6 @@ public abstract class PO
//
// globalqss -- Bug 1618469 - is throwing not updateable even on new records
// if (!p_info.isColumnUpdateable(index))
if ( ( ! p_info.isColumnUpdateable(index) ) && ( ! is_new() ) )
{
colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index);
@ -1331,7 +1330,6 @@ public abstract class PO
{
setKeyInfo();
m_IDs = new Object[] {Integer.valueOf(ID)};
//m_KeyColumns = new String[] {p_info.getTableName() + "_ID"};
load(trxName);
}
else // new
@ -1403,7 +1401,6 @@ public abstract class PO
.append(get_WhereClause(false,uuID));
//
// int index = -1;
if (log.isLoggable(Level.FINEST)) log.finest(get_WhereClause(true,uuID));
PreparedStatement pstmt = null;
ResultSet rs = null;
@ -1439,7 +1436,6 @@ public abstract class PO
log.log(Level.SEVERE, "NO Data found for " + get_WhereClause(true,uuID), new Exception());
m_IDs = new Object[] {I_ZERO};
success = false;
// throw new DBException("NO Data found for " + get_WhereClause(true));
}
m_createNew = false;
// reset new values
@ -1451,14 +1447,10 @@ public abstract class PO
if (m_trxName != null)
msg = "[" + m_trxName + "] - ";
msg += get_WhereClause(true,uuID)
// + ", Index=" + index
// + ", Column=" + get_ColumnName(index)
// + ", " + p_info.toString(index)
+ ", SQL=" + sql.toString();
success = false;
m_IDs = new Object[] {I_ZERO};
log.log(Level.SEVERE, msg, e);
// throw new DBException(e);
}
// Finish
finally {
@ -1669,7 +1661,6 @@ public abstract class PO
while (it.hasNext())
{
String column = (String)it.next();
// int index = p_info.getColumnIndex(column);
String value = (String)m_custom.get(column);
if (value != null)
hmOut.put(column, value);
@ -1709,9 +1700,6 @@ public abstract class PO
protected void loadDefaults()
{
setStandardDefaults();
//
/** @todo defaults from Field */
// MField.getDefault(p_info.getDefaultLogic(i));
} // loadDefaults
/**
@ -2403,7 +2391,6 @@ public abstract class PO
log.log(Level.WARNING, "afterSave", e);
log.saveError("Error", e, false);
success = false;
// throw new DBException(e);
}
// Call ModelValidators TYPE_AFTER_NEW/TYPE_AFTER_CHANGE - teo_sarca [ 1675490 ]
if (success) {
@ -2520,13 +2507,6 @@ public abstract class PO
*/
protected boolean beforeSave(boolean newRecord)
{
/** Prevents saving
log.saveError("Error", Msg.parseTranslation(getCtx(), "@C_Currency_ID@ = @C_Currency_ID@"));
log.saveError("FillMandatory", Msg.getElement(getCtx(), "PriceEntered"));
/** Issues message
log.saveWarning(AD_Message, message);
log.saveInfo (AD_Message, message);
**/
return true;
} // beforeSave
@ -3718,7 +3698,6 @@ public abstract class PO
*/
protected boolean beforeDelete ()
{
// log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete"));
return true;
} // beforeDelete
@ -4816,7 +4795,6 @@ public abstract class PO
while (it.hasNext())
{
String columnName = (String)it.next();
// int index = p_info.getColumnIndex(columnName);
String value = (String)m_custom.get(columnName);
//
Element col = document.createElement(columnName);

View File

@ -126,8 +126,6 @@ public class PO_Record
// Parent Loop
for (int j = 0; j < s_parents.length; j++)
{
// DELETE FROM AD_Attachment WHERE AD_Table_ID=1 AND Record_ID IN
// (SELECT C_InvoiceLine_ID FROM C_InvoiceLine WHERE C_Invoice_ID=1)
if (s_parents[j] == AD_Table_ID)
{
int AD_Table_IDchild = s_parentChilds[j];

View File

@ -326,121 +326,6 @@ public class ProductCost
return cost;
} // getProductCosts
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema
* @param onlyPOPriceList use only PO price list
* @return po price
*/
/*private BigDecimal getPriceList (MAcctSchema as, boolean onlyPOPriceList)
{
StringBuilder sql = new StringBuilder (
"SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit "
+ "FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp "
+ "WHERE pl.M_PriceList_ID = plv.M_PriceList_ID"
+ " AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID"
+ " AND pp.M_Product_ID=?");
if (onlyPOPriceList)
sql.append(" AND pl.IsSOPriceList='N'");
sql.append(" ORDER BY pl.IsSOPriceList ASC, plv.ValidFrom DESC");
int C_Currency_ID = 0;
BigDecimal PriceList = null;
BigDecimal PriceStd = null;
BigDecimal PriceLimit = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, m_M_Product_ID);
rs = pstmt.executeQuery();
if (rs.next())
{
C_Currency_ID = rs.getInt(1);
PriceList = rs.getBigDecimal(2);
PriceStd = rs.getBigDecimal(3);
PriceLimit = rs.getBigDecimal(4);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// nothing found
if (C_Currency_ID == 0)
return null;
BigDecimal price = PriceLimit; // best bet
if (price == null || price.compareTo(Env.ZERO)==0)
price = PriceStd;
if (price == null || price.compareTo(Env.ZERO)==0)
price = PriceList;
// Convert
if (price != null && price.compareTo(Env.ZERO)!=0)
price = MConversionRate.convert (as.getCtx(),
price, C_Currency_ID, as.getC_Currency_ID(),
as.getAD_Client_ID(), 0);
return price;
} // getPOPrice*/
/**
* Get PO Cost from Purchase Info - and convert it to AcctSchema Currency
* @param as accounting schema
* @return po cost
*/
/*private BigDecimal getPOCost (MAcctSchema as)
{
String sql = "SELECT C_Currency_ID, PriceList,PricePO,PriceLastPO "
+ "FROM M_Product_PO WHERE M_Product_ID=? "
+ "ORDER BY IsCurrentVendor DESC";
int C_Currency_ID = 0;
BigDecimal PriceList = null;
BigDecimal PricePO = null;
BigDecimal PriceLastPO = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_M_Product_ID);
rs = pstmt.executeQuery();
if (rs.next())
{
C_Currency_ID = rs.getInt(1);
PriceList = rs.getBigDecimal(2);
PricePO = rs.getBigDecimal(3);
PriceLastPO = rs.getBigDecimal(4);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// nothing found
if (C_Currency_ID == 0)
return null;
BigDecimal cost = PriceLastPO; // best bet
if (cost == null || cost.compareTo(Env.ZERO)==0)
cost = PricePO;
if (cost == null || cost.compareTo(Env.ZERO)==0)
cost = PriceList;
// Convert - standard precision!! - should be costing precision
if (cost != null && cost.compareTo(Env.ZERO)!=0)
cost = MConversionRate.convert (as.getCtx(),
cost, C_Currency_ID, as.getC_Currency_ID(), as.getAD_Client_ID(), as.getAD_Org_ID());
return cost;
} // getPOCost*/
/**
* String Representation
* @return info

View File

@ -57,9 +57,6 @@ public class SalesMgmtValidator implements ModelValidator
engine.addModelChange(MOrder.Table_Name, this);
engine.addModelChange(MOrderLine.Table_Name, this);
// Documents to be monitored
// engine.addDocValidate(MInvoice.Table_Name, this);
} // initialize
/**

View File

@ -126,7 +126,6 @@ public class ScheduleUtil
// Resource Unavailability -------------------------------------------
// log.fine( "- Unavailability -");
String sql = "SELECT Description, DateFrom, DateTo "
+ "FROM S_ResourceUnavailable "
+ "WHERE S_Resource_ID=?" // #1
@ -137,7 +136,6 @@ public class ScheduleUtil
ResultSet rs = null;
try
{
// log.fine( sql, "ID=" + S_Resource_ID + ", Start=" + m_startDate + ", End=" + m_endDate);
pstmt = DB.prepareStatement(sql, trxName);
pstmt.setInt(1, m_S_Resource_ID);
pstmt.setTimestamp(2, m_startDate);
@ -149,7 +147,7 @@ public class ScheduleUtil
TimeUtil.getNextDay(rs.getTimestamp(3)), // user entered date need to convert to not including end time
Msg.getMsg (m_ctx, "ResourceUnAvailable"), rs.getString(1),
MAssignmentSlot.STATUS_UnAvailable);
// log.fine( "- Unavailable", ma);
if (getAll)
createDaySlot (list, ma);
else
@ -175,7 +173,6 @@ public class ScheduleUtil
// NonBusinessDay ----------------------------------------------------
// log.fine( "- NonBusinessDay -");
// "WHERE TRUNC(Date1) BETWEEN TRUNC(?) AND TRUNC(?)" causes
// ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP
sql = MRole.getDefault(m_ctx, false).addAccessSQL (
@ -186,7 +183,6 @@ public class ScheduleUtil
{
Timestamp startDay = TimeUtil.getDay(m_startDate);
Timestamp endDay = TimeUtil.getDay(m_endDate);
// log.fine( sql, "Start=" + startDay + ", End=" + endDay);
pstmt = DB.prepareStatement(sql, trxName);
pstmt.setTimestamp(1, startDay);
pstmt.setTimestamp(2, endDay);
@ -221,7 +217,6 @@ public class ScheduleUtil
// ResourceType Available --------------------------------------------
// log.fine( "- ResourceTypeAvailability -");
sql = "SELECT Name, IsTimeSlot,TimeSlotStart,TimeSlotEnd, " // 1..4
+ "IsDateSlot,OnMonday,OnTuesday,OnWednesday," // 5..8
+ "OnThursday,OnFriday,OnSaturday,OnSunday " // 9..12
@ -384,7 +379,7 @@ public class ScheduleUtil
private void layoutSlots (ArrayList<MAssignmentSlot> list, ArrayList<MAssignmentSlot> clean)
{
int size = list.size();
// System.out.println("Start List=" + size + ", Clean=" + clean.size());
if (size == 0)
return;
else if (size == 1)
@ -615,7 +610,6 @@ public class ScheduleUtil
//
m_S_ResourceType_ID = rs.getInt(4);
m_C_UOM_ID = rs.getInt(5);
// log.fine( "- Resource_ID=" + m_S_ResourceType_ID + ",IsAvailable=" + m_isAvailable);
}
else
m_isAvailable = false;
@ -645,7 +639,6 @@ public class ScheduleUtil
private void createTimeSlot (ArrayList<MAssignmentSlot> list,
Timestamp startTime, Timestamp endTime)
{
// log.fine( "MSchedule.createTimeSlot");
GregorianCalendar cal = new GregorianCalendar(Language.getLoginLanguage().getLocale());
cal.setTimeInMillis(m_startDate.getTime());
// End Date for Comparison
@ -709,7 +702,6 @@ public class ScheduleUtil
boolean OnMonday, boolean OnTuesday, boolean OnWednesday,
boolean OnThursday, boolean OnFriday, boolean OnSaturday, boolean OnSunday)
{
// log.fine( "MSchedule.createDaySlot");
GregorianCalendar cal = new GregorianCalendar(Language.getLoginLanguage().getLocale());
cal.setTimeInMillis(m_startDate.getTime());
// End Date for Comparison
@ -753,7 +745,6 @@ public class ScheduleUtil
*/
private void createDaySlot (ArrayList<MAssignmentSlot> list, MAssignmentSlot ma)
{
// log.fine( "MSchedule.createDaySlot", ma);
//
Timestamp start = ma.getStartTime();
GregorianCalendar calStart = new GregorianCalendar();
@ -842,8 +833,6 @@ public class ScheduleUtil
calEnd.set(Calendar.MILLISECOND, 0);
calEnd.add(Calendar.DAY_OF_YEAR, 1);
}
//System.out.println("Start=" + new Timestamp(cal.getTimeInMillis()));
//System.out.println("Endt=" + new Timestamp(calEnd.getTimeInMillis()));
// Set end Slot Time
GregorianCalendar calEndSlot = new GregorianCalendar();

View File

@ -366,7 +366,6 @@ public class Scriptlet
{
if (key != null && key.length() > 0)
{
// log.fine( "Scriptlet.setEnvironment " + key, value);
if (value == null)
m_ctx.remove(key);
else

View File

@ -237,8 +237,6 @@ public class SetGetUtil
if (s_log.isLoggable(Level.FINEST))
{
s_log.finest("Entering: From=" + from+ " - To=" + to);
// s_log.finest("includeFields=" + ARHIPAC.toString(includeFields));
// s_log.finest("excludeFields=" + ARHIPAC.toString(excludeFields));
}
//
if (to == null || from == null)
@ -515,7 +513,6 @@ public class SetGetUtil
}
else if (o instanceof PO)
{
// return ((PO)o).is_UserEntry();
return false; // TODO
}
else
@ -787,7 +784,6 @@ public class SetGetUtil
String errmsg = tab.setValue(name, value);
if (errmsg != null && errmsg.length() > 0)
{
//~ log.saveError("Error", errmsg);
return false;
}
return true;

View File

@ -167,15 +167,6 @@ public class Tax
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx, String trxName)
{
/* ship location from warehouse is plainly ignored below */
// if (M_Warehouse_ID <= 0)
// M_Warehouse_ID = Env.getContextAsInt(ctx, "M_Warehouse_ID");
// if (M_Warehouse_ID <= 0)
// {
// throw new TaxForChangeNotFoundException(C_Charge_ID, AD_Org_ID, M_Warehouse_ID,
// billC_BPartner_Location_ID, shipC_BPartner_Location_ID,
// "@NotFound@ @M_Warehouse_ID@");
// }
int C_TaxCategory_ID = 0;
int shipFromC_Location_ID = 0;
int shipToC_Location_ID = 0;