Task 1001118 - Link end-of-process to next window

This commit is contained in:
Rajesh.Rajesh-VAIO 2012-08-22 13:47:50 +05:30
parent d5ef3c327a
commit 1b9067d23f
16 changed files with 285 additions and 33 deletions

View File

@ -0,0 +1,36 @@
-- Aug 19, 2012 3:41:46 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES (0,578,200320,'U','N','N','N',0,'N',14,'N',19,'N','N',126,'N','Y','f0b8be7d-2a2a-4c1e-a4b6-d6fe23e4c771','N','Y','N','AD_Table_ID','Database Table information','The Database Table provides the information of the table definition','Table','Y',100,TO_DATE('2012-08-19 15:41:44','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-08-19 15:41:44','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Aug 19, 2012 3:41:46 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200320 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Aug 19, 2012 3:42:25 PM IST
-- Link end-of-process to next window
ALTER TABLE AD_PInstance_Log ADD AD_Table_ID NUMBER(10) DEFAULT NULL
;
-- Aug 19, 2012 3:44:14 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES (0,578,200321,'U','N','N','N',0,'N',14,'N',11,'N','N',538,'N','Y','dcf3a178-7018-4e7d-b449-cf852fb97390','N','Y','N','Record_ID','Direct internal record ID','The Record ID is the internal unique identifier of a record. Please note that zooming to the record may not be successful for Orders, Invoices and Shipment/Receipts as sometimes the Sales Order type is not known.','Record ID','Y',100,TO_DATE('2012-08-19 15:44:13','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-08-19 15:44:13','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Aug 19, 2012 3:44:14 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200321 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Aug 19, 2012 3:45:16 PM IST
-- Link end-of-process to next window
ALTER TABLE AD_PInstance_Log ADD Record_ID NUMBER(10) DEFAULT NULL
;
UPDATE AD_System
SET LastMigrationScriptApplied='887_LinkEndOfProcess.sql'
WHERE LastMigrationScriptApplied<'887_LinkEndOfProcess.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,37 @@
-- Aug 19, 2012 3:40:16 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES (0,578,200320,'U','N','N','N',0,'N',14,'N',19,'N','N',126,'N','Y','f0b8be7d-2a2a-4c1e-a4b6-d6fe23e4c771','N','Y','N','AD_Table_ID','Database Table information','The Database Table provides the information of the table definition','Table','Y',100,TO_TIMESTAMP('2012-08-19 15:41:44','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-08-19 15:41:44','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Aug 19, 2012 3:41:46 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200320 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Aug 19, 2012 3:42:25 PM IST
-- Link end-of-process to next window
ALTER TABLE AD_PInstance_Log ADD COLUMN AD_Table_ID NUMERIC(10) DEFAULT NULL
;
-- Aug 19, 2012 3:44:14 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES (0,578,200321,'U','N','N','N',0,'N',14,'N',11,'N','N',538,'N','Y','dcf3a178-7018-4e7d-b449-cf852fb97390','N','Y','N','Record_ID','Direct internal record ID','The Record ID is the internal unique identifier of a record. Please note that zooming to the record may not be successful for Orders, Invoices and Shipment/Receipts as sometimes the Sales Order type is not known.','Record ID','Y',100,TO_TIMESTAMP('2012-08-19 15:44:13','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-08-19 15:44:13','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Aug 19, 2012 3:44:14 PM IST
-- Link end-of-process to next window
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200321 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Aug 19, 2012 3:45:16 PM IST
-- Link end-of-process to next window
ALTER TABLE AD_PInstance_Log ADD COLUMN Record_ID NUMERIC(10) DEFAULT NULL
;
UPDATE AD_System
SET LastMigrationScriptApplied='887_LinkEndOfProcess.sql'
WHERE LastMigrationScriptApplied<'887_LinkEndOfProcess.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -255,7 +255,8 @@ public class InOutGenerateRMA extends SvrProcess
} }
// Add processing information to process log // Add processing information to process log
addLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString()); addLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString(),shipment.get_Table_ID(),shipment.getM_InOut_ID()
);
m_created++; m_created++;
} }

View File

@ -216,7 +216,7 @@ public class InvoiceGenerateRMA extends SvrProcess
} }
// Add processing information to process log // Add processing information to process log
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, processMsg.toString()); addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, processMsg.toString(),invoice.get_Table_ID(),invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
} }

View File

@ -396,7 +396,7 @@ public class AllocationAuto extends SvrProcess
{ {
if (payment.allocateIt()) if (payment.allocateIt())
{ {
addLog(0, payment.getDateAcct(), openAmt, payment.getDocumentNo() + " [1]"); addLog(0, payment.getDateAcct(), openAmt, payment.getDocumentNo() + " [1]",payment.get_Table_ID(),payment.getC_Payment_ID());
count++; count++;
} }
break; break;

View File

@ -584,8 +584,7 @@ public class InOutGenerate extends SvrProcess
} }
m_shipment.saveEx(); m_shipment.saveEx();
// addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo(),m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID());
addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo());
m_created++; m_created++;
//reset storage cache as MInOut.completeIt will update m_storage //reset storage cache as MInOut.completeIt will update m_storage

View File

@ -162,7 +162,7 @@ public class InvoiceBatchProcess extends SvrProcess
} }
m_invoice.saveEx(); m_invoice.saveEx();
addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), m_invoice.getDocumentNo()); addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), m_invoice.getDocumentNo(),m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID());
m_count++; m_count++;
m_invoice = null; m_invoice = null;

View File

@ -267,7 +267,7 @@ public class InvoiceGenerate extends SvrProcess
if (completeOrder && !fullyDelivered) if (completeOrder && !fullyDelivered)
{ {
log.fine("Failed CompleteOrder - " + oLine); log.fine("Failed CompleteOrder - " + oLine);
addLog("Failed CompleteOrder - " + oLine); // Elaine 2008/11/25 addLog(0, null, null,"Failed CompleteOrder - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); // Elaine 2008/11/25
completeOrder = false; completeOrder = false;
break; break;
} }
@ -287,8 +287,8 @@ public class InvoiceGenerate extends SvrProcess
{ {
log.fine("Failed: " + order.getInvoiceRule() log.fine("Failed: " + order.getInvoiceRule()
+ " - ToInvoice=" + toInvoice + " - " + oLine); + " - ToInvoice=" + toInvoice + " - " + oLine);
addLog("Failed: " + order.getInvoiceRule() addLog(0, null, null,"Failed: " + order.getInvoiceRule()
+ " - ToInvoice=" + toInvoice + " - " + oLine); + " - ToInvoice=" + toInvoice + " - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID());
} }
} // for all order lines } // for all order lines
if (MOrder.INVOICERULE_Immediate.equals(order.getInvoiceRule())) if (MOrder.INVOICERULE_Immediate.equals(order.getInvoiceRule()))
@ -491,13 +491,13 @@ public class InvoiceGenerate extends SvrProcess
if (!m_invoice.processIt(p_docAction)) if (!m_invoice.processIt(p_docAction))
{ {
log.warning("completeInvoice - failed: " + m_invoice); log.warning("completeInvoice - failed: " + m_invoice);
addLog("completeInvoice - failed: " + m_invoice); // Elaine 2008/11/25 addLog(0, null, null,"completeInvoice - failed: " + m_invoice,m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); // Elaine 2008/11/25
throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg());
} }
m_invoice.saveEx(); m_invoice.saveEx();
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, m_invoice.getDocumentNo()); addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, m_invoice.getDocumentNo(),m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
m_invoice = null; m_invoice = null;

View File

@ -208,7 +208,7 @@ public class OrderPOCreate extends SvrProcess
if (po == null || po.getBill_BPartner_ID() != C_BPartner_ID) if (po == null || po.getBill_BPartner_ID() != C_BPartner_ID)
{ {
po = createPOForVendor(rs.getInt(1), so); po = createPOForVendor(rs.getInt(1), so);
addLog(0, null, null, po.getDocumentNo()); addLog(0, null, null, po.getDocumentNo(),po.get_Table_ID(),po.getC_Order_ID());
counter++; counter++;
} }

View File

@ -184,7 +184,7 @@ public class RequestInvoice extends SvrProcess
} }
m_invoice.saveEx(); m_invoice.saveEx();
addLog(0, null, m_invoice.getGrandTotal(), m_invoice.getDocumentNo()); addLog(0, null, m_invoice.getGrandTotal(), m_invoice.getDocumentNo(),m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID());
} }
} }
m_invoice = null; m_invoice = null;

View File

@ -380,7 +380,7 @@ public class RequisitionPOCreate extends SvrProcess
if (m_order != null) if (m_order != null)
{ {
m_order.load(get_TrxName()); m_order.load(get_TrxName());
addLog(0, null, m_order.getGrandTotal(), m_order.getDocumentNo()); addLog(0, null, m_order.getGrandTotal(), m_order.getDocumentNo(),m_order.get_Table_ID(),m_order.getC_Order_ID());
} }
m_order = null; m_order = null;
m_orderLine = null; m_orderLine = null;

View File

@ -23,6 +23,8 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import org.compiere.model.MQuery;
import org.compiere.model.MTable;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Ini; import org.compiere.util.Ini;
@ -298,6 +300,8 @@ public class ProcessInfo implements Serializable
return sb.toString(); return sb.toString();
} // getLogInfo } // getLogInfo
/** /**
* Get ASCII Log Info * Get ASCII Log Info
* @return Log Info * @return Log Info
@ -519,6 +523,16 @@ public class ProcessInfo implements Serializable
} // setParameter } // setParameter
public void addLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg,int tableId,int recordId)
{
addLog (new ProcessInfoLog (Log_ID, P_ID, P_Date, P_Number, P_Msg,tableId,recordId));
}
public void addLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg ,int tableId,int recordId)
{
addLog (new ProcessInfoLog (P_ID, P_Date, P_Number, P_Msg,tableId, recordId));
}
/************************************************************************** /**************************************************************************
* Add to Log * Add to Log
* @param Log_ID Log ID * @param Log_ID Log ID

View File

@ -33,7 +33,29 @@ public class ProcessInfoLog implements Serializable
*/ */
private static final long serialVersionUID = -4064380205358897097L; private static final long serialVersionUID = -4064380205358897097L;
/**
* Create Process Info Log.
* @param P_ID Process ID
* @param P_Date Process Date
* @param P_Number Process Number
* @param P_Msg Process Messagre
*/
public ProcessInfoLog (int Log_ID,int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, int AD_Table_ID ,int Record_ID)
{
setLog_ID (Log_ID);
setP_ID (P_ID);
setP_Date (P_Date);
setP_Number (P_Number);
setP_Msg (P_Msg);
setAd_Table_Id(AD_Table_ID);
setRecord_Id(Record_ID);
} // ProcessInfoLog
public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg , int AD_Table_ID ,int Record_ID)
{
this (s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, AD_Table_ID,Record_ID);
}
/** /**
* Create Process Info Log. * Create Process Info Log.
@ -44,7 +66,7 @@ public class ProcessInfoLog implements Serializable
*/ */
public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg) public ProcessInfoLog (int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{ {
this (s_Log_ID++, P_ID, P_Date, P_Number, P_Msg); this (s_Log_ID++, P_ID, P_Date, P_Number, P_Msg, 0,0);
} // ProcessInfoLog } // ProcessInfoLog
/** /**
@ -57,11 +79,7 @@ public class ProcessInfoLog implements Serializable
*/ */
public ProcessInfoLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg) public ProcessInfoLog (int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg)
{ {
setLog_ID (Log_ID); this (Log_ID, P_ID, P_Date, P_Number, P_Msg, 0,0);
setP_ID (P_ID);
setP_Date (P_Date);
setP_Number (P_Number);
setP_Msg (P_Msg);
} // ProcessInfoLog } // ProcessInfoLog
private static int s_Log_ID = 0; private static int s_Log_ID = 0;
@ -71,9 +89,24 @@ public class ProcessInfoLog implements Serializable
private Timestamp m_P_Date; private Timestamp m_P_Date;
private BigDecimal m_P_Number; private BigDecimal m_P_Number;
private String m_P_Msg; private String m_P_Msg;
private int m_AD_Table_ID;
private int m_Record_ID;
public int getAd_Table_Id() {
return m_AD_Table_ID;
}
public void setAd_Table_Id(int tableId) {
this.m_AD_Table_ID = tableId;
}
public int getRecord_Id() {
return m_Record_ID;
}
public void setRecord_Id(int recordId) {
this.m_Record_ID = recordId;
}
/** /**
* Get Log_ID * Get Log_ID
* @return id * @return id

View File

@ -115,7 +115,7 @@ public class ProcessInfoUtil
public static void setLogFromDB (ProcessInfo pi) public static void setLogFromDB (ProcessInfo pi)
{ {
// s_log.fine("setLogFromDB - AD_PInstance_ID=" + pi.getAD_PInstance_ID()); // s_log.fine("setLogFromDB - AD_PInstance_ID=" + pi.getAD_PInstance_ID());
String sql = "SELECT Log_ID, P_ID, P_Date, P_Number, P_Msg " String sql = "SELECT Log_ID, P_ID, P_Date, P_Number, P_Msg, AD_Table_Id,Record_Id "
+ "FROM AD_PInstance_Log " + "FROM AD_PInstance_Log "
+ "WHERE AD_PInstance_ID=? " + "WHERE AD_PInstance_ID=? "
+ "ORDER BY Log_ID"; + "ORDER BY Log_ID";
@ -125,9 +125,9 @@ public class ProcessInfoUtil
PreparedStatement pstmt = DB.prepareStatement(sql, null); PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, pi.getAD_PInstance_ID()); pstmt.setInt(1, pi.getAD_PInstance_ID());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next()){
// int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg pi.addLog (rs.getInt(1), rs.getInt(2), rs.getTimestamp(3), rs.getBigDecimal(4), rs.getString(5),rs.getInt(6),rs.getInt(7));
pi.addLog (rs.getInt(1), rs.getInt(2), rs.getTimestamp(3), rs.getBigDecimal(4), rs.getString(5)); }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
} }
@ -157,7 +157,7 @@ public class ProcessInfoUtil
for (int i = 0; i < logs.length; i++) for (int i = 0; i < logs.length; i++)
{ {
StringBuffer sql = new StringBuffer ("INSERT INTO AD_PInstance_Log " StringBuffer sql = new StringBuffer ("INSERT INTO AD_PInstance_Log "
+ "(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg)" + "(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg, AD_Table_Id,Record_ID)"
+ " VALUES ("); + " VALUES (");
sql.append(pi.getAD_PInstance_ID()).append(",") sql.append(pi.getAD_PInstance_ID()).append(",")
.append(logs[i].getLog_ID()).append(","); .append(logs[i].getLog_ID()).append(",");
@ -174,10 +174,18 @@ public class ProcessInfoUtil
else else
sql.append(logs[i].getP_Number()).append(","); sql.append(logs[i].getP_Number()).append(",");
if (logs[i].getP_Msg() == null) if (logs[i].getP_Msg() == null)
sql.append("NULL,");
else
sql.append(DB.TO_STRING(logs[i].getP_Msg(),2000)).append(",");
if (logs[i].getAd_Table_Id() == 0)
sql.append("NULL,");
else
sql.append(logs[i].getAd_Table_Id()).append(",");
if (logs[i].getRecord_Id() == 0)
sql.append("NULL)"); sql.append("NULL)");
else else
sql.append(DB.TO_STRING(logs[i].getP_Msg(),2000)).append(")"); sql.append(logs[i].getRecord_Id()).append(")");
// //
DB.executeUpdate(sql.toString(), null); DB.executeUpdate(sql.toString(), null);
} }
pi.setLogList(null); // otherwise log entries are twice pi.setLogList(null); // otherwise log entries are twice

View File

@ -427,6 +427,18 @@ public abstract class SvrProcess implements ProcessCall
} // getParameter } // getParameter
/**************************************************************************
* Add Log Entry with table name
*
*/
public void addLog (int id, Timestamp date, BigDecimal number, String msg, int tableId ,int recordId)
{
if (m_pi != null)
m_pi.addLog(id, date, number, msg,tableId,recordId);
log.info(id + " - " + date + " - " + number + " - " + msg +" - "+tableId);
} // addLog
/************************************************************************** /**************************************************************************
* Add Log Entry * Add Log Entry
* @param date date or null * @param date date or null
@ -437,7 +449,7 @@ public abstract class SvrProcess implements ProcessCall
public void addLog (int id, Timestamp date, BigDecimal number, String msg) public void addLog (int id, Timestamp date, BigDecimal number, String msg)
{ {
if (m_pi != null) if (m_pi != null)
m_pi.addLog(id, date, number, msg); m_pi.addLog(id, date, number, msg );
log.info(id + " - " + date + " - " + number + " - " + msg); log.info(id + " - " + date + " - " + number + " - " + msg);
} // addLog } // addLog

View File

@ -1,11 +1,15 @@
package org.adempiere.webui.apps; package org.adempiere.webui.apps;
import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATE;
import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATE;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -27,14 +31,20 @@ import org.adempiere.webui.window.FDialog;
import org.adempiere.webui.window.MultiFileDownloadDialog; import org.adempiere.webui.window.MultiFileDownloadDialog;
import org.adempiere.webui.window.SimplePDFViewer; import org.adempiere.webui.window.SimplePDFViewer;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import static org.compiere.model.SystemIDs.*; import org.compiere.model.MQuery;
import org.compiere.model.MTable;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoLog;
import org.compiere.process.ProcessInfoUtil; import org.compiere.process.ProcessInfoUtil;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Desktop;
@ -43,13 +53,15 @@ 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.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.A;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Html; import org.zkoss.zul.Html;
import org.zkoss.zul.Label;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import com.lowagie.text.Document; import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfContentByte;
@ -93,6 +105,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto"; private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto";
private Div messageDiv; private Div messageDiv;
private Center center; private Center center;
private Table logMessageTable;
private North north; private North north;
private List<File> downloadFiles; private List<File> downloadFiles;
@ -357,6 +370,10 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
public void onEvent(Event event) { public void onEvent(Event event) {
Component component = event.getTarget(); Component component = event.getTarget();
if(event.getName().equals((Events.ON_CLICK))){
doOnClick(component);
}
if (component instanceof Button) { if (component instanceof Button) {
Button element = (Button)component; Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId())) { if ("Ok".equalsIgnoreCase(element.getId())) {
@ -378,6 +395,30 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
} }
private void doOnClick(Component comp) {
if (comp instanceof A)
{
A btn = (A) comp;
int Record_ID = 0;
int AD_Table_ID =0;
try
{
Record_ID = Integer.valueOf((String)btn.getAttribute("Record_ID"));
AD_Table_ID= Integer.valueOf((String)btn.getAttribute("AD_Table_ID"));
}
catch (Exception e) {
}
if (Record_ID > 0 && AD_Table_ID > 0) {
AEnv.zoom(AD_Table_ID, Record_ID);
}
}
}
public void lockUI(ProcessInfo pi) { public void lockUI(ProcessInfo pi) {
if (m_isLocked || Executions.getCurrent() == null) return; if (m_isLocked || Executions.getCurrent() == null) return;
@ -412,8 +453,9 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
m_messageText.append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ") m_messageText.append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ")
.append(pi.getSummary()) .append(pi.getSummary())
.append("</font></p>"); .append("</font></p>");
m_messageText.append(pi.getLogInfo(true));
message.setContent(m_messageText.toString()); message.setContent(m_messageText.toString());
// Add Log info with zoom on record id
appendRecordLogInfo(pi.getLogs());
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter")); bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter"));
bOK.setImage("/images/Reset16.png"); bOK.setImage("/images/Reset16.png");
@ -430,6 +472,73 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
invalidate(); invalidate();
Clients.response(new AuEcho(this, "onAfterProcess", null)); Clients.response(new AuEcho(this, "onAfterProcess", null));
}
private void appendRecordLogInfo(ProcessInfoLog[] m_logs) {
// TODO Auto-generated method stub
System.out.println("********************************");
if (m_logs == null)
return ;
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
logMessageTable = new Table();
logMessageTable.setId("logrecords");
logMessageTable.setDynamicProperty("border", "1");
logMessageTable.setDynamicProperty("cellpadding", "0");
logMessageTable.setDynamicProperty("cellspacing", "0");
logMessageTable.setDynamicProperty("width", "100%");
this.appendChild(logMessageTable);
for (int i = 0; i < m_logs.length; i++)
{
Tr tr = new Tr();
logMessageTable.appendChild(tr);
ProcessInfoLog log = m_logs[i];
if (log.getP_Date() != null){
Label label = new Label(dateFormat.format(log.getP_Date()));
//label.setStyle("padding-right:100px");
Td td = new Td();
td = new Td();
td.appendChild(label);
tr.appendChild(td);
}
if (log.getP_Number() != null){
Label labelPno= new Label(""+log.getP_Number());
Td td = new Td();
td.appendChild(labelPno);
tr.appendChild(td);
}
A btnrecentItem = null;
if (log.getP_Msg() != null){
btnrecentItem = new A();
btnrecentItem.setLabel(log.getP_Msg());
if (log.getAd_Table_Id() > 0 && log.getRecord_Id()> 0) {
btnrecentItem.setAttribute("Record_ID", String.valueOf(log.getRecord_Id()));
btnrecentItem.setAttribute("AD_Table_ID", String.valueOf(log.getAd_Table_Id()));
btnrecentItem.addEventListener(Events.ON_CLICK, this);
}
Td td = new Td();
td.appendChild(btnrecentItem);
tr.appendChild(td);
}
}
messageDiv.appendChild(logMessageTable);
} }
private void restart() { private void restart() {
@ -438,6 +547,9 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
north.setVisible(true); north.setVisible(true);
messageDiv.detach(); messageDiv.detach();
if(logMessageTable!=null){
messageDiv.removeChild(logMessageTable);
}
messageDiv.setStyle(MESSAGE_DIV_STYLE); messageDiv.setStyle(MESSAGE_DIV_STYLE);
north.appendChild(messageDiv); north.appendChild(messageDiv);