From 1b9067d23f26231bc1ea14f7d2cbb7c1c7c55cf8 Mon Sep 17 00:00:00 2001 From: "Rajesh.Rajesh-VAIO" Date: Wed, 22 Aug 2012 13:47:50 +0530 Subject: [PATCH] Task 1001118 - Link end-of-process to next window --- .../oracle/887_LinkEndOfProcess.sql | 36 ++++++ .../postgresql/887_LinkEndOfProcess.sql | 37 ++++++ .../adempiere/process/InOutGenerateRMA.java | 3 +- .../adempiere/process/InvoiceGenerateRMA.java | 2 +- .../org/compiere/process/AllocationAuto.java | 2 +- .../org/compiere/process/InOutGenerate.java | 3 +- .../compiere/process/InvoiceBatchProcess.java | 2 +- .../org/compiere/process/InvoiceGenerate.java | 10 +- .../org/compiere/process/OrderPOCreate.java | 2 +- .../org/compiere/process/RequestInvoice.java | 2 +- .../compiere/process/RequisitionPOCreate.java | 2 +- .../src/org/compiere/process/ProcessInfo.java | 14 ++ .../org/compiere/process/ProcessInfoLog.java | 45 ++++++- .../org/compiere/process/ProcessInfoUtil.java | 24 ++-- .../src/org/compiere/process/SvrProcess.java | 14 +- .../adempiere/webui/apps/ProcessDialog.java | 120 +++++++++++++++++- 16 files changed, 285 insertions(+), 33 deletions(-) create mode 100644 migration/360lts-release/oracle/887_LinkEndOfProcess.sql create mode 100644 migration/360lts-release/postgresql/887_LinkEndOfProcess.sql diff --git a/migration/360lts-release/oracle/887_LinkEndOfProcess.sql b/migration/360lts-release/oracle/887_LinkEndOfProcess.sql new file mode 100644 index 0000000000..b2da8fb6c1 --- /dev/null +++ b/migration/360lts-release/oracle/887_LinkEndOfProcess.sql @@ -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 +; \ No newline at end of file diff --git a/migration/360lts-release/postgresql/887_LinkEndOfProcess.sql b/migration/360lts-release/postgresql/887_LinkEndOfProcess.sql new file mode 100644 index 0000000000..c73d7efc56 --- /dev/null +++ b/migration/360lts-release/postgresql/887_LinkEndOfProcess.sql @@ -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 +; \ No newline at end of file diff --git a/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java b/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java index 6b51dcc3ef..c28a6e0c82 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java @@ -255,7 +255,8 @@ public class InOutGenerateRMA extends SvrProcess } // 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++; } diff --git a/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java b/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java index 5b341e45f1..f336e8262b 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java @@ -216,7 +216,7 @@ public class InvoiceGenerateRMA extends SvrProcess } // 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++; } } diff --git a/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java b/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java index 4a50bd4924..2da99b4bff 100644 --- a/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java +++ b/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java @@ -396,7 +396,7 @@ public class AllocationAuto extends SvrProcess { 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++; } break; diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index 27a33f5dfe..baa436e83b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -584,8 +584,7 @@ public class InOutGenerate extends SvrProcess } m_shipment.saveEx(); - // - addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo()); + addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo(),m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID()); m_created++; //reset storage cache as MInOut.completeIt will update m_storage diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java index 4b74b5dfeb..5832d40b28 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java @@ -162,7 +162,7 @@ public class InvoiceBatchProcess extends SvrProcess } 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_invoice = null; diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java index 3d4827c7fa..93718cec58 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java @@ -267,7 +267,7 @@ public class InvoiceGenerate extends SvrProcess if (completeOrder && !fullyDelivered) { 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; break; } @@ -287,8 +287,8 @@ public class InvoiceGenerate extends SvrProcess { log.fine("Failed: " + order.getInvoiceRule() + " - ToInvoice=" + toInvoice + " - " + oLine); - addLog("Failed: " + order.getInvoiceRule() - + " - ToInvoice=" + toInvoice + " - " + oLine); + addLog(0, null, null,"Failed: " + order.getInvoiceRule() + + " - ToInvoice=" + toInvoice + " - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); } } // for all order lines if (MOrder.INVOICERULE_Immediate.equals(order.getInvoiceRule())) @@ -491,13 +491,13 @@ public class InvoiceGenerate extends SvrProcess if (!m_invoice.processIt(p_docAction)) { 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()); } 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_invoice = null; diff --git a/org.adempiere.base.process/src/org/compiere/process/OrderPOCreate.java b/org.adempiere.base.process/src/org/compiere/process/OrderPOCreate.java index 258c54131e..b162d06262 100644 --- a/org.adempiere.base.process/src/org/compiere/process/OrderPOCreate.java +++ b/org.adempiere.base.process/src/org/compiere/process/OrderPOCreate.java @@ -208,7 +208,7 @@ public class OrderPOCreate extends SvrProcess if (po == null || po.getBill_BPartner_ID() != C_BPartner_ID) { 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++; } diff --git a/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java b/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java index 845333d2f3..cd963a30cb 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java @@ -184,7 +184,7 @@ public class RequestInvoice extends SvrProcess } 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; diff --git a/org.adempiere.base.process/src/org/compiere/process/RequisitionPOCreate.java b/org.adempiere.base.process/src/org/compiere/process/RequisitionPOCreate.java index cdb8c36ecd..2394c42c93 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RequisitionPOCreate.java +++ b/org.adempiere.base.process/src/org/compiere/process/RequisitionPOCreate.java @@ -380,7 +380,7 @@ public class RequisitionPOCreate extends SvrProcess if (m_order != null) { 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_orderLine = null; diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index d52dac9ecd..c48c0e987d 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -23,6 +23,8 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; +import org.compiere.model.MQuery; +import org.compiere.model.MTable; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Ini; @@ -298,6 +300,8 @@ public class ProcessInfo implements Serializable return sb.toString(); } // getLogInfo + + /** * Get ASCII Log Info * @return Log Info @@ -519,6 +523,16 @@ public class ProcessInfo implements Serializable } // 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 * @param Log_ID Log ID diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfoLog.java b/org.adempiere.base/src/org/compiere/process/ProcessInfoLog.java index a5cf5ba2fa..e9dd94a374 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfoLog.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfoLog.java @@ -33,7 +33,29 @@ public class ProcessInfoLog implements Serializable */ 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. @@ -44,7 +66,7 @@ public class ProcessInfoLog implements Serializable */ 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 /** @@ -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) { - setLog_ID (Log_ID); - setP_ID (P_ID); - setP_Date (P_Date); - setP_Number (P_Number); - setP_Msg (P_Msg); + this (Log_ID, P_ID, P_Date, P_Number, P_Msg, 0,0); } // ProcessInfoLog private static int s_Log_ID = 0; @@ -71,9 +89,24 @@ public class ProcessInfoLog implements Serializable private Timestamp m_P_Date; private BigDecimal m_P_Number; 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 * @return id diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfoUtil.java b/org.adempiere.base/src/org/compiere/process/ProcessInfoUtil.java index f4f0cc032b..168cdc0b26 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfoUtil.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfoUtil.java @@ -115,7 +115,7 @@ public class ProcessInfoUtil public static void setLogFromDB (ProcessInfo pi) { // 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 " + "WHERE AD_PInstance_ID=? " + "ORDER BY Log_ID"; @@ -125,10 +125,10 @@ public class ProcessInfoUtil PreparedStatement pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, pi.getAD_PInstance_ID()); ResultSet rs = pstmt.executeQuery(); - 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.close(); + while (rs.next()){ + pi.addLog (rs.getInt(1), rs.getInt(2), rs.getTimestamp(3), rs.getBigDecimal(4), rs.getString(5),rs.getInt(6),rs.getInt(7)); + } + rs.close(); pstmt.close(); } catch (SQLException e) @@ -157,7 +157,7 @@ public class ProcessInfoUtil for (int i = 0; i < logs.length; i++) { 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 ("); sql.append(pi.getAD_PInstance_ID()).append(",") .append(logs[i].getLog_ID()).append(","); @@ -174,10 +174,18 @@ public class ProcessInfoUtil else sql.append(logs[i].getP_Number()).append(","); 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)"); else - sql.append(DB.TO_STRING(logs[i].getP_Msg(),2000)).append(")"); - // + sql.append(logs[i].getRecord_Id()).append(")"); +// DB.executeUpdate(sql.toString(), null); } pi.setLogList(null); // otherwise log entries are twice diff --git a/org.adempiere.base/src/org/compiere/process/SvrProcess.java b/org.adempiere.base/src/org/compiere/process/SvrProcess.java index 73b1a9a457..7d0676346d 100644 --- a/org.adempiere.base/src/org/compiere/process/SvrProcess.java +++ b/org.adempiere.base/src/org/compiere/process/SvrProcess.java @@ -427,6 +427,18 @@ public abstract class SvrProcess implements ProcessCall } // 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 * @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) { if (m_pi != null) - m_pi.addLog(id, date, number, msg); + m_pi.addLog(id, date, number, msg ); log.info(id + " - " + date + " - " + number + " - " + msg); } // addLog diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index b712524eee..2a3e3caebb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -1,11 +1,15 @@ 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.FileInputStream; import java.io.FileOutputStream; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; 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.SimplePDFViewer; 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.process.ProcessInfo; +import org.compiere.process.ProcessInfoLog; import org.compiere.process.ProcessInfoUtil; import org.compiere.util.CLogger; import org.compiere.util.DB; +import org.compiere.util.DisplayType; import org.compiere.util.Env; 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.ui.Component; 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.Events; import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.A; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; -import org.zkoss.zul.North; -import org.zkoss.zul.South; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; 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.pdf.PdfContentByte; @@ -93,6 +105,7 @@ public class ProcessDialog extends Window implements EventListener, IProc private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto"; private Div messageDiv; private Center center; + private Table logMessageTable; private North north; private List downloadFiles; @@ -357,6 +370,10 @@ public class ProcessDialog extends Window implements EventListener, IProc public void onEvent(Event event) { Component component = event.getTarget(); + if(event.getName().equals((Events.ON_CLICK))){ + doOnClick(component); + } + if (component instanceof Button) { Button element = (Button)component; if ("Ok".equalsIgnoreCase(element.getId())) { @@ -378,6 +395,30 @@ public class ProcessDialog extends Window implements EventListener, 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) { if (m_isLocked || Executions.getCurrent() == null) return; @@ -412,8 +453,9 @@ public class ProcessDialog extends Window implements EventListener, IProc m_messageText.append("

** ") .append(pi.getSummary()) .append("

"); - m_messageText.append(pi.getLogInfo(true)); message.setContent(m_messageText.toString()); + // Add Log info with zoom on record id + appendRecordLogInfo(pi.getLogs()); bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter")); bOK.setImage("/images/Reset16.png"); @@ -432,12 +474,82 @@ public class ProcessDialog extends Window implements EventListener, IProc 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() { m_messageText = new StringBuffer(initialMessage); message.setContent(initialMessage); north.setVisible(true); messageDiv.detach(); + if(logMessageTable!=null){ + messageDiv.removeChild(logMessageTable); + } messageDiv.setStyle(MESSAGE_DIV_STYLE); north.appendChild(messageDiv);