IDEMPIERE-5238 - Record_ID editor (#1610)
* IDEMPIERE-5238 - initial draft commit * IDEMPIERE-5238 - fixes * IDEMPIERE-5238 - popup window * IDEMPIERE-5238 - renaming to Record ID * IDEMPIERE-5238 - renaming to Record ID * IDEMPIERE-5238 - fixes * IDEMPIERE-5238 - fixes * IDEMPIERE-5238 - fixes * IDEMPIERE-5238 - technical fixes * IDEMPIERE-5238 - pr1610_1 patch * IDEMPIERE-5238 - bug fixes * IDEMPIERE-5238 - set table to read only * IDEMPIERE-5238 - fix parsing error * IDEMPIERE-5238 - pr1610 patch * IDEMPIERE-5238 - fix Find Window issue * IDEMPIERE-5238 - Info Panel NPE patch * IDEMPIERE-5238 - UI fix In the Record ID Dialog the 'Record' label should be visible only when the corresponding editor is visible. * IDEMPIERE-5238 - find window patch * IDEMPIERE-5238 - clear Record ID when clearing AD_Table_ID * IDEMPIERE-5238 - clear Record ID when clearing AD_Table_ID * IDEMPIERE-5238 - move scripts to correct folder All scripts to iD10
This commit is contained in:
parent
2888276a0e
commit
dbd024f78e
|
@ -0,0 +1,10 @@
|
|||
-- IDEMPIERE-5238
|
||||
SELECT register_migration_script('202203221602_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Mar 22, 2022, 4:02:23 PM CET
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200202,'Record ID','D',0,0,'Y',TO_TIMESTAMP('2022-03-22 16:02:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-22 16:02:23','YYYY-MM-DD HH24:MI:SS'),100,'D','N','55330dab-f2b6-499d-af8b-187848c47a40')
|
||||
;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
-- IDEMPIERE-5238
|
||||
SELECT register_migration_script('202212201552_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Dec 20, 2022, 3:52:24 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Table',0,0,'Y',TO_TIMESTAMP('2022-12-20 15:52:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-12-20 15:52:24','YYYY-MM-DD HH24:MI:SS'),100,200809,'Table','D','a7c566e9-b176-4d25-9556-137255e45509')
|
||||
;
|
||||
|
||||
-- Dec 20, 2022, 3:53:10 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Choose Related Record',0,0,'Y',TO_TIMESTAMP('2022-12-20 15:53:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-12-20 15:53:09','YYYY-MM-DD HH24:MI:SS'),100,200810,'ChooseRelatedRecord','D','7fb8fd7c-ced8-44a1-950f-26242a5e0371')
|
||||
;
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
-- IDEMPIERE-5238 Record_ID editor
|
||||
SELECT register_migration_script('202302161443_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Feb 16, 2023, 2:43:55 PM CET
|
||||
UPDATE AD_Column SET AD_Reference_ID=200202,Updated=TO_TIMESTAMP('2023-02-16 14:43:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60265
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:07 PM CET
|
||||
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2023-02-16 14:49:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=60992
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:35 PM CET
|
||||
UPDATE AD_Table SET AccessLevel='7',Updated=TO_TIMESTAMP('2023-02-16 14:49:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=135
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:53 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215774,0,'Table','Database Table information','The Database Table provides the information of the table definition',135,'AD_Table_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2023-02-16 14:49:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:49:53','YYYY-MM-DD HH24:MI:SS'),100,126,'Y','N','D','N','N','N','Y','3d04d37e-89a5-4352-9837-ffeda51edaa3','Y',0,'N','N','N','N')
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
UPDATE AD_Column SET FKConstraintName='ADTable_Test', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-02-16 14:49:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215774
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
ALTER TABLE Test ADD AD_Table_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
ALTER TABLE Test ADD CONSTRAINT ADTable_Test FOREIGN KEY (AD_Table_ID) REFERENCES ad_table(ad_table_id) DEFERRABLE INITIALLY DEFERRED
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:15 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (215775,0,'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.',135,'Record_ID',22,'N','N','N','N','N',0,'N',200202,0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:15','YYYY-MM-DD HH24:MI:SS'),100,538,'Y','N','D','N','N','N','Y','354a15e3-4479-4629-b646-5c79887757ee','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:17 PM CET
|
||||
ALTER TABLE Test ADD Record_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:31 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207569,'Table','Database Table information','The Database Table provides the information of the table definition',152,215774,'Y',10,280,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fdaecd3b-5f1b-4f18-9896-da425c7862eb','Y',260,2)
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:31 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207570,'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.',152,215775,'Y',22,290,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','bdc4c637-6066-479d-a606-9dd6cb6bbb36','Y',270,2)
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, XPosition=1,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207569
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, XPosition=4,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207570
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=240,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=250,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8351
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=260,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8352
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=270,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3060
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=280,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3061
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206818
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 3:03:55 PM CET
|
||||
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2023-02-16 15:03:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207570
|
||||
;
|
||||
|
||||
|
||||
UPDATE AD_Field SET XPosition=XPosition-1, IsReadOnly='Y'
|
||||
WHERE AD_Field_ID < 10000000 AND AD_Column_ID IN
|
||||
(SELECT AD_Column_ID FROM AD_Column
|
||||
WHERE ColumnName='Record_ID' AND AD_Reference_ID = 28 AND AD_Column_ID < 1000000
|
||||
)
|
||||
;
|
||||
|
||||
UPDATE AD_Column SET AD_Reference_ID = 200202
|
||||
WHERE ColumnName='Record_ID' AND AD_Reference_ID = 28 AND AD_Column_ID < 1000000
|
||||
;
|
|
@ -0,0 +1,7 @@
|
|||
-- IDEMPIERE-5238
|
||||
SELECT register_migration_script('202203221602_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
-- Mar 22, 2022, 4:02:23 PM CET
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200202,'Record ID','D',0,0,'Y',TO_TIMESTAMP('2022-03-22 16:02:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-22 16:02:23','YYYY-MM-DD HH24:MI:SS'),100,'D','N','55330dab-f2b6-499d-af8b-187848c47a40')
|
||||
;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
-- IDEMPIERE-5238
|
||||
SELECT register_migration_script('202212201552_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
-- Dec 20, 2022, 3:52:24 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Table',0,0,'Y',TO_TIMESTAMP('2022-12-20 15:52:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-12-20 15:52:24','YYYY-MM-DD HH24:MI:SS'),100,200809,'Table','D','a7c566e9-b176-4d25-9556-137255e45509')
|
||||
;
|
||||
|
||||
-- Dec 20, 2022, 3:53:10 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Choose Related Record',0,0,'Y',TO_TIMESTAMP('2022-12-20 15:53:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-12-20 15:53:09','YYYY-MM-DD HH24:MI:SS'),100,200810,'ChooseRelatedRecord','D','7fb8fd7c-ced8-44a1-950f-26242a5e0371')
|
||||
;
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
-- IDEMPIERE-5238 Record_ID editor
|
||||
SELECT register_migration_script('202302161443_IDEMPIERE-5238.sql') FROM dual;
|
||||
|
||||
-- Feb 16, 2023, 2:43:55 PM CET
|
||||
UPDATE AD_Column SET AD_Reference_ID=200202,Updated=TO_TIMESTAMP('2023-02-16 14:43:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60265
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:07 PM CET
|
||||
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2023-02-16 14:49:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=60992
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:35 PM CET
|
||||
UPDATE AD_Table SET AccessLevel='7',Updated=TO_TIMESTAMP('2023-02-16 14:49:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=135
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:53 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215774,0,'Table','Database Table information','The Database Table provides the information of the table definition',135,'AD_Table_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2023-02-16 14:49:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:49:53','YYYY-MM-DD HH24:MI:SS'),100,126,'Y','N','D','N','N','N','Y','3d04d37e-89a5-4352-9837-ffeda51edaa3','Y',0,'N','N','N','N')
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
UPDATE AD_Column SET FKConstraintName='ADTable_Test', FKConstraintType='N',Updated=TO_TIMESTAMP('2023-02-16 14:49:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=215774
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
ALTER TABLE Test ADD COLUMN AD_Table_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:49:57 PM CET
|
||||
ALTER TABLE Test ADD CONSTRAINT ADTable_Test FOREIGN KEY (AD_Table_ID) REFERENCES ad_table(ad_table_id) DEFERRABLE INITIALLY DEFERRED
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:15 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (215775,0,'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.',135,'Record_ID',22,'N','N','N','N','N',0,'N',200202,0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:15','YYYY-MM-DD HH24:MI:SS'),100,538,'Y','N','D','N','N','N','Y','354a15e3-4479-4629-b646-5c79887757ee','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:17 PM CET
|
||||
ALTER TABLE Test ADD COLUMN Record_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:31 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207569,'Table','Database Table information','The Database Table provides the information of the table definition',152,215774,'Y',10,280,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fdaecd3b-5f1b-4f18-9896-da425c7862eb','Y',260,2)
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:50:31 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (207570,'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.',152,215775,'Y',22,290,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-02-16 14:50:31','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','bdc4c637-6066-479d-a606-9dd6cb6bbb36','Y',270,2)
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, XPosition=1,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207569
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, XPosition=4,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207570
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=240,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=250,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8351
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=260,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8352
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=270,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3060
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=280,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3061
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 2:51:43 PM CET
|
||||
UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2023-02-16 14:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206818
|
||||
;
|
||||
|
||||
-- Feb 16, 2023, 3:03:55 PM CET
|
||||
UPDATE AD_Field SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2023-02-16 15:03:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207570
|
||||
;
|
||||
|
||||
|
||||
UPDATE AD_Field SET XPosition=XPosition-1, IsReadOnly='Y'
|
||||
WHERE AD_Field_ID < 10000000 AND AD_Column_ID IN
|
||||
(SELECT AD_Column_ID FROM AD_Column
|
||||
WHERE ColumnName='Record_ID' AND AD_Reference_ID = 28 AND AD_Column_ID < 1000000
|
||||
)
|
||||
;
|
||||
|
||||
UPDATE AD_Column SET AD_Reference_ID = 200202
|
||||
WHERE ColumnName='Record_ID' AND AD_Reference_ID = 28 AND AD_Column_ID < 1000000
|
||||
;
|
|
@ -371,12 +371,12 @@ public class GridField
|
|||
|
||||
// Mandatory if displayed
|
||||
return isDisplayed (checkContext);
|
||||
} // isMandatory
|
||||
|
||||
/**
|
||||
* Is parameter Editable - checks if parameter is Read Only
|
||||
* @param checkContext if true checks Context
|
||||
* @return true, if editable
|
||||
} // isMandatory
|
||||
|
||||
/**
|
||||
* Is parameter Editable - checks if parameter is Read Only
|
||||
* @param checkContext if true checks Context
|
||||
* @return true, if editable
|
||||
*/
|
||||
public boolean isEditablePara(boolean checkContext) {
|
||||
if (checkContext && m_vo.ReadOnlyLogic.length() > 0)
|
||||
|
|
|
@ -845,13 +845,13 @@ public class GridFieldVO implements Serializable, Cloneable
|
|||
* @param tabNo tab no
|
||||
* @param ad_Window_ID window id
|
||||
* @param ad_Tab_ID tab id
|
||||
* @param TabReadOnly r/o
|
||||
* @return Field or null
|
||||
*/
|
||||
public GridFieldVO clone(Properties Ctx, int windowNo, int tabNo,
|
||||
int ad_Window_ID, int ad_Tab_ID,
|
||||
boolean TabReadOnly)
|
||||
{
|
||||
* @param TabReadOnly r/o
|
||||
* @return Field or null
|
||||
*/
|
||||
public GridFieldVO clone(Properties ctx, int windowNo, int tabNo,
|
||||
int ad_Window_ID, int ad_Tab_ID,
|
||||
boolean TabReadOnly)
|
||||
{
|
||||
GridFieldVO clone = null;
|
||||
clone = (GridFieldVO) clone();
|
||||
clone.ctx = ctx;
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
|
|||
|
||||
/** Generated Interface for Test
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 10
|
||||
* @version Release 11
|
||||
*/
|
||||
public interface I_Test
|
||||
{
|
||||
|
@ -35,9 +35,9 @@ public interface I_Test
|
|||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 4 - System
|
||||
/** AccessLevel = 7 - System - Client - Org
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(4);
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(7);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
|
@ -73,6 +73,21 @@ public interface I_Test
|
|||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_Table_ID */
|
||||
public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID";
|
||||
|
||||
/** Set Table.
|
||||
* Database Table information
|
||||
*/
|
||||
public void setAD_Table_ID (int AD_Table_ID);
|
||||
|
||||
/** Get Table.
|
||||
* Database Table information
|
||||
*/
|
||||
public int getAD_Table_ID();
|
||||
|
||||
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
|
||||
|
||||
/** Column name BinaryData */
|
||||
public static final String COLUMNNAME_BinaryData = "BinaryData";
|
||||
|
||||
|
@ -303,6 +318,19 @@ public interface I_Test
|
|||
/** Get Process Now */
|
||||
public boolean isProcessing();
|
||||
|
||||
/** Column name Record_ID */
|
||||
public static final String COLUMNNAME_Record_ID = "Record_ID";
|
||||
|
||||
/** Set Record ID.
|
||||
* Direct internal record ID
|
||||
*/
|
||||
public void setRecord_ID (int Record_ID);
|
||||
|
||||
/** Get Record ID.
|
||||
* Direct internal record ID
|
||||
*/
|
||||
public int getRecord_ID();
|
||||
|
||||
/** Column name T_Amount */
|
||||
public static final String COLUMNNAME_T_Amount = "T_Amount";
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.model;
|
|||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.idempiere.cache.ImmutableIntPOCache;
|
||||
|
@ -216,8 +217,35 @@ public class MField extends X_AD_Field implements ImmutablePOSupport
|
|||
setAD_Val_Rule_ID(0);
|
||||
if (getIsToolbarButton() != null)
|
||||
setIsToolbarButton(null);
|
||||
}
|
||||
|
||||
// set Table field read only if appears in combination with Record ID (Display Type Record ID)
|
||||
MColumn column = MColumn.get(getAD_Column_ID());
|
||||
if(column.getColumnName().equalsIgnoreCase("AD_Table_ID")) {
|
||||
MTab parent = MTab.get(getAD_Tab_ID());
|
||||
for(MField field : parent.getFields(false, get_TrxName())) {
|
||||
if(MColumn.get(field.getAD_Column_ID()).getColumnName().equalsIgnoreCase("Record_ID")) {
|
||||
if(MColumn.get(field.getAD_Column_ID()).getAD_Reference_ID() == DisplayType.RecordID && !this.isReadOnly()) {
|
||||
this.setIsReadOnly(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(column.getColumnName().equalsIgnoreCase("Record_ID") && column.getAD_Reference_ID() == DisplayType.RecordID) {
|
||||
MTab parent = MTab.get(getAD_Tab_ID());
|
||||
for(MField field : parent.getFields(false, get_TrxName())) {
|
||||
if(MColumn.get(field.getAD_Column_ID()).getColumnName().equalsIgnoreCase("AD_Table_ID")) {
|
||||
if(!field.isReadOnly()) {
|
||||
field.setIsReadOnly(true);
|
||||
field.saveEx();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//validate logic expression
|
||||
if (newRecord || is_ValueChanged(COLUMNNAME_ReadOnlyLogic)) {
|
||||
if (isActive() && !Util.isEmpty(getReadOnlyLogic(), true) && !getReadOnlyLogic().startsWith("@SQL=")) {
|
||||
|
|
|
@ -148,6 +148,7 @@ public class SystemIDs
|
|||
public final static int REFERENCE_DATATYPE_PRODUCTATTRIBUTE = 35;
|
||||
public final static int REFERENCE_DATATYPE_QUANTITY = 29;
|
||||
public final static int REFERENCE_DATATYPE_RADIOGROUP_LIST= 200152;
|
||||
public final static int REFERENCE_DATATYPE_RECORD_ID = 200202;
|
||||
public final static int REFERENCE_DATATYPE_ROWID = 26;
|
||||
public final static int REFERENCE_DATATYPE_SEARCH = 30;
|
||||
public final static int REFERENCE_DATATYPE_SINGLE_SELECTION_GRID = 200127;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.compiere.util.KeyNamePair;
|
|||
|
||||
/** Generated Model for Test
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 10 - $Id$ */
|
||||
* @version Release 11 - $Id$ */
|
||||
@org.adempiere.base.Model(table="Test")
|
||||
public class X_Test extends PO implements I_Test, I_Persistent
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public class X_Test extends PO implements I_Test, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20221224L;
|
||||
private static final long serialVersionUID = 20230216L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_Test (Properties ctx, int Test_ID, String trxName)
|
||||
|
@ -65,7 +65,7 @@ public class X_Test extends PO implements I_Test, I_Persistent
|
|||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 4 - System
|
||||
* @return 7 - System - Client - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
|
@ -110,6 +110,34 @@ public class X_Test extends PO implements I_Test, I_Persistent
|
|||
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_ID)
|
||||
.getPO(getAD_Table_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
/** Set Table.
|
||||
@param AD_Table_ID Database Table information
|
||||
*/
|
||||
public void setAD_Table_ID (int AD_Table_ID)
|
||||
{
|
||||
if (AD_Table_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_Table_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
|
||||
}
|
||||
|
||||
/** Get Table.
|
||||
@return Database Table information
|
||||
*/
|
||||
public int getAD_Table_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Binary Data.
|
||||
@param BinaryData Binary Data
|
||||
*/
|
||||
|
@ -457,6 +485,28 @@ public class X_Test extends PO implements I_Test, I_Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Set Record ID.
|
||||
@param Record_ID Direct internal record ID
|
||||
*/
|
||||
public void setRecord_ID (int Record_ID)
|
||||
{
|
||||
if (Record_ID < 0)
|
||||
set_Value (COLUMNNAME_Record_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
|
||||
}
|
||||
|
||||
/** Get Record ID.
|
||||
@return Direct internal record ID
|
||||
*/
|
||||
public int getRecord_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Amount.
|
||||
@param T_Amount Amount
|
||||
*/
|
||||
|
|
|
@ -46,6 +46,7 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PRINTNAME;
|
|||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PRODUCTATTRIBUTE;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_QUANTITY;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_RADIOGROUP_LIST;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_RECORD_ID;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_ROWID;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SEARCH;
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SINGLE_SELECTION_GRID;
|
||||
|
@ -174,6 +175,10 @@ public final class DisplayType
|
|||
public static final int ChosenMultipleSelectionTable = REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_TABLE;
|
||||
|
||||
public static final int ChosenMultipleSelectionSearch = REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_SEARCH;
|
||||
|
||||
public static final int RecordID = REFERENCE_DATATYPE_RECORD_ID;
|
||||
|
||||
|
||||
|
||||
public static final int TimestampWithTimeZone = REFERENCE_DATATYPE_TIMESTAMP_WITH_TIMEZONE;
|
||||
|
||||
|
@ -223,7 +228,7 @@ public final class DisplayType
|
|||
if (displayType == ID || displayType == Table || displayType == TableDir
|
||||
|| displayType == Search || displayType == Location || displayType == Locator
|
||||
|| displayType == Account || displayType == Assignment || displayType == PAttribute
|
||||
|| displayType == Image || displayType == Chart)
|
||||
|| displayType == Image || displayType == Chart || displayType == RecordID)
|
||||
return true;
|
||||
|
||||
IServiceReferenceHolder<IDisplayTypeFactory> cache = s_displayTypeFactoryCache.get(displayType);
|
||||
|
|
|
@ -57,6 +57,6 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
|
||||
<!-- this js module doesn't actually exists and it is here for default theme version -->
|
||||
<!-- since loading of js module is on demand, it doesn't cause any error as long as you don't try to load it -->
|
||||
<javascript-module name="idempiere.theme.default" version="202302161100" />
|
||||
<javascript-module name="idempiere.theme.default" version="202302211500" />
|
||||
|
||||
</language>
|
||||
|
|
|
@ -289,8 +289,8 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
if (value == null)
|
||||
return "";
|
||||
|
||||
GridRowCtx gridRowCtx = new GridRowCtx(Env.getCtx(), gridTab, rowIndex);
|
||||
if (rowIndex >= 0) {
|
||||
GridRowCtx gridRowCtx = new GridRowCtx(Env.getCtx(), gridTab, rowIndex);
|
||||
if (!isForceGetValue && !gridField.isDisplayed(gridRowCtx, true)) {
|
||||
return "";
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
else if (readOnlyEditors.get(gridField) != null)
|
||||
{
|
||||
WEditor editor = readOnlyEditors.get(gridField);
|
||||
return editor.getDisplayTextForGridView(value);
|
||||
return editor.getDisplayTextForGridView(gridRowCtx, value);
|
||||
}
|
||||
else
|
||||
return value.toString();
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.adempiere.util.GridRowCtx;
|
||||
import org.adempiere.webui.AdempiereWebUI;
|
||||
import org.adempiere.webui.ClientInfo;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
|
@ -565,6 +566,10 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
abstract public String getDisplay();
|
||||
|
||||
public String getDisplayTextForGridView(Object value) {
|
||||
return getDisplayTextForGridView(null, value);
|
||||
}
|
||||
|
||||
public String getDisplayTextForGridView(GridRowCtx gridRowCtx, Object value) {
|
||||
this.setValue(value);
|
||||
String s = getDisplay();
|
||||
if ("<0>".equals(s)) {
|
||||
|
|
|
@ -0,0 +1,420 @@
|
|||
/**********************************************************************
|
||||
* This file is part of iDempiere ERP Open Source *
|
||||
* http://www.idempiere.org *
|
||||
* *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Igor Pojzl, Cloudempiere *
|
||||
* - Peter Takacs, Cloudempiere *
|
||||
**********************************************************************/
|
||||
package org.adempiere.webui.editor;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.GridRowCtx;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.window.FindWindow;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.adempiere.webui.window.WRecordIDDialog;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MLookupInfo;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.sys.ComponentCtrl;
|
||||
import org.zkoss.zul.Div;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Peter Takacs, Cloudempiere
|
||||
*
|
||||
*/
|
||||
public class WRecordIDEditor extends WEditor implements ContextMenuListener, IZoomableEditor {
|
||||
|
||||
/** Is Read/Write enabled on the editor */
|
||||
private boolean m_ReadWrite;
|
||||
/** Old value (Record_ID) */
|
||||
private Object recordIDValue;
|
||||
/** Old value (AD_Table_ID) */
|
||||
private Object tableIDValue;
|
||||
|
||||
/** Current tab's AD_Table_ID GrodField */
|
||||
private GridField tableIDGridField;
|
||||
|
||||
// UI components
|
||||
private Textbox recordTextBox;
|
||||
private ToolBarButton editButton;
|
||||
private ToolBarButton zoomButton;
|
||||
|
||||
// images
|
||||
private static final String IMAGES_CONTEXT_ZOOM_PNG = "images/Zoom16.png";
|
||||
private static final String IMAGES_CONTEXT_EDIT_RECORD_PNG = "images/EditRecord16.png";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param gridField
|
||||
* @param tableEditor
|
||||
* @param editorConfiguration
|
||||
*/
|
||||
public WRecordIDEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
|
||||
super(new Div(), gridField, tableEditor, editorConfiguration);
|
||||
|
||||
getComponent().setSclass("recordid-editor");
|
||||
getComponent().addEventListener(Events.ON_RIGHT_CLICK, this);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if(gridTab != null) {
|
||||
tableIDGridField = gridTab.getField("AD_Table_ID");
|
||||
|
||||
if(tableIDGridField == null) {
|
||||
throw new RuntimeException("AD_Table_ID field not found");
|
||||
}
|
||||
|
||||
tableIDGridField.addPropertyChangeListener(evt -> {
|
||||
if (GridField.PROPERTY.equals(evt.getPropertyName())) {
|
||||
tableIDValue = evt.getNewValue();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String tableIdTxt = Env.getContext(gridField.getVO().ctx, gridField.getWindowNo(), FindWindow.TABNO, "AD_Table_ID", true);
|
||||
if (!Util.isEmpty(tableIdTxt, true)) {
|
||||
tableIDValue = Integer.parseInt(tableIdTxt);
|
||||
}
|
||||
|
||||
getComponent().addCallback(ComponentCtrl.AFTER_PAGE_ATTACHED, t -> afterPageAttached(t));
|
||||
}
|
||||
|
||||
recordTextBox = new Textbox();
|
||||
recordTextBox.setParent(getComponent());
|
||||
recordTextBox.setWidth("100%");
|
||||
recordTextBox.setReadonly(true);
|
||||
|
||||
editButton = new ToolBarButton();
|
||||
editButton.setStyle("right: 21px;");
|
||||
if (ThemeManager.isUseFontIconForImage())
|
||||
editButton.setIconSclass("z-icon-Edit");
|
||||
else
|
||||
editButton.setImage(ThemeManager.getThemeResource(IMAGES_CONTEXT_EDIT_RECORD_PNG));
|
||||
editButton.setParent(getComponent());
|
||||
editButton.addEventListener(Events.ON_CLICK, this);
|
||||
editButton.setTooltiptext(Msg.getMsg(Env.getCtx(), "Edit"));
|
||||
|
||||
zoomButton = new ToolBarButton();
|
||||
if (ThemeManager.isUseFontIconForImage())
|
||||
zoomButton.setIconSclass("z-icon-Zoom");
|
||||
else
|
||||
zoomButton.setImage(ThemeManager.getThemeResource(IMAGES_CONTEXT_ZOOM_PNG));
|
||||
zoomButton.setParent(getComponent());
|
||||
zoomButton.addEventListener(Events.ON_CLICK, this);
|
||||
zoomButton.setTooltiptext(Msg.getMsg(Env.getCtx(), "Zoom"));
|
||||
|
||||
if (gridField != null)
|
||||
{
|
||||
popupMenu = new WEditorPopupMenu(true, true, isShowPreference());
|
||||
popupMenu.addMenuListener(this);
|
||||
addChangeLogMenu(popupMenu);
|
||||
}
|
||||
}
|
||||
|
||||
private void afterPageAttached(Object t) {
|
||||
if (t instanceof Component) {
|
||||
Component component = (Component) t;
|
||||
Component parent = component.getParent();
|
||||
while (parent != null) {
|
||||
if (parent instanceof FindWindow)
|
||||
break;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
if (parent != null && parent instanceof FindWindow) {
|
||||
FindWindow fw = (FindWindow) parent;
|
||||
GridField field = fw.getTargetMField("AD_Table_ID");
|
||||
if (field != null) {
|
||||
//search field initialisation code duplicated from FindWindow
|
||||
field = field.clone(gridField.getVO().ctx);
|
||||
field.loadLookupNoValidate();
|
||||
Lookup lookup = field.getLookup();
|
||||
if (lookup != null && lookup instanceof MLookup)
|
||||
{
|
||||
MLookup mLookup = (MLookup) lookup;
|
||||
mLookup.getLookupInfo().tabNo = FindWindow.TABNO;
|
||||
|
||||
if (field.getVO().ValidationCodeLookup != null && !field.getVO().ValidationCodeLookup.isEmpty())
|
||||
{
|
||||
mLookup.getLookupInfo().ValidationCode = field.getVO().ValidationCodeLookup;
|
||||
mLookup.getLookupInfo().IsValidated = false;
|
||||
}
|
||||
}
|
||||
tableIDGridField = field;
|
||||
if (tableIDValue != null)
|
||||
tableIDGridField.setValue(tableIDValue, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void actionRefresh()
|
||||
{
|
||||
recordTextBox.setValue(getDisplay());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionZoom()
|
||||
{
|
||||
String s = tableIDValue != null ? String.valueOf(tableIDValue) : "";
|
||||
int tableID = s.length() > 0 ? Integer.parseInt(s) : 0;
|
||||
s = recordIDValue != null ? String.valueOf(recordIDValue) : "";
|
||||
int recordID = s.length() > 0 ? Integer.parseInt(s) : 0;
|
||||
if(tableID <= 0 || recordID < 0)
|
||||
return;
|
||||
if (!MRole.getDefault().isTableAccess(tableID, false))
|
||||
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "AccessTableNoView"));
|
||||
AEnv.zoom(tableID, recordID);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMenu(ContextMenuEvent evt)
|
||||
{
|
||||
if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
actionRefresh();
|
||||
}
|
||||
else if (WEditorPopupMenu.ZOOM_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
actionZoom();
|
||||
}
|
||||
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
WFieldRecordInfo.start(gridField);
|
||||
}
|
||||
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
|
||||
{
|
||||
if (isShowPreference())
|
||||
ValuePreference.start (getComponent(), gridField, getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadWrite(boolean readWrite) {
|
||||
m_ReadWrite = readWrite;
|
||||
if(editButton != null)
|
||||
editButton.setDisabled(!readWrite);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadWrite() {
|
||||
return m_ReadWrite;
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
if (GridField.PROPERTY.equals(evt.getPropertyName()))
|
||||
{
|
||||
int tableID = tableIDValue != null ? Integer.parseInt(String.valueOf(tableIDValue)) : 0;
|
||||
int recordID = Integer.parseInt(Objects.toString(evt.getNewValue(), "-1"));
|
||||
if (tableID > 0 && recordID >= 0)
|
||||
{
|
||||
MTable table = MTable.get(Env.getCtx(), tableID);
|
||||
table.getPO(recordID, null); // calls po.checkCrossTenant() method
|
||||
}
|
||||
setValue(evt.getNewValue(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
setValue(value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Value
|
||||
* @param value value
|
||||
* @param fire data binding
|
||||
*/
|
||||
|
||||
private void setValue (Object value, boolean fire) {
|
||||
recordTextBox.setValue("");
|
||||
if (value == null || Util.isEmpty(value.toString(), true)) {
|
||||
value = null;
|
||||
} else {
|
||||
//get initial ad_table_id value
|
||||
if (tableIDValue == null && tableIDGridField != null) {
|
||||
tableIDValue = tableIDGridField.getValue();
|
||||
}
|
||||
if(value != null && tableIDValue != null) {
|
||||
int recordID = Integer.parseInt(String.valueOf(value));
|
||||
int tableID = Integer.parseInt(String.valueOf(tableIDValue));
|
||||
if(recordID >= 0 && tableID > 0)
|
||||
recordTextBox.setValue(getIdentifier(tableID, recordID));
|
||||
}
|
||||
}
|
||||
|
||||
if (fire) {
|
||||
// Record_ID
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), recordIDValue, value);
|
||||
super.fireValueChange(changeEvent);
|
||||
}
|
||||
recordIDValue = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return recordIDValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplay() {
|
||||
if((tableIDValue != null) && (recordIDValue != null)) {
|
||||
int tableID = Integer.parseInt(String.valueOf(tableIDValue));
|
||||
int recordID = Integer.parseInt(String.valueOf(recordIDValue));
|
||||
return getIdentifier(tableID, recordID);
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayTextForGridView(GridRowCtx gridRowCtx, Object value) {
|
||||
if (gridTab != null) {
|
||||
String key = gridTab.getWindowNo() + "|AD_Table_ID";
|
||||
Object rowTableIdValue = gridRowCtx.get(key);
|
||||
int rowTableID = Integer.parseInt(String.valueOf(rowTableIdValue));
|
||||
int rowRecordID = Integer.parseInt(String.valueOf(value));
|
||||
return getIdentifier(rowTableID, rowRecordID);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if(event.getName().equalsIgnoreCase(Events.ON_CLICK)) {
|
||||
if(event.getTarget().equals(zoomButton)) {
|
||||
actionZoom();
|
||||
}
|
||||
else if(event.getTarget().equals(editButton)) {
|
||||
if (tableIDGridField != null) {
|
||||
//for find window context
|
||||
if (gridTab == null) {
|
||||
String tableIdTxt = Env.getContext(gridField.getVO().ctx, gridField.getWindowNo(), FindWindow.TABNO, "AD_Table_ID", true);
|
||||
if (!Util.isEmpty(tableIdTxt, true)) {
|
||||
tableIDValue = Integer.parseInt(tableIdTxt);
|
||||
}
|
||||
}
|
||||
new WRecordIDDialog(recordTextBox.getPage(), this, tableIDGridField);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(event.getName().equalsIgnoreCase(Events.ON_RIGHT_CLICK)) {
|
||||
if(event.getTarget().equals(getComponent())) {
|
||||
popupMenu.open(getComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Lookup
|
||||
* @param tableID
|
||||
* @return {@link MLookup}
|
||||
*/
|
||||
public MLookup getRecordsLookup(int tableID) {
|
||||
if(tableID <= 0)
|
||||
return null;
|
||||
MTable mTable = MTable.get(Env.getCtx(), tableID, null);
|
||||
String[] keyColumns = mTable.getKeyColumns();
|
||||
String keyColumn = "";
|
||||
if(keyColumns.length > 0)
|
||||
keyColumn = keyColumns[0];
|
||||
MColumn mColumn = MColumn.get(Env.getCtx(), mTable.getTableName(), keyColumn);
|
||||
|
||||
int tabNo = gridTab != null ? gridTab.getTabNo() : FindWindow.TABNO;
|
||||
int windowNo = gridTab != null ? gridTab.getWindowNo() : gridField.getWindowNo();
|
||||
MLookupInfo lookupInfo = MLookupFactory.getLookupInfo (Env.getCtx(), windowNo, tabNo, mColumn.getAD_Column_ID(), DisplayType.Search);
|
||||
return new MLookup(lookupInfo, tabNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Identifier String from AD_Table_ID and Record_ID
|
||||
* @param tableID
|
||||
* @param recordID
|
||||
* @return String
|
||||
*/
|
||||
public String getIdentifier(int tableID, int recordID) {
|
||||
MLookup lookup = getRecordsLookup(tableID);
|
||||
return lookup != null ? lookup.getDisplay(recordID) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AD_Table_ID
|
||||
* @return Object
|
||||
*/
|
||||
public Object getAD_Table_ID() {
|
||||
return tableIDValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set AD_Table_ID
|
||||
* @param tableID
|
||||
*/
|
||||
public void setAD_Table_ID(Object tableID){
|
||||
// Data Binding
|
||||
// AD_Table_ID
|
||||
if (gridTab != null) {
|
||||
Object oldValue = gridTab.getValue("AD_Table_ID");
|
||||
gridTab.setValue(tableIDGridField, tableID);
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, "AD_Table_ID", oldValue, tableID);
|
||||
super.fireValueChange(changeEvent);
|
||||
} else {
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, "AD_Table_ID", tableIDValue, tableID);
|
||||
super.fireValueChange(changeEvent);
|
||||
}
|
||||
|
||||
tableIDValue = tableID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Div getComponent() {
|
||||
return (Div) super.getComponent();
|
||||
}
|
||||
}
|
|
@ -197,7 +197,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
|
||||
if (Util.isEmpty(m_tableName))
|
||||
setTableAndKeyColumn();
|
||||
|
||||
|
||||
boolean enableDrill = false;
|
||||
if(getGridField() != null && getGridField().getGridTab() != null && getGridField().getColumnName().endsWith("_ID")
|
||||
&& MRole.getDefault().isCanReport(getGridField().getGridTab().getAD_Table_ID()))
|
||||
|
@ -261,7 +261,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
{
|
||||
Object curValue = this.value;
|
||||
this.value = value;
|
||||
if (value != null && !"".equals(String.valueOf(value)))
|
||||
if (value != null && !"".equals(String.valueOf(value)))
|
||||
{
|
||||
NamePair namePair = lookup.get(value);
|
||||
if (namePair != null)
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.adempiere.webui.editor.WPAttributeEditor;
|
|||
import org.adempiere.webui.editor.WPasswordEditor;
|
||||
import org.adempiere.webui.editor.WPaymentEditor;
|
||||
import org.adempiere.webui.editor.WRadioGroupEditor;
|
||||
import org.adempiere.webui.editor.WRecordIDEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
|
@ -229,6 +230,10 @@ public class DefaultEditorFactory implements IEditorFactory {
|
|||
else if (displayType == DisplayType.TimeZoneId)
|
||||
{
|
||||
editor = new WTimeZoneEditor(gridField, tableEditor);
|
||||
}
|
||||
else if (displayType == DisplayType.RecordID)
|
||||
{
|
||||
editor = new WRecordIDEditor(gridField, tableEditor, editorConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -485,6 +485,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
|
|||
+ " AND tab.Ad_Tab_ID=(SELECT MIN(mt.AD_Tab_ID) FROM AD_tab mt WHERE mt.AD_Window_ID=t.AD_Window_ID AND mt.AD_Table_ID=t.AD_Table_ID AND mt.IsActive='Y')"
|
||||
+ " AND (c.IsKey='Y' OR "
|
||||
+ " (f.IsEncrypted='N' AND f.ObscureType IS NULL)) "
|
||||
+ " AND c.IsActive = 'Y' "
|
||||
+ "ORDER BY c.IsKey DESC, f.SeqNo";
|
||||
|
||||
try
|
||||
|
|
|
@ -1276,10 +1276,14 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
*/
|
||||
protected String buildDataSQL(int start, int end) {
|
||||
String dataSql;
|
||||
String dynWhere = getSQLWhere();
|
||||
String dynWhere = getSQLWhere(); // includes first AND
|
||||
StringBuilder sql = new StringBuilder (m_sqlMain);
|
||||
if (dynWhere.length() > 0)
|
||||
sql.append(dynWhere); // includes first AND
|
||||
if (dynWhere.length() > 0) {
|
||||
if(sql.toString().trim().endsWith("WHERE")) {
|
||||
dynWhere = dynWhere.replaceFirst("AND", " ");
|
||||
}
|
||||
sql.append(dynWhere);
|
||||
}
|
||||
|
||||
if (sql.toString().trim().endsWith("WHERE")) {
|
||||
int index = sql.lastIndexOf(" WHERE");
|
||||
|
@ -1420,11 +1424,15 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
queryTimeout = MSysConfig.getIntValue(MSysConfig.ZK_INFO_QUERY_TIME_OUT, 0, Env.getAD_Client_ID(Env.getCtx()));
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
String dynWhere = getSQLWhere();
|
||||
String dynWhere = getSQLWhere(); // includes first AND
|
||||
StringBuilder sql = new StringBuilder (m_sqlCount);
|
||||
|
||||
if (dynWhere.length() > 0)
|
||||
sql.append(dynWhere); // includes first AND
|
||||
if (dynWhere.length() > 0) {
|
||||
if(sql.toString().trim().endsWith("WHERE")) {
|
||||
dynWhere = dynWhere.replaceFirst("AND", " ");
|
||||
}
|
||||
sql.append(dynWhere);
|
||||
}
|
||||
|
||||
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
|
||||
if (countSql.trim().endsWith("WHERE")) {
|
||||
|
@ -2867,14 +2875,18 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
}
|
||||
else
|
||||
{
|
||||
//Workaround for detached HTML input element leak
|
||||
if (getChildren().size() > 0) {
|
||||
Component[] childs = getChildren().toArray(new Component[0]);
|
||||
for(Component c : childs) {
|
||||
AEnv.detachInputElement(c);
|
||||
//detach if attach to page
|
||||
if (getDesktop() != null)
|
||||
{
|
||||
//Workaround for detached HTML input element leak
|
||||
if (getChildren().size() > 0) {
|
||||
Component[] childs = getChildren().toArray(new Component[0]);
|
||||
for(Component c : childs) {
|
||||
AEnv.detachInputElement(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executions.schedule(getDesktop(), e -> this.detach(), new Event("onAsyncDetach"));
|
||||
Executions.schedule(getDesktop(), e -> this.detach(), new Event("onAsyncDetach"));
|
||||
}
|
||||
}
|
||||
} // dispose
|
||||
|
||||
|
|
|
@ -2866,7 +2866,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
|||
findField.setGridTab(null);
|
||||
WEditor editor = null;
|
||||
if (findField.isKey()
|
||||
|| (!DisplayType.isLookup(findField.getDisplayType()) && DisplayType.isID(findField.getDisplayType())))
|
||||
|| (!DisplayType.isLookup(findField.getDisplayType()) && DisplayType.isID(findField.getDisplayType())
|
||||
&& findField.getDisplayType() != DisplayType.RecordID))
|
||||
{
|
||||
editor = new WNumberEditor(findField);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
/**********************************************************************
|
||||
* This file is part of iDempiere ERP Open Source *
|
||||
* http://www.idempiere.org *
|
||||
* *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Peter Takacs, Cloudempiere *
|
||||
**********************************************************************/
|
||||
package org.adempiere.webui.window;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WRecordIDEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zhtml.Text;
|
||||
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.Div;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Peter Takacs, Cloudempiere
|
||||
*
|
||||
*/
|
||||
public class WRecordIDDialog extends Window implements EventListener<Event> {
|
||||
|
||||
/**
|
||||
* generated serial id
|
||||
*/
|
||||
private static final long serialVersionUID = 8126107952514403099L;
|
||||
|
||||
/** Record_ID editor from which the window is opened */
|
||||
private WRecordIDEditor editor;
|
||||
/** Current tab's AD_Table_ID GrodField */
|
||||
private GridField tableIDGridField;
|
||||
/** Current Record_ID value from {@link #editor} */
|
||||
private Integer recordIDValue;
|
||||
/** Current AD_Table_ID value from {@link #editor} */
|
||||
private Integer tableIDValue;
|
||||
|
||||
// UI components
|
||||
private Div contentDiv;
|
||||
private Div labelsDiv;
|
||||
private Div fieldsDiv;
|
||||
private Div confirmPanelDiv;
|
||||
private WTableDirEditor tableIDEditor;
|
||||
private Button okBtn;
|
||||
private Button cancelBtn;
|
||||
private Textbox parentTextBox;
|
||||
private WSearchEditor recordsEditor;
|
||||
private Text recordsEditorLabel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param page
|
||||
* @param editor
|
||||
* @param tableIDGridField
|
||||
*/
|
||||
public WRecordIDDialog(Page page, WRecordIDEditor editor, GridField tableIDGridField) {
|
||||
super();
|
||||
|
||||
this.editor = editor;
|
||||
this.tableIDGridField = tableIDGridField;
|
||||
if(editor.getValue() instanceof Integer) {
|
||||
this.recordIDValue = (Integer)editor.getValue();
|
||||
} else {
|
||||
if (editor.getValue() == null)
|
||||
this.recordIDValue = null;
|
||||
else
|
||||
this.recordIDValue = Integer.valueOf(editor.getValue().toString());
|
||||
}
|
||||
|
||||
if (editor.getAD_Table_ID() instanceof Integer) {
|
||||
tableIDValue = (Integer) editor.getAD_Table_ID();
|
||||
} else {
|
||||
if (editor.getAD_Table_ID() == null)
|
||||
tableIDValue = null;
|
||||
else
|
||||
tableIDValue = Integer.valueOf(editor.getAD_Table_ID().toString());
|
||||
}
|
||||
|
||||
init(page);
|
||||
}
|
||||
|
||||
private void init(Page page) {
|
||||
Vlayout vLayout = new Vlayout();
|
||||
labelsDiv = new Div();
|
||||
fieldsDiv = new Div();
|
||||
contentDiv = new Div();
|
||||
confirmPanelDiv = new Div();
|
||||
okBtn = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
|
||||
cancelBtn = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL, true, true);;
|
||||
tableIDEditor = new WTableDirEditor("AD_Table_ID", false, false, true, tableIDGridField.getLookup(), true);
|
||||
tableIDEditor.setValue(tableIDValue);
|
||||
int tableID = tableIDValue != null ? tableIDValue.intValue() : 0;
|
||||
recordsEditor = tableID > 0 ? new WSearchEditor("Record_ID", false, false, true, editor.getRecordsLookup(tableID)) : null;
|
||||
|
||||
setPage(page);
|
||||
setClosable(true);
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "ChooseRelatedRecord"));
|
||||
setPosition("center");
|
||||
setSclass("recordid-dialog");
|
||||
|
||||
contentDiv.setSclass("recordid-dialog-content");
|
||||
confirmPanelDiv.setSclass("recordid-dialog-confirm");
|
||||
|
||||
if (editor.getGridField().getGridTab() != null) {
|
||||
parentTextBox = new Textbox();
|
||||
parentTextBox.setReadonly(true);
|
||||
parentTextBox.setValue(editor.getIdentifier(
|
||||
editor.getGridField().getGridTab().getAD_Table_ID(), editor.getGridField().getGridTab().getRecord_ID()));
|
||||
}
|
||||
|
||||
tableIDEditor.getComponent().addEventListener(Events.ON_SELECT, this);
|
||||
|
||||
if (recordsEditor != null)
|
||||
recordsEditor.setValue(recordIDValue);
|
||||
|
||||
okBtn.addEventListener(Events.ON_CLICK, this);
|
||||
okBtn.setSclass("recordid-dialog-confirm");
|
||||
cancelBtn.addEventListener(Events.ON_CLICK, this);
|
||||
cancelBtn.setSclass("recordid-dialog-confirm");
|
||||
|
||||
if (parentTextBox != null) {
|
||||
Text text = new Text(Msg.getMsg(Env.getCtx(), "Parent"));
|
||||
labelsDiv.appendChild(text);
|
||||
}
|
||||
Text text = new Text(Msg.getMsg(Env.getCtx(), "Table"));
|
||||
labelsDiv.appendChild(text);
|
||||
recordsEditorLabel = new Text(Msg.getMsg(Env.getCtx(), "Record"));
|
||||
if (recordsEditor != null)
|
||||
labelsDiv.appendChild(recordsEditorLabel);
|
||||
labelsDiv.setSclass("recordid-dialog-labels");
|
||||
|
||||
fieldsDiv.setSclass("recordid-dialog-fields");
|
||||
|
||||
if (parentTextBox != null)
|
||||
fieldsDiv.appendChild(parentTextBox);
|
||||
fieldsDiv.appendChild(tableIDEditor.getComponent());
|
||||
if (recordsEditor != null)
|
||||
fieldsDiv.appendChild(recordsEditor.getComponent());
|
||||
|
||||
contentDiv.appendChild(labelsDiv);
|
||||
contentDiv.appendChild(fieldsDiv);
|
||||
|
||||
confirmPanelDiv.appendChild(okBtn);
|
||||
confirmPanelDiv.appendChild(cancelBtn);
|
||||
|
||||
vLayout.appendChild(contentDiv);
|
||||
vLayout.appendChild(confirmPanelDiv);
|
||||
|
||||
appendChild(vLayout);
|
||||
doHighlighted();
|
||||
|
||||
tableIDEditor.getComponent().focus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if(event.getName().equalsIgnoreCase(Events.ON_CLICK)) {
|
||||
if(event.getTarget().equals(okBtn)) {
|
||||
// set the selected values to the editors
|
||||
editor.setAD_Table_ID(tableIDEditor.getValue());
|
||||
editor.setValue(recordsEditor.getValue());
|
||||
onClose();
|
||||
}
|
||||
else if(event.getTarget().equals(cancelBtn)) {
|
||||
// dismiss the selected values
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
if(event.getName().equalsIgnoreCase(Events.ON_SELECT)) {
|
||||
if (event.getTarget().equals(tableIDEditor.getComponent())) {
|
||||
// the Record_ID should be cleared when a different AD_Table_ID is selected
|
||||
if (recordsEditor != null) {
|
||||
recordsEditor.setValue(null);
|
||||
recordsEditorLabel.detach();
|
||||
recordsEditor.getComponent().detach();
|
||||
}
|
||||
int tableID = Integer.parseInt(Objects.toString(tableIDEditor.getValue(), "-1"));
|
||||
if(tableID > 0) {
|
||||
recordsEditor = new WSearchEditor("Record_ID", false, false, true, editor.getRecordsLookup(tableID));
|
||||
labelsDiv.appendChild(recordsEditorLabel);
|
||||
fieldsDiv.appendChild(recordsEditor.getComponent());
|
||||
recordsEditor.getComponent().focus();
|
||||
} else {
|
||||
tableIDEditor.getComponent().focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -154,6 +154,66 @@ input[type="checkbox"]:focus
|
|||
margin: 5px;
|
||||
}
|
||||
|
||||
.recordid-editor {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.recordid-editor .z-toolbarbutton {
|
||||
padding: 4px 0px 0px 1px;
|
||||
margin: 0px;
|
||||
display: inline-block;
|
||||
background-image: none;
|
||||
position: absolute;
|
||||
background-color: #F7F7F7;
|
||||
width: 22px;
|
||||
height: 24px;
|
||||
min-height: 24px;
|
||||
right: 0px;
|
||||
top: 3px;
|
||||
border: 1px solid #CFCFCF;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.recordid-dialog {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.recordid-dialog-content {
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.recordid-dialog-labels {
|
||||
display: grid;
|
||||
text-align: right;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.recordid-dialog-fields {
|
||||
display: grid;
|
||||
width: 77%;
|
||||
}
|
||||
|
||||
.recordid-dialog-fields .editor-button {
|
||||
top: 8px !important;
|
||||
}
|
||||
|
||||
.recordid-dialog-content .z-combobox, .recordid-dialog-content .z-textbox {
|
||||
width: 98% !important;
|
||||
margin: 8px 5px;
|
||||
}
|
||||
|
||||
.recordid-dialog-confirm {
|
||||
text-align: end;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.recordid-dialog-confirm .z-button {
|
||||
margin: 0px 5px !important;
|
||||
height: 30px;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
.date-picker-calendar-button {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
|
|
Loading…
Reference in New Issue