IDEMPIERE-3334: Adding support for Readonly Logic, Set Pressed Logic … (#1244)

* IDEMPIERE-3334: Adding support for Readonly Logic, Set Pressed Logic on custom toolbar button

* IDEMPIERE-3334: Fix as per Hengsin suggestion

* IDEMPIERE-3334: Renaming migration scripts, changing VARCHAR2(2000) to VARCHAR2(2000 CHAR) and fixing sql have line starting with @

* IDEMPIERE-3334: SQL Logic evaluate by using Evaluator.parseSQLLogic()

* IDEMPIERE-3334 : Adding support for pressed and readonly logic on Window->Tab->toolbar

* IDEMPIERE-3334 : Adding Hengsin't patch

* IDEMPIERE-3334 : removing ParseContext call
This commit is contained in:
Deepak Pansheriya 2022-11-23 10:35:14 +05:30 committed by GitHub
parent 09e0ae3f0f
commit 2074e98616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 400 additions and 16 deletions

View File

@ -0,0 +1,99 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3334 Adding support for Readonly Logic, Set Pressed Logic on custom toolbar button
-- Apr 7, 2017 9:46:15 AM IST
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) VALUES (212976,0,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200003,'ReadOnlyLogic',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2017-04-07 09:46:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-07 09:46:14','YYYY-MM-DD HH24:MI:SS'),100,1663,'Y','N','D','N','N','N','Y','2c970c5d-b093-4b8a-b7df-da5260cb3afc','Y',0,'N','N')
;
-- Apr 7, 2017 9:46:25 AM IST
ALTER TABLE AD_ToolBarButton ADD ReadOnlyLogic VARCHAR2(2000 CHAR) DEFAULT NULL
;
-- Apr 7, 2017 9:47:37 AM IST
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 (203068,0,0,'Y',TO_DATE('2017-04-07 09:47:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-07 09:47:36','YYYY-MM-DD HH24:MI:SS'),100,'PressedLogic','Pressed Logic','Pressed Logic','D','3e4c5b2b-2b91-400f-8e18-fd1aee4627ff')
;
-- Apr 7, 2017 9:47:52 AM IST
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) VALUES (212977,0,'Pressed Logic',200003,'PressedLogic',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2017-04-07 09:47:51','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-07 09:47:51','YYYY-MM-DD HH24:MI:SS'),100,203068,'Y','N','D','N','N','N','Y','e7df64af-a5db-4469-9620-d1008f2b6ae6','Y',0,'N','N')
;
-- Apr 7, 2017 9:47:53 AM IST
ALTER TABLE AD_ToolBarButton ADD PressedLogic VARCHAR2(2000 CHAR) DEFAULT NULL
;
-- Apr 7, 2017 9:48:42 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,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) VALUES (204384,'Pressed Logic',200002,212977,'Y','@IsCustomization@=Y',0,130,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-07 09:48:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-07 09:48:40','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fe0b2b2f-8f24-46d9-b497-c7fdbc6df87e','Y',130,1,1,1,'N','N','N')
;
-- Apr 7, 2017 9:49:03 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,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) VALUES (204385,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200002,212976,'Y','@IsCustomization@=Y',0,140,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-07 09:49:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-07 09:49:00','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d721042e-1aa8-4c00-8c8c-615b7202bc7a','Y',140,1,1,1,'N','N','N')
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204384
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204385
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202546
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202547
;
-- Nov 17, 2022, 4:48:50 PM IST
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,DisplayLogic) VALUES (207419,'Pressed Logic',200028,212977,'Y',0,110,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-11-17 16:48:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-17 16:48:49','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9105d7d0-5208-4c49-ae06-69eb62367f81','Y',90,1,5,3,'N','N','N','N','')
;
-- Nov 17, 2022, 4:49:18 PM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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,DisplayLogic) VALUES (207420,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200028,212976,'Y',0,120,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-11-17 16:49:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-17 16:49:17','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','766bf507-7d6b-4e17-b95a-1d6acb73da51','Y',100,1,5,3,'N','N','N','N','')
;
SELECT register_migration_script('202211091000_IDEMPIERE-3334.sql') FROM dual
;

View File

@ -0,0 +1,96 @@
-- IDEMPIERE-3334 Adding support for Readonly Logic, Set Pressed Logic on custom toolbar button
-- Apr 7, 2017 9:46:15 AM IST
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) VALUES (212976,0,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200003,'ReadOnlyLogic',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2017-04-07 09:46:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-07 09:46:14','YYYY-MM-DD HH24:MI:SS'),100,1663,'Y','N','D','N','N','N','Y','2c970c5d-b093-4b8a-b7df-da5260cb3afc','Y',0,'N','N')
;
-- Apr 7, 2017 9:46:25 AM IST
ALTER TABLE AD_ToolBarButton ADD COLUMN ReadOnlyLogic VARCHAR(2000) DEFAULT NULL
;
-- Apr 7, 2017 9:47:37 AM IST
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 (203068,0,0,'Y',TO_TIMESTAMP('2017-04-07 09:47:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-07 09:47:36','YYYY-MM-DD HH24:MI:SS'),100,'PressedLogic','Pressed Logic','Pressed Logic','D','3e4c5b2b-2b91-400f-8e18-fd1aee4627ff')
;
-- Apr 7, 2017 9:47:52 AM IST
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) VALUES (212977,0,'Pressed Logic',200003,'PressedLogic',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2017-04-07 09:47:51','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-07 09:47:51','YYYY-MM-DD HH24:MI:SS'),100,203068,'Y','N','D','N','N','N','Y','e7df64af-a5db-4469-9620-d1008f2b6ae6','Y',0,'N','N')
;
-- Apr 7, 2017 9:47:53 AM IST
ALTER TABLE AD_ToolBarButton ADD COLUMN PressedLogic VARCHAR(2000) DEFAULT NULL
;
-- Apr 7, 2017 9:48:42 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,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) VALUES (204384,'Pressed Logic',200002,212977,'Y','@IsCustomization@=Y',0,130,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-07 09:48:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-07 09:48:40','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fe0b2b2f-8f24-46d9-b497-c7fdbc6df87e','Y',130,1,1,1,'N','N','N')
;
-- Apr 7, 2017 9:49:03 AM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLogic,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) VALUES (204385,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200002,212976,'Y','@IsCustomization@=Y',0,140,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-07 09:49:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-07 09:49:00','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d721042e-1aa8-4c00-8c8c-615b7202bc7a','Y',140,1,1,1,'N','N','N')
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204384
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204385
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202546
;
-- Apr 7, 2017 9:49:33 AM IST
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-07 09:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202547
;
-- Nov 17, 2022, 4:48:50 PM IST
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,DisplayLogic) VALUES (207419,'Pressed Logic',200028,212977,'Y',0,110,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-11-17 16:48:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-17 16:48:49','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9105d7d0-5208-4c49-ae06-69eb62367f81','Y',90,1,5,3,'N','N','N','N','')
;
-- Nov 17, 2022, 4:49:18 PM IST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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,DisplayLogic) VALUES (207420,'Read Only Logic','Logic to determine if field is read only (applies only when field is read-write)','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
<ul>
<li> @AD_Table_ID@=14 | @Language@!GERGER</li>
<li> @PriceLimit@>10 | @PriceList@>@PriceActual@</li>
<li> @Name@>J</li>
</ul>
Strings may be in single quotes (optional)',200028,212976,'Y',0,120,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-11-17 16:49:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-11-17 16:49:17','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','766bf507-7d6b-4e17-b95a-1d6acb73da51','Y',100,1,5,3,'N','N','N','N','')
;
SELECT register_migration_script('202211091000_IDEMPIERE-3334.sql') FROM dual
;

View File

@ -113,7 +113,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = -2091725732178841608L; private static final long serialVersionUID = 2604313946261586651L;
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
@ -230,6 +230,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
public static final String CTX_FindSQL = "_TabInfo_FindSQL"; public static final String CTX_FindSQL = "_TabInfo_FindSQL";
public static final String CTX_SQL = "_TabInfo_SQL"; public static final String CTX_SQL = "_TabInfo_SQL";
public static final String CTX_IsSortTab = "_TabInfo_IsSortTab"; public static final String CTX_IsSortTab = "_TabInfo_IsSortTab";
public static final String CTX_Record_ID = "_TabInfo_Record_ID";
public static final String CTX_IsLookupOnlySelection = "_TabInfo_IsLookupOnlySelection"; public static final String CTX_IsLookupOnlySelection = "_TabInfo_IsLookupOnlySelection";
public static final String CTX_IsAllowAdvancedLookup = "_TabInfo_IsAllowAdvancedLookup"; public static final String CTX_IsAllowAdvancedLookup = "_TabInfo_IsAllowAdvancedLookup";

View File

@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ToolBarButton /** Generated Interface for AD_ToolBarButton
* @author iDempiere (generated) * @author iDempiere (generated)
* @version Release 9 * @version Release 10
*/ */
public interface I_AD_ToolBarButton public interface I_AD_ToolBarButton
{ {
@ -298,6 +298,28 @@ public interface I_AD_ToolBarButton
*/ */
public String getName(); public String getName();
/** Column name PressedLogic */
public static final String COLUMNNAME_PressedLogic = "PressedLogic";
/** Set Pressed Logic */
public void setPressedLogic (String PressedLogic);
/** Get Pressed Logic */
public String getPressedLogic();
/** Column name ReadOnlyLogic */
public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic";
/** Set Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic);
/** Get Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic();
/** Column name SeqNo */ /** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo"; public static final String COLUMNNAME_SeqNo = "SeqNo";

View File

@ -23,7 +23,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Model for AD_ToolBarButton /** Generated Model for AD_ToolBarButton
* @author iDempiere (generated) * @author iDempiere (generated)
* @version Release 9 - $Id$ */ * @version Release 10 - $Id$ */
@org.adempiere.base.Model(table="AD_ToolBarButton") @org.adempiere.base.Model(table="AD_ToolBarButton")
public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Persistent public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Persistent
{ {
@ -31,7 +31,7 @@ public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Pers
/** /**
* *
*/ */
private static final long serialVersionUID = 20220116L; private static final long serialVersionUID = 20220217L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_ToolBarButton (Properties ctx, int AD_ToolBarButton_ID, String trxName) public X_AD_ToolBarButton (Properties ctx, int AD_ToolBarButton_ID, String trxName)
@ -468,6 +468,37 @@ public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Pers
return new KeyNamePair(get_ID(), getName()); return new KeyNamePair(get_ID(), getName());
} }
/** Set Pressed Logic.
@param PressedLogic Pressed Logic
*/
public void setPressedLogic (String PressedLogic)
{
set_Value (COLUMNNAME_PressedLogic, PressedLogic);
}
/** Get Pressed Logic.
@return Pressed Logic */
public String getPressedLogic()
{
return (String)get_Value(COLUMNNAME_PressedLogic);
}
/** Set Read Only Logic.
@param ReadOnlyLogic Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic)
{
set_Value (COLUMNNAME_ReadOnlyLogic, ReadOnlyLogic);
}
/** Get Read Only Logic.
@return Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic()
{
return (String)get_Value(COLUMNNAME_ReadOnlyLogic);
}
/** Set Sequence. /** Set Sequence.
@param SeqNo Method of ordering records; lowest number comes first @param SeqNo Method of ordering records; lowest number comes first
*/ */

View File

@ -47,6 +47,7 @@ import org.adempiere.util.ServerContext;
import org.adempiere.util.ServerContextProvider; import org.adempiere.util.ServerContextProvider;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.db.CConnection; import org.compiere.db.CConnection;
import org.compiere.model.GridTab;
import org.compiere.model.GridWindowVO; import org.compiere.model.GridWindowVO;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MColumn; import org.compiere.model.MColumn;
@ -1596,7 +1597,19 @@ public final class Env
token = token.substring(0, idx); token = token.substring(0, idx);
} }
String ctxInfo = getContext(ctx, WindowNo, tabNo, token, onlyTab); // get context String ctxInfo = null;
if (token.equalsIgnoreCase(GridTab.CTX_Record_ID))
{
String keycolumnName = Env.getContext(Env.getCtx(), WindowNo, tabNo, GridTab.CTX_KeyColumnName,
onlyTab);
ctxInfo = Env.getContext(Env.getCtx(), WindowNo, tabNo, keycolumnName, onlyTab);
}
else
{
ctxInfo = getContext(ctx, WindowNo, tabNo, token, onlyTab); // get context
}
if (ctxInfo.length() == 0 && (token.startsWith("#") || token.startsWith("$")) ) if (ctxInfo.length() == 0 && (token.startsWith("#") || token.startsWith("$")) )
ctxInfo = getContext(ctx, token); // get global context ctxInfo = getContext(ctx, token); // get global context

View File

@ -1205,9 +1205,11 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
listPanel.dynamicDisplay(col); listPanel.dynamicDisplay(col);
} }
for (ToolbarProcessButton btn : toolbarProcessButtons) { for (ToolbarProcessButton btn : toolbarProcessButtons) {
btn.dynamicDisplay(); btn.dynamicDisplay();
} btn.readOnlyLogic();
btn.pressedLogic();
}
Events.sendEvent(this, new Event(ON_DYNAMIC_DISPLAY_EVENT, this)); Events.sendEvent(this, new Event(ON_DYNAMIC_DISPLAY_EVENT, this));
echoDeferSetSelectedNodeEvent(); echoDeferSetSelectedNodeEvent();

View File

@ -991,6 +991,24 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
} }
} }
} }
pressedLogic();
readOnlyLogic();
}
private void pressedLogic()
{
for (ToolbarCustomButton toolbarCustomBtn : toolbarCustomButtons)
{
toolbarCustomBtn.pressedLogic();
}
}
private void readOnlyLogic()
{
for (ToolbarCustomButton toolbarCustomBtn : toolbarCustomButtons)
{
toolbarCustomBtn.readOnlyLogic();
}
} }
@Override @Override

View File

@ -13,6 +13,7 @@ import org.adempiere.webui.panel.WDocActionPanel;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
@ -31,6 +32,8 @@ public class ProcessButtonPopup extends Menupopup implements EventListener<Event
private static final String DOCUMENT_ACTION_MENUITEM_ATTRIBUTE = "document-action-menuitem"; private static final String DOCUMENT_ACTION_MENUITEM_ATTRIBUTE = "document-action-menuitem";
private static final String DOC_ACTION_PANEL_ATTRIBUTE = "doc-action-panel"; private static final String DOC_ACTION_PANEL_ATTRIBUTE = "doc-action-panel";
private static final String BUTTON_ATTRIBUTE = "button"; private static final String BUTTON_ATTRIBUTE = "button";
public static final String BUTTON_ATTRIBUTE_PRESSED = "buttonPressed";
/** /**
* generated serial id * generated serial id
*/ */
@ -52,6 +55,15 @@ public class ProcessButtonPopup extends Menupopup implements EventListener<Event
Menuitem mi = new Menuitem(button.getLabel()); Menuitem mi = new Menuitem(button.getLabel());
appendChild(mi); appendChild(mi);
mi.setAttribute(BUTTON_ATTRIBUTE, button); mi.setAttribute(BUTTON_ATTRIBUTE, button);
//
String pressed = (String) button.getAttribute(BUTTON_ATTRIBUTE_PRESSED);
if (!Util.isEmpty(pressed, true)) {
if (pressed.trim().equalsIgnoreCase("Y")) {
mi.setSclass("z-toolbarbutton-checked");
} else {
mi.removeSclass("z-toolbarbutton-checked");
}
}
mi.addEventListener(Events.ON_CLICK, this); mi.addEventListener(Events.ON_CLICK, this);
if (button.isDisabled()) if (button.isDisabled())
mi.setDisabled(true); mi.setDisabled(true);

View File

@ -16,10 +16,12 @@ package org.adempiere.webui.adwindow;
import org.adempiere.base.IServiceHolder; import org.adempiere.base.IServiceHolder;
import org.adempiere.webui.action.Actions; import org.adempiere.webui.action.Actions;
import org.adempiere.webui.action.IAction; import org.adempiere.webui.action.IAction;
import org.adempiere.webui.component.ToolBarButton;
import org.compiere.model.MToolBarButton; import org.compiere.model.MToolBarButton;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Evaluatee; import org.compiere.util.Evaluatee;
import org.compiere.util.Evaluator; import org.compiere.util.Evaluator;
import org.compiere.util.Util;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
@ -105,6 +107,68 @@ public class ToolbarCustomButton implements EventListener<Event>, Evaluatee {
toolbarButton.setVisible(visible); toolbarButton.setVisible(visible);
} }
public void pressedLogic() {
if (toolbarButton.getParent() == null)
return;
String pressedLogic = mToolbarButton.getPressedLogic();
if (Util.isEmpty(pressedLogic, true))
return;
ADWindow window = ADWindow.get(windowNo);
if (window == null)
return;
IADTabpanel adTabpanel = window.getADWindowContent().getADTab().getSelectedTabpanel();
if (adTabpanel == null || adTabpanel.getRecord_ID() <= 0)
return;
boolean isPressed = validateLogic(pressedLogic, adTabpanel.getTabNo());
((ToolBarButton) toolbarButton).setPressed(isPressed);
}
public void readOnlyLogic() {
if (toolbarButton.getParent() == null)
return;
String readOnlyLogic = mToolbarButton.getReadOnlyLogic();
if (Util.isEmpty(readOnlyLogic, true))
return;
ADWindow window = ADWindow.get(windowNo);
if (window == null)
return;
IADTabpanel adTabpanel = window.getADWindowContent().getADTab().getSelectedTabpanel();
if (adTabpanel == null || adTabpanel.getRecord_ID() <= 0)
return;
boolean isReadOnly = validateLogic(readOnlyLogic, adTabpanel.getTabNo());
toolbarButton.setDisabled(isReadOnly);
}
private boolean validateLogic(String logic, int tabNo) {
boolean isValid = false;
if (logic.startsWith("@SQL="))
{
isValid = Evaluator.parseSQLLogic(logic, Env.getCtx(), windowNo, tabNo, "");
}
else
{
isValid = Evaluator.evaluateLogic(this, logic);
}
return isValid;
}
public Toolbarbutton getToolbarbutton() { public Toolbarbutton getToolbarbutton() {
return toolbarButton; return toolbarButton;
} }

View File

@ -127,13 +127,7 @@ public class ToolbarProcessButton implements IProcessButton, Evaluatee {
if (displayLogic == null || displayLogic.trim().length() == 0) if (displayLogic == null || displayLogic.trim().length() == 0)
return; return;
boolean visible = true; boolean visible = validateLogic(displayLogic, adTabpanel.getTabNo());
if (displayLogic.startsWith("@SQL=")) {
visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName());
}else {
visible = Evaluator.evaluateLogic(this, displayLogic);
}
button.setVisible(visible); button.setVisible(visible);
} }
@ -145,4 +139,36 @@ public class ToolbarProcessButton implements IProcessButton, Evaluatee {
else else
return Env.getContext (Env.getCtx(), windowNo, tabNo, variableName, false, true); return Env.getContext (Env.getCtx(), windowNo, tabNo, variableName, false, true);
} }
public void readOnlyLogic() {
String readOnlyLogic = mToolbarButton.getReadOnlyLogic();
if (readOnlyLogic == null || readOnlyLogic.trim().length() == 0)
return;
boolean disabled = validateLogic(readOnlyLogic, adTabpanel.getTabNo());
button.setDisabled(disabled);
} // readOnlyLogic
public void pressedLogic() {
String pressedLogic = mToolbarButton.getPressedLogic();
if (pressedLogic == null || pressedLogic.trim().length() == 0)
return;
boolean isPressed = validateLogic(pressedLogic, adTabpanel.getTabNo());
button.setAttribute(ProcessButtonPopup.BUTTON_ATTRIBUTE_PRESSED, isPressed ? "Y" : "N");
} // pressedLogic
private boolean validateLogic(String logic, int tabNo) {
boolean isValid = false;
if (logic.startsWith("@SQL=")) {
isValid = Evaluator.parseSQLLogic(logic, Env.getCtx(), windowNo, tabNo, getColumnName());
} else {
isValid = Evaluator.evaluateLogic(this, logic);
}
return isValid;
} // validateLogic
} }