IDEMPIERE-5319 - Delete Record with Confirmation Logic (#1371)

* IDEMPIERE-5319 - Delete Record with Confirmation Logic

* IDEMPIERE-5319 - modified listener for more correct behavior

* IDEMPIERE-5319 - modified listener for more correct behavior

* IDEMPIERE-5319 - improved validation

* IDEMPIERE-5319 - exception, message translation, removed new buttons

* IDEMPIERE-5319 - merged validation on close
This commit is contained in:
Peter Takács 2022-06-27 11:26:38 +02:00 committed by GitHub
parent 1f9955fcc9
commit 5303a10da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 649 additions and 157 deletions

View File

@ -0,0 +1,100 @@
-- IDEMPIERE-5319
SELECT register_migration_script('202206171231_IDEMPIERE-5319.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jun 17, 2022, 12:31:33 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203602,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:31:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:31:33','YYYY-MM-DD HH24:MI:SS'),100,'DeleteConfirmationLogic','Delete Confirmation Logic','Delete Confirmation Logic','D','1ffaa85d-527c-4e37-9472-3f9e74d8fd1e')
;
-- Jun 17, 2022, 12:33:31 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,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 (214937,0,'Delete Confirmation Logic',106,'DeleteConfirmationLogic',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:33:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:33:31','YYYY-MM-DD HH24:MI:SS'),100,203602,'Y','N','D','N','N','N','Y','c478ffba-25a8-4010-b77b-007286df5403','Y',0,'N','N','N','N')
;
-- Jun 17, 2022, 12:34:23 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,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 (214938,0,'Delete Confirmation Logic',466,'DeleteConfirmationLogic',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:34:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:34:23','YYYY-MM-DD HH24:MI:SS'),100,203602,'Y','N','D','N','N','N','Y','124d81e0-1c59-4583-8c94-d2983184bc92','Y',0,'N','N','N','N')
;
-- Jun 17, 2022, 2:14:19 PM CEST
ALTER TABLE AD_Tab ADD DeleteConfirmationLogic VARCHAR2(255 CHAR) DEFAULT NULL
;
-- Jun 17, 2022, 2:14:42 PM CEST
ALTER TABLE AD_UserDef_Tab ADD DeleteConfirmationLogic VARCHAR2(255 CHAR) DEFAULT NULL
;
-- Jun 17, 2022, 2:27:18 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207079,'Delete Confirmation Logic',106,214937,'Y',0,390,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:27:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:27:18','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','58f3879f-6b9b-4f75-8f84-b3c654eff5f2','Y',360,1,1,1,'N','N','N','N')
;
-- Jun 17, 2022, 2:28:56 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207079
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205
;
-- Jun 17, 2022, 2:29:57 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207080,'Delete Confirmation Logic',394,214938,'Y',0,190,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:29:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:29:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','77efa46f-f83b-4ca8-87cc-375e26d3084f','Y',190,1,1,1,'N','N','N','N')
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207080
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205833
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200003
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205828
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205830
;
-- Jun 17, 2022, 2:50:13 PM CEST
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','Do you want to delete the record?<br />
Please confirm by typing: <b>{0}<b/>',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:50:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:50:13','YYYY-MM-DD HH24:MI:SS'),100,200763,'DeleteRecordWithConfirm?','D','f95200bf-125c-4d7e-a157-79cd1971905d')
;
-- Jun 21, 2022, 10:32:12 AM CEST
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','Do you want to delete {0} (selected) items?<br />
Please confirm by typing: <b>{1}<b/>',0,0,'Y',TO_TIMESTAMP('2022-06-21 10:32:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-21 10:32:11','YYYY-MM-DD HH24:MI:SS'),100,200764,'DeleteSelectionWithConfirm?','D','850eaab7-0ae9-48db-8232-80af712b5024')
;
-- Jun 22, 2022, 1:16:31 PM CEST
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 ('E','Entered Value Is Not Correct',0,0,'Y',TO_TIMESTAMP('2022-06-22 13:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-22 13:16:30','YYYY-MM-DD HH24:MI:SS'),100,200765,'ValueNotCorrect','D','a8be89f0-367c-4f4b-8df8-62b6da3f3f2e')
;

View File

@ -0,0 +1,97 @@
-- IDEMPIERE-5319
SELECT register_migration_script('202206171231_IDEMPIERE-5319.sql') FROM dual;
-- Jun 17, 2022, 12:31:33 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203602,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:31:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:31:33','YYYY-MM-DD HH24:MI:SS'),100,'DeleteConfirmationLogic','Delete Confirmation Logic','Delete Confirmation Logic','D','1ffaa85d-527c-4e37-9472-3f9e74d8fd1e')
;
-- Jun 17, 2022, 12:33:31 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,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 (214937,0,'Delete Confirmation Logic',106,'DeleteConfirmationLogic',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:33:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:33:31','YYYY-MM-DD HH24:MI:SS'),100,203602,'Y','N','D','N','N','N','Y','c478ffba-25a8-4010-b77b-007286df5403','Y',0,'N','N','N','N')
;
-- Jun 17, 2022, 12:34:23 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,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 (214938,0,'Delete Confirmation Logic',466,'DeleteConfirmationLogic',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2022-06-17 12:34:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 12:34:23','YYYY-MM-DD HH24:MI:SS'),100,203602,'Y','N','D','N','N','N','Y','124d81e0-1c59-4583-8c94-d2983184bc92','Y',0,'N','N','N','N')
;
-- Jun 17, 2022, 2:14:19 PM CEST
ALTER TABLE AD_Tab ADD COLUMN DeleteConfirmationLogic VARCHAR(255) DEFAULT NULL
;
-- Jun 17, 2022, 2:14:42 PM CEST
ALTER TABLE AD_UserDef_Tab ADD COLUMN DeleteConfirmationLogic VARCHAR(255) DEFAULT NULL
;
-- Jun 17, 2022, 2:27:18 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207079,'Delete Confirmation Logic',106,214937,'Y',0,390,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:27:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:27:18','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','58f3879f-6b9b-4f75-8f84-b3c654eff5f2','Y',360,1,1,1,'N','N','N','N')
;
-- Jun 17, 2022, 2:28:56 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207079
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131
;
-- Jun 17, 2022, 2:28:57 PM CEST
UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205
;
-- Jun 17, 2022, 2:29:57 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207080,'Delete Confirmation Logic',394,214938,'Y',0,190,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:29:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:29:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','77efa46f-f83b-4ca8-87cc-375e26d3084f','Y',190,1,1,1,'N','N','N','N')
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207080
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205833
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200003
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205828
;
-- Jun 17, 2022, 2:30:46 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-06-17 14:30:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205830
;
-- Jun 17, 2022, 2:50:13 PM CEST
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','Do you want to delete the record?<br />
Please confirm by typing: <b>{0}<b/>',0,0,'Y',TO_TIMESTAMP('2022-06-17 14:50:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-17 14:50:13','YYYY-MM-DD HH24:MI:SS'),100,200763,'DeleteRecordWithConfirm?','D','f95200bf-125c-4d7e-a157-79cd1971905d')
;
-- Jun 21, 2022, 10:32:12 AM CEST
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','Do you want to delete {0} (selected) items?<br />
Please confirm by typing: <b>{1}<b/>',0,0,'Y',TO_TIMESTAMP('2022-06-21 10:32:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-21 10:32:11','YYYY-MM-DD HH24:MI:SS'),100,200764,'DeleteSelectionWithConfirm?','D','850eaab7-0ae9-48db-8232-80af712b5024')
;
-- Jun 22, 2022, 1:16:31 PM CEST
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 ('E','Entered Value Is Not Correct',0,0,'Y',TO_TIMESTAMP('2022-06-22 13:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-06-22 13:16:30','YYYY-MM-DD HH24:MI:SS'),100,200765,'ValueNotCorrect','D','a8be89f0-367c-4f4b-8df8-62b6da3f3f2e')
;

View File

@ -3462,6 +3462,22 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
this.calloutUI = calloutUI;
}
/**
* Get Delete Confirmation Logic
* @return String
*/
public String getDeleteConfirmationLogic() {
return m_vo.deleteConfirmationLogic;
}
/**
* Set Delete Confirmation Logic
* @param deleteConfirmationLogic
*/
public void setDeleteConfirmationLogic(String deleteConfirmationLogic) {
m_vo.deleteConfirmationLogic = deleteConfirmationLogic;
}
/** Get Max Query Records.
* @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records
*/

View File

@ -105,9 +105,21 @@ public class GridTabVO implements Evaluatee, Serializable
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_AD_Tab_UU, vo.AD_Tab_UU);
// FR IDEMPIERE-177
MUserDefTab userDef = MUserDefTab.get(vo.ctx, vo.AD_Tab_ID, vo.AD_Window_ID);
MTab tab = MTab.get(vo.AD_Tab_ID);
vo.Name = rs.getString("Name");
if (userDef != null && userDef.getName() != null)
vo.Name = userDef.getName();
if (userDef != null) {
if(!Util.isEmpty(userDef.getName()))
vo.Name = userDef.getName();
if(!Util.isEmpty(userDef.getDeleteConfirmationLogic()))
vo.deleteConfirmationLogic = userDef.getDeleteConfirmationLogic();
else if((tab != null) && (!Util.isEmpty(tab.getDeleteConfirmationLogic())))
vo.deleteConfirmationLogic = tab.getDeleteConfirmationLogic();
}
else if((tab != null) && (!Util.isEmpty(tab.getDeleteConfirmationLogic()))) {
vo.deleteConfirmationLogic = tab.getDeleteConfirmationLogic();
}
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_Name, vo.Name);
// Translation Tab **
@ -547,6 +559,9 @@ public class GridTabVO implements Evaluatee, Serializable
private ArrayList<GridFieldVO> Fields = null;
private boolean initFields = false;
/** Delete Confirmation Logic of AD_Tab or AD_UserDef_Tab */
public String deleteConfirmationLogic = null;
public ArrayList<GridFieldVO> getFields()
{
@ -627,6 +642,7 @@ public class GridTabVO implements Evaluatee, Serializable
clone.AD_Image_ID = AD_Image_ID;
clone.Included_Tab_ID = Included_Tab_ID;
clone.ReplicationType = ReplicationType;
clone.deleteConfirmationLogic = deleteConfirmationLogic;
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_AccessLevel, clone.AccessLevel);
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_AD_Table_ID, String.valueOf(clone.AD_Table_ID));
Env.setContext(Ctx, windowNo, clone.TabNo, GridTab.CTX_IsLookupOnlySelection, clone.IsLookupOnlySelection);

View File

@ -44,26 +44,11 @@ public interface I_AD_Tab
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
/** Get Tenant.
* Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Column_ID */
public static final String COLUMNNAME_AD_Column_ID = "AD_Column_ID";
/** Set Column.
* Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID);
/** Get Column.
* Column in the table
*/
public int getAD_Column_ID();
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException;
/** Column name AD_ColumnSortOrder_ID */
public static final String COLUMNNAME_AD_ColumnSortOrder_ID = "AD_ColumnSortOrder_ID";
@ -94,6 +79,21 @@ public interface I_AD_Tab
public org.compiere.model.I_AD_Column getAD_ColumnSortYesNo() throws RuntimeException;
/** Column name AD_Column_ID */
public static final String COLUMNNAME_AD_Column_ID = "AD_Column_ID";
/** Set Column.
* Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID);
/** Get Column.
* Column in the table
*/
public int getAD_Column_ID();
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException;
/** Column name AD_CtxHelp_ID */
public static final String COLUMNNAME_AD_CtxHelp_ID = "AD_CtxHelp_ID";
@ -124,12 +124,12 @@ public interface I_AD_Tab
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public int getAD_Org_ID();
@ -148,6 +148,19 @@ public interface I_AD_Tab
public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException;
/** Column name AD_TabType */
public static final String COLUMNNAME_AD_TabType = "AD_TabType";
/** Set Tab Type.
* Defines Tab Type
*/
public void setAD_TabType (String AD_TabType);
/** Get Tab Type.
* Defines Tab Type
*/
public String getAD_TabType();
/** Column name AD_Tab_ID */
public static final String COLUMNNAME_AD_Tab_ID = "AD_Tab_ID";
@ -185,19 +198,6 @@ public interface I_AD_Tab
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
/** Column name AD_TabType */
public static final String COLUMNNAME_AD_TabType = "AD_TabType";
/** Set Tab Type.
* Defines Tab Type
*/
public void setAD_TabType (String AD_TabType);
/** Get Tab Type.
* Defines Tab Type
*/
public String getAD_TabType();
/** Column name AD_Window_ID */
public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID";
@ -242,6 +242,15 @@ public interface I_AD_Tab
*/
public int getCreatedBy();
/** Column name DeleteConfirmationLogic */
public static final String COLUMNNAME_DeleteConfirmationLogic = "DeleteConfirmationLogic";
/** Set Delete Confirmation Logic */
public void setDeleteConfirmationLogic (String DeleteConfirmationLogic);
/** Get Delete Confirmation Logic */
public String getDeleteConfirmationLogic();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
@ -466,12 +475,12 @@ public interface I_AD_Tab
/** Column name IsTranslationTab */
public static final String COLUMNNAME_IsTranslationTab = "IsTranslationTab";
/** Set TranslationTab.
/** Set Translation Tab.
* This Tab contains translation information
*/
public void setIsTranslationTab (boolean IsTranslationTab);
/** Get TranslationTab.
/** Get Translation Tab.
* This Tab contains translation information
*/
public boolean isTranslationTab();

View File

@ -44,8 +44,8 @@ public interface I_AD_UserDef_Tab
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
/** Get Tenant.
* Tenant for this installation.
*/
public int getAD_Client_ID();
@ -53,12 +53,12 @@ public interface I_AD_UserDef_Tab
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
* Organizational entity within tenant
*/
public int getAD_Org_ID();
@ -137,6 +137,15 @@ public interface I_AD_UserDef_Tab
*/
public int getCreatedBy();
/** Column name DeleteConfirmationLogic */
public static final String COLUMNNAME_DeleteConfirmationLogic = "DeleteConfirmationLogic";
/** Set Delete Confirmation Logic */
public void setDeleteConfirmationLogic (String DeleteConfirmationLogic);
/** Get Delete Confirmation Logic */
public String getDeleteConfirmationLogic();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";

View File

@ -31,7 +31,7 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20220119L;
private static final long serialVersionUID = 20220617L;
/** Standard Constructor */
public X_AD_Tab (Properties ctx, int AD_Tab_ID, String trxName)
@ -123,34 +123,6 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return sb.toString();
}
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException
{
return (org.compiere.model.I_AD_Column)MTable.get(getCtx(), org.compiere.model.I_AD_Column.Table_ID)
.getPO(getAD_Column_ID(), get_TrxName());
}
/** Set Column.
@param AD_Column_ID Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID)
{
if (AD_Column_ID < 1)
set_Value (COLUMNNAME_AD_Column_ID, null);
else
set_Value (COLUMNNAME_AD_Column_ID, Integer.valueOf(AD_Column_ID));
}
/** Get Column.
@return Column in the table
*/
public int getAD_Column_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Column_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Column getAD_ColumnSortOrder() throws RuntimeException
{
return (org.compiere.model.I_AD_Column)MTable.get(getCtx(), org.compiere.model.I_AD_Column.Table_ID)
@ -207,6 +179,34 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException
{
return (org.compiere.model.I_AD_Column)MTable.get(getCtx(), org.compiere.model.I_AD_Column.Table_ID)
.getPO(getAD_Column_ID(), get_TrxName());
}
/** Set Column.
@param AD_Column_ID Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID)
{
if (AD_Column_ID < 1)
set_Value (COLUMNNAME_AD_Column_ID, null);
else
set_Value (COLUMNNAME_AD_Column_ID, Integer.valueOf(AD_Column_ID));
}
/** Get Column.
@return Column in the table
*/
public int getAD_Column_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Column_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_CtxHelp getAD_CtxHelp() throws RuntimeException
{
return (org.compiere.model.I_AD_CtxHelp)MTable.get(getCtx(), org.compiere.model.I_AD_CtxHelp.Table_ID)
@ -290,6 +290,29 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return ii.intValue();
}
/** AD_TabType AD_Reference_ID=200117 */
public static final int AD_TABTYPE_AD_Reference_ID=200117;
/** Form = FORM */
public static final String AD_TABTYPE_Form = "FORM";
/** Sort = SORT */
public static final String AD_TABTYPE_Sort = "SORT";
/** Set Tab Type.
@param AD_TabType Defines Tab Type
*/
public void setAD_TabType (String AD_TabType)
{
set_Value (COLUMNNAME_AD_TabType, AD_TabType);
}
/** Get Tab Type.
@return Defines Tab Type
*/
public String getAD_TabType()
{
return (String)get_Value(COLUMNNAME_AD_TabType);
}
/** Set Tab.
@param AD_Tab_ID Tab within a Window
*/
@ -355,29 +378,6 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return ii.intValue();
}
/** AD_TabType AD_Reference_ID=200117 */
public static final int AD_TABTYPE_AD_Reference_ID=200117;
/** Form = FORM */
public static final String AD_TABTYPE_Form = "FORM";
/** Sort = SORT */
public static final String AD_TABTYPE_Sort = "SORT";
/** Set Tab Type.
@param AD_TabType Defines Tab Type
*/
public void setAD_TabType (String AD_TabType)
{
set_Value (COLUMNNAME_AD_TabType, AD_TabType);
}
/** Get Tab Type.
@return Defines Tab Type
*/
public String getAD_TabType()
{
return (String)get_Value(COLUMNNAME_AD_TabType);
}
public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException
{
return (org.compiere.model.I_AD_Window)MTable.get(getCtx(), org.compiere.model.I_AD_Window.Table_ID)
@ -422,6 +422,21 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return (String)get_Value(COLUMNNAME_CommitWarning);
}
/** Set Delete Confirmation Logic.
@param DeleteConfirmationLogic Delete Confirmation Logic
*/
public void setDeleteConfirmationLogic (String DeleteConfirmationLogic)
{
set_Value (COLUMNNAME_DeleteConfirmationLogic, DeleteConfirmationLogic);
}
/** Get Delete Confirmation Logic.
@return Delete Confirmation Logic */
public String getDeleteConfirmationLogic()
{
return (String)get_Value(COLUMNNAME_DeleteConfirmationLogic);
}
/** Set Description.
@param Description Optional short description of the record
*/
@ -762,7 +777,7 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
return false;
}
/** Set TranslationTab.
/** Set Translation Tab.
@param IsTranslationTab This Tab contains translation information
*/
public void setIsTranslationTab (boolean IsTranslationTab)
@ -770,7 +785,7 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent
set_Value (COLUMNNAME_IsTranslationTab, Boolean.valueOf(IsTranslationTab));
}
/** Get TranslationTab.
/** Get Translation Tab.
@return This Tab contains translation information
*/
public boolean isTranslationTab()

View File

@ -31,7 +31,7 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
/**
*
*/
private static final long serialVersionUID = 20220119L;
private static final long serialVersionUID = 20220617L;
/** Standard Constructor */
public X_AD_UserDef_Tab (Properties ctx, int AD_UserDef_Tab_ID, String trxName)
@ -214,6 +214,21 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
return ii.intValue();
}
/** Set Delete Confirmation Logic.
@param DeleteConfirmationLogic Delete Confirmation Logic
*/
public void setDeleteConfirmationLogic (String DeleteConfirmationLogic)
{
set_Value (COLUMNNAME_DeleteConfirmationLogic, DeleteConfirmationLogic);
}
/** Get Delete Confirmation Logic.
@return Delete Confirmation Logic */
public String getDeleteConfirmationLogic()
{
return (String)get_Value(COLUMNNAME_DeleteConfirmationLogic);
}
/** Set Description.
@param Description Optional short description of the record
*/

View File

@ -62,6 +62,7 @@ import org.adempiere.webui.component.ZkCssHelper;
import org.adempiere.webui.editor.IProcessButton;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.event.ActionEvent;
import org.adempiere.webui.event.ActionListener;
import org.adempiere.webui.event.DialogEvents;
@ -110,6 +111,7 @@ import org.compiere.process.DocAction;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoLog;
import org.compiere.process.ProcessInfoUtil;
import org.compiere.tools.FileUtil;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -202,6 +204,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
private int adWindowId;
private MImage image;
private String deleteConfirmationLogic;
/**
* Quick Form Status bar
@ -2756,29 +2760,66 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
onDeleteSelected(postCallback);
return;
}
FDialog.ask(curWindowNo, null, "DeleteRecord?", new Callback<Boolean>() {
@Override
public void onCallback(Boolean result)
{
if (result)
deleteConfirmationLogic = adTabbox.getSelectedGridTab().getDeleteConfirmationLogic();
if(Util.isEmpty(deleteConfirmationLogic)) {
FDialog.ask(curWindowNo, null, "DeleteRecord?", new Callback<Boolean>() {
@Override
public void onCallback(Boolean result)
{
//error will be catch in the dataStatusChanged event
boolean success = adTabbox.getSelectedGridTab().dataDelete();
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
if (!success)
showLastWarning();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel();
MRecentItem.publishChangedEvent(Env.getAD_User_ID(ctx));
if (result)
{
//error will be catch in the dataStatusChanged event
boolean success = adTabbox.getSelectedGridTab().dataDelete();
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
if (!success)
showLastWarning();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel();
MRecentItem.publishChangedEvent(Env.getAD_User_ID(ctx));
}
if (postCallback != null)
postCallback.onCallback(result);
}
if (postCallback != null)
postCallback.onCallback(result);
}
});
});
}
else {
int tableID = adTabbox.getSelectedGridTab().getAD_Table_ID();
int recordID = adTabbox.getSelectedGridTab().getRecord_ID();
deleteConfirmationLogic = FileUtil.parseTitle(ctx, deleteConfirmationLogic, tableID, recordID, curWindowNo, null);
deleteConfirmationLogic = Msg.parseTranslation(ctx, deleteConfirmationLogic);
WEditor editor = new WStringEditor();
editor.fillHorizontal();
editor.setValidInput(deleteConfirmationLogic);
FDialog.askForInputTextConfirmation(curWindowNo, editor, "DeleteRecordWithConfirm?", new Object[] {deleteConfirmationLogic}, null,
new Callback<Map.Entry<Boolean, String>>() {
@Override
public void onCallback(Map.Entry<Boolean, String> result)
{
if(!result.getKey() || !(result.getValue() instanceof String))
return;
if(result.getValue().equals(deleteConfirmationLogic)) {
boolean success = adTabbox.getSelectedGridTab().dataDelete();
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
if (!success)
showLastWarning();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel();
MRecentItem.publishChangedEvent(Env.getAD_User_ID(ctx));
}
if (postCallback != null)
postCallback.onCallback(result.getValue().equals(deleteConfirmationLogic));
}
});
}
}
// Elaine 2008/12/01
@ -2790,46 +2831,95 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
postCallback.onCallback(false);
return;
}
deleteConfirmationLogic = adTabbox.getSelectedGridTab().getDeleteConfirmationLogic();
final int[] indices = adTabbox.getSelectedGridTab().getSelection();
if(indices.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append(Env.getContext(ctx, curWindowNo, "_WinInfo_WindowName", false)).append(" - ")
.append(indices.length).append(" ").append(Msg.getMsg(Env.getCtx(), "Selected"));
FDialog.ask(sb.toString(), curWindowNo, null,"DeleteSelection", new Callback<Boolean>() {
@Override
public void onCallback(Boolean result) {
if(result){
adTabbox.getSelectedGridTab().clearSelection();
Arrays.sort(indices);
int offset = 0;
int count = 0;
for (int i = 0; i < indices.length; i++)
{
adTabbox.getSelectedGridTab().navigate(indices[i]-offset);
if (adTabbox.getSelectedGridTab().dataDelete())
if(Util.isEmpty(deleteConfirmationLogic)) {
FDialog.ask(sb.toString(), curWindowNo, null,"DeleteSelection", new Callback<Boolean>() {
@Override
public void onCallback(Boolean result) {
if(result){
adTabbox.getSelectedGridTab().clearSelection();
Arrays.sort(indices);
int offset = 0;
int count = 0;
for (int i = 0; i < indices.length; i++)
{
offset++;
count++;
adTabbox.getSelectedGridTab().navigate(indices[i]-offset);
if (adTabbox.getSelectedGridTab().dataDelete())
{
offset++;
count++;
}
}
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
if (getActiveGridTab().isQuickForm)
{
statusBarQF.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
else
{
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
}
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
if (getActiveGridTab().isQuickForm)
{
statusBarQF.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
else
{
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
if (postCallback != null)
postCallback.onCallback(result);
}
if (postCallback != null)
postCallback.onCallback(result);
}
});
});
}
else {
deleteConfirmationLogic = Msg.getMsg(ctx, "DeleteSelection");
WEditor editor = new WStringEditor();
editor.fillHorizontal();
editor.setValidInput(deleteConfirmationLogic);
FDialog.askForInputTextConfirmation(curWindowNo, editor, "DeleteSelectionWithConfirm?", new String[] {Integer.toString(indices.length), deleteConfirmationLogic}, null,
new Callback<Map.Entry<Boolean, String>>() {
@Override
public void onCallback(Map.Entry<Boolean, String> result)
{
if(!result.getKey() || !(result.getValue() instanceof String))
return;
if(result.getValue().equals(deleteConfirmationLogic)) {
adTabbox.getSelectedGridTab().clearSelection();
Arrays.sort(indices);
int offset = 0;
int count = 0;
for (int i = 0; i < indices.length; i++)
{
adTabbox.getSelectedGridTab().navigate(indices[i]-offset);
if (adTabbox.getSelectedGridTab().dataDelete())
{
offset++;
count++;
}
}
adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
adTabbox.getSelectedTabpanel().dynamicDisplay(0);
if (getActiveGridTab().isQuickForm)
{
statusBarQF.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
else
{
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted") + ": " + count, false);
}
}
if (postCallback != null)
postCallback.onCallback(result.getValue().equals(deleteConfirmationLogic));
}
});
}
} else {
if (getActiveGridTab().isQuickForm)
{

View File

@ -174,7 +174,7 @@ public class Messagebox extends Window implements EventListener<Event>
btnIgnore = ButtonFactory.createNamedButton("Ignore");
btnIgnore.addEventListener(Events.ON_CLICK, this);
btnIgnore.setId("btnIgnore");
Panel pnlMessage = new Panel();
if (ClientInfo.maxWidth(399))
{
@ -323,7 +323,7 @@ public class Messagebox extends Window implements EventListener<Event>
}
});
}
this.setTitle(title);
this.setPosition("center");
this.setClosable(true);
@ -417,13 +417,41 @@ public class Messagebox extends Window implements EventListener<Event>
{
returnValue = IGNORE;
}
if ((returnValue == CANCEL) || !isInputMandatory || (isInputMandatory && !Util.isEmpty(String.valueOf(inputField.getValue()))))
close();
else {
isExceptionThrown = true;
returnValue = 0;
throw new WrongValueException(inputField.getComponent(), Msg.getMsg(Env.getCtx(), "PrintFormatMandatory"));
}
//TODO
else {
returnValue = 0;
}
validateOnClose();
}
private void validateOnClose() {
// Don't close on OK if input is mandatory while input field is empty
if ((returnValue == CANCEL) || !isInputMandatory || (isInputMandatory && !Util.isEmpty(String.valueOf(inputField.getValue()))))
// if Valid Input is defined, don't close on OK until user types the Valid Input
if(!Util.isEmpty(inputField.getValidInput())) {
if((returnValue == CANCEL) || (inputField.isValid(String.valueOf(inputField.getValue())) && returnValue == OK)) {
close();
}
else {
isExceptionThrown = true;
returnValue = 0;
throw new WrongValueException(inputField.getComponent(), Msg.getMsg(Env.getCtx(), "ValueNotCorrect"));
}
}
else {
close();
}
//
else {
isExceptionThrown = true;
returnValue = 0;
throw new WrongValueException(inputField.getComponent(), Msg.getMsg(Env.getCtx(), "AnswerMandatory"));
}
//
}
private void close() {

View File

@ -0,0 +1,52 @@
/**********************************************************************
* 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.editor;
/**
* Interface to validate the input of editors
* @author Peter Takacs, Cloudempiere
*
*/
public interface IInputValidator {
/**
* Get Valid Input
* @return String
*/
public String getValidInput();
/**
* Set Valid Input
* @param validInput
*/
public void setValidInput(String validInput);
/**
* Is Input Valid
* @param input
* @return boolean
*/
public boolean isValid(String input);
}

View File

@ -71,7 +71,7 @@ import org.zkoss.zul.impl.XulElement;
* @date Mar 11, 2007
* @version $Revision: 0.10 $
*/
public abstract class WEditor implements EventListener<Event>, PropertyChangeListener
public abstract class WEditor implements EventListener<Event>, PropertyChangeListener, IInputValidator
{
private static final String[] lISTENER_EVENTS = {};
@ -104,6 +104,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
protected boolean tableEditor;
private boolean isProcessParameter;
private String sValidInput;
/**
* call to show context menu of this field.
@ -507,6 +509,10 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
return component.isVisible();
}
/**
* Indicating error with changing the style.
* @param error
*/
public void setBackground(boolean error)
{
@ -943,4 +949,19 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
}
}
@Override
public String getValidInput() {
return this.sValidInput;
}
@Override
public void setValidInput(String validInput) {
this.sValidInput = validInput;
}
@Override
public boolean isValid(String input) {
return Util.isEmpty(sValidInput) ? true : sValidInput.equals(input);
}
}

View File

@ -424,6 +424,30 @@ public class FDialog
Messagebox.showDialog(s, Util.isEmpty(title) ? AEnv.getDialogHeader(Env.getCtx(), windowNo) : title,
Messagebox.OK | Messagebox.INPUT, Messagebox.QUESTION, weditor, msgCallback, (msgCallback == null));
}
/**
* Confirmation dialog before deleting the records.
* @param windowNo
* @param weditor
* @param adMessage
* @param adMessageArgs
* @param title
* @param correctInput
* @param callback
*/
public static void askForInputTextConfirmation(int windowNo, WEditor weditor, String adMessage, Object[] adMessageArgs, String title, final Callback<Map.Entry<Boolean, String>> callback)
{
Callback<Map.Entry<Boolean, String>> msgCallback = null;
msgCallback = new Callback<Map.Entry<Boolean, String>>() {
@Override
public void onCallback(Map.Entry<Boolean, String> result) {
callback.onCallback(result);
}
};
String s = Msg.getMsg(Env.getCtx(), adMessage, adMessageArgs).replace("\n", "<br>");
Messagebox.showDialog(s, Util.isEmpty(title) ? AEnv.getDialogHeader(Env.getCtx(), windowNo) : title,
Messagebox.OK | Messagebox.CANCEL | Messagebox.INPUT, Messagebox.QUESTION, weditor, msgCallback, (msgCallback == null));
}
public static void askForInput(int windowNo, Component comp, String adMessage, final Callback<String> callback) {
askForInput(windowNo, comp, adMessage, "", callback);