Integrate bug fixing from Compiere 260c

This commit is contained in:
Carlos Ruiz 2007-02-26 07:46:50 +00:00
parent c425fb36f9
commit b2db385533
100 changed files with 315 additions and 241 deletions

View File

@ -333,7 +333,7 @@ public class PackInHandler extends DefaultHandler {
else if (elementValue.equals("menu")) { else if (elementValue.equals("menu")) {
log.info(elementValue+" "+atts.getValue("ADMenuNameID")); log.info(elementValue+" "+atts.getValue("ADMenuNameID"));
//String entitytype = atts.getValue("EntityType"); //String entitytype = atts.getValue("EntityType");
//if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode == true ) { //if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode == true ) {
d_menu[menu_seq][0] = atts.getValue("ADMenuNameID"); d_menu[menu_seq][0] = atts.getValue("ADMenuNameID");
d_menu[menu_seq][1] = atts.getValue("ADWindowNameID"); d_menu[menu_seq][1] = atts.getValue("ADWindowNameID");
@ -358,7 +358,7 @@ public class PackInHandler extends DefaultHandler {
else if (elementValue.equals("window")) { else if (elementValue.equals("window")) {
log.info(elementValue+" "+atts.getValue("Name")); log.info(elementValue+" "+atts.getValue("Name"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("Name"); String name = atts.getValue("Name");
int id= get_ID("AD_Window", name); int id= get_ID("AD_Window", name);
m_Window = new MWindow(m_ctx, id, m_trxName); m_Window = new MWindow(m_ctx, id, m_trxName);
@ -430,7 +430,7 @@ public class PackInHandler extends DefaultHandler {
else if (elementValue.equals("tab")) { else if (elementValue.equals("tab")) {
log.info(elementValue+" "+atts.getValue("ADTabNameID")); log.info(elementValue+" "+atts.getValue("ADTabNameID"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0) {
String name = atts.getValue("ADTabNameID"); String name = atts.getValue("ADTabNameID");
int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID")); int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID"));
@ -522,7 +522,7 @@ public class PackInHandler extends DefaultHandler {
else if (elementValue.equals("field")) { else if (elementValue.equals("field")) {
log.info(elementValue+" "+atts.getValue("Name")); log.info(elementValue+" "+atts.getValue("Name"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0) {
String name = atts.getValue("Name"); String name = atts.getValue("Name");
String tabname = atts.getValue("ADTabNameID"); String tabname = atts.getValue("ADTabNameID");
String colname = atts.getValue("ADColumnNameID"); String colname = atts.getValue("ADColumnNameID");
@ -617,7 +617,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("Name")); log.info(elementValue+" "+atts.getValue("Name"));
int id = 0; int id = 0;
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("Name"); String name = atts.getValue("Name");
@ -678,7 +678,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("Name")); log.info(elementValue+" "+atts.getValue("Name"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("Name"); String name = atts.getValue("Name");
int id = get_IDWithMaster("AD_Process_Para", name, "AD_Process", atts.getValue("ADProcessNameID")); int id = get_IDWithMaster("AD_Process_Para", name, "AD_Process", atts.getValue("ADProcessNameID"));
@ -819,7 +819,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("ColumnName")); log.info(elementValue+" "+atts.getValue("ColumnName"));
int success=0; int success=0;
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String columnName = atts.getValue("ColumnName"); String columnName = atts.getValue("ColumnName");
int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID")); int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID"));
@ -1438,7 +1438,7 @@ public class PackInHandler extends DefaultHandler {
else if (elementValue.equals("task")) { else if (elementValue.equals("task")) {
log.info(elementValue+" "+atts.getValue("ADTaskNameID")); log.info(elementValue+" "+atts.getValue("ADTaskNameID"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("ADTaskNameID"); String name = atts.getValue("ADTaskNameID");
int id = get_ID("AD_Task", name); int id = get_ID("AD_Task", name);
m_Task = new MTask(m_ctx, id, m_trxName); m_Task = new MTask(m_ctx, id, m_trxName);
@ -1470,7 +1470,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("ADFormNameID")); log.info(elementValue+" "+atts.getValue("ADFormNameID"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("ADFormNameID"); String name = atts.getValue("ADFormNameID");
int id = get_ID("AD_Form", name); int id = get_ID("AD_Form", name);
m_Form = new MForm(m_ctx, id, m_trxName); m_Form = new MForm(m_ctx, id, m_trxName);
@ -1577,7 +1577,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("ADWorkbenchNameID")); log.info(elementValue+" "+atts.getValue("ADWorkbenchNameID"));
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
String name = atts.getValue("ADWorkbenchNameID"); String name = atts.getValue("ADWorkbenchNameID");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
int id = get_ID("AD_Workbench", name); int id = get_ID("AD_Workbench", name);
m_Workbench = new X_AD_Workbench(m_ctx, id, m_trxName); m_Workbench = new X_AD_Workbench(m_ctx, id, m_trxName);
if (id > 0){ if (id > 0){
@ -2089,7 +2089,7 @@ public class PackInHandler extends DefaultHandler {
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
String name = atts.getValue("ADReportViewColID"); String name = atts.getValue("ADReportViewColID");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
int id = get_ID("AD_Reportview_Col", name); int id = get_ID("AD_Reportview_Col", name);
m_Reportview_Col = new X_AD_ReportView_Col(m_ctx, id, m_trxName); m_Reportview_Col = new X_AD_ReportView_Col(m_ctx, id, m_trxName);
if (id > 0){ if (id > 0){
@ -2127,11 +2127,11 @@ public class PackInHandler extends DefaultHandler {
int n = pstmt.executeUpdate(); int n = pstmt.executeUpdate();
log.info("Executed SQL Statement: "+ atts.getValue("statement")); log.info("Executed SQL Statement: "+ atts.getValue("statement"));
} }
else if(DB.isOracle() == true & DBType.equals("Oracle")){ else if(DB.isOracle() == true && DBType.equals("Oracle")){
pstmt.executeUpdate(); pstmt.executeUpdate();
log.info("Executed SQL Statement for Oracle: "+ atts.getValue("statement")); log.info("Executed SQL Statement for Oracle: "+ atts.getValue("statement"));
} }
/* else if(DB.isSybase() == true & DBType.equals("Sybase")){ /* else if(DB.isSybase() == true && DBType.equals("Sybase")){
pstmt.executeUpdate(); pstmt.executeUpdate();
log.info("Exceuted SQL Statement for Sybase"); log.info("Exceuted SQL Statement for Sybase");
} }
@ -2146,7 +2146,7 @@ public class PackInHandler extends DefaultHandler {
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
String name = atts.getValue("name"); String name = atts.getValue("name");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
int id = get_ID("AD_Reference", name); int id = get_ID("AD_Reference", name);
m_Reference = new X_AD_Reference(m_ctx, id, m_trxName); m_Reference = new X_AD_Reference(m_ctx, id, m_trxName);
@ -2180,7 +2180,7 @@ public class PackInHandler extends DefaultHandler {
log.info(elementValue+" "+atts.getValue("Name")); log.info(elementValue+" "+atts.getValue("Name"));
//TODO: Solve for date issues with valuefrom valueto //TODO: Solve for date issues with valuefrom valueto
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
String name = atts.getValue("Name"); String name = atts.getValue("Name");
int Referenceid = get_IDWithColumn("AD_Reference", "Name", atts.getValue("ADRefenceNameID")); int Referenceid = get_IDWithColumn("AD_Reference", "Name", atts.getValue("ADRefenceNameID"));
int id = get_IDWithMaster("AD_Ref_List", name, "AD_Reference",Referenceid); int id = get_IDWithMaster("AD_Ref_List", name, "AD_Reference",Referenceid);
@ -2215,7 +2215,7 @@ public class PackInHandler extends DefaultHandler {
String entitytype = atts.getValue("EntityType"); String entitytype = atts.getValue("EntityType");
String name = atts.getValue("ADRefenceNameID"); String name = atts.getValue("ADRefenceNameID");
if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) {
sqlB = new StringBuffer ("SELECT AD_Reference_ID FROM AD_Reference WHERE Name= ?"); sqlB = new StringBuffer ("SELECT AD_Reference_ID FROM AD_Reference WHERE Name= ?");
int id = DB.getSQLValue(m_trxName,sqlB.toString(),name); int id = DB.getSQLValue(m_trxName,sqlB.toString(),name);
sqlB = new StringBuffer ("SELECT Count(*) FROM AD_Ref_Table WHERE AD_Reference_ID= ?"); sqlB = new StringBuffer ("SELECT Count(*) FROM AD_Ref_Table WHERE AD_Reference_ID= ?");

View File

@ -451,7 +451,7 @@ public class PackOut extends SvrProcess
m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null); m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null);
atts = createmenuBinding(atts,m_Menu); atts = createmenuBinding(atts,m_Menu);
hd_menu.startElement("","","menu",atts); hd_menu.startElement("","","menu",atts);
if ( rs.getInt("AD_WINDOW_ID") > 0 | rs.getInt("AD_WORKFLOW_ID") > 0 | rs.getInt("AD_TASK_ID") > 0 | rs.getInt("AD_PROCESS_ID") > 0 | rs.getInt("AD_FORM_ID") > 0 | rs.getInt("AD_WORKBENCH_ID") > 0) if ( rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 || rs.getInt("AD_PROCESS_ID") > 0 || rs.getInt("AD_FORM_ID") > 0 || rs.getInt("AD_WORKBENCH_ID") > 0)
{ {
//Call CreateWindow. //Call CreateWindow.
if (rs.getInt("AD_WINDOW_ID") > 0) if (rs.getInt("AD_WINDOW_ID") > 0)
@ -526,7 +526,7 @@ public class PackOut extends SvrProcess
m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null); m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null);
atts = createmenuBinding(atts,m_Menu); atts = createmenuBinding(atts,m_Menu);
hd_menu.startElement("","","menu",atts); hd_menu.startElement("","","menu",atts);
if ( rs.getInt("AD_WINDOW_ID") > 0 | rs.getInt("AD_WORKFLOW_ID") > 0 | rs.getInt("AD_TASK_ID") > 0 | rs.getInt("AD_PROCESS_ID") > 0 | rs.getInt("AD_FORM_ID") > 0 | rs.getInt("AD_WORKBENCH_ID") > 0) if ( rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 || rs.getInt("AD_PROCESS_ID") > 0 || rs.getInt("AD_FORM_ID") > 0 || rs.getInt("AD_WORKBENCH_ID") > 0)
{ {
//Call CreateWindow. //Call CreateWindow.
if (rs.getInt("AD_WINDOW_ID") > 0) if (rs.getInt("AD_WINDOW_ID") > 0)
@ -875,12 +875,12 @@ public class PackOut extends SvrProcess
+ "Upper(ColumnName)= '"+col_Name+"'"; + "Upper(ColumnName)= '"+col_Name+"'";
String cName = DB.getSQLValueString(null,sql2,table_id); String cName = DB.getSQLValueString(null,sql2,table_id);
if (cName != null){ if (cName != null){
if (cName.toUpperCase().equals(col_Name) & key1 == 0 ){ if (cName.toUpperCase().equals(col_Name) && key1 == 0 ){
atts.addAttribute("","","key1name","CDATA",cName); atts.addAttribute("","","key1name","CDATA",cName);
atts.addAttribute("","","lookupkey1name","CDATA",""+rs.getObject(col_Name)); atts.addAttribute("","","lookupkey1name","CDATA",""+rs.getObject(col_Name));
key1 = 1; key1 = 1;
} }
else if (cName.toUpperCase().equals(col_Name) & key1 == 1 ){ else if (cName.toUpperCase().equals(col_Name) && key1 == 1 ){
atts.addAttribute("","","key2name","CDATA",cName); atts.addAttribute("","","key2name","CDATA",cName);
atts.addAttribute("","","lookupkey2name","CDATA",""+rs.getObject(col_Name)); atts.addAttribute("","","lookupkey2name","CDATA",""+rs.getObject(col_Name));
key1 = 2; key1 = 2;

View File

@ -180,8 +180,8 @@ public class CacheHandler {
if (JNPURL.indexOf("jnp://")>=0) { if (JNPURL.indexOf("jnp://")>=0) {
JNPURL = JNPURL.substring(JNPURL.indexOf("jnp://")+6); JNPURL = JNPURL.substring(JNPURL.indexOf("jnp://")+6);
} }
if (JNPURL.indexOf(":")>=0) { if (JNPURL.indexOf(':')>=0) {
JNPURL = JNPURL.substring(0,JNPURL.indexOf(":")); JNPURL = JNPURL.substring(0,JNPURL.indexOf(':'));
} }
if (JNPURL.length()>0) { if (JNPURL.length()>0) {
return JNPURL; return JNPURL;

View File

@ -236,8 +236,8 @@ public class StringUtil {
*/ */
public static String getNextWord(String tempStr) { public static String getNextWord(String tempStr) {
String word = ""; String word = "";
if (tempStr.indexOf(" ")>=0) { if (tempStr.indexOf(' ')>=0) {
word=tempStr.substring(0,tempStr.indexOf(" ")); word=tempStr.substring(0,tempStr.indexOf(' '));
} else { } else {
word=tempStr; word=tempStr;
} }

View File

@ -277,7 +277,7 @@ public final class ImpFormatRow
// callout // callout
if (callout != null) if (callout != null)
{ {
int methodStart = callout.lastIndexOf("."); int methodStart = callout.lastIndexOf('.');
try try
{ {
if (methodStart != -1) // no class if (methodStart != -1) // no class
@ -424,7 +424,7 @@ public final class ImpFormatRow
ts = new Timestamp (System.currentTimeMillis()); ts = new Timestamp (System.currentTimeMillis());
// //
String dateString = ts.toString(); String dateString = ts.toString();
return dateString.substring(0, dateString.indexOf(".")); // cut off miliseconds return dateString.substring(0, dateString.indexOf('.')); // cut off miliseconds
} // parseNumber } // parseNumber
/** /**
@ -463,14 +463,14 @@ public final class ImpFormatRow
*/ */
private String parseNumber (String info) private String parseNumber (String info)
{ {
boolean hasPoint = info.indexOf(".") != -1; boolean hasPoint = info.indexOf('.') != -1;
boolean hasComma = info.indexOf(",") != -1; boolean hasComma = info.indexOf(',') != -1;
// delete thousands // delete thousands
if (hasComma && m_decimalPoint.equals(".")) if (hasComma && m_decimalPoint.equals("."))
info = info.replace(',', ' '); info = info.replace(',', ' ');
if (hasPoint && m_decimalPoint.equals(",")) if (hasPoint && m_decimalPoint.equals(","))
info = info.replace('.', ' '); info = info.replace('.', ' ');
hasComma = info.indexOf(",") != -1; hasComma = info.indexOf(',') != -1;
// replace decimal // replace decimal
if (hasComma && m_decimalPoint.equals(",")) if (hasComma && m_decimalPoint.equals(","))

View File

@ -75,7 +75,7 @@ public final class OFX1ToXML extends InputStream implements Runnable
write("<?xml version=\"1.0\"?>\n"); write("<?xml version=\"1.0\"?>\n");
write("<?OFX "); write("<?OFX ");
while(line.indexOf("<") != 0) while(line.indexOf('<') != 0)
{ {
if (line.length() > 0) if (line.length() > 0)
{ {
@ -113,18 +113,18 @@ public final class OFX1ToXML extends InputStream implements Runnable
while(m_ofx != "") while(m_ofx != "")
{ {
addCloseTag = false; addCloseTag = false;
tagStart = m_ofx.indexOf("<"); tagStart = m_ofx.indexOf('<');
if (tagStart == -1) if (tagStart == -1)
{ {
break; break;
} }
tagEnd = m_ofx.indexOf(">"); tagEnd = m_ofx.indexOf('>');
if (tagEnd <= tagStart + 1) if (tagEnd <= tagStart + 1)
{ {
throw new IOException("PARSE ERROR: Invalid tag"); throw new IOException("PARSE ERROR: Invalid tag");
} }
tag = m_ofx.substring(tagStart + 1, tagEnd); tag = m_ofx.substring(tagStart + 1, tagEnd);
if (tag.indexOf(" ") != -1) if (tag.indexOf(' ') != -1)
{ {
throw new IOException("PARSE ERROR: Invalid tag"); throw new IOException("PARSE ERROR: Invalid tag");
} }

View File

@ -2376,7 +2376,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
String cmd = st.nextToken().trim(); String cmd = st.nextToken().trim();
Callout call = null; Callout call = null;
String method = null; String method = null;
int methodStart = cmd.lastIndexOf("."); int methodStart = cmd.lastIndexOf('.');
try try
{ {
if (methodStart != -1) // no class if (methodStart != -1) // no class

View File

@ -267,7 +267,7 @@ public class GridTable extends AbstractTableModel
if (m_whereClause.length() > 0) if (m_whereClause.length() > 0)
{ {
where.append(" WHERE "); where.append(" WHERE ");
if (m_whereClause.indexOf("@") == -1) if (m_whereClause.indexOf('@') == -1)
where.append(m_whereClause); where.append(m_whereClause);
else // replace variables else // replace variables
where.append(Env.parseContext(m_ctx, m_WindowNo, m_whereClause, false)); where.append(Env.parseContext(m_ctx, m_WindowNo, m_whereClause, false));
@ -1721,7 +1721,7 @@ public class GridTable extends AbstractTableModel
// //
MTable table = MTable.get (m_ctx, m_AD_Table_ID); MTable table = MTable.get (m_ctx, m_AD_Table_ID);
PO po = null; PO po = null;
if (Record_ID != -1) if (table.isSingleKey())
po = table.getPO(Record_ID, null); po = table.getPO(Record_ID, null);
else // Multi - Key else // Multi - Key
po = table.getPO(getWhereClause(rowData), null); po = table.getPO(getWhereClause(rowData), null);

View File

@ -227,7 +227,7 @@ public class MBPGroup extends X_C_BP_Group
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
return insert_Accounting("C_BP_Group_Acct", "C_AcctSchema_Default", null); return insert_Accounting("C_BP_Group_Acct", "C_AcctSchema_Default", null);
return success; return success;
} // afterSave } // afterSave

View File

@ -1059,7 +1059,7 @@ public class MBPartner extends X_C_BPartner
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
{ {
// Trees // Trees
insert_Tree(MTree_Base.TREETYPE_BPartner); insert_Tree(MTree_Base.TREETYPE_BPartner);

View File

@ -60,7 +60,7 @@ public class MBPartnerInfo extends X_RV_BPartner
{ {
if (sb.length() > 0) if (sb.length() > 0)
sb.append(" OR "); sb.append(" OR ");
sb.append("UPPER(Contact) LIKE ?"); sb.append("UPPER(ContactName) LIKE ?");
} }
EMail = getFindParameter (EMail); EMail = getFindParameter (EMail);
if (EMail != null) if (EMail != null)

View File

@ -121,7 +121,7 @@ public class MBankAccount extends X_C_BankAccount
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
return insert_Accounting("C_BankAccount_Acct", "C_AcctSchema_Default", null); return insert_Accounting("C_BankAccount_Acct", "C_AcctSchema_Default", null);
return success; return success;
} // afterSave } // afterSave

View File

@ -119,7 +119,7 @@ public class MCStage extends X_CM_CStage
{ {
if (RelativeURL.endsWith("/")) if (RelativeURL.endsWith("/"))
RelativeURL = RelativeURL.substring(0, RelativeURL.length()-1); RelativeURL = RelativeURL.substring(0, RelativeURL.length()-1);
int index = RelativeURL.lastIndexOf("/"); int index = RelativeURL.lastIndexOf('/');
if (index != -1) if (index != -1)
RelativeURL = RelativeURL.substring(index+1); RelativeURL = RelativeURL.substring(index+1);
} }

View File

@ -141,7 +141,7 @@ public class MCashBook extends X_C_CashBook
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("C_CashBook_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_CashBook_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -140,7 +140,7 @@ public class MCharge extends X_C_Charge
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("C_Charge_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_Charge_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -840,7 +840,7 @@ public class MCost extends X_M_Cost
pstmt = null; pstmt = null;
} }
// //
if (newAverageAmt != null & newAverageAmt.signum() != 0) if (newAverageAmt != null && newAverageAmt.signum() != 0)
{ {
s_log.finer(product.getName() + " = " + newAverageAmt); s_log.finer(product.getName() + " = " + newAverageAmt);
return newAverageAmt; return newAverageAmt;
@ -943,7 +943,7 @@ public class MCost extends X_M_Cost
pstmt = null; pstmt = null;
} }
// //
if (newAverageAmt != null & newAverageAmt.signum() != 0) if (newAverageAmt != null && newAverageAmt.signum() != 0)
{ {
s_log.finer(product.getName() + " = " + newAverageAmt); s_log.finer(product.getName() + " = " + newAverageAmt);
return newAverageAmt; return newAverageAmt;

View File

@ -144,7 +144,7 @@ public class MMailText extends X_R_MailText
*/ */
private String parse (String text) private String parse (String text)
{ {
if (text.indexOf("@") == -1) if (text.indexOf('@') == -1)
return text; return text;
// Parse User // Parse User
text = parse (text, m_user); text = parse (text, m_user);
@ -164,20 +164,20 @@ public class MMailText extends X_R_MailText
*/ */
private String parse (String text, PO po) private String parse (String text, PO po)
{ {
if (po == null || text.indexOf("@") == -1) if (po == null || text.indexOf('@') == -1)
return text; return text;
String inStr = text; String inStr = text;
String token; String token;
StringBuffer outStr = new StringBuffer(); StringBuffer outStr = new StringBuffer();
int i = inStr.indexOf("@"); int i = inStr.indexOf('@');
while (i != -1) while (i != -1)
{ {
outStr.append(inStr.substring(0, i)); // up to @ outStr.append(inStr.substring(0, i)); // up to @
inStr = inStr.substring(i+1, inStr.length()); // from first @ inStr = inStr.substring(i+1, inStr.length()); // from first @
int j = inStr.indexOf("@"); // next @ int j = inStr.indexOf('@'); // next @
if (j < 0) // no second tag if (j < 0) // no second tag
{ {
inStr = "@" + inStr; inStr = "@" + inStr;
@ -188,7 +188,7 @@ public class MMailText extends X_R_MailText
outStr.append(parseVariable(token, po)); // replace context outStr.append(parseVariable(token, po)); // replace context
inStr = inStr.substring(j+1, inStr.length()); // from second @ inStr = inStr.substring(j+1, inStr.length()); // from second @
i = inStr.indexOf("@"); i = inStr.indexOf('@');
} }
outStr.append(inStr); // add remainder outStr.append(inStr); // add remainder

View File

@ -352,7 +352,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc
sb.append(")"); sb.append(")");
} }
// BPG // BPG
if (bpColumn.indexOf(".") == -1) if (bpColumn.indexOf('.') == -1)
bpColumn = tableName + "." + bpColumn; bpColumn = tableName + "." + bpColumn;
if (listBPG.size() == 1) if (listBPG.size() == 1)
sb.append(" AND EXISTS (SELECT * FROM C_BPartner bpx WHERE ") sb.append(" AND EXISTS (SELECT * FROM C_BPartner bpx WHERE ")
@ -403,7 +403,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc
sb.append(")"); sb.append(")");
} }
// Category // Category
if (pColumn.indexOf(".") == -1) if (pColumn.indexOf('.') == -1)
pColumn = tableName + "." + pColumn; pColumn = tableName + "." + pColumn;
if (listPC.size() == 1) if (listPC.size() == 1)
sb.append(" AND EXISTS (SELECT * FROM M_Product px WHERE ") sb.append(" AND EXISTS (SELECT * FROM M_Product px WHERE ")

View File

@ -564,7 +564,7 @@ public class MOrder extends X_C_Order implements DocAction
*/ */
public File createPDF (File file) public File createPDF (File file)
{ {
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Invoice_ID()); ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID());
if (re == null) if (re == null)
return null; return null;
return re.getPDF(file); return re.getPDF(file);

View File

@ -18,6 +18,7 @@ package org.compiere.model;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.util.logging.*;
import org.compiere.util.*; import org.compiere.util.*;
/** /**
@ -68,6 +69,79 @@ public class MPriceListVersion extends X_M_PriceList_Version
setM_PriceList_ID(pl.getM_PriceList_ID()); setM_PriceList_ID(pl.getM_PriceList_ID());
} // MPriceListVersion } // MPriceListVersion
/** Product Prices */
private MProductPrice[] m_pp = null;
/** Price List */
private MPriceList m_pl = null;
/**
* Get Parent PriceList
* @return price List
*/
public MPriceList getPriceList()
{
if (m_pl == null && getM_PriceList_ID() != 0)
m_pl = MPriceList.get (getCtx(), getM_PriceList_ID(), null);
return m_pl;
} // PriceList
/**
* Get Product Price
* @param refresh true if refresh
* @return product price
*/
public MProductPrice[] getProductPrice (boolean refresh)
{
if (m_pp != null && !refresh)
return m_pp;
m_pp = getProductPrice(null);
return m_pp;
} // getProductPrice
/**
* Get Product Price
* @param whereClause optional where clause
* @return product price
*/
public MProductPrice[] getProductPrice (String whereClause)
{
ArrayList<MProductPrice> list = new ArrayList<MProductPrice>();
String sql = "SELECT * FROM M_ProductPrice WHERE M_PriceList_Version_ID=?";
if (whereClause != null)
sql += " " + whereClause;
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName ());
pstmt.setInt (1, getM_PriceList_Version_ID());
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
list.add (new MProductPrice(getCtx(), rs, get_TrxName()));
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
//
MProductPrice[] pp = new MProductPrice[list.size()];
list.toArray(pp);
return pp;
} // getProductPrice
/** /**
* Set Name to Valid From Date. * Set Name to Valid From Date.
* If valid from not set, use today * If valid from not set, use today

View File

@ -148,7 +148,7 @@ public class MProductCategory extends X_M_Product_Category
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("M_Product_Category_Acct", "C_AcctSchema_Default", null); insert_Accounting("M_Product_Category_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -168,4 +168,18 @@ public class MProductPrice extends X_M_ProductPrice
setPriceStd (PriceStd); setPriceStd (PriceStd);
} // setPrice } // setPrice
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MProductPrice[");
sb.append(getM_PriceList_Version_ID())
.append(",M_Product_ID=").append (getM_Product_ID())
.append(",PriceList=").append(getPriceList())
.append("]");
return sb.toString ();
} // toString
} // MProductPrice } // MProductPrice

View File

@ -477,7 +477,7 @@ public class MProject extends X_C_Project
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
{ {
insert_Accounting("C_Project_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_Project_Acct", "C_AcctSchema_Default", null);
insert_Tree(MTree_Base.TREETYPE_Project); insert_Tree(MTree_Base.TREETYPE_Project);

View File

@ -341,7 +341,7 @@ public class MTax extends X_C_Tax
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("C_Tax_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_Tax_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -58,7 +58,7 @@ public class MWithholding extends X_C_Withholding
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("C_Withholding_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_Withholding_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -167,7 +167,7 @@ public final class PP_PayFlowPro extends PaymentProcessor
while (st.hasMoreTokens()) while (st.hasMoreTokens())
{ {
String token = st.nextToken(); String token = st.nextToken();
int pos = token.indexOf("="); int pos = token.indexOf('=');
String name = token.substring(0, pos); String name = token.substring(0, pos);
String value = token.substring(pos+1); String value = token.substring(pos+1);
// //

View File

@ -235,7 +235,7 @@ public class Scriptlet
// filter // filter
if (key == null || key.length() == 0 if (key == null || key.length() == 0
|| key.startsWith("P") // Preferences || key.startsWith("P") // Preferences
|| (key.indexOf("|") != -1 && !key.startsWith(String.valueOf(WindowNo))) // other Window Settings || (key.indexOf('|') != -1 && !key.startsWith(String.valueOf(WindowNo))) // other Window Settings
) )
continue; continue;

View File

@ -88,7 +88,7 @@ public class AssetDelivery extends SvrProcess
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
// Test // Test
if (m_client.getSMTPHost() == null) if (m_client.getSMTPHost() == null || m_client.getSMTPHost().length() == 0)
throw new Exception ("No Client SMTP Info"); throw new Exception ("No Client SMTP Info");
if (m_client.getRequestEMail() == null) if (m_client.getRequestEMail() == null)
throw new Exception ("No Client Request User"); throw new Exception ("No Client Request User");

View File

@ -100,7 +100,7 @@ public class ImportBPartner extends SvrProcess
// Set BP_Group // Set BP_Group
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuffer ("UPDATE I_BPartner i "
+ "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'" + "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'"
+ " AND g.AD_Client_ID=i.AD_Client_ID"); + " AND g.AD_Client_ID=i.AD_Client_ID) ");
sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL" sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL"
+ " AND I_IsImported<>'Y'").append(clientCheck); + " AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());

View File

@ -225,9 +225,9 @@ public class InventoryValue extends SvrProcess
// Update Prices // Update Prices
no = DB.executeUpdate ("UPDATE T_InventoryValue iv " no = DB.executeUpdate ("UPDATE T_InventoryValue iv "
+ "SET PricePO = " + "SET PricePO = "
+ "(SELECT currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID)" + "(SELECT MAX(currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID))"
+ " FROM M_Product_PO po WHERE po.M_Product_ID=iv.M_Product_ID" + " FROM M_Product_PO po WHERE po.M_Product_ID=iv.M_Product_ID"
+ " AND po.IsCurrentVendor='Y' AND RowNum=1), " + " AND po.IsCurrentVendor='Y'), "
+ "PriceList = " + "PriceList = "
+ "(SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)" + "(SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)"
+ " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp" + " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp"

View File

@ -54,7 +54,7 @@ public class PaySelectionCreateCheck extends SvrProcess
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
p_C_PaySelection_ID = getRecord_ID(); p_C_PaySelection_ID = getRecord_ID();
if (p_PaymentRule != null & p_PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit)) if (p_PaymentRule != null && p_PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit))
p_PaymentRule = null; p_PaymentRule = null;
} // prepare } // prepare

View File

@ -63,7 +63,7 @@ public class PeriodStatus extends SvrProcess
log.info ("C_Period_ID=" + p_C_Period_ID + ", PeriodAction=" + p_PeriodAction); log.info ("C_Period_ID=" + p_C_Period_ID + ", PeriodAction=" + p_PeriodAction);
MPeriod period = new MPeriod (getCtx(), p_C_Period_ID, get_TrxName()); MPeriod period = new MPeriod (getCtx(), p_C_Period_ID, get_TrxName());
if (period.get_ID() == 0) if (period.get_ID() == 0)
throw new IllegalArgumentException("@NotFound@ @C_Period_ID@=" + p_C_Period_ID); throw new AdempiereUserError("@NotFound@ @C_Period_ID@=" + p_C_Period_ID);
StringBuffer sql = new StringBuffer ("UPDATE C_PeriodControl "); StringBuffer sql = new StringBuffer ("UPDATE C_PeriodControl ");
sql.append("SET PeriodStatus='"); sql.append("SET PeriodStatus='");

View File

@ -143,7 +143,7 @@ public class TableCreateColumns extends SvrProcess
|| tn.endsWith("_V1") // views || tn.endsWith("_V1") // views
|| tn.startsWith("A_A") // asset tables not yet || tn.startsWith("A_A") // asset tables not yet
|| tn.startsWith("A_D") // asset tables not yet || tn.startsWith("A_D") // asset tables not yet
|| tn.indexOf("$") != -1 // oracle system tables || tn.indexOf('$') != -1 // oracle system tables
|| tn.indexOf("EXPLAIN") != -1 // explain plan || tn.indexOf("EXPLAIN") != -1 // explain plan
) )
{ {

View File

@ -361,7 +361,7 @@ public class FileUtil
if (name == null) if (name == null)
return false; return false;
// ignore files with ~ and this file // ignore files with ~ and this file
if (name.indexOf("~") != -1 || name.equals("FileUtil.java")) if (name.indexOf('~') != -1 || name.equals("FileUtil.java"))
return false; return false;
// //
return name.indexOf(filterString) != -1; return name.indexOf(filterString) != -1;

View File

@ -137,7 +137,7 @@ public class EnvLoader
{ {
String s = st.nextToken(); String s = st.nextToken();
// System.out.println(">" + s + "<"); // System.out.println(">" + s + "<");
int pos = s.indexOf("="); // first "=" int pos = s.indexOf('='); // first "="
if (pos > 0) if (pos > 0)
prop.setProperty(prefix + s.substring(0, pos), s.substring(pos+1)); prop.setProperty(prefix + s.substring(0, pos), s.substring(pos+1));
} }

View File

@ -130,7 +130,7 @@ public class FileUpload
// //
int formDataLength = request.getContentLength(); int formDataLength = request.getContentLength();
String contentType = request.getContentType(); String contentType = request.getContentType();
int index = contentType.lastIndexOf("="); int index = contentType.lastIndexOf('=');
String boundary = contentType.substring(index+1); String boundary = contentType.substring(index+1);
log.fine(formDataLength + " - " + boundary); log.fine(formDataLength + " - " + boundary);
int sizeKB = formDataLength/1024; int sizeKB = formDataLength/1024;

View File

@ -242,7 +242,7 @@ public final class WebUtil
outStr.append(inStr.substring(0, i)); // up to &# outStr.append(inStr.substring(0, i)); // up to &#
inStr = inStr.substring(i+2, inStr.length()); // from &# inStr = inStr.substring(i+2, inStr.length()); // from &#
int j = inStr.indexOf(";"); // next ; int j = inStr.indexOf(';'); // next ;
if (j < 0) // no second tag if (j < 0) // no second tag
{ {
inStr = "&#" + inStr; inStr = "&#" + inStr;

View File

@ -1249,12 +1249,12 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
if (variableName == null if (variableName == null
|| (variableName != null && variableName.length() == 0)) || (variableName != null && variableName.length() == 0))
value = null; value = null;
else if (variableName.indexOf("@") != -1 && m_po != null) // we have a variable else if (variableName.indexOf('@') != -1 && m_po != null) // we have a variable
{ {
// Strip // Strip
int index = variableName.indexOf("@"); int index = variableName.indexOf('@');
String columnName = variableName.substring(index+1); String columnName = variableName.substring(index+1);
index = columnName.indexOf("@"); index = columnName.indexOf('@');
if (index == -1) if (index == -1)
{ {
log.warning(nPara.getAttributeName() log.warning(nPara.getAttributeName()
@ -1486,7 +1486,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
else if (email != null && email.length() > 0) else if (email != null && email.length() > 0)
{ {
// Just one // Just one
if (email.indexOf(";") == -1) if (email.indexOf(';') == -1)
{ {
email = email.trim(); email = email.trim();
if (!m_emails.contains(email)) if (!m_emails.contains(email))

View File

@ -413,7 +413,7 @@ class AcctViewerData
rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); rm.addColumn(new RColumn(ctx, column, DisplayType.Date));
else if (column.startsWith("UserElement")) else if (column.startsWith("UserElement"))
{ {
if (column.indexOf("1") != -1) if (column.indexOf('1') != -1)
rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref1)); rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref1));
else else
rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref2)); rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref2));
@ -473,7 +473,7 @@ class AcctViewerData
String columnName = ase.getColumnName(); String columnName = ase.getColumnName();
if (columnName.startsWith("UserElement")) if (columnName.startsWith("UserElement"))
{ {
if (columnName.indexOf("1") != -1) if (columnName.indexOf('1') != -1)
m_ref1 = ase.getDisplayColumnName(); m_ref1 = ase.getDisplayColumnName();
else else
m_ref2 = ase.getDisplayColumnName(); m_ref2 = ase.getDisplayColumnName();

View File

@ -1402,7 +1402,7 @@ public final class APanel extends CPanel
String cmd = st.nextToken().trim(); String cmd = st.nextToken().trim();
Callout call = null; Callout call = null;
String method = null; String method = null;
int methodStart = cmd.lastIndexOf("."); int methodStart = cmd.lastIndexOf('.');
try try
{ {
if (methodStart != -1) // no class if (methodStart != -1) // no class
@ -2238,7 +2238,7 @@ public final class APanel extends CPanel
public String getSelectedTabName() { public String getSelectedTabName() {
String title = m_curWinTab.getTitleAt(m_curWinTab.getSelectedIndex()); String title = m_curWinTab.getTitleAt(m_curWinTab.getSelectedIndex());
title = title.substring(title.indexOf("<html>")+6); title = title.substring(title.indexOf("<html>")+6);
title = title.substring(0,title.indexOf("<")); title = title.substring(0,title.indexOf('<'));
return title; return title;
} }

View File

@ -455,7 +455,7 @@ public final class Attachment extends CDialog
return; return;
String fileName = getFileName(index); String fileName = getFileName(index);
String ext = fileName.substring (fileName.lastIndexOf(".")); String ext = fileName.substring (fileName.lastIndexOf('.'));
log.config( "Ext=" + ext); log.config( "Ext=" + ext);
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();

View File

@ -422,7 +422,7 @@ public class ProcessCtl extends Thread
{ {
String summary = m_pi.getSummary(); String summary = m_pi.getSummary();
log.finer("unlock - " + summary); log.finer("unlock - " + summary);
if (summary != null && summary.indexOf("@") != -1) if (summary != null && summary.indexOf('@') != -1)
m_pi.setSummary(Msg.parseTranslation(Env.getCtx(), summary)); m_pi.setSummary(Msg.parseTranslation(Env.getCtx(), summary));
m_parent.unlockUI(m_pi); m_parent.unlockUI(m_pi);
} }

View File

@ -42,7 +42,7 @@ public class WindowMenu extends JMenu {
private void setEnvText(JMenu menu, String msg) { private void setEnvText(JMenu menu, String msg) {
String text = Msg.getMsg(Env.getCtx(), msg); String text = Msg.getMsg(Env.getCtx(), msg);
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic if (pos != -1 && text.length() > pos) // We have a nemonic
{ {
char ch = text.toUpperCase().charAt(pos+1); char ch = text.toUpperCase().charAt(pos+1);
@ -57,7 +57,7 @@ public class WindowMenu extends JMenu {
private void setEnvText(JMenuItem menu, String msg) { private void setEnvText(JMenuItem menu, String msg) {
String text = Msg.getMsg(Env.getCtx(), msg); String text = Msg.getMsg(Env.getCtx(), msg);
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic if (pos != -1 && text.length() > pos) // We have a nemonic
{ {
char ch = text.toUpperCase().charAt(pos+1); char ch = text.toUpperCase().charAt(pos+1);

View File

@ -506,7 +506,7 @@ public class ArchiveViewer extends CTabbedPane
String ss = nameQField.getText(); String ss = nameQField.getText();
if (ss != null && ss.length() > 0) if (ss != null && ss.length() > 0)
{ {
if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1)
sql.append(" AND Name LIKE ").append(DB.TO_STRING(ss)); sql.append(" AND Name LIKE ").append(DB.TO_STRING(ss));
else else
sql.append(" AND Name=").append(DB.TO_STRING(ss)); sql.append(" AND Name=").append(DB.TO_STRING(ss));
@ -516,7 +516,7 @@ public class ArchiveViewer extends CTabbedPane
ss = descriptionQField.getText(); ss = descriptionQField.getText();
if (ss != null && ss.length() > 0) if (ss != null && ss.length() > 0)
{ {
if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1)
sql.append(" AND Description LIKE ").append(DB.TO_STRING(ss)); sql.append(" AND Description LIKE ").append(DB.TO_STRING(ss));
else else
sql.append(" AND Description=").append(DB.TO_STRING(ss)); sql.append(" AND Description=").append(DB.TO_STRING(ss));
@ -526,7 +526,7 @@ public class ArchiveViewer extends CTabbedPane
ss = helpQField.getText(); ss = helpQField.getText();
if (ss != null && ss.length() > 0) if (ss != null && ss.length() > 0)
{ {
if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1)
sql.append(" AND Help LIKE ").append(DB.TO_STRING(ss)); sql.append(" AND Help LIKE ").append(DB.TO_STRING(ss));
else else
sql.append(" AND Help=").append(DB.TO_STRING(ss)); sql.append(" AND Help=").append(DB.TO_STRING(ss));

View File

@ -623,12 +623,12 @@ public final class Find extends CDialog
// fix a bug with virtualColumn + isSelectionColumn not yielding results // fix a bug with virtualColumn + isSelectionColumn not yielding results
GridField field = getTargetMField(ColumnName); GridField field = getTargetMField(ColumnName);
String ColumnSQL = field.getColumnSQL(false); String ColumnSQL = field.getColumnSQL(false);
if (value.toString().indexOf("%") != -1) if (value.toString().indexOf('%') != -1)
m_query.addRestriction(ColumnSQL, MQuery.LIKE, value, ColumnName, ved.getDisplay()); m_query.addRestriction(ColumnSQL, MQuery.LIKE, value, ColumnName, ved.getDisplay());
else else
m_query.addRestriction(ColumnSQL, MQuery.EQUAL, value, ColumnName, ved.getDisplay()); m_query.addRestriction(ColumnSQL, MQuery.EQUAL, value, ColumnName, ved.getDisplay());
/* /*
if (value.toString().indexOf("%") != -1) if (value.toString().indexOf('%') != -1)
m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay()); m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay());
else else
m_query.addRestriction(ColumnName, MQuery.EQUAL, value, ColumnName, ved.getDisplay()); m_query.addRestriction(ColumnName, MQuery.EQUAL, value, ColumnName, ved.getDisplay());

View File

@ -125,7 +125,7 @@ public final class FindValueRenderer extends DefaultTableCellRenderer
if (value instanceof Boolean) if (value instanceof Boolean)
cb.setSelected(((Boolean)value).booleanValue()); cb.setSelected(((Boolean)value).booleanValue());
else else
cb.setSelected(value.toString().indexOf("Y") != -1); cb.setSelected(value.toString().indexOf('Y') != -1);
return cb; return cb;
} }
return c; return c;

View File

@ -223,8 +223,8 @@ public class InfoBPartner extends Info
if (value.equals("%")) if (value.equals("%"))
fieldName.setText(value); fieldName.setText(value);
// No Numbers entered // No Numbers entered
else if ((value.indexOf("0")+value.indexOf("1")+value.indexOf("2")+value.indexOf("3")+value.indexOf("4") +value.indexOf("5") else if ((value.indexOf('0')+value.indexOf('1')+value.indexOf('2')+value.indexOf('3')+value.indexOf('4') +value.indexOf('5')
+value.indexOf("6")+value.indexOf("7")+value.indexOf("8")+value.indexOf("9")) == -10) +value.indexOf('6')+value.indexOf('7')+value.indexOf('8')+value.indexOf('9')) == -10)
{ {
if (value.startsWith("%")) if (value.startsWith("%"))
fieldName.setText(value); fieldName.setText(value);

View File

@ -437,7 +437,7 @@ public final class InfoProduct extends Info implements ActionListener
{ {
for (int i = 0; i < p_layout.length; i++) for (int i = 0; i < p_layout.length; i++)
{ {
if (p_layout[i].getColSQL().indexOf("?") != -1) if (p_layout[i].getColSQL().indexOf('?') != -1)
pstmt.setInt(index++, M_Warehouse_ID); pstmt.setInt(index++, M_Warehouse_ID);
} }
} }

View File

@ -109,7 +109,7 @@ public final class VPanel extends CPanel
if (mField.isCreateMnemonic()) if (mField.isCreateMnemonic())
return; return;
String text = mField.getHeader(); String text = mField.getHeader();
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic - creates Ctrl_Shift_ if (pos != -1 && text.length() > pos) // We have a nemonic - creates Ctrl_Shift_
{ {
char mnemonic = text.toUpperCase().charAt(pos+1); char mnemonic = text.toUpperCase().charAt(pos+1);
@ -263,7 +263,7 @@ public final class VPanel extends CPanel
private void setMnemonic (CLabel label, char predefinedMnemonic) private void setMnemonic (CLabel label, char predefinedMnemonic)
{ {
String text = label.getText(); String text = label.getText();
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && predefinedMnemonic != 0) if (pos != -1 && predefinedMnemonic != 0)
{ {
text = text.substring(0, pos) + text.substring(pos+1); text = text.substring(0, pos) + text.substring(pos+1);
@ -292,7 +292,7 @@ public final class VPanel extends CPanel
{ {
VCheckBox cb = (VCheckBox)editor; VCheckBox cb = (VCheckBox)editor;
String text = cb.getText(); String text = cb.getText();
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && predefinedMnemonic != 0) if (pos != -1 && predefinedMnemonic != 0)
{ {
text = text.substring(0, pos) + text.substring(pos+1); text = text.substring(0, pos) + text.substring(pos+1);
@ -314,7 +314,7 @@ public final class VPanel extends CPanel
{ {
VButton b = (VButton)editor; VButton b = (VButton)editor;
String text = b.getText(); String text = b.getText();
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && predefinedMnemonic != 0) if (pos != -1 && predefinedMnemonic != 0)
{ {
text = text.substring(0, pos) + text.substring(pos+1); text = text.substring(0, pos) + text.substring(pos+1);

View File

@ -1157,7 +1157,7 @@ public class VPayment extends CDialog
if (error.length() != 0) if (error.length() != 0)
{ {
kNumberField.setBackground(AdempierePLAF.getFieldBackground_Error()); kNumberField.setBackground(AdempierePLAF.getFieldBackground_Error());
if (error.indexOf("?") == -1) if (error.indexOf('?') == -1)
{ {
ADialog.error(m_WindowNo, this, error); ADialog.error(m_WindowNo, this, error);
dataOK = false; dataOK = false;

View File

@ -19,7 +19,6 @@ package org.compiere.grid;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.*;
import javax.swing.*; import javax.swing.*;
import org.compiere.*;
import org.compiere.apps.*; import org.compiere.apps.*;
import org.compiere.model.*; import org.compiere.model.*;
import org.compiere.swing.*; import org.compiere.swing.*;

View File

@ -87,7 +87,7 @@ public class VBinary extends JButton
else else
{ {
text = m_data.getClass().getName(); text = m_data.getClass().getName();
int index = text.lastIndexOf("."); int index = text.lastIndexOf('.');
if (index != -1) if (index != -1)
text = text.substring(index+1); text = text.substring(index+1);
} }

View File

@ -662,8 +662,8 @@ public class VLookup extends JComponent
boolean cancelled = false; boolean cancelled = false;
// //
String col = m_lookup.getColumnName(); // fully qualified name String col = m_lookup.getColumnName(); // fully qualified name
if (col.indexOf(".") != -1) if (col.indexOf('.') != -1)
col = col.substring(col.indexOf(".")+1); col = col.substring(col.indexOf('.')+1);
// Zoom / Validation // Zoom / Validation
String whereClause = getWhereClause(); String whereClause = getWhereClause();
// //

View File

@ -871,7 +871,7 @@ public final class VTreePanel extends CPanel
{ {
// Only first word of Label // Only first word of Label
String label = nd.toString().trim(); String label = nd.toString().trim();
int space = label.indexOf(" "); int space = label.indexOf(' ');
// if (space != -1) // if (space != -1)
// label = label.substring(0, space); // label = label.substring(0, space);

View File

@ -31,7 +31,7 @@ import org.compiere.util.*;
* *
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de: * *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright © Jorg Janke * *Copyright <EFBFBD> Jorg Janke
* @version $Id: SubBPartner.java,v 1.1 2004/07/12 04:10:04 jjanke Exp $ * @version $Id: SubBPartner.java,v 1.1 2004/07/12 04:10:04 jjanke Exp $
*/ */
public class SubBPartner extends PosSubPanel public class SubBPartner extends PosSubPanel
@ -224,7 +224,7 @@ public class SubBPartner extends PosSubPanel
String Value = query; String Value = query;
String Name = (allNumber ? null : query); String Name = (allNumber ? null : query);
String Contact = (allNumber ? null : query); String Contact = (allNumber ? null : query);
String EMail = (query.indexOf("@") != -1 ? query : null); String EMail = (query.indexOf('@') != -1 ? query : null);
String Phone = (noNumber ? null : query); String Phone = (noNumber ? null : query);
String City = null; String City = null;
// //

View File

@ -32,7 +32,7 @@ import org.compiere.util.*;
* *
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de: * *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright © Jorg Janke * *Copyright <EFBFBD> Jorg Janke
* @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $ * @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $
*/ */
public class SubCurrentLine extends PosSubPanel implements ActionListener { public class SubCurrentLine extends PosSubPanel implements ActionListener {
@ -275,7 +275,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
* @return true if deleted * @return true if deleted
*/ */
public void deleteLine (int row) { public void deleteLine (int row) {
if (m_order != null & row != -1 ) if (m_order != null && row != -1 )
{ {
MOrderLine[] lineas = m_order.getLines(); MOrderLine[] lineas = m_order.getLines();
int numLineas = lineas.length; int numLineas = lineas.length;
@ -295,7 +295,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
* *
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de: * *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright © ConSerTi * *Copyright <EFBFBD> ConSerTi
*/ */
public void deleteOrder () { public void deleteOrder () {
if (m_order != null) if (m_order != null)
@ -338,7 +338,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
* *
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de: * *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright © ConSerTi * *Copyright <EFBFBD> ConSerTi
*/ */
public void newOrder() public void newOrder()
{ {
@ -394,7 +394,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
/** /**
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de: * *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright © ConSerTi * *Copyright <EFBFBD> ConSerTi
*/ */
public void setBPartner() public void setBPartner()
{ {

View File

@ -809,12 +809,12 @@ public class Viewer extends CFrame
String ext = outFile.getPath(); String ext = outFile.getPath();
// no extension // no extension
if (ext.lastIndexOf(".") == -1) if (ext.lastIndexOf('.') == -1)
{ {
ADialog.error(m_WindowNo, this, "FileInvalidExtension"); ADialog.error(m_WindowNo, this, "FileInvalidExtension");
return; return;
} }
ext = ext.substring(ext.lastIndexOf(".")+1).toLowerCase(); ext = ext.substring(ext.lastIndexOf('.')+1).toLowerCase();
log.config( "File=" + outFile.getPath() + "; Type=" + ext); log.config( "File=" + outFile.getPath() + "; Type=" + ext);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@ -858,7 +858,7 @@ public class Viewer extends CFrame
if (AD_ReportView_ID != 0) if (AD_ReportView_ID != 0)
{ {
String name = m_reportEngine.getName(); String name = m_reportEngine.getName();
int index = name.lastIndexOf("_"); int index = name.lastIndexOf('_');
if (index != -1) if (index != -1)
name = name.substring(0,index); name = name.substring(0,index);
pf = MPrintFormat.createFromReportView(m_ctx, AD_ReportView_ID, name); pf = MPrintFormat.createFromReportView(m_ctx, AD_ReportView_ID, name);

View File

@ -440,7 +440,7 @@ public class DB_Fyracle implements AdempiereDatabase {
dateString.append(myDate.substring(0, 10)); dateString.append(myDate.substring(0, 10));
dateString.append("','YYYY-MM-DD')"); dateString.append("','YYYY-MM-DD')");
} else { } else {
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut
// off // off
// miliseconds // miliseconds
dateString.append("','YYYY-MM-DD HH24:MI:SS')"); dateString.append("','YYYY-MM-DD HH24:MI:SS')");

View File

@ -434,7 +434,7 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba
} }
else else
{ {
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut off miliseconds
dateString.append("','YYYY-MM-DD HH24:MI:SS')"); dateString.append("','YYYY-MM-DD HH24:MI:SS')");
} }
return dateString.toString(); return dateString.toString();

View File

@ -325,7 +325,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
} }
else else
{ {
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut off miliseconds
dateString.append("','YYYY-MM-DD HH24:MI:SS')"); dateString.append("','YYYY-MM-DD HH24:MI:SS')");
} }
return dateString.toString(); return dateString.toString();
@ -580,7 +580,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
{ {
if (IXName == null || IXName.length()==0) if (IXName == null || IXName.length()==0)
return "0"; return "0";
if (IXName.endsWith("_KEY")) if (IXName.toUpperCase().endsWith("_KEY"))
return "1"+IXName; return "1"+IXName;
else else
return "0"; return "0";

View File

@ -244,7 +244,7 @@ public abstract class Convert
while (m.find()) while (m.find())
{ {
String group = m.group(); // SQL string String group = m.group(); // SQL string
if (group.indexOf("/") != -1) // / in string if (group.indexOf('/') != -1) // / in string
group = group.replace('/', MASK); group = group.replace('/', MASK);
if (group.indexOf('$') != -1) // Group character needs to be escaped if (group.indexOf('$') != -1) // Group character needs to be escaped
group = Util.replace(group, "$", "\\$"); group = Util.replace(group, "$", "\\$");

View File

@ -313,7 +313,7 @@ public class ConvertDialog extends CFrame implements ActionListener
// Output file name // Output file name
String fileName = file.getAbsolutePath(); String fileName = file.getAbsolutePath();
int pos = fileName.lastIndexOf("."); int pos = fileName.lastIndexOf('.');
if (pos == -1) if (pos == -1)
fileName += target; fileName += target;
else else

View File

@ -325,10 +325,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
signature.append(", "); signature.append(", ");
// name ALIAS FOR $1 // name ALIAS FOR $1
String p = parameters[i].trim(); String p = parameters[i].trim();
alias.append(p.substring(0, p.indexOf(" "))).append( alias.append(p.substring(0, p.indexOf(' '))).append(
" ALIAS FOR $").append(i + 1).append(";\n"); " ALIAS FOR $").append(i + 1).append(";\n");
// Datatape // Datatape
signature.append(p.substring(p.lastIndexOf(" ") + 1)); signature.append(p.substring(p.lastIndexOf(' ') + 1));
} }
} }
signature.append(")"); signature.append(")");
@ -358,7 +358,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
group = m.group(); group = m.group();
m.appendReplacement(sb, ""); m.appendReplacement(sb, "");
if (group.startsWith("RETURN")) if (group.startsWith("RETURN"))
sb.append("RETURNS").append(group.substring(group.indexOf(" "))); sb.append("RETURNS").append(group.substring(group.indexOf(' ')));
sb.append(" '\nDECLARE\n").append(alias); // add aliases here sb.append(" '\nDECLARE\n").append(alias); // add aliases here
// log.info("2>" + sb.toString() + "<2"); // log.info("2>" + sb.toString() + "<2");
@ -457,10 +457,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
signature.append(", "); signature.append(", ");
// name ALIAS FOR $1 // name ALIAS FOR $1
String p = parameters[i].trim(); String p = parameters[i].trim();
alias.append(p.substring(0, p.indexOf(" "))).append( alias.append(p.substring(0, p.indexOf(' '))).append(
" ALIAS FOR $").append(i + 1).append(";\n"); " ALIAS FOR $").append(i + 1).append(";\n");
// Datatape // Datatape
signature.append(p.substring(p.lastIndexOf(" ") + 1)); signature.append(p.substring(p.lastIndexOf(' ') + 1));
} }
} }
signature.append(")"); signature.append(")");
@ -490,7 +490,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
group = m.group(); group = m.group();
m.appendReplacement(sb, ""); m.appendReplacement(sb, "");
if (group.startsWith("RETURN")) if (group.startsWith("RETURN"))
sb.append("RETURNS").append(group.substring(group.indexOf(" "))); sb.append("RETURNS").append(group.substring(group.indexOf(' ')));
sb.append(" '\nDECLARE\n").append(alias); // add aliases here sb.append(" '\nDECLARE\n").append(alias); // add aliases here
// log.info("2>" + sb.toString() + "<2"); // log.info("2>" + sb.toString() + "<2");
@ -551,11 +551,11 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
// trigger Name // trigger Name
int triggerPos = stmt.toUpperCase().indexOf(" TRIGGER ") + 9; int triggerPos = stmt.toUpperCase().indexOf(" TRIGGER ") + 9;
String triggerName = stmt.substring(triggerPos); String triggerName = stmt.substring(triggerPos);
triggerName = triggerName.substring(0, triggerName.indexOf(" ")); triggerName = triggerName.substring(0, triggerName.indexOf(' '));
// table name // table name
String tableName = stmt String tableName = stmt
.substring(stmt.toUpperCase().indexOf(" ON ") + 4); .substring(stmt.toUpperCase().indexOf(" ON ") + 4);
tableName = tableName.substring(0, tableName.indexOf(" ")); tableName = tableName.substring(0, tableName.indexOf(' '));
// Function Drop // Function Drop
if (orReplacePos != -1) { if (orReplacePos != -1) {
@ -692,7 +692,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
while (m.find()) { while (m.find()) {
String group = m.group(); String group = m.group();
// System.out.print("-> " + group); // System.out.print("-> " + group);
int pos = group.indexOf("."); int pos = group.indexOf('.');
String seqName = group.substring(0, pos); String seqName = group.substring(0, pos);
String funcName = group.substring(pos + 1); String funcName = group.substring(pos + 1);
group = funcName + "('" + seqName + "')"; group = funcName + "('" + seqName + "')";
@ -1062,21 +1062,21 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
{ {
select = sqlStatement.substring(charIndex - currentToken.length()); select = sqlStatement.substring(charIndex - currentToken.length());
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
else if (")=".equals(previousToken)) else if (")=".equals(previousToken))
{ {
select = sqlStatement.substring(charIndex - currentToken.length()); select = sqlStatement.substring(charIndex - currentToken.length());
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
else if (previousToken != null && previousToken.endsWith(")=")) else if (previousToken != null && previousToken.endsWith(")="))
{ {
select = sqlStatement.substring(charIndex - currentToken.length()); select = sqlStatement.substring(charIndex - currentToken.length());
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
@ -1085,14 +1085,14 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
{ {
select = sqlStatement.substring(charIndex - 1); select = sqlStatement.substring(charIndex - 1);
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
else if (currentToken.endsWith(")=(SELECT")) else if (currentToken.endsWith(")=(SELECT"))
{ {
select = sqlStatement.substring(charIndex - 7); select = sqlStatement.substring(charIndex - 7);
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
else if ("=(".equals(currentToken) || (currentToken != null && currentToken.startsWith("=("))) else if ("=(".equals(currentToken) || (currentToken != null && currentToken.startsWith("=(")))
@ -1101,7 +1101,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
{ {
select = sqlStatement.substring(charIndex - currentToken.length()); select = sqlStatement.substring(charIndex - currentToken.length());
updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex);
updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); updateFields = updateFields.substring(0, updateFields.lastIndexOf(')'));
break; break;
} }
} }
@ -1119,7 +1119,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
updateFields = updateFields.substring(1); updateFields = updateFields.substring(1);
int subQueryEnd = 0; int subQueryEnd = 0;
int subQueryStart = select.indexOf("("); int subQueryStart = select.indexOf('(');
String subWhere = null; String subWhere = null;
int open = -1; int open = -1;
for (int i = subQueryStart; i < select.length(); i++) { for (int i = subQueryStart; i < select.length(); i++) {
@ -1244,7 +1244,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
if (f < 0) { if (f < 0) {
updateField = updateFields; updateField = updateFields;
joinField = joinFields.trim(); joinField = joinFields.trim();
if (joinField.indexOf(".") < 0 && isIdentifier(joinField)) { if (joinField.indexOf('.') < 0 && isIdentifier(joinField)) {
joinField = joinAlias + "." + joinField; joinField = joinAlias + "." + joinField;
} }
@ -1292,7 +1292,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
// fieldsjoin.indexOf(','); // fieldsjoin.indexOf(',');
joinField = joinFields.substring(0, fj).trim(); joinField = joinFields.substring(0, fj).trim();
if (joinField.indexOf(".") < 0 && isIdentifier(joinField)) { if (joinField.indexOf('.') < 0 && isIdentifier(joinField)) {
joinField = joinAlias + "." + joinField; joinField = joinAlias + "." + joinField;
} }
Update.append(updateField.trim()); Update.append(updateField.trim());
@ -1365,7 +1365,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
if (c == '(') if (c == '(')
result = result + t.toString(); result = result + t.toString();
else if (isIdentifier(t.toString()) && else if (isIdentifier(t.toString()) &&
t.toString().indexOf(".") == -1) t.toString().indexOf('.') == -1)
result = result + alias + "." + t.toString(); result = result + alias + "." + t.toString();
else else
result = result + t.toString(); result = result + t.toString();
@ -1381,7 +1381,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
if (t.length() > 0) if (t.length() > 0)
{ {
if (isIdentifier(t.toString()) && if (isIdentifier(t.toString()) &&
t.toString().indexOf(".") == -1) t.toString().indexOf('.') == -1)
result = result + alias + "." + t.toString(); result = result + alias + "." + t.toString();
else else
result = result + t.toString(); result = result + t.toString();
@ -1572,10 +1572,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
if ("VALUES".equalsIgnoreCase(tokens[3]) || if ("VALUES".equalsIgnoreCase(tokens[3]) ||
"SELECT".equalsIgnoreCase(tokens[3])) "SELECT".equalsIgnoreCase(tokens[3]))
return sqlStatement; return sqlStatement;
if (tokens[2].indexOf("(") > 0) if (tokens[2].indexOf('(') > 0)
return sqlStatement; return sqlStatement;
else if ((tokens[3].indexOf("(") < 0) || else if ((tokens[3].indexOf('(') < 0) ||
tokens[3].indexOf("(") > 0) { tokens[3].indexOf('(') > 0) {
table = tokens[2]; table = tokens[2];
alias = tokens[3]; alias = tokens[3];
} else { } else {
@ -1588,7 +1588,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
alias = tokens[3]; alias = tokens[3];
} }
if (table != null && alias != null ) { if (table != null && alias != null ) {
if (alias.indexOf("(") > 0) alias = alias.substring(0, alias.indexOf("(")); if (alias.indexOf('(') > 0) alias = alias.substring(0, alias.indexOf('('));
String converted = sqlStatement.replaceFirst("\\s"+alias+"\\s", " "); String converted = sqlStatement.replaceFirst("\\s"+alias+"\\s", " ");
converted = converted.replaceAll("\\b"+alias+"\\.", table+"."); converted = converted.replaceAll("\\b"+alias+"\\.", table+".");
return converted; return converted;
@ -1636,7 +1636,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
if (begin_col != -1) { if (begin_col != -1) {
column = sqlStatement.substring(begin_col); column = sqlStatement.substring(begin_col);
end_col = begin_col + column.indexOf(" "); end_col = begin_col + column.indexOf(' ');
column = sqlStatement.substring(begin_col, end_col); column = sqlStatement.substring(begin_col, end_col);
// System.out.println(" column:" + column + " begincolumn:" + // System.out.println(" column:" + column + " begincolumn:" +
// begin_col + "en column:" + end_col ); // begin_col + "en column:" + end_col );
@ -1644,7 +1644,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
// + 1)); // + 1));
type = sqlStatement.substring(end_col + 1) + " "; type = sqlStatement.substring(end_col + 1) + " ";
// System.out.println(" type 1 :" + type); // System.out.println(" type 1 :" + type);
type = type.substring(0, type.indexOf(" ")); type = type.substring(0, type.indexOf(' '));
// System.out.println(" type:" + type); // System.out.println(" type:" + type);
if (action.equals(" ADD ")) if (action.equals(" ADD "))
DDL = sqlStatement DDL = sqlStatement
@ -1663,11 +1663,11 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
begin_default = sqlStatement.toUpperCase().indexOf( begin_default = sqlStatement.toUpperCase().indexOf(
" DEFAULT ") + 9; " DEFAULT ") + 9;
defaultvalue = sqlStatement.substring(begin_default); defaultvalue = sqlStatement.substring(begin_default);
int nextspace = defaultvalue.indexOf(" "); int nextspace = defaultvalue.indexOf(' ');
String rest = null; String rest = null;
if (nextspace > -1) { if (nextspace > -1) {
rest = defaultvalue.substring(nextspace); rest = defaultvalue.substring(nextspace);
defaultvalue = defaultvalue.substring(0, defaultvalue.indexOf(" ")); defaultvalue = defaultvalue.substring(0, defaultvalue.indexOf(' '));
} }
if (defaultvalue.equalsIgnoreCase("NULL")) { if (defaultvalue.equalsIgnoreCase("NULL")) {

View File

@ -302,7 +302,7 @@ public class MColumn extends X_AD_Column
String defaultValue = getDefaultValue(); String defaultValue = getDefaultValue();
if (defaultValue != null if (defaultValue != null
&& defaultValue.length() > 0 && defaultValue.length() > 0
&& defaultValue.indexOf("@") == -1) // no variables && defaultValue.indexOf('@') == -1) // no variables
{ {
if (DisplayType.isText(getAD_Reference_ID()) if (DisplayType.isText(getAD_Reference_ID())
|| getAD_Reference_ID() == DisplayType.List || getAD_Reference_ID() == DisplayType.List
@ -346,7 +346,7 @@ public class MColumn extends X_AD_Column
String defaultValue = getDefaultValue(); String defaultValue = getDefaultValue();
if (defaultValue != null if (defaultValue != null
&& defaultValue.length() > 0 && defaultValue.length() > 0
&& defaultValue.indexOf("@") == -1) // no variables && defaultValue.indexOf('@') == -1) // no variables
{ {
if (DisplayType.isText(getAD_Reference_ID()) if (DisplayType.isText(getAD_Reference_ID())
|| getAD_Reference_ID() == DisplayType.List || getAD_Reference_ID() == DisplayType.List

View File

@ -319,7 +319,7 @@ public final class MCountry extends X_C_Country
while (st.hasMoreTokens()) while (st.hasMoreTokens())
{ {
String s = st.nextToken().trim(); String s = st.nextToken().trim();
int pos = s.indexOf(";"); int pos = s.indexOf(';');
String name = Util.initCap(s.substring(0,pos)); String name = Util.initCap(s.substring(0,pos));
String cc = s.substring(pos+1); String cc = s.substring(pos+1);
System.out.println(cc + " - " + name); System.out.println(cc + " - " + name);

View File

@ -481,7 +481,7 @@ public class MIssue extends X_AD_Issue
String pair = st.nextToken(); String pair = st.nextToken();
try try
{ {
int index = pair.indexOf("="); int index = pair.indexOf('=');
if (pair.startsWith("RECORDID=")) if (pair.startsWith("RECORDID="))
{ {
String info = pair.substring(index+1); String info = pair.substring(index+1);

View File

@ -401,13 +401,13 @@ public class MLocation extends X_C_Location implements Comparator
StringBuffer outStr = new StringBuffer(); StringBuffer outStr = new StringBuffer();
String token; String token;
int i = inStr.indexOf("@"); int i = inStr.indexOf('@');
while (i != -1) while (i != -1)
{ {
outStr.append (inStr.substring(0, i)); // up to @ outStr.append (inStr.substring(0, i)); // up to @
inStr = inStr.substring(i+1, inStr.length()); // from first @ inStr = inStr.substring(i+1, inStr.length()); // from first @
int j = inStr.indexOf("@"); // next @ int j = inStr.indexOf('@'); // next @
if (j < 0) if (j < 0)
{ {
token = ""; // no second tag token = ""; // no second tag
@ -443,7 +443,7 @@ public class MLocation extends X_C_Location implements Comparator
outStr.append("@").append(token).append("@"); outStr.append("@").append(token).append("@");
inStr = inStr.substring(j+1, inStr.length()); // from second @ inStr = inStr.substring(j+1, inStr.length()); // from second @
i = inStr.indexOf("@"); i = inStr.indexOf('@');
} }
outStr.append(inStr); // add the rest of the string outStr.append(inStr); // add the rest of the string

View File

@ -184,7 +184,7 @@ public class MLookupFactory
info.ValidationCode = ""; info.ValidationCode = "";
// Variables in SQL WHERE // Variables in SQL WHERE
if (info.Query.indexOf("@") != -1) if (info.Query.indexOf('@') != -1)
{ {
// String newSQL = Env.parseContext(ctx, WindowNo, info.Query, false); // String newSQL = Env.parseContext(ctx, WindowNo, info.Query, false);
String newSQL = Env.parseContext(ctx, 0, info.Query, false); // only global String newSQL = Env.parseContext(ctx, 0, info.Query, false); // only global
@ -416,7 +416,7 @@ public class MLookupFactory
if (WhereClause != null) if (WhereClause != null)
{ {
String where = WhereClause; String where = WhereClause;
if (where.indexOf("@") != -1) if (where.indexOf('@') != -1)
where = Env.parseContext(ctx, WindowNo, where, false); where = Env.parseContext(ctx, WindowNo, where, false);
if (where.length() == 0 && WhereClause.length() != 0) if (where.length() == 0 && WhereClause.length() != 0)
s_log.severe ("Could not resolve: " + WhereClause); s_log.severe ("Could not resolve: " + WhereClause);
@ -425,7 +425,7 @@ public class MLookupFactory
if (where.length() != 0) if (where.length() != 0)
{ {
realSQL.append(" WHERE ").append(where); realSQL.append(" WHERE ").append(where);
if (where.indexOf(".") == -1) if (where.indexOf('.') == -1)
s_log.log(Level.SEVERE, "getLookup_Table - " + TableName s_log.log(Level.SEVERE, "getLookup_Table - " + TableName
+ ": WHERE should be fully qualified: " + WhereClause); + ": WHERE should be fully qualified: " + WhereClause);
zoomQuery = new MQuery (TableName); zoomQuery = new MQuery (TableName);
@ -437,7 +437,7 @@ public class MLookupFactory
if (OrderByClause != null) if (OrderByClause != null)
{ {
realSQL.append(" ORDER BY ").append(OrderByClause); realSQL.append(" ORDER BY ").append(OrderByClause);
if (OrderByClause.indexOf(".") == -1) if (OrderByClause.indexOf('.') == -1)
s_log.log(Level.SEVERE, "getLookup_Table - " + TableName s_log.log(Level.SEVERE, "getLookup_Table - " + TableName
+ ": ORDER BY must fully qualified: " + OrderByClause); + ": ORDER BY must fully qualified: " + OrderByClause);
} }

View File

@ -136,7 +136,7 @@ public class MQuery implements Serializable
{ {
if (P_String_To == null) if (P_String_To == null)
{ {
if (P_String.indexOf("%") == -1) if (P_String.indexOf('%') == -1)
query.addRestriction(ParameterName, MQuery.EQUAL, query.addRestriction(ParameterName, MQuery.EQUAL,
P_String, Name, Info); P_String, Name, Info);
else else

View File

@ -1874,7 +1874,7 @@ public final class MRole extends X_AD_Role
{ {
String userLevel = getUserLevel(); // Format 'SCO' String userLevel = getUserLevel(); // Format 'SCO'
if (userLevel.indexOf("S") != -1) // System cannot change anything if (userLevel.indexOf('S') != -1) // System cannot change anything
return true; return true;
boolean retValue = true; boolean retValue = true;

View File

@ -255,7 +255,8 @@ public class MSequence extends X_AD_Sequence
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID " selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID "
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE Name=?" + "WHERE Name=?"
+ " AND AD_Client_ID IN (0,?)" //jz fix duplicated nextID + " AND AD_Client_ID IN (0,?)"
+ " AND AD_Client_ID = ?"
+ " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' "
+ "ORDER BY AD_Client_ID DESC " + "ORDER BY AD_Client_ID DESC "
+ " FOR UPDATE OF AD_Sequence "; + " FOR UPDATE OF AD_Sequence ";
@ -268,7 +269,8 @@ public class MSequence extends X_AD_Sequence
//end vpj-cd e-evolution 09/02/2005 PostgreSQL //end vpj-cd e-evolution 09/02/2005 PostgreSQL
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE Name=?" + "WHERE Name=?"
+ " AND AD_Client_ID IN (0,?)" //jz fix duplicated nextID + " AND AD_Client_ID IN (0,?)"
+ " AND AD_Client_ID = ?"
+ " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' "
+ " ORDER BY AD_Client_ID DESC "; + " ORDER BY AD_Client_ID DESC ";
USE_PROCEDURE = true; USE_PROCEDURE = true;

View File

@ -218,7 +218,7 @@ public class MWarehouse extends X_M_Warehouse
*/ */
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
if (newRecord & success) if (newRecord && success)
insert_Accounting("M_Warehouse_Acct", "C_AcctSchema_Default", null); insert_Accounting("M_Warehouse_Acct", "C_AcctSchema_Default", null);
return success; return success;

View File

@ -1975,7 +1975,7 @@ public abstract class PO
{ {
lobAdd (value, i, dt); lobAdd (value, i, dt);
// If no changes set UpdatedBy explicitly to ensure commit of lob // If no changes set UpdatedBy explicitly to ensure commit of lob
if (!changes & !updatedBy) if (!changes && !updatedBy)
{ {
int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID"); int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID");
set_ValueNoCheck("UpdatedBy", new Integer(AD_User_ID)); set_ValueNoCheck("UpdatedBy", new Integer(AD_User_ID));

View File

@ -238,11 +238,11 @@ public class Evaluator
// log.fine( "MField.parseDepends", parseString); // log.fine( "MField.parseDepends", parseString);
String s = parseString; String s = parseString;
// while we have variables // while we have variables
while (s.indexOf("@") != -1) while (s.indexOf('@') != -1)
{ {
int pos = s.indexOf("@"); int pos = s.indexOf('@');
s = s.substring(pos+1); s = s.substring(pos+1);
pos = s.indexOf("@"); pos = s.indexOf('@');
if (pos == -1) if (pos == -1)
continue; // error number of @@ not correct continue; // error number of @@ not correct
String variable = s.substring(0, pos); String variable = s.substring(0, pos);

View File

@ -630,13 +630,13 @@ public final class Msg
String token; String token;
StringBuffer outStr = new StringBuffer(); StringBuffer outStr = new StringBuffer();
int i = inStr.indexOf("@"); int i = inStr.indexOf('@');
while (i != -1) while (i != -1)
{ {
outStr.append(inStr.substring(0, i)); // up to @ outStr.append(inStr.substring(0, i)); // up to @
inStr = inStr.substring(i+1, inStr.length()); // from first @ inStr = inStr.substring(i+1, inStr.length()); // from first @
int j = inStr.indexOf("@"); // next @ int j = inStr.indexOf('@'); // next @
if (j < 0) // no second tag if (j < 0) // no second tag
{ {
inStr = "@" + inStr; inStr = "@" + inStr;
@ -647,7 +647,7 @@ public final class Msg
outStr.append(translate(ctx, token)); // replace context outStr.append(translate(ctx, token)); // replace context
inStr = inStr.substring(j+1, inStr.length()); // from second @ inStr = inStr.substring(j+1, inStr.length()); // from second @
i = inStr.indexOf("@"); i = inStr.indexOf('@');
} }
outStr.append(inStr); // add remainder outStr.append(inStr); // add remainder

View File

@ -243,7 +243,7 @@ public class ConfigOracle extends Config
{ {
if (line.length() > 0 if (line.length() > 0
&& Character.isLetter(line.charAt(0)) // no # ( && Character.isLetter(line.charAt(0)) // no # (
&& line.indexOf("=") != -1 && line.indexOf('=') != -1
&& line.indexOf("EXTPROC_") == -1 && line.indexOf("EXTPROC_") == -1
&& line.indexOf("_HTTP") == -1) && line.indexOf("_HTTP") == -1)
{ {

View File

@ -353,7 +353,7 @@ public class KeyStoreMgt
*/ */
public static String escapeCommas(String in) public static String escapeCommas(String in)
{ {
if (in == null || in.indexOf(",") == -1) if (in == null || in.indexOf(',') == -1)
return in; return in;
StringBuffer out = new StringBuffer(); StringBuffer out = new StringBuffer();
char[] chars = in.toCharArray(); char[] chars = in.toCharArray();

View File

@ -960,7 +960,7 @@ public class CompiereColor implements Serializable
m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")), m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")),
new ColorUIResource(m_secondaryColor)); new ColorUIResource(m_secondaryColor));
m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance="))); m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance=")));
setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]"))); setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf(']')));
} }
else if (str.indexOf("[Line ") != -1) else if (str.indexOf("[Line ") != -1)
{ {
@ -970,7 +970,7 @@ public class CompiereColor implements Serializable
m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")), m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")),
new ColorUIResource(m_secondaryColor)); new ColorUIResource(m_secondaryColor));
setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance="))); setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance=")));
setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]"))); setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf(']')));
} }
else if (str.indexOf("[Texture ") != -1) else if (str.indexOf("[Texture ") != -1)
{ {
@ -978,7 +978,7 @@ public class CompiereColor implements Serializable
setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint="))); setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint=")));
m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")), m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")),
new ColorUIResource(m_primaryColor)); new ColorUIResource(m_primaryColor));
setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]"))); setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf(']')));
} }
} // parseString } // parseString

View File

@ -804,7 +804,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
calculate = false; calculate = false;
// No spaces in title // No spaces in title
String title = tabPane.getTitleAt(tabIndex); String title = tabPane.getTitleAt(tabIndex);
int pos = title.indexOf(" "); int pos = title.indexOf(' ');
if (calculate && pos == -1) if (calculate && pos == -1)
calculate = false; calculate = false;
if (!calculate) if (!calculate)
@ -839,7 +839,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
calculate = false; calculate = false;
// No spaces in title // No spaces in title
String title = tabPane.getTitleAt(tabIndex); String title = tabPane.getTitleAt(tabIndex);
int pos = title.indexOf(" "); int pos = title.indexOf(' ');
if (calculate && pos == -1) if (calculate && pos == -1)
calculate = false; calculate = false;
if (!calculate) if (!calculate)

View File

@ -229,7 +229,7 @@ public class CButton extends JButton implements CEditor
super.setText(text); super.setText(text);
return; return;
} }
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic - creates ALT-_ if (pos != -1) // We have a nemonic - creates ALT-_
{ {
int mnemonic = text.toUpperCase().charAt(pos+1); int mnemonic = text.toUpperCase().charAt(pos+1);
@ -255,7 +255,7 @@ public class CButton extends JButton implements CEditor
super.setText(text); super.setText(text);
return; return;
} }
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic - creates ALT-_ if (pos != -1) // We have a nemonic - creates ALT-_
{ {
int mnemonic = text.toUpperCase().charAt(pos+1); int mnemonic = text.toUpperCase().charAt(pos+1);

View File

@ -281,7 +281,7 @@ public class CCheckBox extends JCheckBox implements CEditor
{ {
if (text == null) if (text == null)
return text; return text;
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic if (pos != -1) // We have a nemonic
{ {
char ch = text.charAt(pos+1); char ch = text.charAt(pos+1);

View File

@ -73,7 +73,7 @@ public class CCheckBoxMenuItem extends JCheckBoxMenuItem
super.setText(text); super.setText(text);
return; return;
} }
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_
{ {
int mnemonic = text.toUpperCase().charAt(pos+1); int mnemonic = text.toUpperCase().charAt(pos+1);

View File

@ -221,7 +221,7 @@ public class CDialog extends JDialog
{ {
if (title != null) if (title != null)
{ {
int pos = title.indexOf("&"); int pos = title.indexOf('&');
if (pos != -1 && title.length() > pos) // We have a nemonic if (pos != -1 && title.length() > pos) // We have a nemonic
{ {
int mnemonic = title.toUpperCase().charAt(pos+1); int mnemonic = title.toUpperCase().charAt(pos+1);

View File

@ -96,7 +96,7 @@ public class CFrame extends JFrame
{ {
if (title != null) if (title != null)
{ {
int pos = title.indexOf("&"); int pos = title.indexOf('&');
if (pos != -1 && title.length() > pos) // We have a nemonic if (pos != -1 && title.length() > pos) // We have a nemonic
{ {
int mnemonic = title.toUpperCase().charAt(pos+1); int mnemonic = title.toUpperCase().charAt(pos+1);

View File

@ -227,7 +227,7 @@ public class CLabel extends JLabel
{ {
if (text == null) if (text == null)
return text; return text;
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1) // We have a nemonic if (pos != -1) // We have a nemonic
{ {
char ch = text.charAt(pos+1); char ch = text.charAt(pos+1);

View File

@ -68,7 +68,7 @@ public class CMenuItem extends JMenuItem
super.setText(text); super.setText(text);
return; return;
} }
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_
{ {
int mnemonic = text.toUpperCase().charAt(pos+1); int mnemonic = text.toUpperCase().charAt(pos+1);

View File

@ -178,7 +178,7 @@ public class CTabbedPane extends JTabbedPane
String title = text; String title = text;
if (!title.startsWith("<html>")) if (!title.startsWith("<html>"))
{ {
int pos = title.indexOf("&"); int pos = title.indexOf('&');
if (pos != -1) if (pos != -1)
title = title.substring(0, pos) + title.substring(pos+1); title = title.substring(0, pos) + title.substring(pos+1);
} }
@ -229,7 +229,7 @@ public class CTabbedPane extends JTabbedPane
String title = text; String title = text;
if (!title.startsWith("<html>")) if (!title.startsWith("<html>"))
{ {
int pos = title.indexOf("&"); int pos = title.indexOf('&');
if (pos != -1) // We have a nemonic - creates ALT-_ if (pos != -1) // We have a nemonic - creates ALT-_
title = title.substring(0, pos) + title.substring(pos+1); title = title.substring(0, pos) + title.substring(pos+1);
} }
@ -256,7 +256,7 @@ public class CTabbedPane extends JTabbedPane
// //
if (!text.startsWith("<html>")) if (!text.startsWith("<html>"))
{ {
int pos = text.indexOf("&"); int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_
{ {
keyCode = text.toUpperCase().charAt(pos+1); keyCode = text.toUpperCase().charAt(pos+1);

View File

@ -63,11 +63,11 @@ public final class ThemeUtils {
int b = 0; int b = 0;
int a = 255; int a = 255;
if (information.indexOf("a=") == -1) if (information.indexOf("a=") == -1)
b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf("]"))); b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(']')));
else else
{ {
b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a="))); b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a=")));
a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf("]"))); a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf(']')));
} }
ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a)); ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a));
// System.out.println(" - " + retValue.toString()); // System.out.println(" - " + retValue.toString());
@ -107,7 +107,7 @@ public final class ThemeUtils {
style = Font.ITALIC; style = Font.ITALIC;
else if (s.equals("bolditalic")) else if (s.equals("bolditalic"))
style = Font.BOLD | Font.ITALIC; style = Font.BOLD | Font.ITALIC;
int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf("]"))); int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf(']')));
FontUIResource retValue = new FontUIResource(name,style,size); FontUIResource retValue = new FontUIResource(name,style,size);
// System.out.println(" - " + retValue.toString()); // System.out.println(" - " + retValue.toString());
return retValue; return retValue;

View File

@ -615,7 +615,7 @@ public final class Ini implements Serializable
String value = (String)s_prop.get(key); String value = (String)s_prop.get(key);
if (value == null || value.length() == 0) if (value == null || value.length() == 0)
return null; return null;
int index = value.indexOf("|"); int index = value.indexOf('|');
if (index == -1) if (index == -1)
return null; return null;
try try
@ -658,7 +658,7 @@ public final class Ini implements Serializable
String value = (String)s_prop.get(key); String value = (String)s_prop.get(key);
if (value == null || value.length() == 0) if (value == null || value.length() == 0)
return null; return null;
int index = value.indexOf("|"); int index = value.indexOf('|');
if (index == -1) if (index == -1)
return null; return null;
try try

View File

@ -1502,7 +1502,7 @@ public class DBDifference {
continue; continue;
} }
String value = data2.getValueForColumn(columns2.get(m).getColumnName()); String value = data2.getValueForColumn(columns2.get(m).getColumnName());
if (value != null && value.indexOf("'") != -1) { if (value != null && value.indexOf(''') != -1) {
value = value.replaceAll("'", "''"); value = value.replaceAll("'", "''");
} }
if (and) { if (and) {
@ -1721,8 +1721,8 @@ public class DBDifference {
+ data2.getValueForColumn(columnName).replaceAll("'", "''") + "'"; + data2.getValueForColumn(columnName).replaceAll("'", "''") + "'";
} else if (type.equals("DATE")) { } else if (type.equals("DATE")) {
String date = data2.getValueForColumn(columnName); String date = data2.getValueForColumn(columnName);
if (date.indexOf(" ") != -1) { if (date.indexOf(' ') != -1) {
date = date.substring(0, date.indexOf(" ")); date = date.substring(0, date.indexOf(' '));
} }
insertStatement += "to_date('" + date + "','" + TIME_FORMAT + "')"; insertStatement += "to_date('" + date + "','" + TIME_FORMAT + "')";
} else if (type.equals("NUMBER")) { } else if (type.equals("NUMBER")) {

View File

@ -455,7 +455,7 @@ public class DataEngine
// -- Standard Column -- // -- Standard Column --
else else
{ {
int index = FunctionColumn.indexOf("@"); int index = FunctionColumn.indexOf('@');
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (ColumnSQL != null && ColumnSQL.length() > 0) if (ColumnSQL != null && ColumnSQL.length() > 0)
{ {

View File

@ -1024,6 +1024,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
*/ */
public static ReportEngine get (Properties ctx, int type, int Record_ID) public static ReportEngine get (Properties ctx, int type, int Record_ID)
{ {
if (Record_ID < 1)
{
log.log(Level.WARNING, "No PrintFormat for Record_ID=" + Record_ID
+ ", Type=" + type);
return null;
}
// Order - Print Shipment or Invoice // Order - Print Shipment or Invoice
if (type == ORDER) if (type == ORDER)
{ {
@ -1100,10 +1106,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
+ " c.IsMultiLingualDocument, COALESCE(dt.DocumentCopies,0) " + " c.IsMultiLingualDocument, COALESCE(dt.DocumentCopies,0) "
+ "FROM M_Movement d" + "FROM M_Movement d"
+ " INNER JOIN AD_Client c ON (d.AD_Client_ID=c.AD_Client_ID)" + " INNER JOIN AD_Client c ON (d.AD_Client_ID=c.AD_Client_ID)"
+ " INNER JOIN AD_PrintForm pf ON (c.AD_Client_ID=pf.AD_Client_ID)" + " INNER JOIN AD_PrintForm pf ON (d.AD_Client_ID=pf.AD_Client_ID OR pf.AD_Client_ID=0)"
+ " LEFT OUTER JOIN C_DocType dt ON (d.C_DocType_ID=dt.C_DocType_ID) " + " LEFT OUTER JOIN C_DocType dt ON (d.C_DocType_ID=dt.C_DocType_ID) "
+ "WHERE d.M_Movement_ID=?" // info from PrintForm + "WHERE d.M_Movement_ID=?" // info from PrintForm
+ " AND pf.AD_Org_ID IN (0,d.AD_Org_ID) ORDER BY pf.AD_Org_ID DESC"; + " AND pf.AD_Org_ID IN (0,d.AD_Org_ID) AND pf.Movement_PrintFormat_ID IS NOT NULL "
+ "ORDER BY pf.AD_Client_ID DESC, pf.AD_Org_ID DESC";
else // Get PrintFormat from Org or 0 of document client else // Get PrintFormat from Org or 0 of document client
sql = "SELECT pf.Order_PrintFormat_ID,pf.Shipment_PrintFormat_ID," // 1..2 sql = "SELECT pf.Order_PrintFormat_ID,pf.Shipment_PrintFormat_ID," // 1..2
// Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see InvoicePrint // Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see InvoicePrint
@ -1148,8 +1155,9 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
else if (type == MOVEMENT) { else if (type == MOVEMENT) {
AD_PrintFormat_ID = rs.getInt(1); AD_PrintFormat_ID = rs.getInt(1);
log.fine("PF 2 ="+AD_PrintFormat_ID); copies = rs.getInt(3);
//TODO VHARCQ SQL needs change for copies VHARCQ= rs.getInt(8); if (copies == 0)
copies = 1;
} }
else else
{ {

View File

@ -19,7 +19,6 @@ package org.compiere.wstore;
import java.util.*; import java.util.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import org.compiere.model.*;
import org.compiere.util.*; import org.compiere.util.*;
/** /**

View File

@ -16,37 +16,16 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.wstore; package org.compiere.wstore;
import org.compiere.util.CLogger; import java.io.*;
import org.compiere.util.DB; import java.sql.*;
import org.compiere.util.Env; import java.util.*;
import org.compiere.util.WebEnv;
import org.compiere.util.WebSessionCtx;
import org.compiere.util.Util;
import org.compiere.util.WebUtil;
import org.compiere.model.MBPartner;
import org.compiere.model.MClient;
import org.compiere.model.MOrg;
import org.compiere.model.MWarehouse;
import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
import org.apache.ecs.xhtml.option;
import org.apache.log4j.lf5.LogLevel;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.RequestDispatcher;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import sun.rmi.runtime.Log; import javax.servlet.*;
import javax.servlet.http.*;
import org.compiere.model.*;
import org.compiere.util.*;
/** /**
* Location Servlet * Location Servlet

View File

@ -20,7 +20,6 @@ import java.math.*;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.util.logging.*; import java.util.logging.*;
import org.apache.taglibs.standard.lang.jstl.*;
import org.compiere.model.*; import org.compiere.model.*;
import org.compiere.util.*; import org.compiere.util.*;

View File

@ -464,13 +464,13 @@ public class EMailProcessor
if (index != -1) if (index != -1)
{ {
String finalRecipient = deliveryMessage.substring(index); String finalRecipient = deliveryMessage.substring(index);
int atIndex = finalRecipient.indexOf("@"); int atIndex = finalRecipient.indexOf('@');
if (atIndex != -1) if (atIndex != -1)
{ {
index = finalRecipient.lastIndexOf(' ', atIndex); index = finalRecipient.lastIndexOf(' ', atIndex);
if (index != -1) if (index != -1)
finalRecipient = finalRecipient.substring(index+1); finalRecipient = finalRecipient.substring(index+1);
atIndex = finalRecipient.indexOf("@"); atIndex = finalRecipient.indexOf('@');
if (atIndex != -1) if (atIndex != -1)
index = finalRecipient.indexOf(' ', atIndex); index = finalRecipient.indexOf(' ', atIndex);
if (index != -1) if (index != -1)

View File

@ -193,12 +193,12 @@ public class Scheduler extends AdempiereServer
if (variable == null if (variable == null
|| (variable != null && variable.length() == 0)) || (variable != null && variable.length() == 0))
value = null; value = null;
else if (variable.indexOf("@") != -1) // we have a variable else if (variable.indexOf('@') != -1) // we have a variable
{ {
// Strip // Strip
int index = variable.indexOf("@"); int index = variable.indexOf('@');
String columnName = variable.substring(index+1); String columnName = variable.substring(index+1);
index = columnName.indexOf("@"); index = columnName.indexOf('@');
if (index == -1) if (index == -1)
{ {
log.warning(sPara.getColumnName() log.warning(sPara.getColumnName()

View File

@ -206,7 +206,7 @@ public class AdempiereMonitor extends HttpServlet
String msg = (start ? "Started" : "Stopped") + ": "; String msg = (start ? "Started" : "Stopped") + ": ";
m_message.addElement(new strong(msg)); m_message.addElement(new strong(msg));
// //
String serverID = action.substring(action.indexOf("_")+1); String serverID = action.substring(action.indexOf('_')+1);
boolean ok = false; boolean ok = false;
if (serverID.equals("All")) if (serverID.equals("All"))
{ {

View File

@ -131,7 +131,7 @@ public class AdempiereMonitorFilter implements Filter
BASE64Decoder decoder = new BASE64Decoder(); BASE64Decoder decoder = new BASE64Decoder();
String namePassword = new String (decoder.decodeBuffer(userInfo)); String namePassword = new String (decoder.decodeBuffer(userInfo));
// log.fine("checkAuthorization - Name:Password=" + namePassword); // log.fine("checkAuthorization - Name:Password=" + namePassword);
int index = namePassword.indexOf(":"); int index = namePassword.indexOf(':');
String name = namePassword.substring(0, index); String name = namePassword.substring(0, index);
String password = namePassword.substring(index+1); String password = namePassword.substring(index+1);
MUser user = MUser.get(Env.getCtx(), name, password); MUser user = MUser.get(Env.getCtx(), name, password);

View File

@ -57,14 +57,14 @@ public class MediaBroadcast extends HttpServletCM
String baseURL = requestURL.substring(0,requestURL.indexOf(serverName)+serverName.length()+6)+request.getContextPath(); String baseURL = requestURL.substring(0,requestURL.indexOf(serverName)+serverName.length()+6)+request.getContextPath();
String relativeURL = requestURL.substring(baseURL.length()); String relativeURL = requestURL.substring(baseURL.length());
// If the relativeURL still contains / we will simply strip them off... // If the relativeURL still contains / we will simply strip them off...
if (relativeURL.indexOf("/")>=0) if (relativeURL.indexOf('/')>=0)
relativeURL = relativeURL.substring(relativeURL.lastIndexOf("/")+1); relativeURL = relativeURL.substring(relativeURL.lastIndexOf('/')+1);
// We should have only an ID before the first dot. // We should have only an ID before the first dot.
Integer mediaID = null; Integer mediaID = null;
try { try {
if (relativeURL.indexOf(".")>=0) { if (relativeURL.indexOf('.')>=0) {
mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf("."))); mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf('.')));
} else { } else {
mediaID = Integer.parseInt(relativeURL); mediaID = Integer.parseInt(relativeURL);
} }