hg merge release-1.0c (forward-porting)

This commit is contained in:
Carlos Ruiz 2013-10-02 18:20:45 -05:00
commit b630f5c6d5
18 changed files with 224 additions and 67 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 30, 2013 9:09:59 PM COT
-- IDEMPIERE-1409 Validate format for AD_User.EMail
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('E','EMail format is invalid: ',200235,'D','c2fb0472-795b-41ff-806c-1c1e0895e9b3','InvalidEMailFormat','Y',TO_DATE('2013-09-30 21:09:57','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-09-30 21:09:57','YYYY-MM-DD HH24:MI:SS'),0)
;
SELECT register_migration_script('201309302110_IDEMPIERE-1409.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Sep 30, 2013 9:09:59 PM COT
-- IDEMPIERE-1409 Validate format for AD_User.EMail
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('E','EMail format is invalid: ',200235,'D','c2fb0472-795b-41ff-806c-1c1e0895e9b3','InvalidEMailFormat','Y',TO_TIMESTAMP('2013-09-30 21:09:57','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-09-30 21:09:57','YYYY-MM-DD HH24:MI:SS'),0)
;
SELECT register_migration_script('201309302110_IDEMPIERE-1409.sql') FROM dual
;

View File

@ -1168,6 +1168,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
}
// Prevent New Where Main Record is processed
// but not apply for TabLevel=0 - teo_sarca [ 1673902 ]
// hengsin: together with readonly logic, the following validation create confusing situation for user.
// i.e, if readonly logic enable the new button on toolbar, it will just does nothing due to the validation below.
// better let everything decide using just the tab's readonly logic instead.
/*
if (m_vo.TabLevel > 0 && m_vo.TabNo > 0)
{
boolean processed = isProcessed();
@ -1178,7 +1182,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return false;
}
if (log.isLoggable(Level.FINEST)) log.finest("Processed=" + processed);
}
}*/
//hengsin, don't create new when parent is empty
if (isDetail() && m_parentNeedSave)

View File

@ -1142,10 +1142,14 @@ public final class MSetup
createPreference("C_Country_ID", String.valueOf(C_Country_ID), 0);
// Default Warehouse
MLocation locwh = new MLocation(m_ctx, C_Country_ID, C_Region_ID, City, m_trx.getTrxName());
locwh.setAddress1(address1);
locwh.setPostal(postal);
locwh.saveEx();
MWarehouse wh = new MWarehouse(m_ctx, 0, m_trx.getTrxName());
wh.setValue(defaultName);
wh.setName(defaultName);
wh.setC_Location_ID(loc.getC_Location_ID());
wh.setC_Location_ID(locwh.getC_Location_ID());
if (!wh.save())
log.log(Level.SEVERE, "Warehouse NOT inserted");

View File

@ -37,6 +37,7 @@ import org.adempiere.exceptions.DBException;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.EMail;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Secure;
@ -896,6 +897,15 @@ public class MUser extends X_AD_User
// New Address invalidates verification
if (!newRecord && is_ValueChanged("EMail"))
setEMailVerifyDate(null);
// IDEMPIERE-1409
if (getEMail() != null && (newRecord || is_ValueChanged("EMail"))) {
if (! EMail.validate(getEMail())) {
log.saveError("SaveError", Msg.getMsg(getCtx(), "InvalidEMailFormat") + Msg.getElement(getCtx(), COLUMNNAME_EMail) + " - [" + getEMail() + "]");
return false;
}
}
if (newRecord || super.getValue() == null || is_ValueChanged("Value"))
setValue(super.getValue());

View File

@ -26,6 +26,8 @@ import java.util.Collection;
import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.activation.DataHandler;
import javax.activation.DataSource;
@ -71,7 +73,8 @@ public final class EMail implements Serializable
/**
*
*/
private static final long serialVersionUID = -1408649015285763245L;
private static final long serialVersionUID = -5857825644737211294L;
//use in server bean
public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
/**
@ -1092,6 +1095,18 @@ public final class EMail implements Serializable
return sb.toString ();
} // toString
/**
* Validate format of an email address
* IDEMPIERE-1409 - based on http://examples.javacodegeeks.com/core-java/util/regex/matcher/validate-email-address-with-java-regular-expression-example/
* @return true if email has proper format
*/
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
private static Pattern pattern = Pattern.compile(EMAIL_PATTERN);
public static boolean validate(final String email) {
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
/**************************************************************************
* Test.
* java -cp CTools.jar;CClient.jar org.compiere.util.EMail main info@adempiere.org jjanke@adempiere.org "My Subject" "My Message"

View File

@ -172,7 +172,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
fout.close();
return downloadedFile;
} catch (FileNotFoundException e) {
if(reportLocation.indexOf("Subreport") == -1) // Only show the warning if it is not a subreport
if(reportLocation.indexOf("Subreport") == -1 && !reportLocation.endsWith(".properties")) // Only show the warning if it is not a subreport or properties
log.warning("404 not found: Report cannot be found on server "+ e.getMessage());
return null;
} catch (IOException e) {
@ -424,7 +424,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
String resourcePath = reportDir.getAbsolutePath();
if (!resourcePath.endsWith("/") && !resourcePath.endsWith("\\"));
{
resourcePath = resourcePath + "/";
resourcePath = resourcePath + File.separator;
}
params.put("SUBREPORT_DIR", resourcePath);
if (reportPath.startsWith("http://") || reportPath.startsWith("https://")) {
@ -515,7 +515,8 @@ public class ReportStarter implements ProcessCall, ClientProcess
}
else if (reportPath.startsWith("resource:"))
{
subreports = getResourceSubreports(name+ "Subreport", reportPath, fileExtension);
String path = reportPath.substring(0, reportPath.length() +1 - (name+"."+fileExtension).length());
subreports = getResourceSubreports(name+ "Subreport", path, fileExtension);
}
else
{
@ -585,26 +586,25 @@ public class ReportStarter implements ProcessCall, ClientProcess
// Resources
File resFile = null;
String bundleName = jasperReport.getResourceBundle();
if (bundleName == null) {
// If bundle name is not set, use the same name as the report file (legacy behaviour)
bundleName = jasperName;
}
if (reportPath.startsWith("attachment:") && attachment != null) {
resFile = getAttachmentResourceFile(jasperName, currLang);
resFile = getAttachmentResourceFile(bundleName, currLang);
} else if (reportPath.startsWith("resource:")) {
resFile = getResourcesForResourceFile(jasperName, currLang);
resFile = getResourceResourceFile("resource:" + bundleName, currLang);
} else if (reportPath.startsWith("http://") || reportPath.startsWith("https://")) {
resFile = getHttpResourceFile(reportPath, bundleName, currLang);
} else {
resFile = new File(jasperName+"_"+currLang.getLocale().getLanguage()+".properties");
if (!resFile.exists()) {
resFile = null;
}
if (resFile == null) {
resFile = new File(jasperName+".properties");
if (!resFile.exists()) {
resFile = null;
}
}
resFile = getFileResourceFile(resourcePath, bundleName, currLang);
}
if (resFile!=null) {
try {
PropertyResourceBundle res = new PropertyResourceBundle( new FileInputStream(resFile));
params.put("RESOURCE", res);
params.put(JRParameter.REPORT_RESOURCE_BUNDLE, res);
} catch (IOException e) {
;
}
@ -783,47 +783,113 @@ public class ReportStarter implements ProcessCall, ClientProcess
/**
* Get .property resource file from process attachment
* @param jasperName
* @param bundleName
* @param currLang
* @return File
*/
private File getAttachmentResourceFile(String jasperName, Language currLang) {
File resFile = null;
MAttachmentEntry[] entries = attachment.getEntries();
// try baseName + "_" + language
String resname = jasperName + "_" + currLang.getLocale().getLanguage() + ".properties";
private File getAttachmentResourceFile(String bundleName, Language currLang) {
String resname = bundleName+"_"+currLang.getLocale().getLanguage()+"_"+currLang.getLocale().getCountry()+".properties";
File resFile = getAttachmentEntryFile(resname);
if (resFile == null) {
resname = bundleName+"_"+currLang.getLocale().getLanguage()+".properties";
resFile = getAttachmentEntryFile(resname);
if (resFile == null) {
resname = bundleName+".properties";
resFile = getAttachmentEntryFile(resname);
}
}
return resFile;
}
private File getAttachmentEntryFile(String resname) {
File fileattach = null;
MAttachmentEntry[] entries = attachment.getEntries();
for( int i=0; i<entries.length; i++) {
if (entries[i].getName().equals(resname)) {
resFile = getAttachmentEntryFile(entries[i]);
fileattach = getAttachmentEntryFile(entries[i]);
break;
}
}
if (resFile==null) {
// try baseName only
resname = jasperName + ".properties";
for( int i=0; i<entries.length; i++) {
if (entries[i].getName().equals(resname)) {
resFile = getAttachmentEntryFile(entries[i]);
break;
}
}
}
return resFile;
return fileattach;
}
/**
* Get .property resource file from resources
* @param jasperName
* @param bundleName
* @param currLang
* @return File
*/
private File getResourcesForResourceFile(String jasperName, Language currLang) {
File resFile = null;
private File getResourceResourceFile(String bundleName, Language currLang) {
String resname = bundleName+"_"+currLang.getLocale().getLanguage()+"_"+currLang.getLocale().getCountry()+".properties";
File resFile = null;
try {
resFile = getFileAsResource(jasperName+"_"+currLang.getLocale().getLanguage()+".properties");
resFile = getFileAsResource(resname);
} catch (Exception e) {
// ignore exception - file couldn't exist
}
if (resFile == null) {
resname = bundleName+"_"+currLang.getLocale().getLanguage()+".properties";
try {
resFile = getFileAsResource(resname);
} catch (Exception e) {
// ignore exception - file couldn't exist
}
if (resFile == null) {
resname = bundleName+".properties";
try {
resFile = getFileAsResource(resname);
} catch (Exception e) {
// ignore exception - file couldn't exist
}
}
}
return resFile;
}
/**
* Get .property resource file from http URL
* @param reportPath
* @param bundleName
* @param currLang
* @return File
*/
private File getHttpResourceFile(String reportPath, String bundleName, Language currLang)
{
String remoteDir = reportPath.substring(0, reportPath.lastIndexOf("/"));
String resname = bundleName+"_"+currLang.getLocale().getLanguage()+"_"+currLang.getLocale().getCountry()+".properties";
File resFile = httpDownloadedReport(remoteDir + "/" + resname);
if (resFile == null) {
resname = bundleName+"_"+currLang.getLocale().getLanguage()+".properties";
resFile = httpDownloadedReport(remoteDir + "/" + resname);
if (resFile == null) {
resname = bundleName+".properties";
resFile = httpDownloadedReport(remoteDir + "/" + resname);
}
}
return resFile;
}
/**
* Get .property resource file from file://
* @param resourcePath
* @param bundleName
* @param currLang
* @return File
*/
private File getFileResourceFile(String resourcePath, String bundleName, Language currLang) {
String resname = bundleName+"_"+currLang.getLocale().getLanguage()+"_"+currLang.getLocale().getCountry()+".properties";
File resFile = new File(resourcePath, resname);
if (! resFile.exists()) {
resname = bundleName+"_"+currLang.getLocale().getLanguage()+".properties";
resFile = new File(resourcePath, resname);
if (! resFile.exists()) {
resname = bundleName+".properties";
resFile = new File(resourcePath, resname);
if (! resFile.exists()) {
resFile = null;
}
}
}
return resFile;
}
@ -864,15 +930,13 @@ public class ReportStarter implements ProcessCall, ClientProcess
private File[] getResourceSubreports(String reportName, String reportPath, String fileExtension)
{
ArrayList<File> subreports = new ArrayList<File>();
String remoteDir = reportPath.substring(0, reportPath.lastIndexOf("/"));
// Currently check hardcoded for max. 10 subreports
for(int i=1; i<10; i++)
{
// Check if subreport number i exists
File subreport = null;
try {
subreport = getFileAsResource(remoteDir + "/" + reportName + i + fileExtension);
subreport = getFileAsResource(reportPath + reportName + i + fileExtension);
} catch (Exception e) {
// just ignore it
}
@ -960,18 +1024,31 @@ public class ReportStarter implements ProcessCall, ClientProcess
if (log.isLoggable(Level.INFO)) log.info("localFile = " + localFile);
reportFile = new File(localFile);
boolean empty = true;
OutputStream out = null;
out = new FileOutputStream(reportFile);
if (out != null){
byte buf[]=new byte[1024];
int len;
while((len=inputStream.read(buf))>0)
out.write(buf,0,len);
out.close();
inputStream.close();
try {
out = new FileOutputStream(reportFile);
if (out != null){
byte buf[]=new byte[1024];
int len;
while((len=inputStream.read(buf))>0) {
empty = false;
out.write(buf,0,len);
}
}
} catch (Exception e) {
throw e;
} finally {
if (out != null)
out.close();
if (inputStream != null)
inputStream.close();
}
return reportFile;
if (empty)
return null;
else
return reportFile;
}
/**
@ -1176,10 +1253,24 @@ public class ReportStarter implements ProcessCall, ClientProcess
if (para != null) {
for (int i = 0; i < para.length; i++) {
if (para[i].getParameter_To() == null) {
params.put(para[i].getParameterName(), para[i].getParameter());
if (para[i].getParameterName().endsWith("_ID") && para[i].getParameter() instanceof BigDecimal) {
params.put(para[i].getParameterName(), ((BigDecimal)para[i].getParameter()).intValue());
} else {
params.put(para[i].getParameterName(), para[i].getParameter());
}
} else {
params.put( para[i].getParameterName()+"1", para[i].getParameter());
params.put( para[i].getParameterName()+"2", para[i].getParameter_To());
// range - from
if (para[i].getParameterName().endsWith("_ID") && para[i].getParameter() != null && para[i].getParameter() instanceof BigDecimal) {
params.put( para[i].getParameterName()+"1", ((BigDecimal)para[i].getParameter()).intValue());
} else {
params.put( para[i].getParameterName()+"1", para[i].getParameter());
}
// range - to
if (para[i].getParameterName().endsWith("_ID") && para[i].getParameter_To() instanceof BigDecimal) {
params.put( para[i].getParameterName()+"2", ((BigDecimal)para[i].getParameter_To()).intValue());
} else {
params.put( para[i].getParameterName()+"2", para[i].getParameter_To());
}
}
}
}

View File

@ -1173,7 +1173,18 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
Object value = Executions.getCurrent().removeAttribute(CompositeADTabbox.AD_TABBOX_ON_EDIT_DETAIL_ATTRIBUTE);
if (value != newTabpanel)
{
newTabpanel.query();
}
else
{
//detail pane of the new header tab might need refresh
if (newTabpanel instanceof ADTabpanel)
{
ADTabpanel adtabpanel = (ADTabpanel) newTabpanel;
Events.echoEvent(ADTabpanel.ON_POST_INIT_EVENT, adtabpanel, null);
}
}
}
else
{

View File

@ -31,7 +31,9 @@ bin.includes = META-INF/,\
OSGI-INF/defaultcreatefromfactory.xml,\
OSGI-INF/defaultformfactory.xml,\
OSGI-INF/feedbackservice.xml,\
sessiontimeout.zul
sessiontimeout.zul,\
*.jsp,\
labelapplet.jar
src.includes = WEB-INF/classes/,\
WEB-INF/tld/,\
WEB-INF/web.xml,\

View File

@ -641,6 +641,10 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
width: auto;
}
.dashboard-widget.dashboard-widget-max > .z-panel-body > .z-panelchildren {
overflow: auto;
}
.dashboard-report-iframe {
min-height:300px;
border: 1px solid lightgray;

View File

@ -62,3 +62,4 @@ Import-Package: fit,
org.idempiere.fitnesse.server.slim,
org.osgi.framework;version="1.3.0"
Service-Component: OSGI-INF/fitfixturefactory.xml, OSGI-INF/slimfixturefactory.xml
Export-Package: org.idempiere.fitnesse.fixture

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/selenium-server-standalone-2.35.0.jar" sourcepath="lib/selenium-server-2.35.0-srcs.jar"/>
<classpathentry exported="true" kind="lib" path="lib/phantomjsdriver-1.0.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/selenium-server-standalone-2.31.0.jar" sourcepath="lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/fitlibraryweb-2.0.jar" sourcepath="lib/fitlibraryweb-2.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.16.jar"/>
<classpathentry exported="true" kind="lib" path="lib/fitnesse.jar"/>

View File

@ -18,7 +18,7 @@ Bundle-ClassPath: .,
lib/fitnesse.jar,
lib/log4j-1.2.16.jar,
lib/fitlibraryweb-2.0.jar,
lib/selenium-server-standalone-2.31.0.jar,
lib/selenium-server-standalone-2.35.0.jar,
lib/phantomjsdriver-1.0.3.jar
Web-ContextPath: fitnesse
Export-Package: fit,
@ -290,7 +290,6 @@ Export-Package: fit,
org.openqa.selenium.interactions.internal,
org.openqa.selenium.interactions.touch,
org.openqa.selenium.internal,
org.openqa.selenium.internal.selenesedriver,
org.openqa.selenium.internal.seleniumemulation,
org.openqa.selenium.io,
org.openqa.selenium.iphone,
@ -323,7 +322,6 @@ Export-Package: fit,
org.openqa.selenium.server.cli,
org.openqa.selenium.server.commands,
org.openqa.selenium.server.htmlrunner,
org.openqa.selenium.server.log,
org.openqa.selenium.support,
org.openqa.selenium.support.events,
org.openqa.selenium.support.events.internal,

View File

@ -14,7 +14,7 @@
<!-- Slim Servlet -->
<servlet>
<servlet-name>SlimServlet</servlet-name>
<servlet-class>org.idemiere.fitnesse.server.slim.SlimServlet</servlet-class>
<servlet-class>org.idempiere.fitnesse.server.slim.SlimServlet</servlet-class>
</servlet>
<servlet-mapping>

View File

@ -7,5 +7,5 @@ bin.includes = META-INF/,\
lib/log4j-1.2.16.jar,\
lib/fitlibraryweb-2.0.jar,\
WEB-INF/,\
lib/selenium-server-standalone-2.31.0.jar,\
lib/phantomjsdriver-1.0.3.jar
lib/phantomjsdriver-1.0.3.jar,\
lib/selenium-server-standalone-2.35.0.jar

View File

@ -290,7 +290,6 @@ Import-Package: fit,
org.openqa.selenium.interactions.internal,
org.openqa.selenium.interactions.touch,
org.openqa.selenium.internal,
org.openqa.selenium.internal.selenesedriver,
org.openqa.selenium.internal.seleniumemulation,
org.openqa.selenium.io,
org.openqa.selenium.iphone,
@ -323,7 +322,6 @@ Import-Package: fit,
org.openqa.selenium.server.cli,
org.openqa.selenium.server.commands,
org.openqa.selenium.server.htmlrunner,
org.openqa.selenium.server.log,
org.openqa.selenium.support,
org.openqa.selenium.support.events,
org.openqa.selenium.support.events.internal,

View File

@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/org.idempiere.fitnesse.server/lib/selenium-server-standalone-2.31.0.jar" sourcepath="/org.idempiere.fitnesse.server/lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry kind="lib" path="/org.idempiere.fitnesse.server/lib/selenium-server-standalone-2.35.0.jar" sourcepath="/org.idempiere.fitnesse.server/lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/ztl-2.0.0-SNAPSHOT.jar" sourcepath="lib/ztl-2.0.0-sources.jar"/>
<classpathentry kind="lib" path="/org.idempiere.fitnesse.server/lib/selenium-server-standalone-2.31.0.jar" sourcepath="/org.idempiere.fitnesse.server/lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry kind="lib" path="/org.idempiere.fitnesse.server/lib/selenium-server-standalone-2.35.0.jar" sourcepath="/org.idempiere.fitnesse.server/lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>