-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix-10.24.16' into stable
- Loading branch information
Showing
14 changed files
with
404 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
system/handlers/rules/dynamic/presideObjectExpressions/RecordMatchesId.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Dynamic expression handler for checking whether or not a preside object | ||
* record matches one or more specific Ids | ||
* | ||
*/ | ||
component extends="preside.system.base.AutoObjectExpressionHandler" { | ||
|
||
property name="presideObjectService" inject="presideObjectService"; | ||
|
||
private boolean function evaluateExpression( | ||
required string objectName | ||
, string value = "" | ||
, boolean _is = true | ||
) { | ||
return presideObjectService.dataExists( | ||
objectName = arguments.objectName | ||
, id = payload[ arguments.objectName ].id ?: "" | ||
, extraFilters = prepareFilters( argumentCollection=arguments ) | ||
); | ||
} | ||
|
||
private array function prepareFilters( | ||
required string objectName | ||
, string value = "" | ||
, boolean _is = true | ||
){ | ||
var paramName = "recordMatchesId" & CreateUUId().lCase().replace( "-", "", "all" ); | ||
var operator = _is ? "in" : "not in"; | ||
var filterSql = "#arguments.objectName#.id #operator# (:#paramName#)"; | ||
var params = { "#paramName#" = { value=arguments.value, type="cf_sql_varchar", list=true } }; | ||
|
||
return [ { filter=filterSql, filterParams=params } ]; | ||
} | ||
|
||
private string function getLabel( | ||
required string objectName | ||
) { | ||
var objectLabelSingular = translateObjectName( arguments.objectName ); | ||
|
||
return translateResource( uri="rules.dynamicExpressions:recordMatchesId.label", data=[ objectLabelSingular ] ); | ||
} | ||
|
||
private string function getText( | ||
required string objectName | ||
|
||
){ | ||
var objectLabelSingular = translateObjectName( arguments.objectName ); | ||
|
||
return translateResource( uri="rules.dynamicExpressions:recordMatchesId.text", data=[ objectLabelSingular ] ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.