diff --git a/migration/i2.0z/oracle/201401242121_IDEMPIERE-1711.sql b/migration/i2.0z/oracle/201401242121_IDEMPIERE-1711.sql new file mode 100644 index 0000000000..373ebc36ec --- /dev/null +++ b/migration/i2.0z/oracle/201401242121_IDEMPIERE-1711.sql @@ -0,0 +1,120 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jan 25, 2014 8:16:32 AM MYT +-- IDEMPIERE-1711 InfoWindow Process +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,210944,'N','N','N',0,'N',22,'N','N','N','Y','31b21b81-8828-47c0-9b47-14cfd046ccf7','Y','AD_Process_ID','Process or Report','The Process field identifies a unique Process or Report in the system.','Process','Y',TO_DATE('2014-01-25 08:16:26','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-01-25 08:16:26','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','N',117,19,895) +; + +-- Jan 25, 2014 8:25:41 AM MYT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType) VALUES (0,'N',842,0,'N','N',180,'Y',202596,'N','The Process field identifies a unique Process or Report in the system.','Process or Report','Process','939b9169-77cc-4ca0-b3e8-68478ae01d66','Y','N',100,0,TO_DATE('2014-01-25 08:25:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-01-25 08:25:35','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,1,'N',0,1,1,'N','N',210944,'D') +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=202596 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201634 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=13579 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=13580 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=201627 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=201628 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=201639 +; + +-- Jan 25, 2014 8:29:22 AM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=201807 +; + +-- Jan 25, 2014 8:29:54 AM MYT +UPDATE AD_Field SET IsSameLine='Y', XPosition=3,Updated=TO_DATE('2014-01-25 09:27:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202596 +; + +-- Jan 25, 2014 8:30:12 AM MYT +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='ADProcess_ADInfoWindow',Updated=TO_DATE('2014-01-25 09:06:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210944 +; + +-- Jan 25, 2014 8:30:12 AM MYT +ALTER TABLE AD_InfoWindow ADD AD_Process_ID NUMBER(10) DEFAULT NULL +; + +-- Jan 25, 2014 8:30:14 AM MYT +ALTER TABLE AD_InfoWindow ADD CONSTRAINT ADProcess_ADInfoWindow FOREIGN KEY (AD_Process_ID) REFERENCES ad_process(ad_process_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jan 24, 2014 10:16:49 PM COT +-- IDEMPIERE-1711 InfoWindow Process +UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13575 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=90,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13582 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202596 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13581 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201621 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=130,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201634 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=140,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13579 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=150,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13580 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=160,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201627 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=170,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201628 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=4, ColumnSpan=1,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201639 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=5, ColumnSpan=1,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202198 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=200,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201807 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=210, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_DATE('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202196 +; + +SELECT register_migration_script('201401242121_IDEMPIERE-1711.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201401242121_IDEMPIERE-1711.sql b/migration/i2.0z/postgresql/201401242121_IDEMPIERE-1711.sql new file mode 100644 index 0000000000..f9a60f2c60 --- /dev/null +++ b/migration/i2.0z/postgresql/201401242121_IDEMPIERE-1711.sql @@ -0,0 +1,115 @@ +-- Jan 25, 2014 8:16:32 AM MYT +-- IDEMPIERE-1711 InfoWindow Process +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (0,'N',0,210944,'N','N','N',0,'N',22,'N','N','N','Y','31b21b81-8828-47c0-9b47-14cfd046ccf7','Y','AD_Process_ID','Process or Report','The Process field identifies a unique Process or Report in the system.','Process','Y',TO_TIMESTAMP('2014-01-25 08:16:26','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-01-25 08:16:26','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','N',117,19,895) +; + +-- Jan 25, 2014 8:25:41 AM MYT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType) VALUES (0,'N',842,0,'N','N',180,'Y',202596,'N','The Process field identifies a unique Process or Report in the system.','Process or Report','Process','939b9169-77cc-4ca0-b3e8-68478ae01d66','Y','N',100,0,TO_TIMESTAMP('2014-01-25 08:25:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-01-25 08:25:35','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,1,'N',0,1,1,'N','N',210944,'D') +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=202596 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201634 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=13579 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=13580 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=201627 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=201628 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=201639 +; + +-- Jan 25, 2014 9:10:29 AM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=201807 +; + +UPDATE AD_Field SET IsSameLine='Y', XPosition=3,Updated=TO_TIMESTAMP('2014-01-25 09:27:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202596 +; + +UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='ADProcess_ADInfoWindow',Updated=TO_TIMESTAMP('2014-01-25 09:06:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210944 +; + +-- Jan 25, 2014 9:06:48 AM MYT +ALTER TABLE AD_InfoWindow ADD COLUMN AD_Process_ID NUMERIC(10) DEFAULT NULL +; + +-- Jan 25, 2014 9:06:48 AM MYT +ALTER TABLE AD_InfoWindow ADD CONSTRAINT ADProcess_ADInfoWindow FOREIGN KEY (AD_Process_ID) REFERENCES ad_process(ad_process_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jan 24, 2014 10:16:49 PM COT +-- IDEMPIERE-1711 InfoWindow Process +UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13575 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13582 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202596 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13581 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201621 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201634 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13579 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=150,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13580 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=160,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201627 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=170,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201628 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=4, ColumnSpan=1,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201639 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=5, ColumnSpan=1,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202198 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=200,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201807 +; + +-- Jan 24, 2014 10:16:49 PM COT +UPDATE AD_Field SET SeqNo=210, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2014-01-24 22:16:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202196 +; + +SELECT register_migration_script('201401242121_IDEMPIERE-1711.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java index 97f3636445..bea37accce 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoWindow.java @@ -95,6 +95,21 @@ public interface I_AD_InfoWindow */ public int getAD_Org_ID(); + /** Column name AD_Process_ID */ + public static final String COLUMNNAME_AD_Process_ID = "AD_Process_ID"; + + /** Set Process. + * Process or Report + */ + public void setAD_Process_ID (int AD_Process_ID); + + /** Get Process. + * Process or Report + */ + public int getAD_Process_ID(); + + public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException; + /** Column name AD_Table_ID */ public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java index 909b268835..2aeace3f2a 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoWindow.java @@ -30,7 +30,7 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent /** * */ - private static final long serialVersionUID = 20140108L; + private static final long serialVersionUID = 20140124L; /** Standard Constructor */ public X_AD_InfoWindow (Properties ctx, int AD_InfoWindow_ID, String trxName) @@ -145,6 +145,34 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent return (String)get_Value(COLUMNNAME_AD_InfoWindow_UU); } + public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException + { + return (org.compiere.model.I_AD_Process)MTable.get(getCtx(), org.compiere.model.I_AD_Process.Table_Name) + .getPO(getAD_Process_ID(), get_TrxName()); } + + /** Set Process. + @param AD_Process_ID + Process or Report + */ + public void setAD_Process_ID (int AD_Process_ID) + { + if (AD_Process_ID < 1) + set_Value (COLUMNNAME_AD_Process_ID, null); + else + set_Value (COLUMNNAME_AD_Process_ID, Integer.valueOf(AD_Process_ID)); + } + + /** Get Process. + @return Process or Report + */ + public int getAD_Process_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Process_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException { return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java index ca9994d3b9..450d0d62f3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java @@ -28,10 +28,13 @@ import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; /** * Ported from org.compiere.apps.ProcessCtl * @author hengsin + * @contributor red1 IDEMPIERE-1711 with final review by Hengsin * */ public class WProcessCtl extends AbstractProcessCtl { @@ -39,6 +42,11 @@ public class WProcessCtl extends AbstractProcessCtl { /** Logger */ private static CLogger log = CLogger.getCLogger(WProcessCtl.class); + public static void process (int WindowNo, ProcessInfo pi, Trx trx) + { + process(WindowNo, pi, trx, null); + } + /** * Process Control * @@ -54,36 +62,38 @@ public class WProcessCtl extends AbstractProcessCtl { * @param pi ProcessInfo process info * @param trx Transaction */ - public static void process (int WindowNo, ProcessInfo pi, Trx trx) + public static void process (int WindowNo, ProcessInfo pi, Trx trx, EventListener listener) { if (log.isLoggable(Level.FINE)) log.fine("WindowNo=" + WindowNo + " - " + pi); - MPInstance instance = null; - try - { - instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); - } - catch (Exception e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); - } - catch (Error e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); + if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists + MPInstance instance = null; + try + { + instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); + } + catch (Exception e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + } + catch (Error e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + } + if (!instance.save()) + { + pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); + pi.setError (true); + } + pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); } - if (!instance.save()) - { - pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); - pi.setError (true); - } - pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); // Get Parameters (Dialog) - ProcessModalDialog para = new ProcessModalDialog(WindowNo, pi, false); + ProcessModalDialog para = new ProcessModalDialog(listener, WindowNo, pi, false); if (para.isValid()) { para.setWidth("500px"); @@ -116,32 +126,34 @@ public class WProcessCtl extends AbstractProcessCtl { { if (log.isLoggable(Level.FINE)) log.fine("WindowNo=" + WindowNo + " - " + pi); - MPInstance instance = null; - try - { - instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); - } - catch (Exception e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); - return; - } - catch (Error e) - { - pi.setSummary (e.getLocalizedMessage()); - pi.setError (true); - log.warning(pi.toString()); - return; + if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists + MPInstance instance = null; + try + { + instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID()); + } + catch (Exception e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + return; + } + catch (Error e) + { + pi.setSummary (e.getLocalizedMessage()); + pi.setError (true); + log.warning(pi.toString()); + return; + } + if (!instance.save()) + { + pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); + pi.setError (true); + return; + } + pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); } - if (!instance.save()) - { - pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance")); - pi.setError (true); - return; - } - pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); // Get Parameters if (parameter != null) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index eb1c725063..d8f277ef4d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -14,6 +14,8 @@ import java.util.TreeMap; import java.util.logging.Level; import org.adempiere.webui.AdempiereWebUI; +import org.adempiere.webui.component.Borderlayout; +import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.ConfirmPanel; @@ -54,7 +56,6 @@ 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; -import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; import org.zkoss.zul.Checkbox; import org.zkoss.zul.Div; @@ -67,13 +68,14 @@ import org.zkoss.zul.Vbox; /** * AD_InfoWindow implementation * @author hengsin + * @contributor red1 IDEMPIERE-1711 with final review by Hengsin * */ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventListener { /** * */ - private static final long serialVersionUID = -5723251182432810379L; + private static final long serialVersionUID = -8641832995439101215L; protected Grid parameterGrid; private Borderlayout layout; @@ -93,7 +95,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL protected String queryValue; private List gridFields; - private int AD_InfoWindow_ID; private Checkbox checkAND; /** @@ -122,6 +123,19 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL lookup); this.queryValue = queryValue; this.AD_InfoWindow_ID = AD_InfoWindow_ID; + + //red1 IDEMPIERE-1711 (Hengsin advised this minimal coding way) + infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null); + if (infoWindow.getAD_Process_ID() > 0) + { + p_multipleSelection = true; + hasProcess = true; + Button b = confirmPanel.createButton(ConfirmPanel.A_PROCESS); + confirmPanel.addComponentsLeft(b); + b.addEventListener(Events.ON_CLICK, this); + } + //red1 -- end -- + infoContext = new Properties(Env.getCtx()); p_loadedOK = loadInfoDefinition(); if (loadedOK()) { @@ -526,6 +540,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL renderFooter(south); confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); + confirmPanel.getButton(ConfirmPanel.A_ZOOM).setDisabled(true); + if (hasProcess) + confirmPanel.getButton(ConfirmPanel.A_PROCESS).setDisabled(true); + } protected void renderFooter(South south) { @@ -827,6 +845,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL return !isLookup() && infoWindow != null && !MTable.get(Env.getCtx(), infoWindow.getAD_Table_ID()).isView(); } + @Override + protected boolean hasProcess() { //red1 IDEMPIERE-1711 to retain InfoWindow.process_ID > 0 as true + return hasProcess; + } + @Override public void valueChange(ValueChangeEvent evt) { if (evt != null && evt.getSource() instanceof WEditor) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index cd6abe674b..d2d2c603db 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -23,6 +23,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -35,6 +36,7 @@ import java.util.logging.Level; import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.BusyDialog; +import org.adempiere.webui.apps.WProcessCtl; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ListModelTable; import org.adempiere.webui.component.WListItemRenderer; @@ -49,17 +51,22 @@ import org.adempiere.webui.factory.InfoManager; import org.adempiere.webui.part.ITabOnSelectHandler; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.FDialog; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.model.MInfoWindow; +import org.compiere.model.MPInstance; +import org.compiere.model.MProcess; import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.X_AD_CtxHelp; +import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; +import org.compiere.util.Trx; import org.compiere.util.ValueNamePair; import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.ui.Page; @@ -84,16 +91,18 @@ import org.zkoss.zul.ext.Sortable; * Zk Port * @author Elaine * @version Info.java Adempiere Swing UI 3.4.1 + * + * @contributor red1 IDEMPIERE-1711 with final review by HengSin */ public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, Sortable, IHelpContext { /** * */ - private static final long serialVersionUID = 6189936771781956451L; + private static final long serialVersionUID = 2823393272482373014L; private final static int PAGE_SIZE = 100; - + protected boolean hasProcess = false; protected Map editorMap = new HashMap(); public static InfoPanel create (int WindowNo, @@ -197,9 +206,10 @@ public abstract class InfoPanel extends Window implements EventListener, setWidth("100%"); setHeight("100%"); setStyle("position: absolute"); + if (p_multipleSelection) hasProcess = true; //red1 IDEMPIERE-1711 !isLookUp() and is multipleSelection so add Process button first } - confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16 + confirmPanel = new ConfirmPanel(true, true, false, true, true, true, true, hasProcess); // Elaine 2008/12/16 //red1 hasProcess checked by isLookup() confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.setHflex("1"); @@ -280,6 +290,10 @@ public abstract class InfoPanel extends Window implements EventListener, private Listitem m_lastOnSelectItem; private static final String[] lISTENER_EVENTS = {}; + //red1 added for embedded Process feature + protected int AD_InfoWindow_ID; + private ProcessInfo m_pi = null; + private MProcess m_process = null; /** * Loaded correctly @@ -798,6 +812,19 @@ public abstract class InfoPanel extends Window implements EventListener, return selectedDataList; } // getSelectedRowKeys + /** + * Get selected Keys as Collection + * @return selected keys (Integers) + */ + public Collection getSelectedKeysCollection() + { + m_ok = true; + saveSelection(); + if (!m_ok || m_results.size() == 0) + return null; + return m_results; + } + /** * Get selected Keys * @return selected keys (Integers) @@ -897,18 +924,20 @@ public abstract class InfoPanel extends Window implements EventListener, /** * Enable OK, History, Zoom if row/s selected * --- - * Changes: Changed the logic for accomodating multiple selection + * Changes: Changed the logic for accommodating multiple selection * @author ashley */ protected void enableButtons () { - boolean enable = (contentPanel.getSelectedCount() == 1); - confirmPanel.getOKButton().setEnabled(contentPanel.getSelectedCount() > 0); + boolean enable = (contentPanel.getSelectedCount() > 0); + confirmPanel.getOKButton().setEnabled(contentPanel.getSelectedCount() > 0); //red1 allow Process for 1 or more records if (hasHistory()) confirmPanel.getButton(ConfirmPanel.A_HISTORY).setEnabled(enable); if (hasZoom()) - confirmPanel.getButton(ConfirmPanel.A_ZOOM).setEnabled(enable); + confirmPanel.getButton(ConfirmPanel.A_ZOOM).setEnabled( (contentPanel.getSelectedCount() == 1) ); //red1 only zoom for single record + if (hasProcess()) + confirmPanel.getButton(ConfirmPanel.A_PROCESS).setEnabled(enable); } // enableButtons // @@ -945,6 +974,11 @@ public abstract class InfoPanel extends Window implements EventListener, * Customize dialog * To be overwritten by concrete classes */ + protected boolean hasProcess() {return false;} + /** + * Customize dialog + * To be overwritten by concrete classes + */ protected void customize() {} /** * Has Customize (false) @@ -1065,6 +1099,45 @@ public abstract class InfoPanel extends Window implements EventListener, this.detach(); } } + //red1 handle process_ID + else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_PROCESS))) + { + if (hasProcess) { + infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null); + m_process = MProcess.get(Env.getCtx(), infoWindow.getAD_Process_ID()); + m_pi = new ProcessInfo(m_process.getName(), + infoWindow.getAD_Process_ID()); + m_pi.setAD_User_ID(Env.getAD_User_ID(Env.getCtx())); + m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); + + MPInstance instance = new MPInstance(Env.getCtx(), infoWindow.getAD_Process_ID(), 0); + instance.saveEx(); + // store in T_Selection table selected rows for Execute Process that retrieves from T_Selection in code. + DB.createT_Selection(instance.getAD_PInstance_ID(), getSelectedKeysCollection(), + null); + //clear back + m_results.clear(); + // Execute Process + m_pi.setAD_PInstance_ID(instance.getAD_PInstance_ID()); + + //HengSin - to let process end with message and requery + WProcessCtl.process(p_WindowNo, m_pi, (Trx)null, new EventListener() { + + @Override + public void onEvent(Event event) throws Exception { + if (!m_pi.isError()) { + Clients.response(new AuEcho(InfoPanel.this, "onQueryCallback", null)); + } + if (m_pi.isError()) + FDialog.error(p_WindowNo, m_pi.getSummary()); + else + FDialog.info(p_WindowNo, null, m_pi.getSummary()); + //HengSin -- end -- + } + }); + confirmPanel.getButton(ConfirmPanel.A_PROCESS).setEnabled(false); + } + } //red1 IDEMPIERE-1711 --end-- else if (event.getTarget() == paging) { int pgNo = paging.getActivePage();