IDEMPIERE-1461 Zoom Condition doesn't work on empty fields
This commit is contained in:
parent
677b13dde1
commit
b3345e1e89
|
@ -0,0 +1,116 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Nov 27, 2013 8:53:08 AM COT
|
||||
-- IDEMPIERE-1461 POC for Zoom Logic
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('ZoomLogic',202629,'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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
'||chr(64)||'AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
'||chr(64)||'PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
'||chr(64)||'Name@>J<br>
|
||||
Strings may be in single quotes (optional)','Zoom Logic','the result determines if the zoom condition is applied','Zoom Logic','3dafeed4-bdf0-4cbf-821a-834b0e39a8b0',TO_DATE('2013-11-27 08:53:07','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-11-27 08:53:07','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D')
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:19 AM COT
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure,FKConstraintType) VALUES (0,'N',0,200066,210891,'N','N','N',0,'N',2000,'N',14,'N','N','Y','fc45039d-0c87-49cc-9c50-b72d0e7a2c91','Y','ZoomLogic','the result determines if the zoom condition is applied','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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
'||chr(64)||'AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
'||chr(64)||'PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
'||chr(64)||'Name@>J<br>
|
||||
Strings may be in single quotes (optional)','Zoom Logic','Y',TO_DATE('2013-11-27 08:55:18','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2013-11-27 08:55:18','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202629,'N','N')
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:23 AM COT
|
||||
ALTER TABLE AD_ZoomCondition ADD ZoomLogic NVARCHAR2(2000) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:39 AM COT
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan) VALUES ('N',200077,36,'N','N',210683,100,'Y',202539,'N','D','AD_ZoomCondition_UU','99b8eae9-2a51-4985-8202-bd4ce28bccc2','N','N',100,0,TO_DATE('2013-11-27 08:55:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-27 08:55:38','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2)
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:39 AM COT
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan,NumLines) VALUES ('N',200077,2000,'N','N',210891,110,'Y',202540,'N','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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
'||chr(64)||'AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
'||chr(64)||'PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
'||chr(64)||'Name@>J<br>
|
||||
Strings may be in single quotes (optional)','D','the result determines if the zoom condition is applied','Zoom Logic','bcc492c0-652c-4900-a6fd-514d9e385cf2','Y','N',100,0,TO_DATE('2013-11-27 08:55:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-27 08:55:39','YYYY-MM-DD HH24:MI:SS'),'Y',0,5,3)
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=10, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201829
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201834
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=30, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201836
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=40, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202339
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50, ColumnSpan=5,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202338
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60, ColumnSpan=5,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201831
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202540
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=1, ColumnSpan=5,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202337
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=1, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201837
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5, ColumnSpan=2,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201828
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202539
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:21 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2013-11-27 09:00:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210659
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:23 AM COT
|
||||
ALTER TABLE AD_ZoomCondition MODIFY WhereClause NVARCHAR2(2000) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:23 AM COT
|
||||
ALTER TABLE AD_ZoomCondition MODIFY WhereClause NULL
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201401150857_IDEMPIERE-1461.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
-- Nov 27, 2013 8:53:08 AM COT
|
||||
-- IDEMPIERE-1461 POC for Zoom Logic
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('ZoomLogic',202629,'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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
@AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
@Name@>J<br>
|
||||
Strings may be in single quotes (optional)','Zoom Logic','the result determines if the zoom condition is applied','Zoom Logic','3dafeed4-bdf0-4cbf-821a-834b0e39a8b0',TO_TIMESTAMP('2013-11-27 08:53:07','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-11-27 08:53:07','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D')
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:19 AM COT
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure,FKConstraintType) VALUES (0,'N',0,200066,210891,'N','N','N',0,'N',2000,'N',14,'N','N','Y','fc45039d-0c87-49cc-9c50-b72d0e7a2c91','Y','ZoomLogic','the result determines if the zoom condition is applied','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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
@AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
@Name@>J<br>
|
||||
Strings may be in single quotes (optional)','Zoom Logic','Y',TO_TIMESTAMP('2013-11-27 08:55:18','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2013-11-27 08:55:18','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202629,'N','N')
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:23 AM COT
|
||||
ALTER TABLE AD_ZoomCondition ADD COLUMN ZoomLogic VARCHAR(2000) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:39 AM COT
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan) VALUES ('N',200077,36,'N','N',210683,100,'Y',202539,'N','D','AD_ZoomCondition_UU','99b8eae9-2a51-4985-8202-bd4ce28bccc2','N','N',100,0,TO_TIMESTAMP('2013-11-27 08:55:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-27 08:55:38','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2)
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:55:39 AM COT
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan,NumLines) VALUES ('N',200077,2000,'N','N',210891,110,'Y',202540,'N','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{>}, le{<}, not{~^!} <br>
|
||||
Examples: <br>
|
||||
@AD_Table_ID@=14 | @Language@!GERGER <br>
|
||||
@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
||||
@Name@>J<br>
|
||||
Strings may be in single quotes (optional)','D','the result determines if the zoom condition is applied','Zoom Logic','bcc492c0-652c-4900-a6fd-514d9e385cf2','Y','N',100,0,TO_TIMESTAMP('2013-11-27 08:55:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-27 08:55:39','YYYY-MM-DD HH24:MI:SS'),'Y',0,5,3)
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=10, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201829
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201834
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=30, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201836
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=40, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202339
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50, ColumnSpan=5,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202338
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60, ColumnSpan=5,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201831
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202540
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80, IsDisplayed='Y', XPosition=1, ColumnSpan=5,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202337
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=1, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201837
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201828
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 8:56:59 AM COT
|
||||
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2013-11-27 08:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202539
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:21 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2013-11-27 09:00:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210659
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:23 AM COT
|
||||
INSERT INTO t_alter_column values('ad_zoomcondition','WhereClause','VARCHAR(2000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Nov 27, 2013 9:00:23 AM COT
|
||||
INSERT INTO t_alter_column values('ad_zoomcondition','WhereClause',null,'NULL',null)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201401150857_IDEMPIERE-1461.sql') FROM dual
|
||||
;
|
||||
|
|
@ -208,4 +208,17 @@ public interface I_AD_ZoomCondition
|
|||
* Fully qualified SQL WHERE clause
|
||||
*/
|
||||
public String getWhereClause();
|
||||
|
||||
/** Column name ZoomLogic */
|
||||
public static final String COLUMNNAME_ZoomLogic = "ZoomLogic";
|
||||
|
||||
/** Set Zoom Logic.
|
||||
* the result determines if the zoom condition is applied
|
||||
*/
|
||||
public void setZoomLogic (String ZoomLogic);
|
||||
|
||||
/** Get Zoom Logic.
|
||||
* the result determines if the zoom condition is applied
|
||||
*/
|
||||
public String getZoomLogic();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.util.Properties;
|
|||
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Evaluatee;
|
||||
import org.compiere.util.Evaluator;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -32,9 +34,9 @@ import org.compiere.util.Util;
|
|||
public class MZoomCondition extends X_AD_ZoomCondition
|
||||
{
|
||||
/**
|
||||
* generated serial id
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4615781101317341203L;
|
||||
private static final long serialVersionUID = 3077830061348224074L;
|
||||
|
||||
/**************************************************************************
|
||||
* Standard Constructor
|
||||
|
@ -72,18 +74,36 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
.setOrderBy(MZoomCondition.COLUMNNAME_SeqNo)
|
||||
.list();
|
||||
return list.toArray(new MZoomCondition[list.size()]);
|
||||
} // getCondition
|
||||
} // getConditions
|
||||
|
||||
private static int findZoomWindowByTableId(int AD_Table_ID, MQuery query)
|
||||
{
|
||||
return findZoomWindowByTableId(AD_Table_ID, query, 0);
|
||||
}
|
||||
|
||||
private static int findZoomWindowByTableId(int AD_Table_ID, MQuery query, int windowNo)
|
||||
{
|
||||
final int winNo = windowNo;
|
||||
if (query == null)
|
||||
return 0;
|
||||
|
||||
|
||||
MZoomCondition[] conditions = MZoomCondition.getConditions(AD_Table_ID);
|
||||
if (conditions.length > 0)
|
||||
{
|
||||
Evaluatee evaluatee = new Evaluatee() {
|
||||
public String get_ValueAsString(String variableName) {
|
||||
return Env.getContext(Env.getCtx(), winNo, variableName);
|
||||
}
|
||||
};
|
||||
|
||||
for (MZoomCondition condition : conditions)
|
||||
{
|
||||
if (! Util.isEmpty(condition.getZoomLogic())) {
|
||||
if (!Evaluator.evaluateLogic(evaluatee, condition.getZoomLogic())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
boolean evaluation = condition.evaluate(query.getWhereClause(true));
|
||||
|
||||
if (evaluation)
|
||||
|
@ -111,13 +131,18 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
return findZoomWindowByTableId(table.getAD_Table_ID(), query);
|
||||
}
|
||||
|
||||
public static int findZoomWindowByWindowId(int AD_Window_ID, MQuery query)
|
||||
{
|
||||
return findZoomWindowByWindowId(AD_Window_ID, query, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* find first AD_Window_ID from matching zoom condition record
|
||||
* @param AD_Window_ID Zoom AD_Window_ID from MLookup
|
||||
* @param query
|
||||
* @return AD_Window_ID
|
||||
*/
|
||||
public static int findZoomWindowByWindowId(int AD_Window_ID, MQuery query)
|
||||
public static int findZoomWindowByWindowId(int AD_Window_ID, MQuery query, int windowNo)
|
||||
{
|
||||
if (query == null)
|
||||
return 0;
|
||||
|
@ -134,7 +159,7 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
}
|
||||
|
||||
if (tableName != null && tableName.equals(query.getZoomTableName())) {
|
||||
return findZoomWindowByTableId(tableID, query);
|
||||
return findZoomWindowByTableId(tableID, query, windowNo);
|
||||
} else {
|
||||
try {
|
||||
GridWindow window = GridWindow.get(Env.getCtx(), -1, AD_Window_ID);
|
||||
|
@ -156,7 +181,18 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
window.initTab(gTab.getTabNo());
|
||||
GridTab parentTab = gTab.getParentTab();
|
||||
int parentId = DB.getSQLValue(null, "SELECT " + gTab.getLinkColumnName() + " FROM " + gTab.getTableName() + " WHERE " + query.getWhereClause());
|
||||
if (parentId <= 0)return 0;
|
||||
if (parentId <= 0) {
|
||||
if (Util.isEmpty(parentTab.getKeyColumnName()))
|
||||
parentTab.initTab(false);
|
||||
// no parent link -- search in context of window
|
||||
String parentctxid = Env.getContext(Env.getCtx(), windowNo, parentTab.getKeyColumnName());
|
||||
if (! Util.isEmpty(parentctxid)) {
|
||||
parentId = DB.getSQLValue(null, "SELECT " + parentTab.getKeyColumnName() + " FROM " + parentTab.getTableName()
|
||||
+ " WHERE " + parentTab.getKeyColumnName() + "=" + parentctxid);
|
||||
}
|
||||
if (parentId <= 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (parentTab != null)
|
||||
{
|
||||
|
@ -172,7 +208,7 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
{
|
||||
if (parentTab == window.getTab(0))
|
||||
{
|
||||
return findZoomWindowByTableId(parentTab.getAD_Table_ID(), parentId);
|
||||
return findZoomWindowByTableId(parentTab.getAD_Table_ID(), parentId, windowNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,22 +220,39 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static int findZoomWindowByTableId(int AD_Table_ID, int recordID)
|
||||
{
|
||||
return findZoomWindowByTableId(AD_Table_ID, recordID, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* find AD_Window_ID from matching zoom condition record
|
||||
* @param AD_Table_ID
|
||||
* @param recordID
|
||||
* @return AD_Window_ID
|
||||
*/
|
||||
public static int findZoomWindowByTableId(int AD_Table_ID, int recordID)
|
||||
public static int findZoomWindowByTableId(int AD_Table_ID, int recordID, int windowNo)
|
||||
{
|
||||
|
||||
final int winNo = windowNo;
|
||||
MTable table = MTable.get(Env.getCtx(), AD_Table_ID);
|
||||
MZoomCondition[] conditions = MZoomCondition.getConditions(AD_Table_ID);
|
||||
if (conditions.length > 0)
|
||||
{
|
||||
Evaluatee evaluatee = new Evaluatee() {
|
||||
public String get_ValueAsString(String variableName) {
|
||||
return Env.getContext(Env.getCtx(), winNo, variableName);
|
||||
}
|
||||
};
|
||||
|
||||
String whereClause = table.getTableName() + "_ID="+recordID;
|
||||
for (MZoomCondition condition : conditions)
|
||||
{
|
||||
if (! Util.isEmpty(condition.getZoomLogic())) {
|
||||
if (!Evaluator.evaluateLogic(evaluatee, condition.getZoomLogic())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
boolean evaluation = condition.evaluate(whereClause);
|
||||
|
||||
if (evaluation)
|
||||
|
@ -213,11 +266,14 @@ public class MZoomCondition extends X_AD_ZoomCondition
|
|||
}
|
||||
|
||||
/**
|
||||
* @param whereClause mandatory filter to get record for evaluation
|
||||
* @return true if the condition is true for the record
|
||||
* @param whereClause filter to get record for evaluation
|
||||
* @return true if the condition is empty (applies for all records) or if the condition is true for the record
|
||||
*/
|
||||
public boolean evaluate(String whereClause)
|
||||
{
|
||||
if (Util.isEmpty(getWhereClause()))
|
||||
return true;
|
||||
|
||||
MTable table = MTable.get(Env.getCtx(), getAD_Table_ID());
|
||||
String tableName = table.getTableName();
|
||||
StringBuilder builder = new StringBuilder("SELECT Count(*) FROM ");
|
||||
|
|
|
@ -29,7 +29,7 @@ public class X_AD_ZoomCondition extends PO implements I_AD_ZoomCondition, I_Pers
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20131031L;
|
||||
private static final long serialVersionUID = 20131127L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_ZoomCondition (Properties ctx, int AD_ZoomCondition_ID, String trxName)
|
||||
|
@ -41,7 +41,6 @@ public class X_AD_ZoomCondition extends PO implements I_AD_ZoomCondition, I_Pers
|
|||
setAD_Window_ID (0);
|
||||
setAD_ZoomCondition_ID (0);
|
||||
setName (null);
|
||||
setWhereClause (null);
|
||||
} */
|
||||
}
|
||||
|
||||
|
@ -233,4 +232,21 @@ public class X_AD_ZoomCondition extends PO implements I_AD_ZoomCondition, I_Pers
|
|||
{
|
||||
return (String)get_Value(COLUMNNAME_WhereClause);
|
||||
}
|
||||
|
||||
/** Set Zoom Logic.
|
||||
@param ZoomLogic
|
||||
the result determines if the zoom condition is applied
|
||||
*/
|
||||
public void setZoomLogic (String ZoomLogic)
|
||||
{
|
||||
set_Value (COLUMNNAME_ZoomLogic, ZoomLogic);
|
||||
}
|
||||
|
||||
/** Get Zoom Logic.
|
||||
@return the result determines if the zoom condition is applied
|
||||
*/
|
||||
public String getZoomLogic ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_ZoomLogic);
|
||||
}
|
||||
}
|
|
@ -1855,7 +1855,12 @@ public final class Env
|
|||
|
||||
public static int getZoomWindowID(int AD_Table_ID, int Record_ID)
|
||||
{
|
||||
int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID);
|
||||
return getZoomWindowID(AD_Table_ID, Record_ID, 0);
|
||||
}
|
||||
|
||||
public static int getZoomWindowID(int AD_Table_ID, int Record_ID, int windowNo)
|
||||
{
|
||||
int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID, windowNo);
|
||||
MTable table = MTable.get(Env.getCtx(), AD_Table_ID);
|
||||
if (AD_Window_ID <= 0)
|
||||
{
|
||||
|
|
|
@ -166,15 +166,19 @@ public final class AEnv
|
|||
* @param Record_ID
|
||||
* @param query
|
||||
*/
|
||||
public static void zoom (int AD_Table_ID, int Record_ID, MQuery query)
|
||||
public static void zoom (int AD_Table_ID, int Record_ID, MQuery query, int windowNo)
|
||||
{
|
||||
int AD_Window_ID = Env.getZoomWindowID(AD_Table_ID, Record_ID);
|
||||
int AD_Window_ID = Env.getZoomWindowID(AD_Table_ID, Record_ID, windowNo);
|
||||
// Nothing to Zoom to
|
||||
if (AD_Window_ID == 0)
|
||||
return;
|
||||
zoom(AD_Window_ID, query);
|
||||
} // zoom
|
||||
|
||||
public static void zoom (int AD_Table_ID, int Record_ID, MQuery query) {
|
||||
zoom (AD_Table_ID, Record_ID, query, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit System
|
||||
* @param status System exit status (usually 0 for no error)
|
||||
|
@ -403,10 +407,10 @@ public final class AEnv
|
|||
}
|
||||
if (value instanceof Integer && ((Integer) value).intValue() >= 0 && zoomQuery != null && zoomQuery.getZoomTableName() != null) {
|
||||
int tableId = MTable.getTable_ID(zoomQuery.getZoomTableName());
|
||||
zoom(tableId, ((Integer) value).intValue(), zoomQuery);
|
||||
zoom(tableId, ((Integer) value).intValue(), zoomQuery, lookup.getWindowNo());
|
||||
} else {
|
||||
int windowId = lookup.getZoom(zoomQuery);
|
||||
zoom(windowId, zoomQuery);
|
||||
zoom(windowId, zoomQuery, lookup.getWindowNo());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,11 +430,15 @@ public final class AEnv
|
|||
* @param AD_Window_ID Window on which to zoom
|
||||
* @param query Filter to be applied on the records.
|
||||
*/
|
||||
public static void zoom(int AD_Window_ID, MQuery query)
|
||||
public static void zoom(int AD_Window_ID, MQuery query, int windowNo)
|
||||
{
|
||||
int zoomId = MZoomCondition.findZoomWindowByWindowId(AD_Window_ID, query);
|
||||
int zoomId = MZoomCondition.findZoomWindowByWindowId(AD_Window_ID, query, windowNo);
|
||||
showZoomWindow(zoomId > 0 ? zoomId : AD_Window_ID, query);
|
||||
}
|
||||
|
||||
public static void zoom(int AD_Window_ID, MQuery query) {
|
||||
zoom(AD_Window_ID, query, 0);
|
||||
}
|
||||
|
||||
public static void showWindow(Window win)
|
||||
{
|
||||
|
|
|
@ -26,10 +26,8 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.adwindow.ADTabpanel;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.adwindow.ADWindowContent;
|
||||
import org.adempiere.webui.adwindow.IFieldEditorContainer;
|
||||
|
@ -40,7 +38,6 @@ import org.adempiere.webui.event.ContextMenuListener;
|
|||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.exception.ApplicationException;
|
||||
import org.adempiere.webui.factory.InfoManager;
|
||||
import org.adempiere.webui.grid.WQuickEntry;
|
||||
import org.adempiere.webui.panel.IHelpContext;
|
||||
|
@ -53,14 +50,12 @@ import org.compiere.model.GridField;
|
|||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.X_AD_CtxHelp;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
@ -289,47 +284,14 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
|
||||
public void actionZoom()
|
||||
{
|
||||
if (getValue() == null || Util.isEmpty(getValue().toString()))
|
||||
{
|
||||
onNewRecord();
|
||||
}
|
||||
else
|
||||
{
|
||||
AEnv.actionZoom(lookup, getValue());
|
||||
}
|
||||
AEnv.actionZoom(lookup, getValue());
|
||||
}
|
||||
private void actionZoom(Object value)
|
||||
|
||||
private void actionZoom(Object value)
|
||||
{
|
||||
AEnv.actionZoom(lookup, value);
|
||||
}
|
||||
|
||||
private void onNewRecord() {
|
||||
try
|
||||
{
|
||||
MQuery query = new MQuery("");
|
||||
query.addRestriction("1=2");
|
||||
query.setRecordCount(0);
|
||||
|
||||
int zoomWindowId = gridField != null ? lookup.getZoom(Env.isSOTrx(Env.getCtx(), gridField.getWindowNo())) : lookup.getZoom(Env.isSOTrx(Env.getCtx()));
|
||||
SessionManager.getAppDesktop().openWindow(zoomWindowId, query, new Callback<ADWindow>() {
|
||||
@Override
|
||||
public void onCallback(ADWindow result) {
|
||||
if(result == null)
|
||||
return;
|
||||
|
||||
result.getADWindowContent().onNew();
|
||||
ADTabpanel adtabpanel = (ADTabpanel) result.getADWindowContent().getADTab().getSelectedTabpanel();
|
||||
adtabpanel.focusToFirstEditor(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApplicationException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onMenu(ContextMenuEvent evt)
|
||||
{
|
||||
if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent()))
|
||||
|
|
|
@ -22,27 +22,21 @@ import java.beans.PropertyChangeEvent;
|
|||
import javax.swing.event.ListDataEvent;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.exception.ApplicationException;
|
||||
import org.adempiere.webui.grid.WQuickEntry;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.adempiere.webui.window.WLocationDialog;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MLocation;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -488,14 +482,7 @@ ContextMenuListener, IZoomableEditor
|
|||
*/
|
||||
public void actionZoom()
|
||||
{
|
||||
if (getValue() == null)
|
||||
{
|
||||
onNewRecord();
|
||||
}
|
||||
else
|
||||
{
|
||||
AEnv.actionZoom(lookup, getValue());
|
||||
}
|
||||
AEnv.actionZoom(lookup, getValue());
|
||||
}
|
||||
|
||||
public Lookup getLookup()
|
||||
|
@ -503,31 +490,6 @@ ContextMenuListener, IZoomableEditor
|
|||
return lookup;
|
||||
}
|
||||
|
||||
private void onNewRecord() {
|
||||
try
|
||||
{
|
||||
MQuery query = new MQuery("");
|
||||
query.addRestriction("1=2");
|
||||
query.setRecordCount(0);
|
||||
|
||||
SessionManager.getAppDesktop().openWindow(lookup.getZoom(query), query, new Callback<ADWindow>() {
|
||||
@Override
|
||||
public void onCallback(ADWindow result) {
|
||||
if(result == null)
|
||||
return;
|
||||
|
||||
GridTab tab = result.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApplicationException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Action - Special Quick Entry Screen
|
||||
* @param newRecord true if new record should be created
|
||||
|
|
Loading…
Reference in New Issue