Integrate bug fixing from Compiere 260b

This commit is contained in:
Carlos Ruiz 2007-02-26 05:49:54 +00:00
parent fcb4aa7057
commit 14afc561fd
18 changed files with 76 additions and 46 deletions

View File

@ -84,6 +84,7 @@ public class AdvertisementServlet extends HttpServlet
throws ServletException, IOException
{
log.info("Get from " + request.getRemoteHost() + " - " + request.getRemoteAddr() + " - forward to request.jsp");
if (!response.isCommitted ())
response.sendRedirect("advertisements.jsp");
} // doGet
@ -110,6 +111,7 @@ public class AdvertisementServlet extends HttpServlet
if (wu == null)
{
log.warning("No web user");
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=advertisement.jsp"); // entry
return;
}

View File

@ -95,6 +95,7 @@ public class Click extends HttpServlet
request.getSession(true); // force create session for ctx
//
String url = getTargetURL(request);
if (!response.isCommitted ())
response.sendRedirect(url);
response.flushBuffer();
log.fine("redirect - " + url);

View File

@ -20,7 +20,6 @@ import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.compiere.model.*;
import org.compiere.util.*;
/**
@ -105,7 +104,10 @@ public class EMailServlet extends HttpServlet
WebLogin thisLogin = new WebLogin(request, response, ctx);
thisLogin.init ();
if (!thisLogin.action ()) {
thisLogin.setMode("EMailVerify");
if (!thisLogin.action ())
{
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=" + url);
return;
}

View File

@ -85,7 +85,8 @@ public class ExpenseServlet extends HttpServlet
throws ServletException, IOException
{
log.info("Get from " + request.getRemoteHost() + " - " + request.getRemoteAddr() + " - forward to request.jsp");
response.sendRedirect("expenses.jsp");
if (!response.isCommitted ())
response.sendRedirect("expenses.jsp");
} // doGet

View File

@ -16,30 +16,13 @@
*****************************************************************************/
package org.compiere.wstore;
import org.compiere.util.CLogger;
import org.compiere.util.WebEnv;
import org.compiere.util.WebSessionCtx;
import org.compiere.util.Util;
import org.compiere.model.MLocation;
import org.compiere.model.MCountry;
import org.compiere.model.MRegion;
import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
import org.apache.ecs.xhtml.option;
import org.apache.log4j.lf5.LogLevel;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.compiere.model.*;
import org.compiere.util.*;
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.util.Properties;
import java.util.logging.Level;
import sun.rmi.runtime.Log;
/**
* Location Servlet

View File

@ -22,7 +22,6 @@ import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.apache.ecs.*;
import org.apache.ecs.xhtml.*;
import org.apache.taglibs.standard.tag.el.core.*;
import org.compiere.model.*;

View File

@ -22,8 +22,6 @@ import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.compiere.model.*;
import java.util.logging.*;
import org.compiere.util.*;
/**
@ -97,7 +95,14 @@ public class LoginServlet extends HttpServlet
org.compiere.util.WebLogin thisLogin = new org.compiere.util.WebLogin(request, response, ctx);
thisLogin.init ();
// JJ: cause needs to be fixed
if (WebUtil.getParameter(request, "Mode") == null)
if (WebUtil.getParameter(request, "mode") != null)
thisLogin.setP_Action("mode");
thisLogin.action ();
if ("logout".equals(thisLogin.getMode()))
return; // already forwarded
String url = thisLogin.getLogin_RelURL ();
if (!url.startsWith("/"))
@ -165,8 +170,8 @@ public class LoginServlet extends HttpServlet
if (salesRep != null)
url += "?SalesRep_ID=" + salesRep;
//
String mode = WebUtil.getParameter (request, "Mode");
log.fine("- targeting url=" + url + " - mode=" + mode);
//String mode = WebUtil.getParameter (request, "Mode");
log.fine("- targeting url=" + url); // + " - mode=" + mode);
// Web User
WebUser wu = WebUser.get(request);
@ -176,6 +181,10 @@ public class LoginServlet extends HttpServlet
thisLogin.setForward (url);
// Also handover adressConfirm
thisLogin.setAddressConfirm (addressConfirm);
// Since Mode Usage is not consequent we will try to figure it out.
if (WebUtil.getParameter(request, "Mode")==null)
if (WebUtil.getParameter(request, "mode")!=null)
thisLogin.setP_Action("mode");
// Start the process
thisLogin.action ();
// getback the URL
@ -190,4 +199,5 @@ public class LoginServlet extends HttpServlet
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
} // doPost
} // LoginServlet

View File

@ -188,7 +188,8 @@ public class NoteServlet extends HttpServlet
if (wu == null)
{
log.warning("No web user");
response.sendRedirect("loginServlet?ForwardTo=notes.jsp"); // entry
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=notes.jsp"); // entry
return;
}
WebEnv.dump(request);

View File

@ -118,7 +118,7 @@ public class OrderServlet extends HttpServlet
url = "/login.jsp";
done = true;
}
else
else // Order parameter
order = getOrder(request, ctx);
// We have an Order

View File

@ -94,7 +94,8 @@ public class RegistrationServlet extends HttpServlet
if (!processSystemRegistration(request, response))
{
log.info("Forward to registration.jsp");
response.sendRedirect("registration.jsp");
if (!response.isCommitted ())
response.sendRedirect("registration.jsp");
}
} // doGet

View File

@ -209,7 +209,8 @@ public class RequestServlet extends HttpServlet
if (wu == null)
{
log.warning("No web user");
response.sendRedirect("loginServlet?ForwardTo=request.jsp"); // entry
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=request.jsp"); // entry
return;
}
if (contentType != null && contentType.indexOf("multipart/form-data") != -1)

View File

@ -204,7 +204,8 @@ public class RfQServlet extends HttpServlet
if (wu == null)
{
log.warning("doPost - no web user");
response.sendRedirect("loginServlet?ForwardTo=note.jsp"); // entry
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=note.jsp"); // entry
return;
}
int C_RfQResponse_ID = WebUtil.getParameterAsInt(request, P_RfQResponse_ID);

View File

@ -17,13 +17,11 @@
package org.compiere.wstore;
import org.compiere.util.*;
import org.compiere.model.*;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.util.*;
import java.util.logging.*;
/**
* Web User Update.
@ -134,7 +132,9 @@ public class UpdateServlet
WebUtil.reload(thisLogin.getMessage(), thisLogin.getUpdate_page (), session, request, response, getServletContext());
return;
}
String url = thisLogin.getLogin_RelURL ();
String url = thisLogin.getForward();
if (url == null || url.length() == 0)
url = "/";
session.setAttribute (WebUser.NAME, wu);
@ -143,5 +143,7 @@ public class UpdateServlet
url = "/" + url;
log.info("Forward to " + url);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
} // doPost
}

View File

@ -57,7 +57,7 @@ public class WorkflowServlet extends HttpServlet
*/
public String getServletInfo()
{
return "adempiere Web Workflow Servlet";
return "Adempiere Web Workflow Servlet";
} // getServletInfo
/**
@ -195,7 +195,8 @@ public class WorkflowServlet extends HttpServlet
if (wu == null)
{
log.warning("doPost - no web user");
response.sendRedirect("loginServlet?ForwardTo=note.jsp"); // entry
if (!response.isCommitted ())
response.sendRedirect("loginServlet?ForwardTo=note.jsp"); // entry
return;
}
// Get Feedback

View File

@ -661,7 +661,8 @@ public class ServerBean implements SessionBean
m_no = ++s_no;
try
{
Adempiere.startup(false);
if (!Adempiere.startup(false))
throw new CreateException("Compiere could not start");
}
catch (Exception ex)
{

View File

@ -231,7 +231,8 @@ public class StatusBean implements SessionBean
m_no = ++s_no;
try
{
org.compiere.Adempiere.startup(false);
if (!Adempiere.startup(false))
throw new CreateException("Compiere could not start");
}
catch (Exception ex)
{

View File

@ -871,8 +871,19 @@ public class Doc_Invoice extends Doc
+ "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,po.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) "
+ "FROM C_Invoice i, C_InvoiceLine il "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID"
+ " AND ROWNUM=1 AND i.C_Invoice_ID=").append(get_ID()).append(") ")
+ " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID");
//jz + " AND ROWNUM=1 AND i.C_Invoice_ID=").append(get_ID()).append(") ")
if (DB.isOracle()) //jz
{
sql.append(" AND ROWNUM=1) ");
}
else
sql.append(" AND i.UPDATED IN (SELECT MAX(i1.UPDATED) "
+ "FROM C_Invoice i1, C_InvoiceLine il1 "
+ "WHERE i1.C_Invoice_ID=il1.C_Invoice_ID"
+ " AND po.M_Product_ID=il1.M_Product_ID AND po.C_BPartner_ID=i1.C_BPartner_ID")
.append(" AND i1.C_Invoice_ID=").append(get_ID()).append(") ");
sql.append(" AND i.C_Invoice_ID=").append(get_ID()).append(") ")
// update
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Invoice i, C_InvoiceLine il "

View File

@ -422,7 +422,19 @@ public class Doc_Order extends Doc
+ "FROM C_Order o, C_OrderLine ol "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"
+ " AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID"
+ " AND ROWNUM=1 AND o.C_Order_ID=").append(get_ID()).append(") ")
+ " AND ROWNUM=1 AND o.C_Order_ID=").append(get_ID()).append(") ");
//jz + " AND ROWNUM=1 AND o.C_Order_ID=").append(get_ID()).append(") ")
if (DB.isOracle()) //jz
{
sql.append(" AND ROWNUM=1) ");
}
else
sql.append(" AND o.UPDATED IN (SELECT MAX(o1.UPDATED) "
+ "FROM C_Order o1, C_OrderLine ol1 "
+ "WHERE o1.C_Order_ID=ol1.C_Order_ID"
+ " AND po.M_Product_ID=ol1.M_Product_ID AND po.C_BPartner_ID=o1.C_BPartner_ID")
.append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
sql.append(" AND o.C_Order_ID=").append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Order o, C_OrderLine ol "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"