diff --git a/server/AyaNova/PickList/CustomerPickList.cs b/server/AyaNova/PickList/CustomerPickList.cs index 73745da7..835aef49 100644 --- a/server/AyaNova/PickList/CustomerPickList.cs +++ b/server/AyaNova/PickList/CustomerPickList.cs @@ -11,7 +11,7 @@ namespace AyaNova.PickList { DefaultListAType = AyaType.Customer; - SQLFrom = "from acustomer"; + SQLFrom = "from acustomer "; AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); @@ -58,8 +58,6 @@ namespace AyaNova.PickList { //Currently the only variant is a object type and id to indicate headoffice - - //ClientCriteria format for this list is "OBJECTID,AYATYPE" var crit = (variant ?? "").Split(',').Select(z => z.Trim()).ToArray(); if (crit.Length > 1) @@ -78,7 +76,7 @@ namespace AyaNova.PickList { case AyaType.HeadOffice: { - return $"aunit.customerid = {lId}"; + return $"acustomer.headofficeid = {lId}"; } } } diff --git a/server/AyaNova/PickList/PickListSqlBuilder.cs b/server/AyaNova/PickList/PickListSqlBuilder.cs index d9fcf11d..c75dc1b7 100644 --- a/server/AyaNova/PickList/PickListSqlBuilder.cs +++ b/server/AyaNova/PickList/PickListSqlBuilder.cs @@ -283,12 +283,15 @@ namespace AyaNova.PickList else { //we might have a trailing and to remove - //jesus this stuff sucks, there must be a better way, it seems so fragile - if (!IncludeInactive || HasTagSpecificQuery || preIds.Length > 0) - { - //trailing " and " to remove - sb.Length -= 5; - } + //{select acustomer.id as plId, acustomer.active as plActive, concat_ws(' ', acustomer.name) as plname from acustomer where (acustomer.headofficeid = 2) and } + if(sb.ToString().EndsWith(" and ")) + sb.Length-=5; + // + // if (!IncludeInactive || HasTagSpecificQuery || preIds.Length > 0) + // { + // //trailing " and " to remove + // sb.Length -= 5; + // } } }