mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Projections: Fixing NRE in FieldTypeEditors when the Query doesn't have its VersionScope configured
This commit is contained in:
+3
-1
@@ -25,7 +25,9 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return BooleanFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
return BooleanFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
+5
-1
@@ -29,7 +29,11 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return DateTimeFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName(), _clock.UtcNow, true);
|
||||
return DateTimeFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName(),
|
||||
_clock.UtcNow,
|
||||
true);
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
+3
-1
@@ -27,7 +27,9 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return NumericFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
return NumericFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return NumericFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
return NumericFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
@@ -33,7 +33,15 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
/// Defines the relationship to the corresponding field indexing table for this editor
|
||||
/// </summary>
|
||||
Action<IAliasFactory> GetFilterRelationship(string aliasName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class FieldTypeEditorExtensions {
|
||||
public static QueryVersionScopeOptions GetQueryVersionScope(this IFieldTypeEditor editor, string value) {
|
||||
if (!Enum.TryParse(value, out QueryVersionScopeOptions versionScope))
|
||||
versionScope = QueryVersionScopeOptions.Published;
|
||||
|
||||
return versionScope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -34,7 +34,9 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return NumericFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
return NumericFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
+3
-1
@@ -25,7 +25,9 @@ namespace Orchard.Projections.FieldTypeEditors {
|
||||
}
|
||||
|
||||
public Action<IHqlExpressionFactory> GetFilterPredicate(dynamic formState) {
|
||||
return StringFilterForm.GetFilterPredicate(formState, ((QueryVersionScopeOptions)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
return StringFilterForm.GetFilterPredicate(
|
||||
formState,
|
||||
this.GetQueryVersionScope((string)formState.VersionScope).ToVersionedFieldIndexColumnName());
|
||||
}
|
||||
|
||||
public LocalizedString DisplayFilter(string fieldName, string storageName, dynamic formState) {
|
||||
|
||||
Reference in New Issue
Block a user