IDEMPIERE-5432 - Performance Measure Calculation - Improve SQL Definition (#1500)

* IDEMPIERE-5432 - Performance Measure Calculation - Improve SQL Definition

* IDEMPIERE-5432 - IDEMPIERE-5432_PR1 patch
This commit is contained in:
Peter Takács 2022-10-07 08:01:12 +02:00 committed by GitHub
parent abae9f221d
commit a96c6e482d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,25 @@
-- IDEMPIERE-5432
SELECT register_migration_script('202209261211_IDEMPIERE-5432.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 30, 2022, 5:04:55 PM CEST
UPDATE AD_Window SET Help='The Performance Measure Calculation defines how performance measures will be calculated.
The sql needs to return a single value. Please check examples.<br>
The date restriction is defined in the Goal.
Any restrictions for Organizations, Business Partners, Products, etc. are as Performance Goal Restrictions.',Updated=TO_TIMESTAMP('2022-09-30 17:04:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=213
;
-- Sep 30, 2022, 5:04:55 PM CEST
UPDATE AD_WF_Node SET Name='Performance Measure Calculation', Description='Define how you calculate your performance measures', Help='The Performance Measure Calculation defines how performance measures will be calculated.
The sql needs to return a single value. Please check examples.<br>
The date restriction is defined in the Goal.
Any restrictions for Organizations, Business Partners, Products, etc. are as Performance Goal Restrictions.',Updated=TO_TIMESTAMP('2022-09-30 17:04:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_WF_Node_ID=148
;
-- Sep 30, 2022, 5:05:48 PM CEST
UPDATE AD_Tab SET Help='The Performance Measure Calculation defines how performance measures will be calculated. See examples.<br>
The SELECT definition must contain the SELECT and FROM keywords in upper case. The WHERE clause can only contain values of the main table (e.g. when selecting from Header and lines, only header variables can be used in the where clause) and be fully qualified if there is more then one table.',Updated=TO_TIMESTAMP('2022-09-30 17:05:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=369
;

View File

@ -0,0 +1,22 @@
-- IDEMPIERE-5432
SELECT register_migration_script('202209261211_IDEMPIERE-5432.sql') FROM dual;
-- Sep 30, 2022, 5:04:55 PM CEST
UPDATE AD_Window SET Help='The Performance Measure Calculation defines how performance measures will be calculated.
The sql needs to return a single value. Please check examples.<br>
The date restriction is defined in the Goal.
Any restrictions for Organizations, Business Partners, Products, etc. are as Performance Goal Restrictions.',Updated=TO_TIMESTAMP('2022-09-30 17:04:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=213
;
-- Sep 30, 2022, 5:04:55 PM CEST
UPDATE AD_WF_Node SET Name='Performance Measure Calculation', Description='Define how you calculate your performance measures', Help='The Performance Measure Calculation defines how performance measures will be calculated.
The sql needs to return a single value. Please check examples.<br>
The date restriction is defined in the Goal.
Any restrictions for Organizations, Business Partners, Products, etc. are as Performance Goal Restrictions.',Updated=TO_TIMESTAMP('2022-09-30 17:04:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_WF_Node_ID=148
;
-- Sep 30, 2022, 5:05:48 PM CEST
UPDATE AD_Tab SET Help='The Performance Measure Calculation defines how performance measures will be calculated. See examples.<br>
The SELECT definition must contain the SELECT and FROM keywords in upper case. The WHERE clause can only contain values of the main table (e.g. when selecting from Header and lines, only header variables can be used in the where clause) and be fully qualified if there is more then one table.',Updated=TO_TIMESTAMP('2022-09-30 17:05:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=369
;

View File

@ -39,7 +39,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc implements ImmutablePOSupport
/** /**
* *
*/ */
private static final long serialVersionUID = 3143013490477454559L; private static final long serialVersionUID = -1334100963468705584L;
/** /**
* Get MMeasureCalc from Cache (immutable) * Get MMeasureCalc from Cache (immutable)
@ -482,7 +482,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc implements ImmutablePOSupport
return finalSQL; return finalSQL;
if (role == null) if (role == null)
role = MRole.getDefault(); role = MRole.getDefault();
String retValue = role.addAccessSQL(finalSQL, tableName, true, false); String retValue = role.addAccessSQL(finalSQL, null, true, false);
return retValue; return retValue;
} // addRestrictions } // addRestrictions
@ -515,4 +515,15 @@ public class MMeasureCalc extends X_PA_MeasureCalc implements ImmutablePOSupport
return this; return this;
} }
/**
* Get the Where clause adding the WHERE keyword when needed
*/
@Override
public String getWhereClause() {
String whereClause = super.getWhereClause();
if (! whereClause.toLowerCase().startsWith("where "))
whereClause = "WHERE " + whereClause;
return whereClause;
}
} // MMeasureCalc } // MMeasureCalc