This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -55,7 +55,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
||||||
|
|||||||
@@ -126,7 +126,10 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSR)
|
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSR)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
//todo: workorder list
|
case "CustomerWorkOrderDataList":
|
||||||
|
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowViewWO)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -143,7 +146,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (UserInfo.HeadOfficeId == null || UserInfo.HeadOfficeId == 0) return false;
|
if (UserInfo.HeadOfficeId == null || UserInfo.HeadOfficeId == 0) return false;
|
||||||
tableRequest.ClientCriteria = $"{UserInfo.HeadOfficeId},{(int)AyaType.HeadOffice}";
|
tableRequest.ClientCriteria = $"{UserInfo.HeadOfficeId},{(int)AyaType.HeadOffice}";
|
||||||
break;
|
break;
|
||||||
default://other user types can fuck right off!
|
default://other user type
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
206
server/AyaNova/DataList/CustomerWorkOrderDataList.cs
Normal file
206
server/AyaNova/DataList/CustomerWorkOrderDataList.cs
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using AyaNova.Biz;
|
||||||
|
using AyaNova.Models;
|
||||||
|
|
||||||
|
namespace AyaNova.DataList
|
||||||
|
{
|
||||||
|
internal class CustomerWorkOrderDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||||
|
{
|
||||||
|
//CUSTOMER VERSION
|
||||||
|
public CustomerWorkOrderDataList(long translationId)
|
||||||
|
{
|
||||||
|
DefaultListAType = AyaType.CustomerServiceRequest;
|
||||||
|
SQLFrom = "from acustomerservicerequest " +
|
||||||
|
"left join acustomer on (acustomerservicerequest.customerid=acustomer.id) " +
|
||||||
|
"left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) " +
|
||||||
|
"left join auser on (acustomerservicerequest.requestedbyuserid=auser.id) " +
|
||||||
|
"left join aunit on (acustomerservicerequest.unitid = aunit.id) " +
|
||||||
|
"left join aworkorderitem as wi on (acustomerservicerequest.workorderitemid=wi.id) " +
|
||||||
|
"left join aworkorder as w on (wi.workorderid=w.id)";
|
||||||
|
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||||
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
DefaultColumns = new List<string>() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus", "CustomerServiceRequestItemUnitID", "WorkOrder" };
|
||||||
|
DefaultSortBy = new Dictionary<string, string>() { { "Created", "-" } };
|
||||||
|
|
||||||
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "CustomerServiceRequestTitle",
|
||||||
|
FieldKey = "CustomerServiceRequestTitle",
|
||||||
|
AType = (int)AyaType.CustomerServiceRequest,
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlIdColumnName = "acustomerservicerequest.id",
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.name",
|
||||||
|
IsRowId = true
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "CustomerServiceRequestDetails",
|
||||||
|
FieldKey = "CustomerServiceRequestDetails",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.notes"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "Created",
|
||||||
|
FieldKey = "Created",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.daterequested"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "Customer",
|
||||||
|
TKey = "Customer",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "acustomer.name"
|
||||||
|
});
|
||||||
|
|
||||||
|
//Openable unit in case decide to allow customers to open a unit record of some kind
|
||||||
|
// FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
// {
|
||||||
|
// FieldKey = "CustomerServiceRequestItemUnitID",
|
||||||
|
// TKey = "CustomerServiceRequestItemUnitID",
|
||||||
|
// UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
// AType = (int)AyaType.Unit,
|
||||||
|
// SqlIdColumnName = "aunit.id",
|
||||||
|
// SqlValueColumnName = "aunit.serial"
|
||||||
|
// });
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "CustomerServiceRequestItemUnitID",
|
||||||
|
TKey = "CustomerServiceRequestItemUnitID",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "aunit.serial"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Openable version for future consideration
|
||||||
|
// FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
// {
|
||||||
|
// FieldKey = "WorkOrder",
|
||||||
|
// TKey = "WorkOrder",
|
||||||
|
// UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
// AType = (int)AyaType.WorkOrderItem,
|
||||||
|
// SqlIdColumnName = "wi.id",
|
||||||
|
// SqlValueColumnName = "w.serial"
|
||||||
|
// });
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "WorkOrder",
|
||||||
|
TKey = "WorkOrder",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "w.serial"
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "CustomerServiceRequestRequestedBy",
|
||||||
|
TKey = "CustomerServiceRequestRequestedBy",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "auser.name"
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "CustomerServiceRequestCustomerReferenceNumber",
|
||||||
|
FieldKey = "CustomerServiceRequestCustomerReferenceNumber",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.customerreferencenumber"
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "CustomerServiceRequestStatus",
|
||||||
|
FieldKey = "CustomerServiceRequestStatus",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||||
|
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(CustomerServiceRequestStatus).ToString()),
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.status"
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
TKey = "CustomerServiceRequestPriority",
|
||||||
|
FieldKey = "CustomerServiceRequestPriority",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||||
|
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(CustomerServiceRequestPriority).ToString()),
|
||||||
|
SqlValueColumnName = "acustomerservicerequest.priority"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//-----------
|
||||||
|
|
||||||
|
|
||||||
|
//META COLUMNS
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metacustomer",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "acustomer.id",
|
||||||
|
SqlValueColumnName = "acustomer.id",
|
||||||
|
IsMeta = true
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metaheadoffice",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "aheadoffice.id",
|
||||||
|
SqlValueColumnName = "aheadoffice.id",
|
||||||
|
IsMeta = true
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
|
{
|
||||||
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
//ClientCriteria format for this list is "OBJECTID,AYATYPE"
|
||||||
|
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||||
|
if (crit.Length > 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
int nType = 0;
|
||||||
|
if (!int.TryParse(crit[1], out nType)) return ret;
|
||||||
|
AyaType forType = (AyaType)nType;
|
||||||
|
if (forType != AyaType.Customer && forType != AyaType.HeadOffice) return ret;
|
||||||
|
|
||||||
|
long lId = 0;
|
||||||
|
if (!long.TryParse(crit[0], out lId)) return ret;
|
||||||
|
if (lId == 0) return ret;
|
||||||
|
|
||||||
|
//Have valid type, have an id, so filter away
|
||||||
|
switch (forType)
|
||||||
|
{
|
||||||
|
case AyaType.Customer:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||||
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
ret.Add(FilterOption);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AyaType.HeadOffice:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaheadoffice" };
|
||||||
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
ret.Add(FilterOption);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}//eoc
|
||||||
|
}//eons
|
||||||
@@ -1669,8 +1669,10 @@ namespace AyaNova.Util
|
|||||||
gbiz.CustomerAllowNotifyWOCompleted = true;
|
gbiz.CustomerAllowNotifyWOCompleted = true;
|
||||||
gbiz.CustomerAllowNotifyWOCreated = true;
|
gbiz.CustomerAllowNotifyWOCreated = true;
|
||||||
gbiz.CustomerAllowUserSettings = true;
|
gbiz.CustomerAllowUserSettings = true;
|
||||||
gbiz.CustomerAllowViewWO = false;
|
gbiz.CustomerAllowViewWO = true;
|
||||||
gbiz.CustomerAllowWOWiki = false;
|
// gbiz.CustomerDefaultWorkOrderReportId=1;
|
||||||
|
gbiz.CustomerAllowWOWiki = true;
|
||||||
|
gbiz.CustomerAllowWOAttachments=true;
|
||||||
|
|
||||||
await biz.PutAsync(gbiz);
|
await biz.PutAsync(gbiz);
|
||||||
ServerGlobalBizSettings.Initialize(gbiz, null);
|
ServerGlobalBizSettings.Initialize(gbiz, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user