hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2014-12-02 10:04:17 -05:00
commit e0a05471f9
22 changed files with 270 additions and 89 deletions

View File

@ -765,7 +765,7 @@ public class GridTabCSVImporter implements IGridTabImporter
return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)})); return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)}));
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
if((field.isMandatory(true) || column.isMandatory()) && value == null && field.getDefault()==null){ if((field.isMandatory(false) || column.isMandatory()) && value == null && field.getDefault()==null){
mandatoryColumns.append(" / "); mandatoryColumns.append(" / ");
mandatoryColumns.append(header.get(i)); mandatoryColumns.append(header.get(i));
} }

View File

@ -180,13 +180,6 @@ public class GridField
log.log(Level.SEVERE, "(" + m_vo.ColumnName + ") - No LookupInfo"); log.log(Level.SEVERE, "(" + m_vo.ColumnName + ") - No LookupInfo");
return; return;
} }
// Prevent loading of CreatedBy/UpdatedBy
if (m_vo.displayType == DisplayType.Table
&& (m_vo.ColumnName.equals("CreatedBy") || m_vo.ColumnName.equals("UpdatedBy")) )
{
m_vo.lookupInfo.IsCreadedUpdatedBy = true;
m_vo.lookupInfo.DisplayType = DisplayType.Search;
}
// //
loadLookupNoValidate(); loadLookupNoValidate();
} }
@ -220,6 +213,14 @@ public class GridField
if (m_vo.lookupInfo == null) { if (m_vo.lookupInfo == null) {
return; return;
} }
// Prevent loading of CreatedBy/UpdatedBy
if (m_vo.displayType == DisplayType.Table
&& (m_vo.ColumnName.equals("CreatedBy") || m_vo.ColumnName.equals("UpdatedBy")) )
{
m_vo.lookupInfo.IsCreadedUpdatedBy = true;
m_vo.lookupInfo.DisplayType = DisplayType.Search;
m_vo.displayType = DisplayType.Search;
}
m_vo.lookupInfo.IsKey = isKey(); m_vo.lookupInfo.IsKey = isKey();
loadLookupFromFactory(); loadLookupFromFactory();
} }

View File

@ -113,7 +113,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 1377113168185797983L; private static final long serialVersionUID = 1151723870943569774L;
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
@ -157,6 +157,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// The window of this tab // The window of this tab
private GridWindow m_window; private GridWindow m_window;
public GridWindow getGridWindow() {
return m_window;
}
/** The Table Model for Query */ /** The Table Model for Query */
private GridTable m_mTable = null; private GridTable m_mTable = null;

View File

@ -211,11 +211,11 @@ public class MMovementLine extends X_M_MovementLine
// Mandatory Instance // Mandatory Instance
MProduct product = getProduct(); MProduct product = getProduct();
if (getM_AttributeSetInstance_ID() == 0) { if (getM_AttributeSetInstance_ID() == 0) {
if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (product != null && product.isASIMandatory(true)) { if (product != null && product.isASIMandatory(true)) {
if (product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) { if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) {
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
return false; return false;
@ -231,12 +231,12 @@ public class MMovementLine extends X_M_MovementLine
setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID());
} }
if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0) if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0)
{ {
if (product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) { if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) {
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID)); log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID));
return false; return false;

View File

@ -660,8 +660,6 @@ public class MPayment extends X_C_Payment
|| is_ValueChanged(COLUMNNAME_C_Charge_ID) || is_ValueChanged(COLUMNNAME_C_Charge_ID)
|| is_ValueChanged(COLUMNNAME_C_Currency_ID) || is_ValueChanged(COLUMNNAME_C_Currency_ID)
|| is_ValueChanged(COLUMNNAME_C_DocType_ID) || is_ValueChanged(COLUMNNAME_C_DocType_ID)
|| is_ValueChanged(COLUMNNAME_C_Invoice_ID)
|| is_ValueChanged(COLUMNNAME_C_Order_ID)
|| is_ValueChanged(COLUMNNAME_DateAcct) || is_ValueChanged(COLUMNNAME_DateAcct)
|| is_ValueChanged(COLUMNNAME_DateTrx) || is_ValueChanged(COLUMNNAME_DateTrx)
|| is_ValueChanged(COLUMNNAME_DiscountAmt) || is_ValueChanged(COLUMNNAME_DiscountAmt)

View File

@ -476,7 +476,7 @@ public final class DisplayType
// //
if ( pattern != null && pattern.length() > 0) if ( pattern != null && pattern.length() > 0)
{ {
SimpleDateFormat format = (SimpleDateFormat)DateFormat.getInstance(); SimpleDateFormat format = (SimpleDateFormat)DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, language.getLocale());
try { try {
format.applyPattern(pattern); format.applyPattern(pattern);
return format; return format;

View File

@ -48,7 +48,6 @@ import javax.mail.internet.MimeMultipart;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import com.sun.mail.smtp.SMTPMessage; import com.sun.mail.smtp.SMTPMessage;
/** /**
@ -338,7 +337,7 @@ public final class EMail implements Serializable
m_msg.setHeader("Comments", "iDempiereMail"); m_msg.setHeader("Comments", "iDempiereMail");
// m_msg.setDescription("Description"); // m_msg.setDescription("Description");
// SMTP specifics // SMTP specifics
m_msg.setAllow8bitMIME(true); //m_msg.setAllow8bitMIME(true);
// Send notification on Failure & Success - no way to set envid in Java yet // Send notification on Failure & Success - no way to set envid in Java yet
// m_msg.setNotifyOptions (SMTPMessage.NOTIFY_FAILURE | SMTPMessage.NOTIFY_SUCCESS); // m_msg.setNotifyOptions (SMTPMessage.NOTIFY_FAILURE | SMTPMessage.NOTIFY_SUCCESS);
// Bounce only header // Bounce only header
@ -974,18 +973,34 @@ public final class EMail implements Serializable
else // Multi part message *************************************** else // Multi part message ***************************************
{ {
// First Part - Message // First Part - Message
MimeBodyPart mbp_1 = new MimeBodyPart(); MimeBodyPart htmlPart= null;
mbp_1.setText(""); MimeBodyPart planPart = new MimeBodyPart();
if (m_messageHTML == null || m_messageHTML.length () == 0) //TODO: get plan text form html, i see getMessageCRLF just return empty string
mbp_1.setText (getMessageCRLF(), charSetName); planPart.setText (getMessageCRLF(), charSetName);
else htmlPart = new MimeBodyPart();
mbp_1.setDataHandler (new DataHandler if (m_messageHTML == null){
m_messageHTML = "<html><body>" + getMessageCRLF() + "</body></html>";
}
htmlPart.setDataHandler (new DataHandler
(new ByteArrayDataSource (m_messageHTML, charSetName, "text/html"))); (new ByteArrayDataSource (m_messageHTML, charSetName, "text/html")));
// Create Multipart and its parts to it // Create Multipart and its parts to it
Multipart mp = new MimeMultipart("related"); Multipart mainPart = new MimeMultipart("mixed");
mp.addBodyPart(mbp_1);
if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + mbp_1); Multipart viewContentPart = new MimeMultipart("related");
MimeBodyPart viewBodyPart = new MimeBodyPart();
viewBodyPart.setContent(viewContentPart);
mainPart.addBodyPart(viewBodyPart);
Multipart textAlternativePart = new MimeMultipart("alternative");
//textAlternativePart.addBodyPart(planPart);
textAlternativePart.addBodyPart(htmlPart);
MimeBodyPart alternativeBodyPart = new MimeBodyPart();
alternativeBodyPart.setContent(textAlternativePart);
viewContentPart.addBodyPart(alternativeBodyPart);
if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + htmlPart);
// for all attachments // for all attachments
for (int i = 0; i < m_attachments.size(); i++) for (int i = 0; i < m_attachments.size(); i++)
@ -1024,12 +1039,14 @@ public final class EMail implements Serializable
if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) { if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) {
mbp_2.setContentID("<" + ds.getName() + ">"); mbp_2.setContentID("<" + ds.getName() + ">");
mbp_2.setDisposition(MimeBodyPart.INLINE); mbp_2.setDisposition(MimeBodyPart.INLINE);
viewContentPart.addBodyPart(mbp_2);
}else{
mainPart.addBodyPart(mbp_2);
} }
mp.addBodyPart(mbp_2);
} }
// Add to Message // Add to Message
m_msg.setContent(mp); m_msg.setContent(mainPart);
} // multi=part } // multi=part
} // setContent } // setContent

View File

@ -1509,8 +1509,9 @@ public final class Env
if (column.isSecure()) { if (column.isSecure()) {
outStr.append("********"); outStr.append("********");
} else { } else {
outStr.append(DB.getSQLValueString(trxName, String value = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v);
"SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v)); if (value != null)
outStr.append(value);
} }
} }
} }

View File

@ -1011,6 +1011,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
if (!m_po.save()) if (!m_po.save())
{ {
success = false; success = false;
m_docStatus = null;
processMsg = "SaveError"; processMsg = "SaveError";
} }
if (!success) if (!success)

View File

@ -60,6 +60,7 @@ import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JRDesignQuery; import net.sf.jasperreports.engine.design.JRDesignQuery;
import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.export.JRCsvExporter; import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRCsvExporterParameter;
import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRPdfExporter; import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter; import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
@ -714,8 +715,12 @@ public class ReportStarter implements ProcessCall, ClientProcess
exporter = new JRPrintServiceExporter(ljrContext); exporter = new JRPrintServiceExporter(ljrContext);
else if (ext.equals("xml")) else if (ext.equals("xml"))
exporter = new JRXmlExporter(ljrContext); exporter = new JRXmlExporter(ljrContext);
else if (ext.equals("csv") || ext.equals("ssv")) else if (ext.equals("csv"))
exporter = new JRCsvExporter(ljrContext); exporter = new JRCsvExporter(ljrContext);
else if (ext.equals("ssv")) {
exporter = new JRCsvExporter(ljrContext);
exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";");
}
else if (ext.equals("txt")) else if (ext.equals("txt"))
exporter = new JRTextExporter(ljrContext); exporter = new JRTextExporter(ljrContext);
else if (ext.equals("html") || ext.equals("htm")) else if (ext.equals("html") || ext.equals("htm"))

View File

@ -22,6 +22,8 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -43,11 +45,13 @@ import org.compiere.model.MRole;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MSystem; import org.compiere.model.MSystem;
import org.compiere.model.MTable;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkforge.keylistener.Keylistener; import org.zkforge.keylistener.Keylistener;
import org.zkoss.web.Attributes; import org.zkoss.web.Attributes;
import org.zkoss.web.servlet.Servlets; import org.zkoss.web.servlet.Servlets;
@ -77,7 +81,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
/** /**
* *
*/ */
private static final long serialVersionUID = 5875869799688466929L; private static final long serialVersionUID = 2030098494203345181L;
private static final String SAVED_CONTEXT = "saved.context"; private static final String SAVED_CONTEXT = "saved.context";
@ -107,12 +111,16 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
private static boolean eventThreadEnabled = false; private static boolean eventThreadEnabled = false;
private ConcurrentMap<String, String[]> m_URLParameters;
public AdempiereWebUI() public AdempiereWebUI()
{ {
this.addEventListener(Events.ON_CLIENT_INFO, this); this.addEventListener(Events.ON_CLIENT_INFO, this);
this.setVisible(false); this.setVisible(false);
userPreference = new UserPreference(); userPreference = new UserPreference();
// preserve the original URL parameters as is destroyed later on loging
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
} }
public void onCreate() public void onCreate()
@ -275,9 +283,54 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
} }
Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString()); Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString());
Clients.response(new AuScript("zAu.cmd0.clearBusy()")); Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
processParameters();
} }
/** private void processParameters() {
String action = getPrmString("Action");
if ("Zoom".equalsIgnoreCase(action)) {
int tableID = getPrmInt("AD_Table_ID");
if (tableID == 0) {
String tableName = getPrmString("TableName");
if (!Util.isEmpty(tableName)) {
MTable table = MTable.get(Env.getCtx(), tableName);
if (table != null) {
tableID = table.getAD_Table_ID();
}
}
}
int recordID = getPrmInt("Record_ID");
if (tableID > 0) {
AEnv.zoom(tableID, recordID);
}
}
m_URLParameters = null;
}
private String getPrmString(String prm) {
String retValue = "";
if (m_URLParameters != null) {
String[] strs = m_URLParameters.get(prm);
if (strs != null && strs.length == 1 && strs[0] != null)
retValue = strs[0];
}
return retValue;
}
private int getPrmInt(String prm) {
int retValue = 0;
String str = getPrmString(prm);
try {
if (!Util.isEmpty(str))
retValue = Integer.parseInt(str);
} catch (NumberFormatException e) {
// ignore
}
return retValue;
}
/**
* @return key listener * @return key listener
*/ */
@Override @Override

View File

@ -1622,8 +1622,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow); toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
toolbar.enableReport(!isNewRow); toolbar.enableReport(!isNewRow);
toolbar.enableExport(!adTabbox.getSelectedGridTab().isSortTab()); toolbar.enableExport(!isNewRow && !adTabbox.getSelectedGridTab().isSortTab());
toolbar.enableFileImport(!changed && !adTabbox.getSelectedGridTab().isSortTab() && adTabbox.getSelectedGridTab().isInsertRecord()); toolbar.enableFileImport(!isNewRow && !changed && !adTabbox.getSelectedGridTab().isSortTab() && adTabbox.getSelectedGridTab().isInsertRecord());
toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null); toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null);

View File

@ -468,12 +468,18 @@ public class WReportCustomization implements IFormController,EventListener<Even
m_reportEngine.createXML(sw); m_reportEngine.createXML(sw);
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("csv") || ext.equals("ssv")) else if (ext.equals("csv"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage()); m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("ssv"))
{
StringWriter sw = new StringWriter();
m_reportEngine.createCSV(sw, ';', m_reportEngine.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes();
}
else if (ext.equals("txt")) else if (ext.equals("txt"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();

View File

@ -17,7 +17,6 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -60,11 +59,6 @@ public class AutoComplete extends Combobox
public void setDict(String[] vals) public void setDict(String[] vals)
{ {
comboItems = vals; comboItems = vals;
if (comboItems != null)
{
Arrays.sort(comboItems);
}
} }
/** /**

View File

@ -51,34 +51,34 @@ public class InfoProductWindow extends InfoWindow {
/** /**
* *
*/ */
private static final long serialVersionUID = -1343685368452976048L; private static final long serialVersionUID = -7892916038089331016L;
private Tabbox tabbedPane; protected Tabbox tabbedPane;
private WListbox warehouseTbl; protected WListbox warehouseTbl;
private String m_sqlWarehouse; protected String m_sqlWarehouse;
private WListbox substituteTbl; protected WListbox substituteTbl;
private String m_sqlSubstitute; protected String m_sqlSubstitute;
private WListbox relatedTbl; protected WListbox relatedTbl;
private String m_sqlRelated; protected String m_sqlRelated;
//Available to Promise Tab //Available to Promise Tab
private WListbox m_tableAtp; protected WListbox m_tableAtp;
// Group atp by warehouse or non // Group atp by warehouse or non
private Checkbox chbShowDetailAtp; protected Checkbox chbShowDetailAtp;
//IDEMPIERE-337 //IDEMPIERE-337
private WListbox productpriceTbl; protected WListbox productpriceTbl;
private String m_sqlProductprice; protected String m_sqlProductprice;
private Textbox fieldDescription; protected Textbox fieldDescription;
/** ASI */ /** ASI */
protected int m_M_AttributeSetInstance_ID; protected int m_M_AttributeSetInstance_ID;
private Borderlayout contentBorderLayout; protected Borderlayout contentBorderLayout;
/** Instance Button */ /** Instance Button */
private Button m_PAttributeButton; protected Button m_PAttributeButton;
protected int m_M_Locator_ID; protected int m_M_Locator_ID;
@ -369,7 +369,7 @@ public class InfoProductWindow extends InfoWindow {
}); });
} }
private void onPAttributeClick() { protected void onPAttributeClick() {
Integer productInteger = getSelectedRowKey(); Integer productInteger = getSelectedRowKey();
if (productInteger == null) { if (productInteger == null) {
m_PAttributeButton.setEnabled(false); m_PAttributeButton.setEnabled(false);
@ -397,7 +397,7 @@ public class InfoProductWindow extends InfoWindow {
}); });
} }
private String getSelectedWarehouseLabel() { protected String getSelectedWarehouseLabel() {
for(WEditor editor : editors) { for(WEditor editor : editors) {
if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("M_Warehouse_ID")) { if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("M_Warehouse_ID")) {
Number value = (Number) editor.getValue(); Number value = (Number) editor.getValue();
@ -461,7 +461,7 @@ public class InfoProductWindow extends InfoWindow {
* @param M_PriceList_ID price list * @param M_PriceList_ID price list
* @return M_PriceList_Version_ID price list version * @return M_PriceList_Version_ID price list version
*/ */
private int findPLV (int M_PriceList_ID) protected int findPLV (int M_PriceList_ID)
{ {
Timestamp priceDate = null; Timestamp priceDate = null;
// Sales Order Date // Sales Order Date
@ -518,7 +518,7 @@ public class InfoProductWindow extends InfoWindow {
* *
* @param M_Warehouse_ID warehouse * @param M_Warehouse_ID warehouse
*/ */
private void setWarehouse(int M_Warehouse_ID) protected void setWarehouse(int M_Warehouse_ID)
{ {
for(WEditor editor : editors) { for(WEditor editor : editors) {
if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("M_Warehouse_ID")) { if (editor.getGridField() != null && editor.getGridField().getColumnName().equals("M_Warehouse_ID")) {
@ -535,7 +535,7 @@ public class InfoProductWindow extends InfoWindow {
* *
* @param M_PriceList_Version_ID price list * @param M_PriceList_Version_ID price list
*/ */
private void setPriceListVersion(int M_PriceList_Version_ID) protected void setPriceListVersion(int M_PriceList_Version_ID)
{ {
if (log.isLoggable(Level.CONFIG)) log.config("M_PriceList_Version_ID=" + M_PriceList_Version_ID); if (log.isLoggable(Level.CONFIG)) log.config("M_PriceList_Version_ID=" + M_PriceList_Version_ID);
@ -555,7 +555,7 @@ public class InfoProductWindow extends InfoWindow {
/** /**
* Refresh Query * Refresh Query
*/ */
private void refresh(int M_Warehouse_ID, int M_PriceList_Version_ID) protected void refresh(int M_Warehouse_ID, int M_PriceList_Version_ID)
{ {
int m_M_Product_ID = getSelectedRowKey(); int m_M_Product_ID = getSelectedRowKey();
String sql = m_sqlWarehouse; String sql = m_sqlWarehouse;
@ -641,7 +641,7 @@ public class InfoProductWindow extends InfoWindow {
* @param m_M_Warehouse_ID * @param m_M_Warehouse_ID
* @param m_M_Product_ID * @param m_M_Product_ID
*/ */
private void initAtpTab (int m_M_Warehouse_ID, int m_M_Product_ID) protected void initAtpTab (int m_M_Warehouse_ID, int m_M_Product_ID)
{ {
// Header // Header
Vector<String> columnNames = new Vector<String>(); Vector<String> columnNames = new Vector<String>();

View File

@ -96,7 +96,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
/** /**
* *
*/ */
private static final long serialVersionUID = 6606023722122538154L; private static final long serialVersionUID = -2192106603768665006L;
protected Grid parameterGrid; protected Grid parameterGrid;
private Borderlayout layout; private Borderlayout layout;
@ -399,7 +399,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
btMenuProcess.setVisible(ipMenu.getChildren().size() > 0); btMenuProcess.setVisible(ipMenu.getChildren().size() > 0);
} }
private void processQueryValue() { protected void processQueryValue() {
isQueryByUser = true; isQueryByUser = true;
for (int i = 0; i < identifiers.size(); i++) { for (int i = 0; i < identifiers.size(); i++) {
WEditor editor = identifiers.get(i); WEditor editor = identifiers.get(i);
@ -434,7 +434,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
isQueryByUser = false; isQueryByUser = false;
} }
private boolean loadInfoDefinition() { protected boolean loadInfoDefinition() {
String tableName = null; String tableName = null;
if (AD_InfoWindow_ID > 0) { if (AD_InfoWindow_ID > 0) {
infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null); infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null);
@ -514,7 +514,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
//private MInfoColumn[] topinfoColumns;//infoWindow.getInfoColumns(tableInfos); //private MInfoColumn[] topinfoColumns;//infoWindow.getInfoColumns(tableInfos);
private boolean loadInfoRelatedTabs() { protected boolean loadInfoRelatedTabs() {
if (infoWindow == null) if (infoWindow == null)
return false; return false;
@ -654,7 +654,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
prepareTable(columnInfos, infoWindow.getFromClause(), p_whereClause, infoWindow.getOrderByClause()); prepareTable(columnInfos, infoWindow.getFromClause(), p_whereClause, infoWindow.getOrderByClause());
} }
private ColumnInfo createLookupColumnInfo(TableInfo[] tableInfos, protected ColumnInfo createLookupColumnInfo(TableInfo[] tableInfos,
GridField gridField, MInfoColumn infoColumn) { GridField gridField, MInfoColumn infoColumn) {
String columnName = gridField.getColumnName(); String columnName = gridField.getColumnName();
String validationCode = ""; String validationCode = "";
@ -801,7 +801,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return sql; return sql;
} }
private MInfoColumn findInfoColumn(GridField gridField) { protected MInfoColumn findInfoColumn(GridField gridField) {
for(int i = 0; i < gridFields.size(); i++) { for(int i = 0; i < gridFields.size(); i++) {
if (gridFields.get(i) == gridField) { if (gridFields.get(i) == gridField) {
return infoColumns[i]; return infoColumns[i];
@ -1138,7 +1138,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
dynamicDisplay(null); dynamicDisplay(null);
} }
private void evalDisplayLogic() { protected void evalDisplayLogic() {
for(WEditor editor : editors) { for(WEditor editor : editors) {
if (editor.getGridField() != null && !editor.getGridField().isDisplayed(true)) { if (editor.getGridField() != null && !editor.getGridField().isDisplayed(true)) {
editor.getComponent().setVisible(false); editor.getComponent().setVisible(false);
@ -1256,7 +1256,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
panel.appendChild(fieldEditor); panel.appendChild(fieldEditor);
} }
private void createAndCheckbox() { protected void createAndCheckbox() {
checkAND = new Checkbox(); checkAND = new Checkbox();
checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND", true)); checkAND.setLabel(Msg.getMsg(Env.getCtx(), "SearchAND", true));
String tips = Msg.getMsg(Env.getCtx(), "SearchAND", false); String tips = Msg.getMsg(Env.getCtx(), "SearchAND", false);
@ -1502,7 +1502,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* Test Row Count * Test Row Count
* @return true if display * @return true if display
*/ */
private boolean testCount(boolean promptError) protected boolean testCount(boolean promptError)
{ {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
String dynWhere = getSQLWhere(); String dynWhere = getSQLWhere();
@ -1640,7 +1640,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @author xolali IDEMPIERE-1045 * @author xolali IDEMPIERE-1045
* refresh(Object obj, EmbedWinInfo relatedInfo) * refresh(Object obj, EmbedWinInfo relatedInfo)
*/ */
private void refresh(Object obj, EmbedWinInfo relatedInfo) protected void refresh(Object obj, EmbedWinInfo relatedInfo)
{ {
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
sql.append(relatedInfo.getInfoSql()); // delete get sql method from MInfoWindow sql.append(relatedInfo.getInfoSql()); // delete get sql method from MInfoWindow
@ -1703,7 +1703,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @author xolali IDEMPIERE-1045 * @author xolali IDEMPIERE-1045
* GridField getGridField(MInfoColumn infoColumn) * GridField getGridField(MInfoColumn infoColumn)
*/ */
private GridField getGridField(MInfoColumn infoColumn){ protected GridField getGridField(MInfoColumn infoColumn){
String columnName = infoColumn.getColumnName(); String columnName = infoColumn.getColumnName();
GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0, GridFieldVO vo = GridFieldVO.createParameter(infoContext, p_WindowNo, 0,
columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(), columnName, infoColumn.get_Translation("Name"), infoColumn.getAD_Reference_ID(),
@ -1725,7 +1725,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return gridField; return gridField;
} }
private ArrayList<Object> readData(ResultSet rs, ColumnInfo[] p_layout) throws SQLException { protected ArrayList<Object> readData(ResultSet rs, ColumnInfo[] p_layout) throws SQLException {
int colOffset = 1; // columns start with 1 int colOffset = 1; // columns start with 1
ArrayList<Object> data = new ArrayList<Object>(); ArrayList<Object> data = new ArrayList<Object>();

View File

@ -123,7 +123,7 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor
* M_AttributeSet pa * M_AttributeSet pa
* </code> * </code>
*/ */
private void cmd_InfoPAttribute() protected void cmd_InfoPAttribute()
{ {
int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID"); int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID");
final InfoPAttributePanel ia = new InfoPAttributePanel(attributeSetId); final InfoPAttributePanel ia = new InfoPAttributePanel(attributeSetId);

View File

@ -664,6 +664,9 @@ public class LoginPanel extends Window implements EventListener<Event>
/** get default languages from the browser */ /** get default languages from the browser */
private List<String> browserLanguages(String header) { private List<String> browserLanguages(String header) {
List<String> arrstr = new ArrayList<String>(); List<String> arrstr = new ArrayList<String>();
if (header == null)
return arrstr;
for (String str : header.split(",")){ for (String str : header.split(",")){
String[] arr = str.trim().replace("-", "_").split(";"); String[] arr = str.trim().replace("-", "_").split(";");

View File

@ -400,12 +400,18 @@ public class ReportAction implements EventListener<Event>
re.createXML(sw); re.createXML(sw);
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("csv") || ext.equals("ssv")) else if (ext.equals("csv"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
re.createCSV(sw, ',', re.getPrintFormat().getLanguage()); re.createCSV(sw, ',', re.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("ssv"))
{
StringWriter sw = new StringWriter();
re.createCSV(sw, ';', re.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes();
}
else if (ext.equals("txt")) else if (ext.equals("txt"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();

View File

@ -13,6 +13,9 @@
package org.adempiere.webui.part; package org.adempiere.webui.part;
import java.util.List;
import org.adempiere.webui.component.Menupopup;
import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
@ -21,11 +24,14 @@ import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.panel.IHelpContext; import org.adempiere.webui.panel.IHelpContext;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.compiere.model.X_AD_CtxHelp; import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.SwipeEvent; import org.zkoss.zk.ui.event.SwipeEvent;
import org.zkoss.zul.Menuitem;
/** /**
* *
@ -128,7 +134,7 @@ public class WindowContainer extends AbstractUIPart
*/ */
public Tab insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable) public Tab insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable)
{ {
Tab tab = new Tab(); final Tab tab = new Tab();
if (title != null) if (title != null)
{ {
setTabTitle(title, tab); setTabTitle(title, tab);
@ -199,6 +205,63 @@ public class WindowContainer extends AbstractUIPart
setSelectedTab(tab); setSelectedTab(tab);
} }
Menupopup popupClose = new Menupopup();
Menuitem mi;
if(tab.getIndex()!=0){
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "Close"));
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int currentTabIndex = tab.getIndex();
int tabsSizeBeforeClose = tabbox.getTabs().getChildren().size();
if ( tabsSizeBeforeClose == currentTabIndex + 1 ) {
currentTabIndex--;
}
if ( tab.getPreviousSibling() != null ) {
tab.onClose();
// Update the current tab index.
if ( tabsSizeBeforeClose != tabbox.getTabs().getChildren().size() )
tabbox.setSelectedIndex( currentTabIndex );
}
}
});
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseOtherWindows"));
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int focusTabIndex = 1;
List<Component> tabs = tabbox.getTabs().getChildren();
for ( int i = tabs.size() - 1; i > 0; i-- ) {
if(!((Tab)tabs.get( i )).equals(tab)){
((Tab)tabs.get( i )).setSelected(false);
((Tab)tabs.get( i )).onClose();
}
}
tabbox.setSelectedIndex(focusTabIndex);
}
});
}
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseAllWindows"));
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int focusTabIndex = 0;
List<Component> tabs = tabbox.getTabs().getChildren();
for ( int i = tabs.size() - 1; i > 0; i-- ) {
((Tab)tabs.get( i )).setSelected(false);
((Tab)tabs.get( i )).onClose();
}
tabbox.setSelectedIndex( focusTabIndex );
}
});
popupClose.appendChild(mi);
popupClose.setWidth("auto");
popupClose.setPage(tab.getPage());
tab.setContext(popupClose);
return tab; return tab;
} }

View File

@ -14,6 +14,7 @@ import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRCsvExporter; import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRCsvExporterParameter;
import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRHtmlExporterParameter; import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
import net.sf.jasperreports.engine.export.JRPdfExporter; import net.sf.jasperreports.engine.export.JRPdfExporter;
@ -57,7 +58,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
/** /**
* *
*/ */
private static final long serialVersionUID = -8378226782387071338L; private static final long serialVersionUID = -1250003381099609830L;
private JasperPrint jasperPrint; private JasperPrint jasperPrint;
private Listbox previewType = new Listbox(); private Listbox previewType = new Listbox();
@ -103,6 +104,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
previewType.appendItem("HTML", "HTML"); previewType.appendItem("HTML", "HTML");
previewType.appendItem("Excel", "XLS"); previewType.appendItem("Excel", "XLS");
previewType.appendItem("CSV", "CSV"); previewType.appendItem("CSV", "CSV");
previewType.appendItem("SSV", "SSV");
if ("PDF".equals(defaultType)) { if ("PDF".equals(defaultType)) {
previewType.setSelectedIndex(0); previewType.setSelectedIndex(0);
} else if ("HTML".equals(defaultType)) { } else if ("HTML".equals(defaultType)) {
@ -111,6 +113,8 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
previewType.setSelectedIndex(2); previewType.setSelectedIndex(2);
} else if ("CSV".equals(defaultType)) { } else if ("CSV".equals(defaultType)) {
previewType.setSelectedIndex(3); previewType.setSelectedIndex(3);
} else if ("SSV".equals(defaultType)) {
previewType.setSelectedIndex(4);
} else { } else {
previewType.setSelectedIndex(0); previewType.setSelectedIndex(0);
log.info("Format not Valid: "+defaultType); log.info("Format not Valid: "+defaultType);
@ -126,6 +130,8 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
previewType.setSelectedIndex(0); // default to PDF if cannot export previewType.setSelectedIndex(0); // default to PDF if cannot export
} else if ("CSV".equals(defaultType)) { } else if ("CSV".equals(defaultType)) {
previewType.setSelectedIndex(0); // default to PDF if cannot export previewType.setSelectedIndex(0); // default to PDF if cannot export
} else if ("SSV".equals(defaultType)) {
previewType.setSelectedIndex(0); // default to PDF if cannot export
} else { } else {
previewType.setSelectedIndex(0); previewType.setSelectedIndex(0);
log.info("Format not Valid: "+defaultType); log.info("Format not Valid: "+defaultType);
@ -292,6 +298,23 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
exporter.exportReport(); exporter.exportReport();
media = new AMedia(m_title, "csv", "application/csv", file, true); media = new AMedia(m_title, "csv", "application/csv", file, true);
}else if ("SSV".equals(reportType)) {
String path = System.getProperty("java.io.tmpdir");
String prefix = makePrefix(jasperPrint.getName());
if (log.isLoggable(Level.FINE))
{
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".ssv", new File(path));
FileOutputStream fos = new FileOutputStream(file);
JRCsvExporter exporter= new JRCsvExporter();
exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";");
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, fos);
exporter.exportReport();
media = new AMedia(m_title, "ssv", "application/ssv", file, true);
} }
} finally { } finally {
Thread.currentThread().setContextClassLoader(cl); Thread.currentThread().setContextClassLoader(cl);

View File

@ -948,12 +948,18 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
m_reportEngine.createXML(sw); m_reportEngine.createXML(sw);
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("csv") || ext.equals("ssv")) else if (ext.equals("csv"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage()); m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes(); data = sw.getBuffer().toString().getBytes();
} }
else if (ext.equals("ssv"))
{
StringWriter sw = new StringWriter();
m_reportEngine.createCSV(sw, ';', m_reportEngine.getPrintFormat().getLanguage());
data = sw.getBuffer().toString().getBytes();
}
else if (ext.equals("txt")) else if (ext.equals("txt"))
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();