merge development into experimental
This commit is contained in:
commit
f40a8cd310
|
@ -257,34 +257,38 @@ public class InitialClientSetup extends SvrProcess
|
|||
|
||||
// Process
|
||||
MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS);
|
||||
try {
|
||||
if (! ms.createClient(p_ClientName, p_OrgValue, p_OrgName, p_AdminUserName, p_NormalUserName
|
||||
, p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail)) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("Create client failed");
|
||||
}
|
||||
|
||||
addLog(ms.getInfo());
|
||||
|
||||
if (! ms.createClient(p_ClientName, p_OrgValue, p_OrgName, p_AdminUserName, p_NormalUserName
|
||||
, p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail)) {
|
||||
// Generate Accounting
|
||||
MCurrency currency = MCurrency.get(getCtx(), p_C_Currency_ID);
|
||||
KeyNamePair currency_kp = new KeyNamePair(p_C_Currency_ID, currency.getDescription());
|
||||
if (!ms.createAccounting(currency_kp,
|
||||
p_IsUseProductDimension, p_IsUseBPDimension, p_IsUseProjectDimension, p_IsUseCampaignDimension, p_IsUseSalesRegionDimension, p_IsUseActivityDimension,
|
||||
coaFile, p_UseDefaultCoA, p_InactivateDefaults)) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("@AccountSetupError@");
|
||||
}
|
||||
|
||||
// Generate Entities
|
||||
if (!ms.createEntities(p_C_Country_ID, p_CityName, p_C_Region_ID, p_C_Currency_ID, p_Postal, p_Address1)) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("@AccountSetupError@");
|
||||
}
|
||||
addLog(ms.getInfo());
|
||||
|
||||
// Create Print Documents
|
||||
PrintUtil.setupPrintForm(ms.getAD_Client_ID());
|
||||
} catch (Exception e) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("Create client failed");
|
||||
throw e;
|
||||
}
|
||||
|
||||
addLog(ms.getInfo());
|
||||
|
||||
// Generate Accounting
|
||||
MCurrency currency = MCurrency.get(getCtx(), p_C_Currency_ID);
|
||||
KeyNamePair currency_kp = new KeyNamePair(p_C_Currency_ID, currency.getDescription());
|
||||
if (!ms.createAccounting(currency_kp,
|
||||
p_IsUseProductDimension, p_IsUseBPDimension, p_IsUseProjectDimension, p_IsUseCampaignDimension, p_IsUseSalesRegionDimension, p_IsUseActivityDimension,
|
||||
coaFile, p_UseDefaultCoA, p_InactivateDefaults)) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("@AccountSetupError@");
|
||||
}
|
||||
|
||||
// Generate Entities
|
||||
if (!ms.createEntities(p_C_Country_ID, p_CityName, p_C_Region_ID, p_C_Currency_ID, p_Postal, p_Address1)) {
|
||||
ms.rollback();
|
||||
throw new AdempiereException("@AccountSetupError@");
|
||||
}
|
||||
addLog(ms.getInfo());
|
||||
|
||||
// Create Print Documents
|
||||
PrintUtil.setupPrintForm(ms.getAD_Client_ID());
|
||||
|
||||
return "@OK@";
|
||||
}
|
||||
|
|
|
@ -353,8 +353,9 @@ public class ReplicationLocal extends SvrProcess
|
|||
// no keys - search for parents
|
||||
if (list.size() == 0)
|
||||
{
|
||||
DB.close(rs);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
sql = "SELECT ColumnName FROM AD_Column "
|
||||
+ "WHERE AD_Table_ID=?"
|
||||
+ " AND IsParent='Y'";
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.compiere.impexp;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.compiere.model.MBankStatementLoader;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -71,6 +72,13 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im
|
|||
{
|
||||
m_errorMessage = new StringBuffer("ErrorReadingData");
|
||||
m_errorDescription = new StringBuffer();
|
||||
}finally{
|
||||
if (m_stream != null)
|
||||
try {
|
||||
m_stream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -439,7 +439,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
|
|||
public boolean isAddressLinesReverse()
|
||||
{
|
||||
// Local
|
||||
if (getC_Country_ID() == MCountry.getDefault(getCtx()).getC_Country_ID())
|
||||
if (MCountry.getDefault(getCtx()) != null && getC_Country_ID() == MCountry.getDefault(getCtx()).getC_Country_ID())
|
||||
return getCountry().isAddressLinesLocalReverse();
|
||||
return getCountry().isAddressLinesReverse();
|
||||
} // isAddressLinesReverse
|
||||
|
@ -465,7 +465,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
|
|||
if (c == null)
|
||||
return "CountryNotFound";
|
||||
|
||||
boolean local = getC_Country_ID() == MCountry.getDefault(getCtx()).getC_Country_ID();
|
||||
boolean local = MCountry.getDefault(getCtx()) != null && getC_Country_ID() == MCountry.getDefault(getCtx()).getC_Country_ID();
|
||||
String inStr = local ? c.getDisplaySequenceLocal() : c.getDisplaySequence();
|
||||
StringBuilder outStr = new StringBuilder();
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ public class ModelValidationEngine
|
|||
*/
|
||||
public String fireModelChange (PO po, int changeType)
|
||||
{
|
||||
if (po == null || m_modelChangeListeners.size() == 0)
|
||||
if (po == null )
|
||||
return null;
|
||||
|
||||
String propertyName = po.get_TableName() + "*";
|
||||
|
@ -502,7 +502,7 @@ public class ModelValidationEngine
|
|||
*/
|
||||
public String fireDocValidate (PO po, int docTiming)
|
||||
{
|
||||
if (po == null || m_docValidateListeners.size() == 0)
|
||||
if (po == null)
|
||||
return null;
|
||||
|
||||
String propertyName = po.get_TableName() + "*";
|
||||
|
@ -688,7 +688,7 @@ public class ModelValidationEngine
|
|||
*/
|
||||
public String fireFactsValidate (MAcctSchema schema, List<Fact> facts, PO po)
|
||||
{
|
||||
if (schema == null || facts == null || po == null || m_factsValidateListeners.size() == 0)
|
||||
if (schema == null || facts == null || po == null)
|
||||
return null;
|
||||
|
||||
String propertyName = po.get_TableName() + "*";
|
||||
|
@ -715,6 +715,7 @@ public class ModelValidationEngine
|
|||
FactsEventData eventData = new FactsEventData(schema, facts, po);
|
||||
Event event = EventManager.newEvent(IEventTopics.ACCT_FACTS_VALIDATE,
|
||||
new EventProperty(EventManager.EVENT_DATA, eventData), new EventProperty("tableName", po.get_TableName()));
|
||||
EventManager.getInstance().sendEvent(event);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> errors = (List<String>) event.getProperty(IEventManager.EVENT_ERROR_MESSAGES);
|
||||
if (errors != null && !errors.isEmpty())
|
||||
|
@ -769,8 +770,6 @@ public class ModelValidationEngine
|
|||
*/
|
||||
public void fireImportValidate (ImportProcess process, PO importModel, PO targetModel, int timing)
|
||||
{
|
||||
if (m_impValidateListeners.size() == 0)
|
||||
return;
|
||||
|
||||
String propertyName = process.getImportTableName() + "*";
|
||||
ArrayList<ImportValidator> list = m_impValidateListeners.get(propertyName);
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class PO
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2731993630208549493L;
|
||||
private static final long serialVersionUID = 8237905660667141657L;
|
||||
|
||||
public static final String LOCAL_TRX_PREFIX = "POSave";
|
||||
|
||||
|
@ -1882,16 +1882,22 @@ public abstract class PO
|
|||
/** Cache */
|
||||
private static CCache<String,String> trl_cache = new CCache<String,String>("po_trl", 5);
|
||||
|
||||
public String get_Translation (String columnName, String AD_Language)
|
||||
{
|
||||
return get_Translation(columnName, AD_Language, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Translation of column (if needed).
|
||||
* It checks if the base language is used or the column is not translated.
|
||||
* If there is no translation then it fallback to original value.
|
||||
* @param columnName
|
||||
* @param AD_Language
|
||||
* @boolean reload
|
||||
* @return translated string
|
||||
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
|
||||
*/
|
||||
public String get_Translation (String columnName, String AD_Language)
|
||||
public String get_Translation (String columnName, String AD_Language, boolean reload)
|
||||
{
|
||||
//
|
||||
// Check if columnName, AD_Language is valid or table support translation (has 1 PK) => error
|
||||
|
@ -1907,7 +1913,7 @@ public abstract class PO
|
|||
|
||||
String key = get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
|
||||
String retValue = null;
|
||||
if (trl_cache.containsKey(key)) {
|
||||
if (! reload && trl_cache.containsKey(key)) {
|
||||
retValue = trl_cache.get(key);
|
||||
return retValue;
|
||||
|
||||
|
|
|
@ -1655,6 +1655,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
.append("FROM C_DocType dt, C_Order o ")
|
||||
.append("WHERE o.C_DocTypeTarget_ID=dt.C_DocType_ID")
|
||||
.append(" AND o.C_Order_ID=?");
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, C_Order_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
|
|
|
@ -265,7 +265,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
m_printFont = MPrintFont.get (format.getAD_PrintFont_ID());
|
||||
|
||||
// Print Context
|
||||
Env.setContext(m_printCtx, Page.CONTEXT_REPORTNAME, m_format.getName());
|
||||
Env.setContext(m_printCtx, Page.CONTEXT_REPORTNAME, m_format.get_Translation(MPrintFormat.COLUMNNAME_Name));
|
||||
Env.setContext(m_printCtx, Page.CONTEXT_HEADER, Env.getHeader(m_printCtx, 0));
|
||||
Env.setContext(m_printCtx, Env.LANGUAGE, m_format.getLanguage().getAD_Language());
|
||||
|
||||
|
@ -1009,6 +1009,9 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
|||
{
|
||||
if (log.isLoggable(Level.INFO)) log.info("Row=" + row);
|
||||
m_data.setRowIndex(row);
|
||||
if (row > 0)
|
||||
newPage(true, false); // break page per record when the report is a form
|
||||
|
||||
boolean somethingPrinted = true; // prevent NL of nothing printed and supress null
|
||||
// for every item
|
||||
for (int i = 0; i < m_format.getItemCount(); i++)
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.compiere.process;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.logging.Level;
|
||||
|
@ -51,9 +50,7 @@ public class FactReconciliation extends SvrProcess
|
|||
*/
|
||||
protected String doIt()
|
||||
{
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
String sql = "INSERT into T_Reconciliation " +
|
||||
"(AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, " +
|
||||
|
@ -69,8 +66,6 @@ public class FactReconciliation extends SvrProcess
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getAD_PInstance_ID());
|
||||
pstmt.setInt(2, p_Account_ID);
|
||||
|
@ -88,25 +83,26 @@ public class FactReconciliation extends SvrProcess
|
|||
" AND r.AD_PInstance_ID = t.AD_PInstance_ID) = 0 " +
|
||||
"AND t.AD_PInstance_ID = ?";
|
||||
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getAD_PInstance_ID());
|
||||
count = pstmt.executeUpdate();
|
||||
result = Msg.getMsg(getCtx(), "@Deleted@") + ": " + count;
|
||||
DB.close(pstmt);
|
||||
pstmt = null;
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getAD_PInstance_ID());
|
||||
count = pstmt.executeUpdate();
|
||||
result = Msg.getMsg(getCtx(), "@Deleted@") + ": " + count;
|
||||
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, result);
|
||||
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, result);
|
||||
|
||||
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
return e.getLocalizedMessage();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
return e.getLocalizedMessage();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
if (log.isLoggable(Level.FINE)) log.fine((System.currentTimeMillis() - m_start) + " ms");
|
||||
return "";
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.compiere.tools;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -165,32 +164,15 @@ public class Strip
|
|||
private boolean copy (File infile, File outfile)
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
try
|
||||
{
|
||||
fis = new FileInputStream(infile);
|
||||
}
|
||||
catch (FileNotFoundException fnfe)
|
||||
{
|
||||
System.err.println(fnfe);
|
||||
return false;
|
||||
}
|
||||
//
|
||||
FileOutputStream fos = null;
|
||||
try
|
||||
{
|
||||
fos = new FileOutputStream(outfile, false); // no append
|
||||
}
|
||||
catch (FileNotFoundException fnfe)
|
||||
{
|
||||
System.err.println(fnfe);
|
||||
return false;
|
||||
}
|
||||
|
||||
int noIn = 0;
|
||||
int noOut = 0;
|
||||
int noLines = 1;
|
||||
try
|
||||
{
|
||||
try{
|
||||
fis = new FileInputStream(infile);
|
||||
fos = new FileOutputStream(outfile, false); // no append
|
||||
|
||||
int noIn = 0;
|
||||
int noOut = 0;
|
||||
int noLines = 1;
|
||||
|
||||
int c;
|
||||
while ((c = fis.read()) != -1)
|
||||
{
|
||||
|
@ -203,15 +185,24 @@ public class Strip
|
|||
if (c == 13) // cr
|
||||
noLines++;
|
||||
}
|
||||
fis.close();
|
||||
fos.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
System.out.println(" read: " + noIn + ", written: " + noOut + " - lines: " + noLines);
|
||||
}catch (IOException ioe)
|
||||
{
|
||||
System.err.println(ioe);
|
||||
return false;
|
||||
}finally{
|
||||
if (fos != null)
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
if (fis != null)
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println(" read: " + noIn + ", written: " + noOut + " - lines: " + noLines);
|
||||
return true;
|
||||
} // stripIt
|
||||
|
||||
|
|
|
@ -188,6 +188,8 @@ public class CLogErrorBuffer extends Handler
|
|||
loggerName = "";
|
||||
//String className = record.getSourceClassName(); // physical class
|
||||
String methodName = record.getSourceMethodName(); //
|
||||
if (methodName == null)
|
||||
methodName = "";
|
||||
if (DB.isConnected(false)
|
||||
&& !methodName.equals("saveError")
|
||||
&& !methodName.equals("get_Value")
|
||||
|
|
|
@ -72,7 +72,7 @@ public final class EMail implements Serializable
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5857825644737211294L;
|
||||
private static final long serialVersionUID = 955264336741872361L;
|
||||
|
||||
//use in server bean
|
||||
public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
|
||||
|
@ -184,6 +184,10 @@ public final class EMail implements Serializable
|
|||
m_smtpPort = smtpPort;
|
||||
}
|
||||
|
||||
public void setAcknoledgmentReceipt(boolean ar) {
|
||||
m_acknowledgementReceipt = ar;
|
||||
}
|
||||
|
||||
/** From Address */
|
||||
private InternetAddress m_from;
|
||||
/** To Address */
|
||||
|
@ -204,7 +208,7 @@ public final class EMail implements Serializable
|
|||
private String m_smtpHost;
|
||||
private int m_smtpPort;
|
||||
private boolean m_secureSmtp;
|
||||
|
||||
private boolean m_acknowledgementReceipt;
|
||||
|
||||
/** Attachments */
|
||||
private ArrayList<DataSource> m_attachments;
|
||||
|
@ -335,6 +339,8 @@ public final class EMail implements Serializable
|
|||
//
|
||||
m_msg.setSentDate(new java.util.Date());
|
||||
m_msg.setHeader("Comments", "iDempiereMail");
|
||||
if (m_acknowledgementReceipt)
|
||||
m_msg.setHeader("Disposition-Notification-To", m_from.getAddress());
|
||||
// m_msg.setDescription("Description");
|
||||
// SMTP specifics
|
||||
//m_msg.setAllow8bitMIME(true);
|
||||
|
|
|
@ -255,6 +255,10 @@ public class GenericPOElementHandler extends AbstractElementHandler {
|
|||
{
|
||||
tableId = (Integer)detail.getProperty(DataElementParameters.AD_TABLE_ID);
|
||||
sql = (String)detail.getProperty(DataElementParameters.SQL_STATEMENT);
|
||||
if (sql == null){
|
||||
m_tableName = MTable.get(packout.getCtx().ctx, tableId).getTableName();
|
||||
sql = "SELECT * FROM " + m_tableName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -233,20 +233,25 @@ public class PackIn {
|
|||
ZipFile zf = new ZipFile(m_packageDirectory+File.separator+"blobs"+File.separator+fileName);
|
||||
Enumeration<?> e = zf.entries();
|
||||
ArrayList<File> files = new ArrayList<File>();
|
||||
while (e.hasMoreElements()) {
|
||||
ZipEntry ze = (ZipEntry) e.nextElement();
|
||||
File file = new File(m_packageDirectory + File.separator + ze.getName());
|
||||
FileOutputStream fout = new FileOutputStream(file);
|
||||
InputStream in = zf.getInputStream(ze);
|
||||
for (int c = in.read(); c != -1; c = in.read()) {
|
||||
fout.write(c);
|
||||
File[] retValue = null;
|
||||
try{
|
||||
while (e.hasMoreElements()) {
|
||||
ZipEntry ze = (ZipEntry) e.nextElement();
|
||||
File file = new File(m_packageDirectory + File.separator + ze.getName());
|
||||
FileOutputStream fout = new FileOutputStream(file);
|
||||
InputStream in = zf.getInputStream(ze);
|
||||
for (int c = in.read(); c != -1; c = in.read()) {
|
||||
fout.write(c);
|
||||
}
|
||||
in.close();
|
||||
fout.close();
|
||||
files.add(file);
|
||||
}
|
||||
in.close();
|
||||
fout.close();
|
||||
files.add(file);
|
||||
retValue = new File[files.size()];
|
||||
files.toArray(retValue);
|
||||
}catch (Exception ex){
|
||||
zf.close();
|
||||
}
|
||||
File[] retValue = new File[files.size()];
|
||||
files.toArray(retValue);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,11 +204,13 @@ public class PoFiller{
|
|||
{
|
||||
Element orgElement = element.properties.get("AD_Org_ID");
|
||||
String sAD_Org_ID = orgElement != null ? orgElement.contents.toString() : null;
|
||||
if (sAD_Org_ID != null && sAD_Org_ID.equals("0") && po.getAD_Org_ID() != 0)
|
||||
po.setAD_Org_ID(0);
|
||||
else if (sAD_Org_ID != null && sAD_Org_ID.equals("@AD_Org_ID@"))
|
||||
if (sAD_Org_ID != null && sAD_Org_ID.equals("0")) {
|
||||
if (po.getAD_Org_ID() != 0) {
|
||||
po.setAD_Org_ID(0);
|
||||
}
|
||||
} else if (sAD_Org_ID != null && sAD_Org_ID.equals("@AD_Org_ID@")) {
|
||||
po.setAD_Org_ID(Env.getAD_Org_ID(ctx.ctx));
|
||||
else {
|
||||
} else {
|
||||
if (setTableReference("AD_Client_ID") >= 0)
|
||||
setTableReference("AD_Org_ID");
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class WArchive implements EventListener<Event>
|
|||
if (allReports > 0)
|
||||
{
|
||||
m_reportsAll = new Menuitem(Msg.getMsg(Env.getCtx(), "ArchivedReportsAll")
|
||||
+ " (" + reportCount + ")");
|
||||
+ " (" + allReports + ")");
|
||||
m_reportsAll.addEventListener(Events.ON_CLICK, this);
|
||||
m_popup.appendChild(m_reportsAll);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import org.compiere.util.KeyNamePair;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -133,15 +134,25 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
{
|
||||
log.info("");
|
||||
|
||||
form = new CustomForm();
|
||||
try {
|
||||
dynInit();
|
||||
jbInit();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "init", e);
|
||||
}
|
||||
form = new CustomForm() {
|
||||
private static final long serialVersionUID = 7226661630651936293L;
|
||||
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
if (newpage != null)
|
||||
try {
|
||||
dynInit();
|
||||
jbInit();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "init", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
m_WindowNo = form.getWindowNo();
|
||||
}
|
||||
|
@ -511,6 +522,9 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
*/
|
||||
private void updateQDisplay()
|
||||
{
|
||||
if (!showQuery)
|
||||
return;
|
||||
|
||||
boolean reports = reportField.isChecked();
|
||||
if (log.isLoggable(Level.CONFIG)) log.config("Reports=" + reports);
|
||||
|
||||
|
|
|
@ -17,9 +17,11 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.model.GenericPO;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
|
@ -32,6 +34,7 @@ import org.adempiere.webui.component.Tabbox;
|
|||
import org.adempiere.webui.component.Tabpanels;
|
||||
import org.adempiere.webui.component.Tabs;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.panel.ADForm;
|
||||
import org.adempiere.webui.panel.CustomForm;
|
||||
import org.adempiere.webui.panel.IFormController;
|
||||
|
@ -46,6 +49,7 @@ import org.adempiere.webui.theme.ThemeManager;
|
|||
import org.adempiere.webui.window.FDialog;
|
||||
import org.adempiere.webui.window.ZkReportViewer;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.print.ReportEngine;
|
||||
|
@ -54,6 +58,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -86,7 +91,8 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
public ArrayList<MPrintFormatItem> pfi ;
|
||||
|
||||
private Auxheader headerPanel=new Auxheader();
|
||||
private Listbox comboReport = new Listbox();
|
||||
private WStringEditor name = new WStringEditor();
|
||||
private String tempName = "";
|
||||
private Button newPrintFormat;
|
||||
private Label selectAll;
|
||||
private Label deselectAll;
|
||||
|
@ -168,12 +174,20 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
|
||||
headerPanel.appendChild(new Separator("vertical"));
|
||||
|
||||
comboReport.setMold("select");
|
||||
fm =m_reportEngine.getPrintFormat();
|
||||
comboReport.setTooltiptext(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
|
||||
comboReport.appendItem(fm.getName(), fm.get_ID());
|
||||
headerPanel.appendChild(comboReport);
|
||||
name.setValue(fm.getName());
|
||||
|
||||
if (Env.isMultiLingualDocument(m_ctx))
|
||||
name.setValue(fm.get_Translation("Name"));
|
||||
else
|
||||
name.setValue(fm.getName());
|
||||
|
||||
headerPanel.appendChild(name.getComponent());
|
||||
headerPanel.appendChild(new Separator("vertical"));
|
||||
|
||||
name.getComponent().addEventListener(Events.ON_FOCUS, this);
|
||||
name.getComponent().addEventListener(Events.ON_BLUR, this);
|
||||
name.getComponent().addEventListener(Events.ON_OK, this);
|
||||
|
||||
newPrintFormat=new Button();
|
||||
newPrintFormat.setName("NewPrintFormat");
|
||||
|
@ -350,20 +364,68 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
onSave();
|
||||
close();
|
||||
}
|
||||
|
||||
if (event.getTarget() == name.getComponent()) {
|
||||
if (event.getName().equals(Events.ON_FOCUS))
|
||||
tempName = (String) name.getValue();
|
||||
else if (event.getName().equals(Events.ON_BLUR) || event.getName().equals(Events.ON_OK)) {
|
||||
if (!tempName.equals(name.getValue()))
|
||||
setIsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
selectAll.setVisible(oldtabidx == 0);
|
||||
deselectAll.setVisible(oldtabidx == 0);
|
||||
pipeSeparator.setVisible(oldtabidx == 0);
|
||||
}
|
||||
|
||||
private void onSave() {
|
||||
|
||||
for (MPrintFormatItem item : pfi)
|
||||
if (item.is_Changed())
|
||||
item.saveEx();
|
||||
|
||||
setIsChanged(false);
|
||||
|
||||
if (name.getValue() == null || Util.isEmpty((String) name.getValue()))
|
||||
throw new WrongValueException(name.getComponent(), Msg.getMsg(m_ctx, "FillMandatory"));
|
||||
|
||||
if (Env.isMultiLingualDocument(m_ctx)) {
|
||||
if (Env.isBaseLanguage(m_ctx, "AD_PrintFormat")) {
|
||||
if (!fm.getName().equals(name.getValue())) {
|
||||
fm.setName((String) name.getValue());
|
||||
fm.saveEx();
|
||||
tempName = (String) name.getValue();
|
||||
}
|
||||
} else {
|
||||
if (!fm.get_Translation("Name").equals(name.getValue())) {
|
||||
updateTrl();
|
||||
tempName = (String) name.getValue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!fm.getName().equals(name.getValue())) {
|
||||
fm.setName((String) name.getValue());
|
||||
fm.saveEx();
|
||||
updateTrl();
|
||||
tempName = (String) name.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
for (MPrintFormatItem item : pfi)
|
||||
if (item.is_Changed())
|
||||
item.saveEx();
|
||||
|
||||
setIsChanged(false);
|
||||
}
|
||||
|
||||
|
||||
private void updateTrl()
|
||||
{
|
||||
List<GenericPO> list = new Query(m_ctx, "AD_PrintFormat_Trl", "AD_PrintFormat_ID = ?", null)
|
||||
.setParameters(fm.getAD_PrintFormat_ID())
|
||||
.list();
|
||||
for (GenericPO trl : list) {
|
||||
trl.set_ValueOfColumn("Name", (String) name.getValue());
|
||||
trl.saveEx();
|
||||
|
||||
fm.get_Translation("Name", trl.get_ValueAsString("AD_Language"), true); // reload
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ADForm getForm() {
|
||||
return form;
|
||||
|
@ -551,9 +613,11 @@ public class WReportCustomization implements IFormController,EventListener<Even
|
|||
tpsf5.refresh();
|
||||
setIsChanged(false);
|
||||
|
||||
comboReport.removeAllItems();
|
||||
comboReport.appendItem(newpf.getName(), newpf.get_ID());
|
||||
name.setValue(newpf.getName());
|
||||
m_reportEngine.setPrintFormat(newpf);
|
||||
|
||||
newpf.saveEx();
|
||||
fm = newpf;
|
||||
}
|
||||
|
||||
public void setIsChanged(boolean change){
|
||||
|
|
|
@ -175,7 +175,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
noItems =new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i< m_pfi.size();i++){
|
||||
MPrintFormatItem item = m_pfi.get(i);
|
||||
if(item!=null && item.isPrinted()){
|
||||
if(item!=null){
|
||||
if(item.isOrderBy()){
|
||||
yesItems.add(item);
|
||||
}else{
|
||||
|
|
|
@ -49,7 +49,7 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
public void refresh() {
|
||||
orderfield = new ArrayList<MPrintFormatItem>();
|
||||
for(int i=0 ; i < m_pfi.size(); i++){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isOrderBy() && m_pfi.get(i).isPrinted()){
|
||||
if(m_pfi.get(i) != null && m_pfi.get(i).isOrderBy()){
|
||||
orderfield.add(m_pfi.get(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,12 +378,23 @@ public class CSVImportAction implements EventListener<Event>
|
|||
} catch (IOException e) {
|
||||
throw new AdempiereException(e);
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
in.close();
|
||||
if (bw != null)
|
||||
if (in != null)
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
if (bw != null)
|
||||
try {
|
||||
bw.close();
|
||||
} catch (IOException e) {}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
if (reader != null)
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
|
|
@ -29,10 +29,13 @@ import java.util.StringTokenizer;
|
|||
import java.util.logging.Level;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.activation.DataSource;
|
||||
|
||||
import org.adempiere.webui.AdempiereWebUI;
|
||||
import org.adempiere.webui.component.AttachmentItem;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
|
@ -95,7 +98,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4540369233682337505L;
|
||||
private static final long serialVersionUID = -3675260492572002393L;
|
||||
|
||||
/**
|
||||
* EMail Dialog
|
||||
|
@ -202,7 +205,8 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
|||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private Button bAddDefaultMailText;
|
||||
private Div attachmentBox;
|
||||
|
||||
private Checkbox isAcknowledgmentReceipt = new Checkbox();
|
||||
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
|
@ -227,6 +231,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
|||
lSubject.setValue(Msg.getMsg(Env.getCtx(), "Subject") + ":");
|
||||
lAttachment.setValue(Msg.getMsg(Env.getCtx(), "Attachment") + ":");
|
||||
fFrom.setReadonly(true);
|
||||
isAcknowledgmentReceipt.setLabel(Msg.getMsg(Env.getCtx(), "Acknowledge"));
|
||||
//
|
||||
|
||||
Grid grid = new Grid();
|
||||
|
@ -266,7 +271,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
|||
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(new Label(""));
|
||||
row.appendChild(isAcknowledgmentReceipt);
|
||||
row.appendChild(fTo);
|
||||
fTo.setHflex("1");
|
||||
|
||||
|
@ -522,7 +527,9 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
|||
{
|
||||
email.addAttachment(ds);
|
||||
}
|
||||
|
||||
|
||||
email.setAcknoledgmentReceipt(isAcknowledgmentReceipt.isChecked());
|
||||
|
||||
status = email.send();
|
||||
//
|
||||
if (m_user != null)
|
||||
|
|
|
@ -217,7 +217,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
}
|
||||
m_isCanExport = MRole.getDefault().isCanExport(m_AD_Table_ID);
|
||||
|
||||
setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Report") + ": " + m_reportEngine.getName()));
|
||||
setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Report") + ": " +
|
||||
m_reportEngine.getPrintFormat().get_Translation(MPrintFormat.COLUMNNAME_Name)));
|
||||
|
||||
addEventListener(ON_RENDER_REPORT_EVENT, this);
|
||||
}
|
||||
|
@ -654,7 +655,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
{
|
||||
MPrintFormat printFormat = new MPrintFormat (Env.getCtx(), rs, null);
|
||||
|
||||
KeyNamePair pp = new KeyNamePair(printFormat.get_ID(), printFormat.get_Translation(MPrintFormat.COLUMNNAME_Name));
|
||||
KeyNamePair pp = new KeyNamePair(printFormat.get_ID(), printFormat.get_Translation(MPrintFormat.COLUMNNAME_Name, Env.getAD_Language(Env.getCtx()), true));
|
||||
Listitem li = comboReport.appendItem(pp.getName(), pp.getKey());
|
||||
if (rs.getInt(1) == AD_PrintFormat_ID)
|
||||
{
|
||||
|
@ -1217,9 +1218,6 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
/*IDEMPIERE -379*/
|
||||
private void cmd_Wizard()
|
||||
{
|
||||
int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID();
|
||||
|
||||
Env.setContext(m_ctx, "AD_PrintFormat_ID", AD_PrintFormat_ID);
|
||||
ADForm form = ADForm.openForm(SystemIDs.FORM_REPORT_WIZARD);
|
||||
WReportCustomization av = (WReportCustomization) form.getICustomForm();
|
||||
av.setReportEngine(m_reportEngine);
|
||||
|
@ -1230,10 +1228,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if (DialogEvents.ON_WINDOW_CLOSE.equals(event.getName())) {
|
||||
if(m_reportEngine.getPrintFormat().get_ID()!=Env.getContextAsInt(m_ctx, "AD_PrintFormat_ID")){
|
||||
fillComboReport (m_reportEngine.getPrintFormat().get_ID());
|
||||
}
|
||||
cmd_report();
|
||||
fillComboReport (m_reportEngine.getPrintFormat().get_ID());
|
||||
cmd_report();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue