This commit is contained in:
2020-03-16 22:43:26 +00:00
parent fd63ad2320
commit cdfca271d3
6 changed files with 29 additions and 10 deletions

View File

@@ -18,20 +18,19 @@ namespace AyaNova.PickList
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery, string tagSpecificQuery, bool IncludeInactive)
{
//determine this in advance as it will be used in a loop later
bool HasAutoCompleteQuery = !string.IsNullOrWhiteSpace(autoCompleteQuery);
bool HasTagSpecificQuery = !string.IsNullOrWhiteSpace(tagSpecificQuery);
//lists to collect the clauses so to avoid comma fuckery
//Variables to collect the data needed to create the actual clauses later
List<string> lSelect = new List<string>();
string ActiveWhereFragment = string.Empty;
List<string> lWhere = new List<string>();
List<string> lOrderBy = new List<string>();
string PlIdSelectFragment = string.Empty;
string ActiveSelectFragment = string.Empty;
string ActiveWhereFragment = string.Empty;
//PROCESS ROW ID "VALUE" COLUMN
//

View File

@@ -58,11 +58,27 @@ namespace AyaNova.Biz
//get picklist
internal async Task<List<NameIdActiveItem>> GetPickListAsync(AyaType ayaType, string query, bool inactive, AuthorizationRoles userRoles)
{
var PickList = PickListFactory.GetAyaPickList(ayaType);
//was the name not found as a pick list?
if (PickList == null)
{
//not a user error so no need to localize
AddError(ApiErrorCode.NOT_FOUND, "ayaType", $"PickList for type \"{ayaType}\" specified does not exist");
return null;
}
//Crack and validate the query part set a broken rule if not valid and return null
//else do the query
string TagSpecificQuery = null;
string AutoCompleteQuery = null;
//Here need to handle scenario of badly formed query so user knows they did it wrong and doesn't just assume it's not there
//determine if this is a tag query
@@ -75,7 +91,7 @@ namespace AyaNova.Biz
var querySegments = AutoCompleteQuery.Split(' ');
if (querySegments.Length > 2)
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:PickListQueryInvalid");
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:ErrorPickListQueryInvalid");
return null;
}
// users may type several spaces in a regular query, so ignore that and only use the first two segments
@@ -91,7 +107,7 @@ namespace AyaNova.Biz
}
else
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:PickListQueryInvalid");
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:ErrorPickListQueryInvalid");
return null;
}

View File

@@ -1632,5 +1632,6 @@
"OldPassword": "Altes Kennwort",
"NewPassword": "Neues Kennwort",
"ConfirmPassword": "Kennwort bestätigen",
"ErrorNoMatch":"Werte stimmen nicht überein"
"ErrorNoMatch":"Werte stimmen nicht überein",
"ErrorPickListQueryInvalid":"Die eingegebene Abfrage ist ungültig - siehe PickList-Dokumentation"
}

View File

@@ -1633,7 +1633,8 @@
"OldPassword": "Old password",
"NewPassword": "New password",
"ConfirmPassword": "Confirm password",
"ErrorNoMatch":"Values don't match"
"ErrorNoMatch":"Values don't match",
"ErrorPickListQueryInvalid":"Query entered is not valid - see PickList documentation"

View File

@@ -1632,7 +1632,8 @@
"OldPassword": "Contraseña anterior",
"NewPassword": "Nueva contraseña",
"ConfirmPassword": "Confirmar contraseña",
"ErrorNoMatch":"Los valores no coinciden"
"ErrorNoMatch":"Los valores no coinciden",
"ErrorPickListQueryInvalid":"La consulta ingresada no es válida; consulte la documentación de PickList"
}

View File

@@ -1631,7 +1631,8 @@
"OldPassword": "Ancien mot de passe",
"NewPassword": "Nouveau mot de passe",
"ConfirmPassword": "Confirmer le mot de passe",
"ErrorNoMatch":"Les valeurs ne correspondent pas"
"ErrorNoMatch":"Les valeurs ne correspondent pas",
"ErrorPickListQueryInvalid":"La requête saisie n'est pas valide - voir la documentation PickList"
}