diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e2049e9..8fd97968 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/devdocs/specs/core-import-v7.txt b/devdocs/specs/core-import-v7.txt index ad839946..20550318 100644 --- a/devdocs/specs/core-import-v7.txt +++ b/devdocs/specs/core-import-v7.txt @@ -63,7 +63,7 @@ SCHEMA - It would be helpful to have a importmap table that is used temporarily during import to store a map of v7Guid's with their imported RAVEN type and id - This way it can be a lookup table to quickly set other imported data, i.e. client id's to match to units being imported. IMPORTMAP - - ObjectType + - AType - ObjectId - v7Guid diff --git a/devdocs/specs/core-long-running-operations.txt b/devdocs/specs/core-long-running-operations.txt index 09e07834..47624301 100644 --- a/devdocs/specs/core-long-running-operations.txt +++ b/devdocs/specs/core-long-running-operations.txt @@ -64,7 +64,7 @@ AOPSJOB - StartAfter NOT NULL INDEXED (datetime to start the job, in cases of start now jobs the date will be minvalue) - jobtype enum int NOT NULL of the jobtype which is an enum of all possible job types (i.e. NotifyClosed) - ObjectId NULL source of job object id (i.e. workorder id) - - ObjectType NULL source of job object type (i.e. workorder) + - AType NULL source of job object type (i.e. workorder) - descriptive name text NOT NULL for display in UI only, isn't filtered - jobstatus enum int NOT NULL type (one of "sleeping | notstarted | running | succeeded | failed") - jobinfo text NULL (json string of extra info required for job, maybe the name of an import file or who knows what, anything really can be put in here as long as it's shortish) diff --git a/devdocs/specs/core-search.txt b/devdocs/specs/core-search.txt index 707c0c7f..abd31cf3 100644 --- a/devdocs/specs/core-search.txt +++ b/devdocs/specs/core-search.txt @@ -78,7 +78,7 @@ asearchkey - id (long) - wordid (fk on asearchdictionary.id) - objectid (long id of source object) - - objecttype (AyaType as int of source object) + - aType (AyaType as int of source object) diff --git a/devdocs/specs/core-tags.txt b/devdocs/specs/core-tags.txt index 5445d881..04f937ee 100644 --- a/devdocs/specs/core-tags.txt +++ b/devdocs/specs/core-tags.txt @@ -58,7 +58,7 @@ RETRIEVAL Will need to query tags as follows: -ObjectType and Id list of tags (most common) +AType and Id list of tags (most common) Objects with one or more tags Objects that have a set of tags but do not have another set of tags Objects of a certain type but any id that have a certain tag diff --git a/docs/8.0/ayanova/docs/api-upload-routes.md b/docs/8.0/ayanova/docs/api-upload-routes.md index 99994910..43979c81 100644 --- a/docs/8.0/ayanova/docs/api-upload-routes.md +++ b/docs/8.0/ayanova/docs/api-upload-routes.md @@ -41,7 +41,7 @@ for (var i = 0; i < files.length; i++) { //Attachment upload route requires further form data to designate //the object being attached to by it's type and id: -//data.append('AttachToObjectType','2'); +//data.append('AttachToAType','2'); //data.append('AttachToObjectId','200'); $.ajax({ diff --git a/server/AyaNova/ControllerHelpers/Authorized.cs b/server/AyaNova/ControllerHelpers/Authorized.cs index 761a7531..d9397953 100644 --- a/server/AyaNova/ControllerHelpers/Authorized.cs +++ b/server/AyaNova/ControllerHelpers/Authorized.cs @@ -41,23 +41,23 @@ namespace AyaNova.Api.ControllerHelpers /// any access at all? /// /// - /// + /// /// - internal static bool HasAnyRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasAnyRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); - return HasAnyRole(currentUserRoles, objectType); + return HasAnyRole(currentUserRoles, aType); } /// /// User has any access at all to this object? /// /// - /// + /// /// - internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType aType) { - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change | RoleSet.Select; return currentUserRoles.HasAnyFlags(AllowedRoles); @@ -67,23 +67,23 @@ namespace AyaNova.Api.ControllerHelpers /// READ FULL RECORD (not just name and id) /// /// - /// + /// /// - internal static bool HasSelectRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasSelectRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); - return HasSelectRole(currentUserRoles, objectType); + return HasSelectRole(currentUserRoles, aType); } /// /// SELECT BY NAME /// /// - /// + /// /// - internal static bool HasSelectRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasSelectRole(AuthorizationRoles currentUserRoles, AyaType aType) { - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; //NOTE: this assumes that if you can change you can read @@ -104,24 +104,24 @@ namespace AyaNova.Api.ControllerHelpers /// READ FULL RECORD (not just name and id) /// /// - /// + /// /// - internal static bool HasReadFullRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasReadFullRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); - return HasReadFullRole(currentUserRoles, objectType); + return HasReadFullRole(currentUserRoles, aType); } /// /// READ FULL RECORD (not just name and id) /// /// - /// + /// /// - internal static bool HasReadFullRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasReadFullRole(AuthorizationRoles currentUserRoles, AyaType aType) { //NOTE: this assumes that if you can change you can read - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; return currentUserRoles.HasAnyFlags(AllowedRoles); @@ -133,23 +133,23 @@ namespace AyaNova.Api.ControllerHelpers /// CREATE /// /// - /// + /// /// - internal static bool HasCreateRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasCreateRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); - return HasCreateRole(currentUserRoles, objectType); + return HasCreateRole(currentUserRoles, aType); } /// /// CREATE /// /// - /// + /// /// - internal static bool HasCreateRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasCreateRole(AuthorizationRoles currentUserRoles, AyaType aType) { - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; if (currentUserRoles.HasAnyFlags(RoleSet.Change)) return true; @@ -161,13 +161,13 @@ namespace AyaNova.Api.ControllerHelpers /// MODIFY /// /// - /// + /// /// - internal static bool HasModifyRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasModifyRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); - return HasModifyRole(currentUserRoles, objectType); + return HasModifyRole(currentUserRoles, aType); } @@ -175,11 +175,11 @@ namespace AyaNova.Api.ControllerHelpers /// MODIFY /// /// - /// + /// /// - internal static bool HasModifyRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasModifyRole(AuthorizationRoles currentUserRoles, AyaType aType) { - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; if (currentUserRoles.HasAnyFlags(RoleSet.Change)) return true; @@ -193,14 +193,14 @@ namespace AyaNova.Api.ControllerHelpers /// DELETE /// /// - /// + /// /// //For now just going to treat as a modify, but for maximum flexibility keeping this as a separate method in case we change our minds in future - internal static bool HasDeleteRole(IDictionary HttpContextItems, AyaType objectType) + internal static bool HasDeleteRole(IDictionary HttpContextItems, AyaType aType) { AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems); long currentUserId = UserIdFromContext.Id(HttpContextItems); - return HasDeleteRole(currentUserRoles, objectType); + return HasDeleteRole(currentUserRoles, aType); } @@ -208,12 +208,12 @@ namespace AyaNova.Api.ControllerHelpers /// DELETE /// /// - /// + /// /// //For now just going to treat as a modify, but for maximum flexibility keeping this as a separate method in case we change our minds in future - internal static bool HasDeleteRole(AuthorizationRoles currentUserRoles, AyaType objectType) + internal static bool HasDeleteRole(AuthorizationRoles currentUserRoles, AyaType aType) { - var RoleSet = BizRoles.GetRoleSet(objectType); + var RoleSet = BizRoles.GetRoleSet(aType); if (RoleSet == null) return false; if (currentUserRoles.HasAnyFlags(RoleSet.Change)) return true; diff --git a/server/AyaNova/Controllers/AttachmentController.cs b/server/AyaNova/Controllers/AttachmentController.cs index eb0dd5df..c06453f1 100644 --- a/server/AyaNova/Controllers/AttachmentController.cs +++ b/server/AyaNova/Controllers/AttachmentController.cs @@ -86,7 +86,7 @@ namespace AyaNova.Api.Controllers long UserId = UserIdFromContext.Id(HttpContext.Items); - if (!Authorized.HasModifyRole(HttpContext.Items, dbObject.AttachToObjectType)) + if (!Authorized.HasModifyRole(HttpContext.Items, dbObject.AttachToAType)) { return StatusCode(403, new ApiNotAuthorizedResponse()); } @@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers ct.Entry(dbObject).OriginalValues["Concurrency"] = inObj.Concurrency; //Log event and save context - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToObjectType, AyaEvent.AttachmentModified, ChangeTextra), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToAType, AyaEvent.AttachmentModified, ChangeTextra), ct); @@ -133,7 +133,7 @@ namespace AyaNova.Api.Controllers } //Normallyh wouldn't return a whole list but in this case the UI demands it because of reactivity issues - var ret = await GetFileListForObjectAsync(dbObject.AttachToObjectType, dbObject.AttachToObjectId); + var ret = await GetFileListForObjectAsync(dbObject.AttachToAType, dbObject.AttachToObjectId); return Ok(ApiOkResponse.Response(ret)); } @@ -189,7 +189,7 @@ namespace AyaNova.Api.Controllers return NotFound(); - return Ok(ApiOkResponse.Response(new { id = at.AttachToObjectId, type = at.AttachToObjectType })); + return Ok(ApiOkResponse.Response(new { id = at.AttachToObjectId, type = at.AttachToAType })); } @@ -224,7 +224,7 @@ namespace AyaNova.Api.Controllers bool badRequest = false; - string AttachToObjectType = string.Empty; + string AttachToAType = string.Empty; string AttachToObjectId = string.Empty; string errorMessage = string.Empty; string Notes = string.Empty; @@ -239,15 +239,15 @@ namespace AyaNova.Api.Controllers if (!badRequest && (!uploadFormData.FormFieldData.ContainsKey("FileData") - || !uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") + || !uploadFormData.FormFieldData.ContainsKey("AttachToAType") || !uploadFormData.FormFieldData.ContainsKey("AttachToObjectId"))) { badRequest = true; - errorMessage = "Missing one or more required FormFieldData values: AttachToObjectType, AttachToObjectId, FileData"; + errorMessage = "Missing one or more required FormFieldData values: AttachToAType, AttachToObjectId, FileData"; } if (!badRequest) { - AttachToObjectType = uploadFormData.FormFieldData["AttachToObjectType"].ToString(); + AttachToAType = uploadFormData.FormFieldData["AttachToAType"].ToString(); AttachToObjectId = uploadFormData.FormFieldData["AttachToObjectId"].ToString(); if (uploadFormData.FormFieldData.ContainsKey("Notes")) Notes = uploadFormData.FormFieldData["Notes"].ToString(); @@ -255,10 +255,10 @@ namespace AyaNova.Api.Controllers //"[{\"name\":\"Client.csv\",\"lastModified\":1582822079618},{\"name\":\"wmi4fu06nrs41.jpg\",\"lastModified\":1586900220990}]" FileData = Newtonsoft.Json.JsonConvert.DeserializeObject>(uploadFormData.FormFieldData["FileData"].ToString()); - if (string.IsNullOrWhiteSpace(AttachToObjectType) || string.IsNullOrWhiteSpace(AttachToObjectId)) + if (string.IsNullOrWhiteSpace(AttachToAType) || string.IsNullOrWhiteSpace(AttachToObjectId)) { badRequest = true; - errorMessage = "AttachToObjectType and / or AttachToObjectId are empty and are required"; + errorMessage = "AttachToAType and / or AttachToObjectId are empty and are required"; } } @@ -267,11 +267,11 @@ namespace AyaNova.Api.Controllers if (!badRequest) { - attachToObject = new AyaTypeId(AttachToObjectType, AttachToObjectId); + attachToObject = new AyaTypeId(AttachToAType, AttachToObjectId); if (attachToObject.IsEmpty) { badRequest = true; - errorMessage = "AttachToObjectType and / or AttachToObjectId are not valid and are required"; + errorMessage = "AttachToAType and / or AttachToObjectId are not valid and are required"; } } @@ -281,7 +281,7 @@ namespace AyaNova.Api.Controllers if (!attachToObject.IsCoreBizObject) { badRequest = true; - errorMessage = attachToObject.ObjectType.ToString() + " - AttachToObjectType does not support attachments"; + errorMessage = attachToObject.AType.ToString() + " - AttachToAType does not support attachments"; } } @@ -290,7 +290,7 @@ namespace AyaNova.Api.Controllers if (!badRequest) { //check if object exists - if (!await BizObjectExistsInDatabase.ExistsAsync(attachToObject.ObjectType, attachToObject.ObjectId, ct)) + if (!await BizObjectExistsInDatabase.ExistsAsync(attachToObject.AType, attachToObject.ObjectId, ct)) { badRequest = true; errorMessage = "Invalid attach object"; @@ -298,7 +298,7 @@ namespace AyaNova.Api.Controllers else { // User needs modify rights to the object type in question - if (!Authorized.HasModifyRole(HttpContext.Items, attachToObject.ObjectType)) + if (!Authorized.HasModifyRole(HttpContext.Items, attachToObject.AType)) { //delete temp files ApiUploadProcessor.DeleteTempUploadFile(uploadFormData); @@ -354,7 +354,7 @@ namespace AyaNova.Api.Controllers var v = await FileUtil.StoreFileAttachmentAsync(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, theDate, attachToObject, Notes, ct); //EVENT LOG - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, attachToObject.ObjectId, attachToObject.ObjectType, AyaEvent.AttachmentCreate, v.DisplayFileName), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, attachToObject.ObjectId, attachToObject.AType, AyaEvent.AttachmentCreate, v.DisplayFileName), ct); //SEARCH INDEXING var SearchParams = new Search.SearchIndexProcessObjectParameters(UserTranslationIdFromContext.Id(HttpContext.Items), v.Id, AyaType.FileAttachment); @@ -363,7 +363,7 @@ namespace AyaNova.Api.Controllers } } - ret = await GetFileListForObjectAsync(attachToObject.ObjectType, attachToObject.ObjectId); + ret = await GetFileListForObjectAsync(attachToObject.AType, attachToObject.ObjectId); } catch (InvalidDataException ex) { @@ -415,7 +415,7 @@ namespace AyaNova.Api.Controllers long UserId = UserIdFromContext.Id(HttpContext.Items); - if (!Authorized.HasDeleteRole(HttpContext.Items, dbObject.AttachToObjectType)) + if (!Authorized.HasDeleteRole(HttpContext.Items, dbObject.AttachToAType)) { return StatusCode(403, new ApiNotAuthorizedResponse()); } @@ -425,7 +425,7 @@ namespace AyaNova.Api.Controllers await FileUtil.DeleteFileAttachmentAsync(dbObject, ct); //Event log process delete - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToObjectType, AyaEvent.AttachmentDelete, dbObject.DisplayFileName), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToAType, AyaEvent.AttachmentDelete, dbObject.DisplayFileName), ct); //Delete search index await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.FileAttachment, ct); @@ -461,7 +461,7 @@ namespace AyaNova.Api.Controllers await FileUtil.DeleteFileAttachmentAsync(dbObject, ct); //Event log process delete - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToObjectType, AyaEvent.AttachmentDelete, dbObject.DisplayFileName), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToAType, AyaEvent.AttachmentDelete, dbObject.DisplayFileName), ct); //Delete search index await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, AyaType.FileAttachment, ct); @@ -495,13 +495,13 @@ namespace AyaNova.Api.Controllers continue; //do the move - var msg = $"{dbObject.DisplayFileName} moved from {dbObject.AttachToObjectType}-{dbObject.AttachToObjectId} to {dt.ToType}-{dt.ToId} "; + var msg = $"{dbObject.DisplayFileName} moved from {dbObject.AttachToAType}-{dbObject.AttachToObjectId} to {dt.ToType}-{dt.ToId} "; dbObject.AttachToObjectId = dt.ToId; - dbObject.AttachToObjectType = dt.ToType; + dbObject.AttachToAType = dt.ToType; await ct.SaveChangesAsync(); //Event log process move - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToObjectType, AyaEvent.AttachmentModified, msg), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.AttachToObjectId, dbObject.AttachToAType, AyaEvent.AttachmentModified, msg), ct); } return NoContent(); @@ -546,7 +546,7 @@ namespace AyaNova.Api.Controllers } //is this allowed? - if (!Authorized.HasReadFullRole(DownloadUser.Roles, dbObject.AttachToObjectType)) + if (!Authorized.HasReadFullRole(DownloadUser.Roles, dbObject.AttachToAType)) { await Task.Delay(AyaNova.Util.ServerBootConfig.FAILED_AUTH_DELAY);//DOS protection return StatusCode(403, new ApiNotAuthorizedResponse()); @@ -568,7 +568,7 @@ namespace AyaNova.Api.Controllers } //Log - await EventLogProcessor.LogEventToDatabaseAsync(new Event(DownloadUser.Id, dbObject.AttachToObjectId, dbObject.AttachToObjectType, AyaEvent.AttachmentDownload, dbObject.DisplayFileName), ct); + await EventLogProcessor.LogEventToDatabaseAsync(new Event(DownloadUser.Id, dbObject.AttachToObjectId, dbObject.AttachToAType, AyaEvent.AttachmentDownload, dbObject.DisplayFileName), ct); return PhysicalFile(filePath, mimetype, dbObject.DisplayFileName); @@ -579,7 +579,7 @@ namespace AyaNova.Api.Controllers async private Task GetFileListForObjectAsync(AyaType ayaType, long ayaId) { - return await ct.FileAttachment.AsNoTracking().Where(z => z.AttachToObjectId == ayaId && z.AttachToObjectType == ayaType).OrderBy(z => z.DisplayFileName) + return await ct.FileAttachment.AsNoTracking().Where(z => z.AttachToObjectId == ayaId && z.AttachToAType == ayaType).OrderBy(z => z.DisplayFileName) .Select(z => new { z.Id, z.Concurrency, z.ContentType, z.DisplayFileName, z.LastModified, z.Notes }) .ToArrayAsync(); // var v = l.OrderBy(z => z.DisplayFileName); @@ -604,7 +604,7 @@ namespace AyaNova.Api.Controllers var JobName = $"Attachment maintenance (demand) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = AyaType.FileAttachment; + j.AType = AyaType.FileAttachment; j.JobType = JobType.AttachmentMaintenance; j.SubType = JobSubType.NotSet; j.Exclusive = true; diff --git a/server/AyaNova/Controllers/BackupController.cs b/server/AyaNova/Controllers/BackupController.cs index 4c823d9b..b7657487 100644 --- a/server/AyaNova/Controllers/BackupController.cs +++ b/server/AyaNova/Controllers/BackupController.cs @@ -66,7 +66,7 @@ namespace AyaNova.Api.Controllers var JobName = $"LT:BackupNow LT:User {UserNameFromContext.Name(HttpContext.Items)}"; OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = AyaType.NoType; + j.AType = AyaType.NoType; j.JobType = JobType.Backup; j.SubType = JobSubType.NotSet; j.Exclusive = true; diff --git a/server/AyaNova/Controllers/EventLogController.cs b/server/AyaNova/Controllers/EventLogController.cs index 13822b11..afc09349 100644 --- a/server/AyaNova/Controllers/EventLogController.cs +++ b/server/AyaNova/Controllers/EventLogController.cs @@ -184,9 +184,9 @@ namespace AyaNova.Api.Controllers public sealed class UserEventLogItem { - //DateTime, ObjectType, ObjectId, Event, Textra + //DateTime, AType, ObjectId, Event, Textra public DateTime Date { get; set; } - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } public long ObjectId { get; set; } public string Name { get; set; } public AyaEvent Event { get; set; } diff --git a/server/AyaNova/Controllers/ExportController.cs b/server/AyaNova/Controllers/ExportController.cs index 6e164898..3be213fc 100644 --- a/server/AyaNova/Controllers/ExportController.cs +++ b/server/AyaNova/Controllers/ExportController.cs @@ -61,7 +61,7 @@ namespace AyaNova.Api.Controllers if (selectedRequest == null) return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelectedRequest is required")); - if (!Authorized.HasReadFullRole(HttpContext.Items, selectedRequest.ObjectType)) + if (!Authorized.HasReadFullRole(HttpContext.Items, selectedRequest.AType)) return StatusCode(403, new ApiNotAuthorizedResponse()); if (string.IsNullOrWhiteSpace(format)) @@ -86,12 +86,12 @@ namespace AyaNova.Api.Controllers UserTranslationId); - log.LogDebug($"Instantiating biz object handler for {selectedRequest.ObjectType}"); - var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct, UserId, UserRoles, UserTranslationId); - log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.ObjectType} items"); + log.LogDebug($"Instantiating biz object handler for {selectedRequest.AType}"); + var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, UserRoles, UserTranslationId); + log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.AType} items"); // var TheData = await ((IExportAbleObject)biz).GetJSONExportData(dataListSelection.SelectedRowIds); - string baseFileName = FileUtil.StringToSafeFileName($"{selectedRequest.ObjectType.ToString().ToLowerInvariant()}-{format}-{FileUtil.GetSafeDateFileName()}"); + string baseFileName = FileUtil.StringToSafeFileName($"{selectedRequest.AType.ToString().ToLowerInvariant()}-{format}-{FileUtil.GetSafeDateFileName()}"); // string outputRandomFileNameNoExtension = StringUtil.ReplaceLastOccurrence(FileUtil.NewRandomFileName, ".", ""); string outputSourceFileName = baseFileName + "." + format; diff --git a/server/AyaNova/Controllers/ImportController.cs b/server/AyaNova/Controllers/ImportController.cs index 0985ab5a..644d62f8 100644 --- a/server/AyaNova/Controllers/ImportController.cs +++ b/server/AyaNova/Controllers/ImportController.cs @@ -70,7 +70,7 @@ namespace AyaNova.Api.Controllers // uploadFormData = await ApiUploadProcessor.ProcessUploadAsync(HttpContext);xx - string UploadObjectType = string.Empty; + string UploadAType = string.Empty; string errorMessage = string.Empty; string Notes = string.Empty; @@ -100,10 +100,10 @@ namespace AyaNova.Api.Controllers return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Missing required FormFieldData value: FileData")); - if (uploadFormData.FormFieldData.ContainsKey("ObjectType")) - UploadObjectType = uploadFormData.FormFieldData["ObjectType"].ToString(); + if (uploadFormData.FormFieldData.ContainsKey("AType")) + UploadAType = uploadFormData.FormFieldData["AType"].ToString(); else - return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Missing required FormFieldData value: ObjectType")); + return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Missing required FormFieldData value: AType")); //fileData in JSON stringify format which contains the actual last modified dates etc //"[{\"name\":\"Client.csv\",\"lastModified\":1582822079618},{\"name\":\"wmi4fu06nrs41.jpg\",\"lastModified\":1586900220990}]" @@ -112,7 +112,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler - AyaType TheType = System.Enum.Parse(UploadObjectType, true); + AyaType TheType = System.Enum.Parse(UploadAType, true); log.LogDebug($"Instantiating biz object handler for {TheType}"); var biz = BizObjectFactory.GetBizObject(TheType, ct); diff --git a/server/AyaNova/Controllers/JobOperationsController.cs b/server/AyaNova/Controllers/JobOperationsController.cs index 14ee100a..ff79595e 100644 --- a/server/AyaNova/Controllers/JobOperationsController.cs +++ b/server/AyaNova/Controllers/JobOperationsController.cs @@ -207,7 +207,7 @@ namespace AyaNova.Api.Controllers return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelectedRequest is required")); - if (!Authorized.HasDeleteRole(HttpContext.Items, selectedRequest.ObjectType)) + if (!Authorized.HasDeleteRole(HttpContext.Items, selectedRequest.AType)) return StatusCode(403, new ApiNotAuthorizedResponse()); //Rehydrate id list if necessary @@ -220,7 +220,7 @@ namespace AyaNova.Api.Controllers UserIdFromContext.Id(HttpContext.Items), UserTranslationIdFromContext.Id(HttpContext.Items)); - var JobName = $"LT:BatchDeleteJob - LT:{selectedRequest.ObjectType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; + var JobName = $"LT:BatchDeleteJob - LT:{selectedRequest.AType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; JObject o = JObject.FromObject(new { idList = selectedRequest.SelectedRowIds @@ -228,7 +228,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = selectedRequest.ObjectType; + j.AType = selectedRequest.AType; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.Delete; j.Exclusive = false; diff --git a/server/AyaNova/Controllers/NameController.cs b/server/AyaNova/Controllers/NameController.cs index 92290b13..612a2ad2 100644 --- a/server/AyaNova/Controllers/NameController.cs +++ b/server/AyaNova/Controllers/NameController.cs @@ -40,22 +40,22 @@ namespace AyaNova.Api.Controllers /// not all business objects have names some may return '-' or simply the type name /// if that is the case /// - /// AyaType + /// AyaType /// Non zero id, if zero returns type name /// Name - [HttpGet("{ayType}/{id}")] - public ActionResult GetName([FromRoute] AyaType ayType, [FromRoute] long id) + [HttpGet("{aType}/{id}")] + public ActionResult GetName([FromRoute] AyaType aType, [FromRoute] long id) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - if (!Authorized.HasSelectRole(HttpContext.Items, ayType)) + if (!Authorized.HasSelectRole(HttpContext.Items, aType)) return StatusCode(403, new ApiNotAuthorizedResponse()); if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); if (id == 0) - return Ok(ApiOkResponse.Response(ayType.ToString())); + return Ok(ApiOkResponse.Response(aType.ToString())); - return Ok(ApiOkResponse.Response(BizObjectNameFetcherDirect.Name(ayType, id, ct))); + return Ok(ApiOkResponse.Response(BizObjectNameFetcherDirect.Name(aType, id, ct))); } diff --git a/server/AyaNova/Controllers/ReportController.cs b/server/AyaNova/Controllers/ReportController.cs index f2a53f4d..bbbd7dab 100644 --- a/server/AyaNova/Controllers/ReportController.cs +++ b/server/AyaNova/Controllers/ReportController.cs @@ -160,10 +160,10 @@ namespace AyaNova.Api.Controllers /// /// Get Report list for object /// - /// Type of object + /// Type of object /// Name / id report list of allowed reports for role of requester - [HttpGet("list/{ayType}")] - public async Task GetReportList([FromRoute] AyaType ayType) + [HttpGet("list/{aType}")] + public async Task GetReportList([FromRoute] AyaType aType) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -171,11 +171,11 @@ namespace AyaNova.Api.Controllers if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType)) return StatusCode(403, new ApiNotAuthorizedResponse()); //extra check if they have rights to the type of object in question, this nips it in the bud before they even get to the fetch data stage later - if (!Authorized.HasReadFullRole(HttpContext.Items, ayType)) + if (!Authorized.HasReadFullRole(HttpContext.Items, aType)) return StatusCode(403, new ApiNotAuthorizedResponse()); if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - var o = await biz.GetReportListAsync(ayType); + var o = await biz.GetReportListAsync(aType); if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); return Ok(ApiOkResponse.Response(o)); } diff --git a/server/AyaNova/Controllers/SearchController.cs b/server/AyaNova/Controllers/SearchController.cs index 206e3f89..d665e800 100644 --- a/server/AyaNova/Controllers/SearchController.cs +++ b/server/AyaNova/Controllers/SearchController.cs @@ -140,7 +140,7 @@ namespace AyaNova.Api.Controllers case AyaType.WorkOrderItemTask: case AyaType.WorkOrderItemTravel: AyaTypeId TypeId = await WorkOrderBiz.GetAncestor(ayaType, id, ct); - return Ok(ApiOkResponse.Response(new { AyaType = TypeId.ObjectTypeAsInt, Id = TypeId.ObjectId })); + return Ok(ApiOkResponse.Response(new { AyaType = TypeId.ATypeAsInt, Id = TypeId.ObjectId })); default: return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, null, "Only types with ancestors are valid")); diff --git a/server/AyaNova/Controllers/TagController.cs b/server/AyaNova/Controllers/TagController.cs index 0ff84426..49150993 100644 --- a/server/AyaNova/Controllers/TagController.cs +++ b/server/AyaNova/Controllers/TagController.cs @@ -90,10 +90,10 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - if (!selectedRequest.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute))) + if (!selectedRequest.AType.HasAttribute(typeof(CoreBizObjectAttribute))) return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type")); - if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.ObjectType)) + if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.AType)) return StatusCode(403, new ApiNotAuthorizedResponse()); tag = TagBiz.NormalizeTag(tag); @@ -110,7 +110,7 @@ namespace AyaNova.Api.Controllers UserIdFromContext.Id(HttpContext.Items), UserTranslationIdFromContext.Id(HttpContext.Items)); - var JobName = $"LT:BatchJob LT:Add LT:Tag \"{tag}\" LT:{selectedRequest.ObjectType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; + var JobName = $"LT:BatchJob LT:Add LT:Tag \"{tag}\" LT:{selectedRequest.AType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; JObject o = JObject.FromObject(new { idList = selectedRequest.SelectedRowIds, @@ -119,7 +119,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = selectedRequest.ObjectType; + j.AType = selectedRequest.AType; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.TagAdd; j.Exclusive = false; @@ -159,7 +159,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = ayaType; + j.AType = ayaType; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.TagAddAny; j.Exclusive = false; @@ -183,9 +183,9 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - if (!selectedRequest.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute))) + if (!selectedRequest.AType.HasAttribute(typeof(CoreBizObjectAttribute))) return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type")); - if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.ObjectType)) + if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.AType)) return StatusCode(403, new ApiNotAuthorizedResponse()); tag = TagBiz.NormalizeTag(tag); @@ -202,7 +202,7 @@ namespace AyaNova.Api.Controllers UserIdFromContext.Id(HttpContext.Items), UserTranslationIdFromContext.Id(HttpContext.Items)); - var JobName = $"LT:BatchJob LT:Remove LT:Tag \"{tag}\" LT:{selectedRequest.ObjectType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; + var JobName = $"LT:BatchJob LT:Remove LT:Tag \"{tag}\" LT:{selectedRequest.AType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; JObject o = JObject.FromObject(new { idList = selectedRequest.SelectedRowIds, @@ -211,7 +211,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = selectedRequest.ObjectType; + j.AType = selectedRequest.AType; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.TagRemove; j.Exclusive = false; @@ -252,7 +252,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = ayaType; + j.AType = ayaType; j.SubType = JobSubType.TagRemoveAny; j.JobType = JobType.BatchCoreObjectOperation; j.Exclusive = false; @@ -278,9 +278,9 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - if (!selectedRequest.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute))) + if (!selectedRequest.AType.HasAttribute(typeof(CoreBizObjectAttribute))) return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type")); - if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.ObjectType)) + if (!Authorized.HasModifyRole(HttpContext.Items, selectedRequest.AType)) return StatusCode(403, new ApiNotAuthorizedResponse()); fromTag = TagBiz.NormalizeTag(fromTag); if (string.IsNullOrWhiteSpace(fromTag)) @@ -299,7 +299,7 @@ namespace AyaNova.Api.Controllers UserIdFromContext.Id(HttpContext.Items), UserTranslationIdFromContext.Id(HttpContext.Items)); - var JobName = $"LT:BatchJob LT:Replace LT:Tag \"{fromTag}\" -> LT:Tag \"{toTag}\" LT:{selectedRequest.ObjectType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; + var JobName = $"LT:BatchJob LT:Replace LT:Tag \"{fromTag}\" -> LT:Tag \"{toTag}\" LT:{selectedRequest.AType} ({selectedRequest.SelectedRowIds.LongLength}) LT:User {UserNameFromContext.Name(HttpContext.Items)}"; JObject o = JObject.FromObject(new { idList = selectedRequest.SelectedRowIds, @@ -308,7 +308,7 @@ namespace AyaNova.Api.Controllers }); OpsJob j = new OpsJob(); - j.ObjectType = selectedRequest.ObjectType; + j.AType = selectedRequest.AType; j.Name = JobName; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.TagReplace; @@ -355,7 +355,7 @@ namespace AyaNova.Api.Controllers OpsJob j = new OpsJob(); j.Name = JobName; - j.ObjectType = ayaType; + j.AType = ayaType; j.JobType = JobType.BatchCoreObjectOperation; j.SubType = JobSubType.TagReplaceAny; j.Exclusive = false; diff --git a/server/AyaNova/Controllers/TranslationController.cs b/server/AyaNova/Controllers/TranslationController.cs index 3f60c6bf..de61fdff 100644 --- a/server/AyaNova/Controllers/TranslationController.cs +++ b/server/AyaNova/Controllers/TranslationController.cs @@ -336,7 +336,7 @@ namespace AyaNova.Api.Controllers bool badRequest = false; - string UploadObjectType = string.Empty; + string UploadAType = string.Empty; string UploadObjectId = string.Empty; string errorMessage = string.Empty; string Notes = string.Empty; @@ -371,8 +371,8 @@ namespace AyaNova.Api.Controllers } if (!badRequest) { - if (uploadFormData.FormFieldData.ContainsKey("ObjectType")) - UploadObjectType = uploadFormData.FormFieldData["ObjectType"].ToString(); + if (uploadFormData.FormFieldData.ContainsKey("AType")) + UploadAType = uploadFormData.FormFieldData["AType"].ToString(); if (uploadFormData.FormFieldData.ContainsKey("ObjectId")) UploadObjectId = uploadFormData.FormFieldData["ObjectId"].ToString(); if (uploadFormData.FormFieldData.ContainsKey("Notes")) diff --git a/server/AyaNova/DataList/AttachmentDataList.cs b/server/AyaNova/DataList/AttachmentDataList.cs index fd728ce3..f1cd2a85 100644 --- a/server/AyaNova/DataList/AttachmentDataList.cs +++ b/server/AyaNova/DataList/AttachmentDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public AttachmentDataList() { - DefaultListObjectType = AyaType.FileAttachment; + DefaultListAType = AyaType.FileAttachment; SQLFrom = "from afileattachment"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "displayfilename", "object", "size", "notes", "exists" }; DefaultSortBy = new Dictionary() { { "displayfilename", "+" }, { "size", "-" } }; @@ -20,7 +20,7 @@ namespace AyaNova.DataList { TKey = "FileAttachment", FieldKey = "displayfilename", - AyaObjectType = (int)AyaType.FileAttachment, + AType = (int)AyaType.FileAttachment, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "afileattachment.id", SqlValueColumnName = "afileattachment.displayfilename", @@ -41,8 +41,8 @@ namespace AyaNova.DataList FieldKey = "object", UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "afileattachment.AttachToObjectid", - SqlValueColumnName = "AYGETNAME(afileattachment.AttachToObjectid, afileattachment.attachtoobjecttype)", - SqlAyTypeColumnName = "afileattachment.attachtoobjecttype" + SqlValueColumnName = "AYGETNAME(afileattachment.AttachToObjectid, afileattachment.attachtoatype)", + SqlATypeColumnName = "afileattachment.attachtoatype" }); FieldDefinitions.Add(new DataListFieldDefinition diff --git a/server/AyaNova/DataList/ContractDataList.cs b/server/AyaNova/DataList/ContractDataList.cs index d6eef41c..b784ca1b 100644 --- a/server/AyaNova/DataList/ContractDataList.cs +++ b/server/AyaNova/DataList/ContractDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public ContractDataList() { - DefaultListObjectType = AyaType.Contract; + DefaultListAType = AyaType.Contract; SQLFrom = "from acontract"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "contractname", "contractactive" }; DefaultSortBy = new Dictionary() { { "contractname", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "ContractName", FieldKey = "contractname", - AyaObjectType = (int)AyaType.Contract, + AType = (int)AyaType.Contract, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "acontract.id", SqlValueColumnName = "acontract.name", diff --git a/server/AyaNova/DataList/CustomerDataList.cs b/server/AyaNova/DataList/CustomerDataList.cs index 68e7a363..1e3d2026 100644 --- a/server/AyaNova/DataList/CustomerDataList.cs +++ b/server/AyaNova/DataList/CustomerDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public CustomerDataList() { - DefaultListObjectType = AyaType.Customer; + DefaultListAType = AyaType.Customer; SQLFrom = "from acustomer left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join acontract on (acustomer.contractid=acontract.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "customername", "customerphone1", "customeremail", "customerheadoffice" }; DefaultSortBy = new Dictionary() { { "customername", "+" } }; @@ -19,7 +19,7 @@ namespace AyaNova.DataList { TKey = "CustomerName", FieldKey = "customername", - AyaObjectType = (int)AyaType.Customer, + AType = (int)AyaType.Customer, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name", @@ -71,7 +71,7 @@ namespace AyaNova.DataList TKey = "HeadOffice", FieldKey = "customerheadoffice", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.HeadOffice, + AType = (int)AyaType.HeadOffice, SqlIdColumnName = "aheadoffice.id", SqlValueColumnName = "aheadoffice.name" }); @@ -113,7 +113,7 @@ namespace AyaNova.DataList TKey = "Contract", FieldKey = "customercontract", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Contract, + AType = (int)AyaType.Contract, SqlIdColumnName = "acontract.id", SqlValueColumnName = "acontract.name" }); diff --git a/server/AyaNova/DataList/CustomerNoteDataList.cs b/server/AyaNova/DataList/CustomerNoteDataList.cs index 6e25988e..b4c694c6 100644 --- a/server/AyaNova/DataList/CustomerNoteDataList.cs +++ b/server/AyaNova/DataList/CustomerNoteDataList.cs @@ -8,9 +8,9 @@ namespace AyaNova.DataList { public CustomerNoteDataList() { - DefaultListObjectType = AyaType.CustomerNote; + DefaultListAType = AyaType.CustomerNote; SQLFrom = "from acustomernote left join auser on (acustomernote.userid=auser.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "notedate", "notes", "username" }; DefaultSortBy = new Dictionary() { { "notedate", "-" } }; @@ -21,7 +21,7 @@ namespace AyaNova.DataList { TKey = "User", FieldKey = "username", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name", @@ -33,7 +33,7 @@ namespace AyaNova.DataList { TKey = "CustomerNoteNotes", FieldKey = "notes", - AyaObjectType = (int)AyaType.CustomerNote, + AType = (int)AyaType.CustomerNote, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "acustomernote.id", SqlValueColumnName = "acustomernote.notes", diff --git a/server/AyaNova/DataList/CustomerServiceRequestDataList.cs b/server/AyaNova/DataList/CustomerServiceRequestDataList.cs index 4793c2dc..17ec4c93 100644 --- a/server/AyaNova/DataList/CustomerServiceRequestDataList.cs +++ b/server/AyaNova/DataList/CustomerServiceRequestDataList.cs @@ -6,14 +6,14 @@ namespace AyaNova.DataList { public CustomerServiceRequestDataList() { - DefaultListObjectType = AyaType.CustomerServiceRequest; + DefaultListAType = AyaType.CustomerServiceRequest; SQLFrom = "from acustomerservicerequest " + "left join acustomer on (acustomerservicerequest.customerid=acustomer.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(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus" }; DefaultSortBy = new Dictionary() { { "Created", "-" } }; @@ -24,7 +24,7 @@ namespace AyaNova.DataList { TKey = "CustomerServiceRequestTitle", FieldKey = "CustomerServiceRequestTitle", - AyaObjectType = (int)AyaType.CustomerServiceRequest, + AType = (int)AyaType.CustomerServiceRequest, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "acustomerservicerequest.id", SqlValueColumnName = "acustomerservicerequest.name", @@ -60,7 +60,7 @@ namespace AyaNova.DataList FieldKey = "Customer", TKey = "Customer", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Customer, + AType = (int)AyaType.Customer, SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name" }); @@ -70,7 +70,7 @@ namespace AyaNova.DataList FieldKey = "CustomerServiceRequestItemUnitID", TKey = "CustomerServiceRequestItemUnitID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Unit, + AType = (int)AyaType.Unit, SqlIdColumnName = "aunit.id", SqlValueColumnName = "aunit.serial" }); @@ -80,7 +80,7 @@ namespace AyaNova.DataList FieldKey = "WorkOrder", TKey = "WorkOrder", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.WorkOrderItem, + AType = (int)AyaType.WorkOrderItem, SqlIdColumnName = "wi.id", SqlValueColumnName = "w.serial" }); @@ -90,7 +90,7 @@ namespace AyaNova.DataList FieldKey = "CustomerServiceRequestRequestedBy", TKey = "CustomerServiceRequestRequestedBy", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name" }); diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 42d7e0c4..048ec691 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -120,9 +120,9 @@ namespace AyaNova.DataList AyaField.i = dr.GetInt64(ordinal); } - if (f.SqlAyTypeColumnName != null) + if (f.SqlATypeColumnName != null) { - var ordinal = qSelect.map[f.SqlAyTypeColumnName]; + var ordinal = qSelect.map[f.SqlATypeColumnName]; if (!await dr.IsDBNullAsync(ordinal)) AyaField.ot = dr.GetInt32(ordinal); } diff --git a/server/AyaNova/DataList/DataListFieldDefinition.cs b/server/AyaNova/DataList/DataListFieldDefinition.cs index 9a042d5c..e25507c6 100644 --- a/server/AyaNova/DataList/DataListFieldDefinition.cs +++ b/server/AyaNova/DataList/DataListFieldDefinition.cs @@ -36,7 +36,7 @@ namespace AyaNova.DataList public bool IsRowId { get; set; } //CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object - public int AyaObjectType { get; set; } + public int AType { get; set; } //SERVER - for building sql queries //don't return these properties when api user fetches field list definitions in DataListController @@ -45,7 +45,7 @@ namespace AyaNova.DataList [JsonIgnore] public string SqlValueColumnName { get; set; } [JsonIgnore] - public string SqlAyTypeColumnName { get; set; }//column to fetch the AyaType openabel for this field to set it dynamically instead of preset + public string SqlATypeColumnName { get; set; }//column to fetch the AyaType openabel for this field to set it dynamically instead of preset [JsonIgnore] public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field @@ -58,8 +58,8 @@ namespace AyaNova.DataList IsRowId = false; IsMeta = false; //Set openable object type to no type which is the default and means it's not a link to another object - AyaObjectType = (int)AyaType.NoType; - SqlAyTypeColumnName = null;//must be null as that is checked against specifically + AType = (int)AyaType.NoType; + SqlATypeColumnName = null;//must be null as that is checked against specifically SqlColorColumnName = null;//must be null to be ignored properly } diff --git a/server/AyaNova/DataList/DataListProcessingBase.cs b/server/AyaNova/DataList/DataListProcessingBase.cs index eb78ce33..2dc917a3 100644 --- a/server/AyaNova/DataList/DataListProcessingBase.cs +++ b/server/AyaNova/DataList/DataListProcessingBase.cs @@ -29,7 +29,7 @@ namespace AyaNova.DataList public string SQLFrom { get; set; } public List FieldDefinitions { get; set; } public AuthorizationRoles AllowedRoles { get; set; } - public AyaType DefaultListObjectType { get; set; } + public AyaType DefaultListAType { get; set; } public long CurrentUserId { get; set; } public List DefaultColumns { get; set; } public Dictionary DefaultSortBy { get; set; } @@ -112,9 +112,9 @@ namespace AyaNova.DataList } } - //Has a AyObjectType? (linkable / openable) - if (o.AyaObjectType != 0) - sb.Append($",\"ay\":{(int)o.AyaObjectType}"); + //Has a AyAType? (linkable / openable) + if (o.AType != 0) + sb.Append($",\"ay\":{(int)o.AType}"); //Row ID column? if (o.IsRowId) diff --git a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs index 9dacc294..c9c2e3a1 100644 --- a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs +++ b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs @@ -78,7 +78,7 @@ namespace AyaNova.DataList } //does it also have an openable AyaType column? - var ayaTypeColumnName = o.SqlAyTypeColumnName; + var ayaTypeColumnName = o.SqlATypeColumnName; if (!string.IsNullOrWhiteSpace(ayaTypeColumnName)) { if (!map.ContainsKey(ayaTypeColumnName)) diff --git a/server/AyaNova/DataList/EventDataList.cs b/server/AyaNova/DataList/EventDataList.cs index ca92bb37..fa8f7d00 100644 --- a/server/AyaNova/DataList/EventDataList.cs +++ b/server/AyaNova/DataList/EventDataList.cs @@ -7,9 +7,9 @@ namespace AyaNova.DataList public EventDataList() { //NOTE: used this type because it's full BizFull and read only BizLimited only which is appropriate and there is no event type - DefaultListObjectType = AyaType.Global; + DefaultListAType = AyaType.Global; SQLFrom = "from aevent left join auser on (aevent.userid=auser.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "eventcreated", "event", "object", "AyaType", "username", "textra" }; DefaultSortBy = new Dictionary() { { "eventcreated", "-" } }; @@ -49,7 +49,7 @@ namespace AyaNova.DataList UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aevent.ayid", SqlValueColumnName = "AYGETNAME(aevent.ayid, aevent.ayatype)", - SqlAyTypeColumnName = "aevent.ayatype" + SqlATypeColumnName = "aevent.ayatype" }); FieldDefinitions.Add(new DataListFieldDefinition @@ -57,7 +57,7 @@ namespace AyaNova.DataList FieldKey = "username", TKey = "User", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name" }); diff --git a/server/AyaNova/DataList/HeadOfficeDataList.cs b/server/AyaNova/DataList/HeadOfficeDataList.cs index 850b9d43..8914a277 100644 --- a/server/AyaNova/DataList/HeadOfficeDataList.cs +++ b/server/AyaNova/DataList/HeadOfficeDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public HeadOfficeDataList() { - DefaultListObjectType = AyaType.HeadOffice; + DefaultListAType = AyaType.HeadOffice; SQLFrom = "from aheadoffice left join acontract on (aheadoffice.contractid=acontract.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "headofficename", "headofficephone1", "headofficeemail" }; DefaultSortBy = new Dictionary() { { "headofficename", "+" } }; @@ -19,7 +19,7 @@ namespace AyaNova.DataList { TKey = "HeadOfficeName", FieldKey = "headofficename", - AyaObjectType = (int)AyaType.HeadOffice, + AType = (int)AyaType.HeadOffice, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aheadoffice.id", SqlValueColumnName = "aheadoffice.name", @@ -80,7 +80,7 @@ namespace AyaNova.DataList TKey = "Contract", FieldKey = "headofficecontract", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Contract, + AType = (int)AyaType.Contract, SqlIdColumnName = "acontract.id", SqlValueColumnName = "acontract.name" }); diff --git a/server/AyaNova/DataList/IDataListProcessing.cs b/server/AyaNova/DataList/IDataListProcessing.cs index 8d129120..58d4284b 100644 --- a/server/AyaNova/DataList/IDataListProcessing.cs +++ b/server/AyaNova/DataList/IDataListProcessing.cs @@ -11,7 +11,7 @@ namespace AyaNova.DataList //allowed roles to access this list AuthorizationRoles AllowedRoles { get; set; } //Default object type to open for rows of this list (use no object if no) - AyaType DefaultListObjectType { get; set; } + AyaType DefaultListAType { get; set; } //Defaults when none is specified (see DataListOptions for formats and notes) List DefaultColumns { get; set; } Dictionary DefaultSortBy { get; set; } diff --git a/server/AyaNova/DataList/InsideUserDataList.cs b/server/AyaNova/DataList/InsideUserDataList.cs index 8914fe10..bf520783 100644 --- a/server/AyaNova/DataList/InsideUserDataList.cs +++ b/server/AyaNova/DataList/InsideUserDataList.cs @@ -9,9 +9,9 @@ namespace AyaNova.DataList public InsideUserDataList() { - DefaultListObjectType = AyaType.User; + DefaultListAType = AyaType.User; SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "name", "employeenumber", "active", "usertype", "lastlogin" }; DefaultSortBy = new Dictionary() { { "name", "+" } }; @@ -21,7 +21,7 @@ namespace AyaNova.DataList { TKey = "User", FieldKey = "name", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name", @@ -77,7 +77,7 @@ namespace AyaNova.DataList TKey = "Vendor", FieldKey = "uservendor", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "avendor.id", SqlValueColumnName = "avendor.name" }); diff --git a/server/AyaNova/DataList/LoanUnitDataList.cs b/server/AyaNova/DataList/LoanUnitDataList.cs index 0727c899..9393451f 100644 --- a/server/AyaNova/DataList/LoanUnitDataList.cs +++ b/server/AyaNova/DataList/LoanUnitDataList.cs @@ -6,7 +6,7 @@ namespace AyaNova.DataList { public LoanUnitDataList() { - DefaultListObjectType = AyaType.LoanUnit; + DefaultListAType = AyaType.LoanUnit; SQLFrom = "from aloanunit " + "left join aunit as shadowunit on (aloanunit.unitid=shadowunit.id) " + "left join aworkorderitemloan as wil on (aloanunit.workorderitemloanid=wil.id) " + @@ -14,7 +14,7 @@ namespace AyaNova.DataList "left join aworkorder as w on (wi.workorderid=w.id)"; //MIGRATE_OUTSTANDING awaiting workorderitemloan coding //todo: look at loanitemlist in v7 it surfaces due date, out date etc in the list and should here too once those fields are coded for - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "LoanUnitName", "LoanUnitSerial", "Tags" }; DefaultSortBy = new Dictionary() { { "LoanUnitName", "+" } }; @@ -24,7 +24,7 @@ namespace AyaNova.DataList { TKey = "LoanUnitName", FieldKey = "LoanUnitName", - AyaObjectType = (int)AyaType.LoanUnit, + AType = (int)AyaType.LoanUnit, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aloanunit.id", SqlValueColumnName = "aloanunit.name", @@ -68,7 +68,7 @@ namespace AyaNova.DataList FieldKey = "LoanUnitCurrentWorkOrderItemLoan", TKey = "LoanUnitCurrentWorkOrderItemLoan", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.WorkOrderItemLoan, + AType = (int)AyaType.WorkOrderItemLoan, SqlIdColumnName = "wil.id", SqlValueColumnName = "w.serial" }); @@ -135,7 +135,7 @@ namespace AyaNova.DataList FieldKey = "LoanUnitShadowUnit", TKey = "LoanUnitShadowUnit", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Unit, + AType = (int)AyaType.Unit, SqlIdColumnName = "shadowunit.id", SqlValueColumnName = "shadowunit.serial" }); diff --git a/server/AyaNova/DataList/MemoDataList.cs b/server/AyaNova/DataList/MemoDataList.cs index 0efdbf67..c3f9ea16 100644 --- a/server/AyaNova/DataList/MemoDataList.cs +++ b/server/AyaNova/DataList/MemoDataList.cs @@ -8,9 +8,9 @@ namespace AyaNova.DataList public MemoDataList() { - DefaultListObjectType = AyaType.Memo; + DefaultListAType = AyaType.Memo; SQLFrom = "from amemo left join auser on (amemo.fromid=auser.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "MemoSubject", "MemoFromID", "MemoSent", "MemoViewed" }; DefaultSortBy = new Dictionary() { { "MemoSent", "-" } }; @@ -20,7 +20,7 @@ namespace AyaNova.DataList { TKey = "MemoSubject", FieldKey = "MemoSubject", - AyaObjectType = (int)AyaType.Memo, + AType = (int)AyaType.Memo, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "amemo.id", SqlValueColumnName = "amemo.name", @@ -39,7 +39,7 @@ namespace AyaNova.DataList { TKey = "MemoFromID", FieldKey = "MemoFromID", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name", diff --git a/server/AyaNova/DataList/OutsideUserDataList.cs b/server/AyaNova/DataList/OutsideUserDataList.cs index a932f9cd..574f5d65 100644 --- a/server/AyaNova/DataList/OutsideUserDataList.cs +++ b/server/AyaNova/DataList/OutsideUserDataList.cs @@ -8,9 +8,9 @@ namespace AyaNova.DataList public OutsideUserDataList() { - DefaultListObjectType = AyaType.Customer; + DefaultListAType = AyaType.Customer; SQLFrom = "from auser left join aheadoffice on (auser.headofficeid=aheadoffice.id) left join acustomer on (auser.customerid=acustomer.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" }; DefaultSortBy = new Dictionary() { { "name", "+" } }; @@ -20,7 +20,7 @@ namespace AyaNova.DataList { TKey = "User", FieldKey = "name", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name", @@ -75,7 +75,7 @@ namespace AyaNova.DataList TKey = "HeadOffice", FieldKey = "userheadoffice", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.HeadOffice, + AType = (int)AyaType.HeadOffice, SqlIdColumnName = "aheadoffice.id", SqlValueColumnName = "aheadoffice.name" }); @@ -85,7 +85,7 @@ namespace AyaNova.DataList TKey = "Customer", FieldKey = "usercustomer", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Customer, + AType = (int)AyaType.Customer, SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name" }); diff --git a/server/AyaNova/DataList/PartAssemblyDataList.cs b/server/AyaNova/DataList/PartAssemblyDataList.cs index 4a521b65..ea33dfe8 100644 --- a/server/AyaNova/DataList/PartAssemblyDataList.cs +++ b/server/AyaNova/DataList/PartAssemblyDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public PartAssemblyDataList() { - DefaultListObjectType = AyaType.PartAssembly; + DefaultListAType = AyaType.PartAssembly; SQLFrom = "from apartassembly"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "partassemblyname" }; DefaultSortBy = new Dictionary() { { "partassemblyname", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "PartAssemblyName", FieldKey = "partassemblyname", - AyaObjectType = (int)AyaType.PartAssembly, + AType = (int)AyaType.PartAssembly, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartassembly.id", SqlValueColumnName = "apartassembly.name", diff --git a/server/AyaNova/DataList/PartDataList.cs b/server/AyaNova/DataList/PartDataList.cs index a030d150..177a154e 100644 --- a/server/AyaNova/DataList/PartDataList.cs +++ b/server/AyaNova/DataList/PartDataList.cs @@ -6,12 +6,12 @@ namespace AyaNova.DataList { public PartDataList() { - DefaultListObjectType = AyaType.Part; + DefaultListAType = AyaType.Part; SQLFrom = "from apart " + "left join avendor as aman on (apart.manufacturerid=aman.id) " + "left join avendor as awhole on (apart.wholesalerid=awhole.id) " + "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" }; DefaultSortBy = new Dictionary() { { "PartPartNumber", "+" } }; @@ -21,7 +21,7 @@ namespace AyaNova.DataList { TKey = "PartPartNumber", FieldKey = "PartPartNumber", - AyaObjectType = (int)AyaType.Part, + AType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apart.id", SqlValueColumnName = "apart.partnumber", @@ -81,7 +81,7 @@ namespace AyaNova.DataList FieldKey = "PartManufacturerID", TKey = "PartManufacturerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "aman.id", SqlValueColumnName = "aman.name" }); @@ -91,7 +91,7 @@ namespace AyaNova.DataList FieldKey = "PartWholesalerID", TKey = "PartWholesalerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "awhole.id", SqlValueColumnName = "awhole.name" }); @@ -101,7 +101,7 @@ namespace AyaNova.DataList FieldKey = "PartAlternativeWholesalerID", TKey = "PartAlternativeWholesalerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "aaltwhole.id", SqlValueColumnName = "aaltwhole.name" }); diff --git a/server/AyaNova/DataList/PartInventoryDataList.cs b/server/AyaNova/DataList/PartInventoryDataList.cs index 9498081b..188e9190 100644 --- a/server/AyaNova/DataList/PartInventoryDataList.cs +++ b/server/AyaNova/DataList/PartInventoryDataList.cs @@ -9,13 +9,13 @@ namespace AyaNova.DataList { public PartInventoryDataList() { - DefaultListObjectType = AyaType.PartInventory; + DefaultListAType = AyaType.PartInventory; SQLFrom = "from vpartinventorylist " + "LEFT JOIN apart ON (vpartinventorylist.partid = apart.id) " + "LEFT JOIN apartwarehouse ON (vpartinventorylist.partwarehouseid = apartwarehouse.id) "; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartByWarehouseInventoryQuantityOnOrder", "PartByWarehouseInventoryQtyOnOrderCommitted" }; DefaultSortBy = new Dictionary() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } }; @@ -25,7 +25,7 @@ namespace AyaNova.DataList { TKey = "PartPartNumber", FieldKey = "PartPartNumber", - AyaObjectType = (int)AyaType.Part, + AType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apart.id", SqlValueColumnName = "apart.partnumber" @@ -35,7 +35,7 @@ namespace AyaNova.DataList { TKey = "PartName", FieldKey = "PartName", - AyaObjectType = (int)AyaType.Part, + AType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apart.id", SqlValueColumnName = "apart.name" @@ -45,7 +45,7 @@ namespace AyaNova.DataList { TKey = "PartWarehouseName", FieldKey = "PartWarehouseName", - AyaObjectType = (int)AyaType.PartWarehouse, + AType = (int)AyaType.PartWarehouse, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartwarehouse.id", SqlValueColumnName = "apartwarehouse.name" @@ -55,7 +55,7 @@ namespace AyaNova.DataList { TKey = "PartInventoryTransactionDescription", FieldKey = "PartInventoryTransactionDescription", - AyaObjectType = (int)AyaType.PartInventory, + AType = (int)AyaType.PartInventory, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "vpartinventorylist.id", SqlValueColumnName = "vpartinventorylist.description", diff --git a/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs b/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs index 85b02b66..665d850e 100644 --- a/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs +++ b/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs @@ -9,11 +9,11 @@ namespace AyaNova.DataList { public PartInventoryTransactionsDataList() { - DefaultListObjectType = AyaType.PartInventory; + DefaultListAType = AyaType.PartInventory; SQLFrom = "from apartinventory " + "left join apart on (apartinventory.partid=apart.id) " + "left join apartwarehouse on (apartinventory.partwarehouseid=apartwarehouse.id) "; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity", @@ -29,14 +29,14 @@ namespace AyaNova.DataList UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartinventory.sourceid", SqlValueColumnName = "AYGETNAME(apartinventory.sourceid, apartinventory.sourcetype)", - SqlAyTypeColumnName = "apartinventory.sourcetype" + SqlATypeColumnName = "apartinventory.sourcetype" }); FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartPartNumber", FieldKey = "PartPartNumber", - AyaObjectType = (int)AyaType.Part, + AType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apart.id", SqlValueColumnName = "apart.partnumber" @@ -46,7 +46,7 @@ namespace AyaNova.DataList { TKey = "PartWarehouseName", FieldKey = "PartWarehouseName", - AyaObjectType = (int)AyaType.PartWarehouse, + AType = (int)AyaType.PartWarehouse, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartwarehouse.id", SqlValueColumnName = "apartwarehouse.name" @@ -56,7 +56,7 @@ namespace AyaNova.DataList { TKey = "PartInventoryTransactionDescription", FieldKey = "PartInventoryTransactionDescription", - AyaObjectType = (int)AyaType.PartInventory, + AType = (int)AyaType.PartInventory, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartinventory.id", SqlValueColumnName = "apartinventory.description", diff --git a/server/AyaNova/DataList/PartRestockDataList.cs b/server/AyaNova/DataList/PartRestockDataList.cs index 7472db17..4c1cff37 100644 --- a/server/AyaNova/DataList/PartRestockDataList.cs +++ b/server/AyaNova/DataList/PartRestockDataList.cs @@ -14,9 +14,9 @@ namespace AyaNova.DataList // + "apartstocklevel.minimumquantity, vpartinventorynow.balance, COALESCE(vpartsonorder.quantityonorder,0) AS onorderquantity, " // + "apartstocklevel.minimumquantity - (COALESCE(vpartinventorynow.balance, 0) + COALESCE(vpartsonorder.quantityonorder, 0)) AS requiredquantity " - DefaultListObjectType = AyaType.PartInventoryRestock; + DefaultListAType = AyaType.PartInventoryRestock; SQLFrom = "FROM vrestockrequired"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PartPartNumber", "PartWarehouseName", "PartWholesalerID","PartAlternativeWholesalerID","PartManufacturerID", "PartByWarehouseInventoryMinStockLevel", @@ -30,7 +30,7 @@ namespace AyaNova.DataList { TKey = "PartPartNumber", FieldKey = "PartPartNumber", - AyaObjectType = (int)AyaType.Part, + AType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "partid", SqlValueColumnName = "partnumber" @@ -40,7 +40,7 @@ namespace AyaNova.DataList { TKey = "PartWarehouseName", FieldKey = "PartWarehouseName", - AyaObjectType = (int)AyaType.PartWarehouse, + AType = (int)AyaType.PartWarehouse, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "partwarehouseid", SqlValueColumnName = "displaywarehouse" @@ -51,7 +51,7 @@ namespace AyaNova.DataList FieldKey = "PartManufacturerID", TKey = "PartManufacturerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "manufactureid", SqlValueColumnName = "displaymanufacturer" }); @@ -61,7 +61,7 @@ namespace AyaNova.DataList FieldKey = "PartWholesalerID", TKey = "PartWholesalerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "wholesalerid", SqlValueColumnName = "displaywholesaler" }); @@ -71,7 +71,7 @@ namespace AyaNova.DataList FieldKey = "PartAlternativeWholesalerID", TKey = "PartAlternativeWholesalerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "alternativewholesalerid", SqlValueColumnName = "displayalternativewholesaler" }); diff --git a/server/AyaNova/DataList/PartWarehouseDataList.cs b/server/AyaNova/DataList/PartWarehouseDataList.cs index a5fcc158..1e7d0d97 100644 --- a/server/AyaNova/DataList/PartWarehouseDataList.cs +++ b/server/AyaNova/DataList/PartWarehouseDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public PartWarehouseDataList() { - DefaultListObjectType = AyaType.PartWarehouse; + DefaultListAType = AyaType.PartWarehouse; SQLFrom = "from apartwarehouse"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PartWarehouseName", "Active", "Tags" }; DefaultSortBy = new Dictionary() { { "PartWarehouseName", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "PartWarehouseName", FieldKey = "PartWarehouseName", - AyaObjectType = (int)AyaType.PartWarehouse, + AType = (int)AyaType.PartWarehouse, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartwarehouse.id", SqlValueColumnName = "apartwarehouse.name", diff --git a/server/AyaNova/DataList/ProjectDataList.cs b/server/AyaNova/DataList/ProjectDataList.cs index e9bd52ee..0f4d232f 100644 --- a/server/AyaNova/DataList/ProjectDataList.cs +++ b/server/AyaNova/DataList/ProjectDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public ProjectDataList() { - DefaultListObjectType = AyaType.Project; + DefaultListAType = AyaType.Project; SQLFrom = "from aproject left join auser on (aproject.projectoverseerid=auser.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "projectname", "ProjectProjectOverseerID", "ProjectDateStarted", "ProjectDateCompleted", "ProjectAccountNumber", "projectactive", "projecttags" }; @@ -19,7 +19,7 @@ namespace AyaNova.DataList { TKey = "ProjectName", FieldKey = "projectname", - AyaObjectType = (int)AyaType.Project, + AType = (int)AyaType.Project, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aproject.id", SqlValueColumnName = "aproject.name", @@ -63,7 +63,7 @@ namespace AyaNova.DataList FieldKey = "ProjectProjectOverseerID", TKey = "ProjectProjectOverseerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name" }); diff --git a/server/AyaNova/DataList/PurchaseOrderDataList.cs b/server/AyaNova/DataList/PurchaseOrderDataList.cs index 6456bdb9..c0f16992 100644 --- a/server/AyaNova/DataList/PurchaseOrderDataList.cs +++ b/server/AyaNova/DataList/PurchaseOrderDataList.cs @@ -6,13 +6,13 @@ namespace AyaNova.DataList { public PurchaseOrderDataList() { - DefaultListObjectType = AyaType.PurchaseOrder; + DefaultListAType = AyaType.PurchaseOrder; SQLFrom = "from apurchaseorder " + "left join avendor on (apurchaseorder.vendorid=avendor.id)" + "left join acustomer on (apurchaseorder.dropshiptocustomerid=acustomer.id)" + "left join aproject on (apurchaseorder.projectid=aproject.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PurchaseOrderPONumber", "Vendor", "PurchaseOrderOrderedDate", "PurchaseOrderStatus", "PurchaseOrderExpectedReceiveDate" }; @@ -23,7 +23,7 @@ namespace AyaNova.DataList { TKey = "PurchaseOrderPONumber", FieldKey = "PurchaseOrderPONumber", - AyaObjectType = (int)AyaType.PurchaseOrder, + AType = (int)AyaType.PurchaseOrder, UiFieldDataType = (int)UiFieldDataType.Integer, SqlIdColumnName = "apurchaseorder.id", SqlValueColumnName = "apurchaseorder.serial", @@ -59,7 +59,7 @@ namespace AyaNova.DataList FieldKey = "PurchaseOrderDropShipToCustomerID", TKey = "PurchaseOrderDropShipToCustomerID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name" }); @@ -77,7 +77,7 @@ namespace AyaNova.DataList FieldKey = "Vendor", TKey = "Vendor", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "avendor.id", SqlValueColumnName = "avendor.name" }); @@ -112,7 +112,7 @@ namespace AyaNova.DataList FieldKey = "Project", TKey = "Project", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "aproject.id", SqlValueColumnName = "aproject.name" }); diff --git a/server/AyaNova/DataList/ReminderDataList.cs b/server/AyaNova/DataList/ReminderDataList.cs index 2a16d29f..41823103 100644 --- a/server/AyaNova/DataList/ReminderDataList.cs +++ b/server/AyaNova/DataList/ReminderDataList.cs @@ -7,9 +7,9 @@ namespace AyaNova.DataList { public ReminderDataList() { - DefaultListObjectType = AyaType.Reminder; + DefaultListAType = AyaType.Reminder; SQLFrom = "from areminder"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "ReminderName", "ReminderNotes", "ReminderStopDate", "ReminderStartDate" }; DefaultSortBy = new Dictionary() { { "ReminderStopDate", "-" } }; @@ -19,7 +19,7 @@ namespace AyaNova.DataList { TKey = "ReminderName", FieldKey = "ReminderName", - AyaObjectType = (int)AyaType.Reminder, + AType = (int)AyaType.Reminder, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "areminder.id", SqlValueColumnName = "areminder.name", diff --git a/server/AyaNova/DataList/ReportDataList.cs b/server/AyaNova/DataList/ReportDataList.cs index 2a05fc8a..ed2c5a46 100644 --- a/server/AyaNova/DataList/ReportDataList.cs +++ b/server/AyaNova/DataList/ReportDataList.cs @@ -6,11 +6,11 @@ namespace AyaNova.DataList { public ReportDataList() { - DefaultListObjectType = AyaType.Report; + DefaultListAType = AyaType.Report; SQLFrom = "from aReport"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - DefaultColumns = new List() { "name", "objecttype", "active" }; + DefaultColumns = new List() { "name", "aType", "active" }; DefaultSortBy = new Dictionary() { { "name", "+" } }; FieldDefinitions = new List(); @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "Report", FieldKey = "name", - AyaObjectType = (int)AyaType.Report, + AType = (int)AyaType.Report, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aReport.id", SqlValueColumnName = "aReport.name", @@ -28,10 +28,10 @@ namespace AyaNova.DataList FieldDefinitions.Add(new DataListFieldDefinition { TKey = "AyaType", - FieldKey = "objecttype", + FieldKey = "aType", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "areport.ObjectType" + SqlValueColumnName = "areport.AType" }); FieldDefinitions.Add(new DataListFieldDefinition diff --git a/server/AyaNova/DataList/ReviewDataList.cs b/server/AyaNova/DataList/ReviewDataList.cs index b70d44c4..dfaa85e7 100644 --- a/server/AyaNova/DataList/ReviewDataList.cs +++ b/server/AyaNova/DataList/ReviewDataList.cs @@ -9,11 +9,11 @@ namespace AyaNova.DataList public ReviewDataList() { - DefaultListObjectType = AyaType.Review; + DefaultListAType = AyaType.Review; SQLFrom = "from areview " + "left join auser uassto on (areview.userid=uassto.id) " + "left join auser uassby on (areview.assignedbyuserid=uassby.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "ReviewCompletedDate", "ReviewDueDate", "ReviewName", "Object", "AyaType", "ReviewNotes", "ReviewUserId" }; DefaultSortBy = new Dictionary() { { "ReviewCompletedDate", "-" }, { "ReviewDueDate", "+" } }; @@ -25,8 +25,8 @@ namespace AyaNova.DataList FieldKey = "Object", UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "areview.objectid", - SqlValueColumnName = "AYGETNAME(areview.objectid, areview.objecttype)", - SqlAyTypeColumnName = "areview.objecttype" + SqlValueColumnName = "AYGETNAME(areview.objectid, areview.aType)", + SqlATypeColumnName = "areview.aType" }); FieldDefinitions.Add(new DataListFieldDefinition @@ -35,14 +35,14 @@ namespace AyaNova.DataList FieldKey = "AyaType", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "areview.objecttype" + SqlValueColumnName = "areview.aType" }); FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReviewName", FieldKey = "ReviewName", - AyaObjectType = (int)AyaType.Review, + AType = (int)AyaType.Review, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "areview.id", SqlValueColumnName = "areview.name", @@ -85,7 +85,7 @@ namespace AyaNova.DataList { TKey = "ReviewUserId", FieldKey = "ReviewUserId", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "uassto.id", SqlValueColumnName = "uassto.name" @@ -95,7 +95,7 @@ namespace AyaNova.DataList { TKey = "ReviewAssignedByUserId", FieldKey = "ReviewAssignedByUserId", - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "uassby.id", SqlValueColumnName = "uassby.name" @@ -155,7 +155,7 @@ namespace AyaNova.DataList FieldKey = "metaobjecttype", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "areview.objecttype", + SqlValueColumnName = "areview.aType", IsMeta = true }); } diff --git a/server/AyaNova/DataList/ServiceBankDataList.cs b/server/AyaNova/DataList/ServiceBankDataList.cs index 12947d28..d625b7fa 100644 --- a/server/AyaNova/DataList/ServiceBankDataList.cs +++ b/server/AyaNova/DataList/ServiceBankDataList.cs @@ -9,9 +9,9 @@ namespace AyaNova.DataList public ServiceBankDataList() { - DefaultListObjectType = AyaType.ServiceBank; + DefaultListAType = AyaType.ServiceBank; SQLFrom = "from aservicebank"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "ServiceBankCreated", "Object", "ServiceBankCurrency", "ServiceBankCurrencyBalance", "ServiceBankIncidents", @@ -22,12 +22,12 @@ namespace AyaNova.DataList FieldDefinitions.Add(new DataListFieldDefinition { - TKey = "ServiceBankSourceRootObjectType", - FieldKey = "ServiceBankSourceRootObjectType", + TKey = "ServiceBankSourceRootAType", + FieldKey = "ServiceBankSourceRootAType", UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aservicebank.sourceid", SqlValueColumnName = "AYGETNAME(aservicebank.sourceid, aservicebank.sourcetype)", - SqlAyTypeColumnName = "aservicebank.sourcetype" + SqlATypeColumnName = "aservicebank.sourcetype" }); FieldDefinitions.Add(new DataListFieldDefinition @@ -36,8 +36,8 @@ namespace AyaNova.DataList FieldKey = "Object", UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aservicebank.objectid", - SqlValueColumnName = "AYGETNAME(aservicebank.objectid, aservicebank.objecttype)", - SqlAyTypeColumnName = "aservicebank.objecttype" + SqlValueColumnName = "AYGETNAME(aservicebank.objectid, aservicebank.aType)", + SqlATypeColumnName = "aservicebank.aType" }); FieldDefinitions.Add(new DataListFieldDefinition @@ -46,14 +46,14 @@ namespace AyaNova.DataList FieldKey = "AyaType", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "aservicebank.objecttype" + SqlValueColumnName = "aservicebank.aType" }); FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ServiceBankDescription", FieldKey = "ServiceBankDescription", - AyaObjectType = (int)AyaType.ServiceBank, + AType = (int)AyaType.ServiceBank, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aservicebank.id", SqlValueColumnName = "aservicebank.name", @@ -132,7 +132,7 @@ namespace AyaNova.DataList FieldKey = "metaobjecttype", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "aservicebank.objecttype", + SqlValueColumnName = "aservicebank.aType", IsMeta = true }); } diff --git a/server/AyaNova/DataList/ServiceRateDataList.cs b/server/AyaNova/DataList/ServiceRateDataList.cs index 5ccc6383..242401ef 100644 --- a/server/AyaNova/DataList/ServiceRateDataList.cs +++ b/server/AyaNova/DataList/ServiceRateDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public ServiceRateDataList() { - DefaultListObjectType = AyaType.ServiceRate; + DefaultListAType = AyaType.ServiceRate; SQLFrom = "from aservicerate"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "Name", "Cost", "RateCharge", "RateUnitChargeDescriptionID", "Active" }; DefaultSortBy = new Dictionary() { { "Name", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "Name", FieldKey = "Name", - AyaObjectType = (int)AyaType.ServiceRate, + AType = (int)AyaType.ServiceRate, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aservicerate.id", SqlValueColumnName = "aservicerate.name", diff --git a/server/AyaNova/DataList/TaxCodeDataList.cs b/server/AyaNova/DataList/TaxCodeDataList.cs index d3b4e984..d9842736 100644 --- a/server/AyaNova/DataList/TaxCodeDataList.cs +++ b/server/AyaNova/DataList/TaxCodeDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public TaxCodeDataList() { - DefaultListObjectType = AyaType.TaxCode; + DefaultListAType = AyaType.TaxCode; SQLFrom = "from ataxcode"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "Name", "TaxCodeTaxA", "TaxCodeTaxB", "TaxCodeTaxOnTax", "Active" }; DefaultSortBy = new Dictionary() { { "Name", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "Name", FieldKey = "Name", - AyaObjectType = (int)AyaType.TaxCode, + AType = (int)AyaType.TaxCode, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "ataxcode.id", SqlValueColumnName = "ataxcode.name", diff --git a/server/AyaNova/DataList/TestWidgetDataList.cs b/server/AyaNova/DataList/TestWidgetDataList.cs index 8591d7c0..89470875 100644 --- a/server/AyaNova/DataList/TestWidgetDataList.cs +++ b/server/AyaNova/DataList/TestWidgetDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public TestWidgetDataList() { - DefaultListObjectType = AyaType.Widget; + DefaultListAType = AyaType.Widget; SQLFrom = "from awidget left join auser on (awidget.userid=auser.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "widgetname", "widgetserial", "widgetdollaramount", "widgetusertype", "widgetstartdate", "widgetactive", "username" }; DefaultSortBy = new Dictionary() { { "widgetname", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "WidgetName", FieldKey = "widgetname", - AyaObjectType = (int)AyaType.Widget, + AType = (int)AyaType.Widget, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "awidget.id", SqlValueColumnName = "awidget.name", @@ -87,7 +87,7 @@ namespace AyaNova.DataList FieldKey = "username", TKey = "User", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.User, + AType = (int)AyaType.User, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name" }); diff --git a/server/AyaNova/DataList/TranslationDataList.cs b/server/AyaNova/DataList/TranslationDataList.cs index c43eea47..8ab1e025 100644 --- a/server/AyaNova/DataList/TranslationDataList.cs +++ b/server/AyaNova/DataList/TranslationDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public TranslationDataList() { - DefaultListObjectType = AyaType.Translation; + DefaultListAType = AyaType.Translation; SQLFrom = "from atranslation"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "name", "stock", "cjkindex" }; DefaultSortBy = new Dictionary() { { "name", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "Translation", FieldKey = "name", - AyaObjectType = (int)AyaType.Translation, + AType = (int)AyaType.Translation, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "atranslation.id", SqlValueColumnName = "atranslation.name", diff --git a/server/AyaNova/DataList/TravelRateDataList.cs b/server/AyaNova/DataList/TravelRateDataList.cs index fc828b6d..460663a8 100644 --- a/server/AyaNova/DataList/TravelRateDataList.cs +++ b/server/AyaNova/DataList/TravelRateDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public TravelRateDataList() { - DefaultListObjectType = AyaType.TravelRate; + DefaultListAType = AyaType.TravelRate; SQLFrom = "from atravelrate"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "Name", "Cost", "RateCharge", "RateUnitChargeDescriptionID", "Active" }; DefaultSortBy = new Dictionary() { { "Name", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "Name", FieldKey = "Name", - AyaObjectType = (int)AyaType.TravelRate, + AType = (int)AyaType.TravelRate, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "atravelrate.id", SqlValueColumnName = "atravelrate.name", diff --git a/server/AyaNova/DataList/UnitDataList.cs b/server/AyaNova/DataList/UnitDataList.cs index b53b556a..caed24f3 100644 --- a/server/AyaNova/DataList/UnitDataList.cs +++ b/server/AyaNova/DataList/UnitDataList.cs @@ -6,7 +6,7 @@ namespace AyaNova.DataList { public UnitDataList() { - DefaultListObjectType = AyaType.Unit; + DefaultListAType = AyaType.Unit; SQLFrom = "from aunit as amainunit " + "left join acustomer on (amainunit.customerid=acustomer.id) " + "left join aunit as aparentunit on (amainunit.parentunitid=aparentunit.id) " @@ -15,7 +15,7 @@ namespace AyaNova.DataList + "left join aunit as areplacedbyunit on (amainunit.replacedbyunitid=areplacedbyunit.id) " + "left join acontract on (amainunit.contractid=acontract.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "UnitSerial", "UnitModel", "Customer", "Active" }; DefaultSortBy = new Dictionary() { { "UnitSerial", "+" } }; @@ -25,7 +25,7 @@ namespace AyaNova.DataList { TKey = "UnitSerial", FieldKey = "UnitSerial", - AyaObjectType = (int)AyaType.Unit, + AType = (int)AyaType.Unit, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "amainunit.id", SqlValueColumnName = "amainunit.serial", @@ -61,7 +61,7 @@ namespace AyaNova.DataList FieldKey = "Customer", TKey = "Customer", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Customer, + AType = (int)AyaType.Customer, SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name" }); @@ -71,7 +71,7 @@ namespace AyaNova.DataList FieldKey = "UnitParentUnitID", TKey = "UnitParentUnitID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Unit, + AType = (int)AyaType.Unit, SqlIdColumnName = "aparentunit.id", SqlValueColumnName = "aparentunit.serial" }); @@ -81,7 +81,7 @@ namespace AyaNova.DataList FieldKey = "UnitReplacedByUnitID", TKey = "UnitReplacedByUnitID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Unit, + AType = (int)AyaType.Unit, SqlIdColumnName = "areplacedbyunit.id", SqlValueColumnName = "areplacedbyunit.serial" }); @@ -91,7 +91,7 @@ namespace AyaNova.DataList FieldKey = "UnitModel", TKey = "UnitModel", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.UnitModel, + AType = (int)AyaType.UnitModel, SqlIdColumnName = "aunitmodel.id", SqlValueColumnName = "aunitmodel.number" }); @@ -117,7 +117,7 @@ namespace AyaNova.DataList FieldKey = "UnitPurchaseFromID", TKey = "UnitPurchaseFromID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "avendor.id", SqlValueColumnName = "avendor.name" }); @@ -183,7 +183,7 @@ namespace AyaNova.DataList TKey = "Contract", FieldKey = "unitcontract", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Contract, + AType = (int)AyaType.Contract, SqlIdColumnName = "acontract.id", SqlValueColumnName = "acontract.name" }); diff --git a/server/AyaNova/DataList/UnitModelDataList.cs b/server/AyaNova/DataList/UnitModelDataList.cs index 5c200057..aecd623d 100644 --- a/server/AyaNova/DataList/UnitModelDataList.cs +++ b/server/AyaNova/DataList/UnitModelDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public UnitModelDataList() { - DefaultListObjectType = AyaType.UnitModel; + DefaultListAType = AyaType.UnitModel; SQLFrom = "from aunitmodel left join avendor on (aunitmodel.vendorid=avendor.id)"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "UnitModelModelNumber", "Name", "UnitModelVendorID", "Active" }; DefaultSortBy = new Dictionary() { { "UnitModelModelNumber", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "UnitModelModelNumber", FieldKey = "UnitModelModelNumber", - AyaObjectType = (int)AyaType.UnitModel, + AType = (int)AyaType.UnitModel, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "aunitmodel.id", SqlValueColumnName = "aunitmodel.number", @@ -54,7 +54,7 @@ namespace AyaNova.DataList FieldKey = "UnitModelVendorID", TKey = "UnitModelVendorID", UiFieldDataType = (int)UiFieldDataType.Text, - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, SqlIdColumnName = "avendor.id", SqlValueColumnName = "avendor.name" }); diff --git a/server/AyaNova/DataList/VendorDataList.cs b/server/AyaNova/DataList/VendorDataList.cs index 1ddb4c4c..1574269a 100644 --- a/server/AyaNova/DataList/VendorDataList.cs +++ b/server/AyaNova/DataList/VendorDataList.cs @@ -6,9 +6,9 @@ namespace AyaNova.DataList { public VendorDataList() { - DefaultListObjectType = AyaType.Vendor; + DefaultListAType = AyaType.Vendor; SQLFrom = "from avendor"; - var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "vendorname", "vendorphone1", "vendoremail", "vendortags" }; DefaultSortBy = new Dictionary() { { "vendorname", "+" } }; @@ -18,7 +18,7 @@ namespace AyaNova.DataList { TKey = "VendorName", FieldKey = "vendorname", - AyaObjectType = (int)AyaType.Vendor, + AType = (int)AyaType.Vendor, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "avendor.id", SqlValueColumnName = "avendor.name", diff --git a/server/AyaNova/PickList/AyaPickList.cs b/server/AyaNova/PickList/AyaPickList.cs index 5b871afd..bb8af9ac 100644 --- a/server/AyaNova/PickList/AyaPickList.cs +++ b/server/AyaNova/PickList/AyaPickList.cs @@ -13,7 +13,7 @@ namespace AyaNova.PickList public string SQLFrom { get; set; } public List ColumnDefinitions { get; set; } public AuthorizationRoles AllowedRoles { get; set; } - public AyaType DefaultListObjectType { get; set; } + public AyaType DefaultListAType { get; set; } public string DefaultTemplate { get; set; } //return array of field keys in list view public List GetFieldListFromTemplate(JArray template) diff --git a/server/AyaNova/PickList/ContractPickList.cs b/server/AyaNova/PickList/ContractPickList.cs index 1fd0c8ce..6bf94d8e 100644 --- a/server/AyaNova/PickList/ContractPickList.cs +++ b/server/AyaNova/PickList/ContractPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public ContractPickList() { - DefaultListObjectType = AyaType.Contract; + DefaultListAType = AyaType.Contract; SQLFrom = "from acontract"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/CustomerPickList.cs b/server/AyaNova/PickList/CustomerPickList.cs index 97a96abc..41782548 100644 --- a/server/AyaNova/PickList/CustomerPickList.cs +++ b/server/AyaNova/PickList/CustomerPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public CustomerPickList() { - DefaultListObjectType = AyaType.Customer; + DefaultListAType = AyaType.Customer; SQLFrom = "from acustomer"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/HeadOfficePickList.cs b/server/AyaNova/PickList/HeadOfficePickList.cs index 46639653..4ba59fce 100644 --- a/server/AyaNova/PickList/HeadOfficePickList.cs +++ b/server/AyaNova/PickList/HeadOfficePickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public HeadOfficePickList() { - DefaultListObjectType = AyaType.HeadOffice; + DefaultListAType = AyaType.HeadOffice; SQLFrom = "from aheadoffice"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/IAyaPickList.cs b/server/AyaNova/PickList/IAyaPickList.cs index b00e73a2..f5c37892 100644 --- a/server/AyaNova/PickList/IAyaPickList.cs +++ b/server/AyaNova/PickList/IAyaPickList.cs @@ -12,7 +12,7 @@ namespace AyaNova.PickList //allowed roles to access this list AuthorizationRoles AllowedRoles { get; set; } //Default object type to open for rows of this list (use no object if no) - AyaType DefaultListObjectType { get; set; } + AyaType DefaultListAType { get; set; } //Default / STOCK template when none is specified string DefaultTemplate { get; set; } List GetFieldListFromTemplate(JArray fieldListArray); diff --git a/server/AyaNova/PickList/LoanUnitPickList.cs b/server/AyaNova/PickList/LoanUnitPickList.cs index dbe877f1..fb4f28c5 100644 --- a/server/AyaNova/PickList/LoanUnitPickList.cs +++ b/server/AyaNova/PickList/LoanUnitPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public LoanUnitPickList() { - DefaultListObjectType = AyaType.LoanUnit; + DefaultListAType = AyaType.LoanUnit; SQLFrom = "from aloanunit"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/PartAssemblyPickList.cs b/server/AyaNova/PickList/PartAssemblyPickList.cs index 91eb1ac8..35c6dadb 100644 --- a/server/AyaNova/PickList/PartAssemblyPickList.cs +++ b/server/AyaNova/PickList/PartAssemblyPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public PartAssemblyPickList() { - DefaultListObjectType = AyaType.PartAssembly; + DefaultListAType = AyaType.PartAssembly; SQLFrom = "from apartassembly"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/PartPickList.cs b/server/AyaNova/PickList/PartPickList.cs index 1c9e4da9..04fb5afb 100644 --- a/server/AyaNova/PickList/PartPickList.cs +++ b/server/AyaNova/PickList/PartPickList.cs @@ -8,12 +8,12 @@ namespace AyaNova.PickList public PartPickList() { - DefaultListObjectType = AyaType.Part; + DefaultListAType = AyaType.Part; SQLFrom = "from apart " + "left join avendor as amanufacturer on (apart.manufacturerid = amanufacturer.id) " + "left join avendor as awholesaler on (apart.wholesalerid = awholesaler.id) " + "left join avendor as aalternativewholesaler on (apart.alternativewholesalerid = aalternativewholesaler.id) "; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/PartWarehousePickList.cs b/server/AyaNova/PickList/PartWarehousePickList.cs index 108c5171..017d6bcf 100644 --- a/server/AyaNova/PickList/PartWarehousePickList.cs +++ b/server/AyaNova/PickList/PartWarehousePickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public PartWarehousePickList() { - DefaultListObjectType = AyaType.PartWarehouse; + DefaultListAType = AyaType.PartWarehouse; SQLFrom = "from apartwarehouse"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/PickListFetcher.cs b/server/AyaNova/PickList/PickListFetcher.cs index 0f384a19..d4f8d12d 100644 --- a/server/AyaNova/PickList/PickListFetcher.cs +++ b/server/AyaNova/PickList/PickListFetcher.cs @@ -17,7 +17,7 @@ namespace AyaNova.PickList //Sort out effective Template string Template = null; //Attempt to fetch custom template - var t = await ct.PickListTemplate.FirstOrDefaultAsync(z => z.Id == ((long)PickList.DefaultListObjectType)); + var t = await ct.PickListTemplate.FirstOrDefaultAsync(z => z.Id == ((long)PickList.DefaultListAType)); if (t == null) { Template = PickList.DefaultTemplate; diff --git a/server/AyaNova/PickList/PickListSqlBuilder.cs b/server/AyaNova/PickList/PickListSqlBuilder.cs index 47651ab2..113d7e14 100644 --- a/server/AyaNova/PickList/PickListSqlBuilder.cs +++ b/server/AyaNova/PickList/PickListSqlBuilder.cs @@ -57,7 +57,7 @@ namespace AyaNova.PickList AyaPickListFieldDefinition rowIdColumn = pickList.ColumnDefinitions.FirstOrDefault(z => z.IsRowId == true); //this should only happen with a development error if (rowIdColumn == null) - throw new System.ArgumentNullException($"DEV ERROR in PickListSqlBuilder.cs: picklist for {pickList.DefaultListObjectType.ToString()} has no rowId column specified in columnDefinitions list"); + throw new System.ArgumentNullException($"DEV ERROR in PickListSqlBuilder.cs: picklist for {pickList.DefaultListAType.ToString()} has no rowId column specified in columnDefinitions list"); PlIdSelectFragment = rowIdColumn.SqlIdColumnName + " as plId"; diff --git a/server/AyaNova/PickList/ProjectPickList.cs b/server/AyaNova/PickList/ProjectPickList.cs index c28e9e98..32ba6603 100644 --- a/server/AyaNova/PickList/ProjectPickList.cs +++ b/server/AyaNova/PickList/ProjectPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public ProjectPickList() { - DefaultListObjectType = AyaType.Project; + DefaultListAType = AyaType.Project; SQLFrom = "from aproject"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/ServiceRatePickList.cs b/server/AyaNova/PickList/ServiceRatePickList.cs index aab2e273..4fb429c0 100644 --- a/server/AyaNova/PickList/ServiceRatePickList.cs +++ b/server/AyaNova/PickList/ServiceRatePickList.cs @@ -12,9 +12,9 @@ namespace AyaNova.PickList public ServiceRatePickList() { - DefaultListObjectType = AyaType.ServiceRate; + DefaultListAType = AyaType.ServiceRate; SQLFrom = "from aservicerate"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/TaxCodePickList.cs b/server/AyaNova/PickList/TaxCodePickList.cs index 060a0351..d66655b2 100644 --- a/server/AyaNova/PickList/TaxCodePickList.cs +++ b/server/AyaNova/PickList/TaxCodePickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public TaxCodePickList() { - DefaultListObjectType = AyaType.TaxCode; + DefaultListAType = AyaType.TaxCode; SQLFrom = "from ataxcode"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/TravelRatePickList.cs b/server/AyaNova/PickList/TravelRatePickList.cs index 14c47b8c..053ff44a 100644 --- a/server/AyaNova/PickList/TravelRatePickList.cs +++ b/server/AyaNova/PickList/TravelRatePickList.cs @@ -12,9 +12,9 @@ namespace AyaNova.PickList public TravelRatePickList() { - DefaultListObjectType = AyaType.TravelRate; + DefaultListAType = AyaType.TravelRate; SQLFrom = "from atravelrate"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/UnitModelPickList.cs b/server/AyaNova/PickList/UnitModelPickList.cs index 8c98522d..fadc3b09 100644 --- a/server/AyaNova/PickList/UnitModelPickList.cs +++ b/server/AyaNova/PickList/UnitModelPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public UnitModelPickList() { - DefaultListObjectType = AyaType.UnitModel; + DefaultListAType = AyaType.UnitModel; SQLFrom = "from aunitmodel left join avendor on (aunitmodel.vendorid=avendor.id)"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/UnitPickList.cs b/server/AyaNova/PickList/UnitPickList.cs index 34b61e17..a5ca2450 100644 --- a/server/AyaNova/PickList/UnitPickList.cs +++ b/server/AyaNova/PickList/UnitPickList.cs @@ -8,12 +8,12 @@ namespace AyaNova.PickList public UnitPickList() { - DefaultListObjectType = AyaType.Unit; + DefaultListAType = AyaType.Unit; SQLFrom = "from aunit " + "left join aunitmodel on (aunit.unitmodelid=aunitmodel.id) " + "left join avendor on (aunitmodel.vendorid=avendor.id) "; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = null; diff --git a/server/AyaNova/PickList/UserPickList.cs b/server/AyaNova/PickList/UserPickList.cs index 1c2511d0..a44bcb10 100644 --- a/server/AyaNova/PickList/UserPickList.cs +++ b/server/AyaNova/PickList/UserPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public UserPickList() { - DefaultListObjectType = AyaType.User; + DefaultListAType = AyaType.User; SQLFrom = "from auser"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/VendorPickList.cs b/server/AyaNova/PickList/VendorPickList.cs index bef40a71..b7074735 100644 --- a/server/AyaNova/PickList/VendorPickList.cs +++ b/server/AyaNova/PickList/VendorPickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public VendorPickList() { - DefaultListObjectType = AyaType.Vendor; + DefaultListAType = AyaType.Vendor; SQLFrom = "from avendor"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/PickList/WidgetPickList.cs b/server/AyaNova/PickList/WidgetPickList.cs index 5c641916..f8b6515c 100644 --- a/server/AyaNova/PickList/WidgetPickList.cs +++ b/server/AyaNova/PickList/WidgetPickList.cs @@ -7,9 +7,9 @@ namespace AyaNova.PickList { public WidgetPickList() { - DefaultListObjectType = AyaType.Widget; + DefaultListAType = AyaType.Widget; SQLFrom = "from awidget left join auser on (awidget.userid=auser.id)"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; //Default template dynamic dTemplate = new JArray(); @@ -47,7 +47,7 @@ namespace AyaNova.PickList { TKey = "WidgetName", FieldKey = "widgetname", - //AyaObjectType = AyaType.Widget, + //AType = AyaType.Widget, ColumnDataType = UiFieldDataType.Text, SqlIdColumnName = "awidget.id", SqlValueColumnName = "awidget.name", diff --git a/server/AyaNova/PickList/WorkOrderTemplatePickList.cs b/server/AyaNova/PickList/WorkOrderTemplatePickList.cs index c970ed8d..fcefe517 100644 --- a/server/AyaNova/PickList/WorkOrderTemplatePickList.cs +++ b/server/AyaNova/PickList/WorkOrderTemplatePickList.cs @@ -8,9 +8,9 @@ namespace AyaNova.PickList public WorkOrderTemplatePickList() { - DefaultListObjectType = AyaType.WorkOrderTemplate; + DefaultListAType = AyaType.WorkOrderTemplate; SQLFrom = "from aworkordertemplate"; - AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); diff --git a/server/AyaNova/biz/AttachmentBiz.cs b/server/AyaNova/biz/AttachmentBiz.cs index 88a5b458..65298611 100644 --- a/server/AyaNova/biz/AttachmentBiz.cs +++ b/server/AyaNova/biz/AttachmentBiz.cs @@ -90,7 +90,7 @@ namespace AyaNova.Biz var FullPathName = FileUtil.GetPermanentAttachmentFilePath(i.StoredFileName); AllDBFileFullPath.Add(FullPathName); var FileExistsInReality = AllAttachmentFilesOnDisk.Contains(FullPathName); - var ParentBizObjectExistsInReality = await BizObjectExistsInDatabase.ExistsAsync(i.AttachToObjectType, i.AttachToObjectId, ct); + var ParentBizObjectExistsInReality = await BizObjectExistsInDatabase.ExistsAsync(i.AttachToAType, i.AttachToObjectId, ct); //does the db record reflect the same status as reality? if (FileExistsInReality != i.Exists || !ParentBizObjectExistsInReality) { @@ -101,7 +101,7 @@ namespace AyaNova.Biz if (!ParentBizObjectExistsInReality) { //switch it to notype - f.AttachToObjectType = AyaType.NoType; + f.AttachToAType = AyaType.NoType; f.AttachToObjectId = 0; } await ct.SaveChangesAsync(); @@ -121,10 +121,10 @@ namespace AyaNova.Biz // //also, potentiallly // //iterate orphaned file attachments to NOTHING type, if found to be attached to any other object remove the orphaned object attachment record in db // //but keeping the physical file since it's attached to something else - // var AllOrphansInDb = await ct.FileAttachment.Where(z => z.AttachToObjectType == AyaType.NoType).ToListAsync(); + // var AllOrphansInDb = await ct.FileAttachment.Where(z => z.AttachToAType == AyaType.NoType).ToListAsync(); // foreach (FileAttachment OrphanInDb in AllOrphansInDb) // { - // if (await ct.FileAttachment.AnyAsync(z => z.StoredFileName==OrphanInDb.StoredFileName && z.AttachToObjectType != AyaType.NoType)) + // if (await ct.FileAttachment.AnyAsync(z => z.StoredFileName==OrphanInDb.StoredFileName && z.AttachToAType != AyaType.NoType)) // { // //It is also attached to something else so remove it from the nothing type // ct.FileAttachment.Remove(OrphanInDb); @@ -158,7 +158,7 @@ namespace AyaNova.Biz { FileAttachment fa = new FileAttachment(); fa.AttachToObjectId = 0; - fa.AttachToObjectType = AyaType.NoType; + fa.AttachToAType = AyaType.NoType; fa.ContentType = "application/octet-stream";//most generic type, we don't know what it is fa.DisplayFileName = "FOUND" + FileUtil.GetSafeDateFileName(); fa.LastModified = DateTime.UtcNow; diff --git a/server/AyaNova/biz/AyaTypeId.cs b/server/AyaNova/biz/AyaTypeId.cs index 948902d5..919bedc5 100644 --- a/server/AyaNova/biz/AyaTypeId.cs +++ b/server/AyaNova/biz/AyaTypeId.cs @@ -17,7 +17,7 @@ namespace AyaNova.Biz } } - public AyaType ObjectType + public AyaType AType { get { @@ -25,7 +25,7 @@ namespace AyaNova.Biz } } - public int ObjectTypeAsInt + public int ATypeAsInt { get { @@ -33,20 +33,20 @@ namespace AyaNova.Biz } } - public AyaTypeId(AyaType ObjectType, long Id) + public AyaTypeId(AyaType aType, long Id) { _id = Id; - _ayaType = ObjectType; + _ayaType = aType; } - public AyaTypeId(string sObjectTypeNumeral, string sId) + public AyaTypeId(string sATypeNumeral, string sId) { _id = long.Parse(sId); - int nType = int.Parse(sObjectTypeNumeral); + int nType = int.Parse(sATypeNumeral); if (!AyaTypeExists(nType)) _ayaType = AyaType.NoType; else - _ayaType = (AyaType)Enum.Parse(typeof(AyaType), sObjectTypeNumeral); + _ayaType = (AyaType)Enum.Parse(typeof(AyaType), sATypeNumeral); } public bool Equals(AyaTypeId x, AyaTypeId y) @@ -60,7 +60,7 @@ namespace AyaNova.Biz return false; //Check whether the products' properties are equal. - return x.ObjectId == y.ObjectId && x.ObjectType == y.ObjectType; + return x.ObjectId == y.ObjectId && x.AType == y.AType; } public bool IsEmpty @@ -95,7 +95,7 @@ namespace AyaNova.Biz { get { - return this.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)); + return this.AType.HasAttribute(typeof(CoreBizObjectAttribute)); } } diff --git a/server/AyaNova/biz/BizObjectExistsInDatabase.cs b/server/AyaNova/biz/BizObjectExistsInDatabase.cs index af535044..c56ba33d 100644 --- a/server/AyaNova/biz/BizObjectExistsInDatabase.cs +++ b/server/AyaNova/biz/BizObjectExistsInDatabase.cs @@ -15,11 +15,11 @@ namespace AyaNova.Biz //Returns existance status of object type and id specified in database - internal static async Task ExistsAsync(AyaType objectType, long id, AyContext ct) + internal static async Task ExistsAsync(AyaType aType, long id, AyContext ct) { //new up a context?? - switch (objectType) + switch (aType) { //CoreBizObject add here case AyaType.NoType://no type always exists and this is used by orphaned attachments @@ -123,7 +123,7 @@ namespace AyaNova.Biz case AyaType.CustomerServiceRequest: return await ct.CustomerServiceRequest.AnyAsync(z => z.Id == id); default: - throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::ExistsAsync type {objectType.ToString()} is not supported"); + throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::ExistsAsync type {aType.ToString()} is not supported"); } } diff --git a/server/AyaNova/biz/EventLogProcessor.cs b/server/AyaNova/biz/EventLogProcessor.cs index 6668ea31..a7e31bd6 100644 --- a/server/AyaNova/biz/EventLogProcessor.cs +++ b/server/AyaNova/biz/EventLogProcessor.cs @@ -113,7 +113,7 @@ namespace AyaNova.Biz { Date = z.Created, - ObjectType = z.AyaType, + AType = z.AyaType, ObjectId = z.AyId, Event = z.AyEvent, Textra = z.Textra, diff --git a/server/AyaNova/biz/JobsBiz.cs b/server/AyaNova/biz/JobsBiz.cs index bdabee3a..49e9d2fa 100644 --- a/server/AyaNova/biz/JobsBiz.cs +++ b/server/AyaNova/biz/JobsBiz.cs @@ -311,7 +311,7 @@ namespace AyaNova.Biz case JobType.BatchCoreObjectOperation: //batch op, hand off to biz object to deal with //note, convention is that there is an idList in job.jobinfo json if preselected else it's all objects of type - o = (IJobObject)BizObjectFactory.GetBizObject(job.ObjectType, ct); + o = (IJobObject)BizObjectFactory.GetBizObject(job.AType, ct); break; default: throw new System.NotSupportedException($"ProcessJobAsync type {job.JobType.ToString()} is not supported"); diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 1e4d7116..5207260c 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -121,7 +121,7 @@ namespace AyaNova.Biz // newObject.JsHelpers = (string)o["JsHelpers"]; // newObject.JsPrerender = (string)o["JsPrerender"]; // newObject.Notes = (string)o["Notes"]; - // newObject.ObjectType = (AyaType)(int)o["ObjectType"]; + // newObject.AType = (AyaType)(int)o["AType"]; // newObject.RenderType = (ReportRenderType)(int)o["RenderType"]; // newObject.Roles = (AuthorizationRoles)(int)o["Roles"]; // newObject.Style = (string)o["Style"]; @@ -239,9 +239,9 @@ namespace AyaNova.Biz //////////////////////////////////////////////////////////////////////////////////////////////// //GET LIST // - internal async Task> GetReportListAsync(AyaType ayType) + internal async Task> GetReportListAsync(AyaType aType) { - var rpts = await ct.Report.AsNoTracking().Where(z => z.ObjectType == ayType && z.Active == true).Select(z => new { id = z.Id, name = z.Name, roles = z.Roles }).ToListAsync(); + var rpts = await ct.Report.AsNoTracking().Where(z => z.AType == aType && z.Active == true).Select(z => new { id = z.Id, name = z.Name, roles = z.Roles }).ToListAsync(); var ret = new List(); foreach (var item in rpts) { @@ -341,15 +341,15 @@ namespace AyaNova.Biz var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::GetReportData"); AuthorizationRoles effectiveRoles = CurrentUserRoles; - if (selectedRequest.ObjectType == AyaType.NoType) + if (selectedRequest.AType == AyaType.NoType) { - AddError(ApiErrorCode.VALIDATION_REQUIRED, null, $"ObjectType is required"); + AddError(ApiErrorCode.VALIDATION_REQUIRED, null, $"AType is required"); return null; } - if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, selectedRequest.ObjectType)) + if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, selectedRequest.AType)) { - AddError(ApiErrorCode.NOT_AUTHORIZED, null, $"User not authorized for {selectedRequest.ObjectType} type object"); + AddError(ApiErrorCode.NOT_AUTHORIZED, null, $"User not authorized for {selectedRequest.AType} type object"); return null; } @@ -358,9 +358,9 @@ namespace AyaNova.Biz selectedRequest.SelectedRowIds = await DataListSelectedProcessingOptions.RehydrateIdList(selectedRequest, ct, effectiveRoles, log, UserId, UserTranslationId); - log.LogDebug($"Instantiating biz object handler for {selectedRequest.ObjectType}"); - var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct, UserId, CurrentUserRoles, UserTranslationId); - log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.ObjectType} items"); + log.LogDebug($"Instantiating biz object handler for {selectedRequest.AType}"); + var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, CurrentUserRoles, UserTranslationId); + log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.AType} items"); return await ((IReportAbleObject)biz).GetReportData(selectedRequest.SelectedRowIds); } @@ -383,17 +383,17 @@ namespace AyaNova.Biz } //If we get here via the /viewreport url in the client then there is no object type set so we need to set it here from the report - if(reportRequest.ObjectType==AyaType.NoType){ - reportRequest.ObjectType=report.ObjectType; + if(reportRequest.AType==AyaType.NoType){ + reportRequest.AType=report.AType; } AuthorizationRoles effectiveRoles = CurrentUserRoles; - if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.ObjectType)) + if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.AType)) { - AddError(ApiErrorCode.NOT_AUTHORIZED, null, $"User not authorized for {report.ObjectType} type object"); + AddError(ApiErrorCode.NOT_AUTHORIZED, null, $"User not authorized for {report.AType} type object"); return null; } @@ -559,14 +559,14 @@ namespace AyaNova.Biz //Custom fields definition for report usage string CustomFieldsTemplate = "null"; - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == report.ObjectType.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == report.AType.ToString()); if (FormCustomization != null) { CustomFieldsTemplate = FormCustomization.Template; } //Report meta data - var reportMeta = $"{{Id:{report.Id},Name:`{report.Name}`,Notes:`{report.Notes}`,ObjectType:`{report.ObjectType}`,CustomFieldsDefinition:{CustomFieldsTemplate},DataListKey:`{reportRequest.DataListKey}`,SelectedRowIds: `{string.Join(",", reportRequest.SelectedRowIds)}`}}"; + var reportMeta = $"{{Id:{report.Id},Name:`{report.Name}`,Notes:`{report.Notes}`,AType:`{report.AType}`,CustomFieldsDefinition:{CustomFieldsTemplate},DataListKey:`{reportRequest.DataListKey}`,SelectedRowIds: `{string.Join(",", reportRequest.SelectedRowIds)}`}}"; //duplicate meta data in report page wide variable for use by our internal functions diff --git a/server/AyaNova/biz/ReviewBiz.cs b/server/AyaNova/biz/ReviewBiz.cs index 803f72cd..7bd5cac3 100644 --- a/server/AyaNova/biz/ReviewBiz.cs +++ b/server/AyaNova/biz/ReviewBiz.cs @@ -276,17 +276,17 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ObjectId"); return; } - if (proposedObj.ObjectType != currentObj.ObjectType) + if (proposedObj.AType != currentObj.AType) { - AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ObjectType"); + AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "AType"); return; } } //Does the object of this Review actually exist? - if (!await BizObjectExistsInDatabase.ExistsAsync(proposedObj.ObjectType, proposedObj.ObjectId, ct)) + if (!await BizObjectExistsInDatabase.ExistsAsync(proposedObj.AType, proposedObj.ObjectId, ct)) { - AddError(ApiErrorCode.NOT_FOUND, "generalerror", $"LT:ErrorAPI2010 LT:{proposedObj.ObjectType} id {proposedObj.ObjectId}"); + AddError(ApiErrorCode.NOT_FOUND, "generalerror", $"LT:ErrorAPI2010 LT:{proposedObj.AType} id {proposedObj.ObjectId}"); return; } diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index 159b783c..6db8b2e5 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -152,11 +152,11 @@ namespace AyaNova.Biz //Of type? if (searchParameters.TypeOnly != AyaType.NoType) - q = q.Where(z => z.ObjectType == searchParameters.TypeOnly); + q = q.Where(z => z.AType == searchParameters.TypeOnly); //Find the records that have the search terms in searchkey - var SearchMatches = q.GroupBy(z => new { z.ObjectType, z.ObjectId }).Select(z => new { ObjectId = z.Key.ObjectId, ObjectType = z.Key.ObjectType, ObjectCount = z.LongCount() }); + var SearchMatches = q.GroupBy(z => new { z.AType, z.ObjectId }).Select(z => new { ObjectId = z.Key.ObjectId, AType = z.Key.AType, ObjectCount = z.LongCount() }); //PUT THE RESULTS INTO MATCHING OBJECTS LIST @@ -164,7 +164,7 @@ namespace AyaNova.Biz { //keep any object that matches *all* the search terms if (SearchMatch.ObjectCount == TotalSearchTermsToMatch) - MatchingObjects.Add(new AyaTypeId(SearchMatch.ObjectType, SearchMatch.ObjectId)); + MatchingObjects.Add(new AyaTypeId(SearchMatch.AType, SearchMatch.ObjectId)); } @@ -173,19 +173,19 @@ namespace AyaNova.Biz List CanReadMatchingObjects = new List(); foreach (AyaTypeId t in MatchingObjects) { - if (t.ObjectType == AyaType.FileAttachment) + if (t.AType == AyaType.FileAttachment) { //have to look up the actual underlying object type and id here //check if it's readable for user //then add the PARENT object type and id to the CanREadMatchingObjects list //this means user will not see it return as an attachment, just as the object FileAttachment f = await ct.FileAttachment.AsNoTracking().FirstOrDefaultAsync(z => z.Id == t.ObjectId); - if (AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(currentUserRoles, f.AttachToObjectType)) + if (AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(currentUserRoles, f.AttachToAType)) { - CanReadMatchingObjects.Add(new AyaTypeId(f.AttachToObjectType, f.AttachToObjectId)); + CanReadMatchingObjects.Add(new AyaTypeId(f.AttachToAType, f.AttachToObjectId)); } } - else if (t.ObjectType == AyaType.Memo) + else if (t.AType == AyaType.Memo) { //Users are only permitted to search their own memo's if (await ct.Memo.AsNoTracking().AnyAsync(z => z.Id == t.ObjectId && z.ToId == currentUserId)) @@ -193,7 +193,7 @@ namespace AyaNova.Biz } else { - if (AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(currentUserRoles, t.ObjectType)) + if (AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(currentUserRoles, t.AType)) { CanReadMatchingObjects.Add(t); } @@ -217,7 +217,7 @@ namespace AyaNova.Biz //Sort and group the matching objects list in return order //zCzustomer.OrderBy(z => z.LastName).ThenBy(z => z.FirstName) - var OrderedMatchingObjects = MatchingObjects.OrderBy(z => z.ObjectType).ThenByDescending(z => z.ObjectId); + var OrderedMatchingObjects = MatchingObjects.OrderBy(z => z.AType).ThenByDescending(z => z.ObjectId); @@ -233,11 +233,11 @@ namespace AyaNova.Biz foreach (AyaTypeId i in OrderedMatchingObjects) { SearchResult SR = new SearchResult(); - SR.Name = BizObjectNameFetcherDirect.Name(i.ObjectType, + SR.Name = BizObjectNameFetcherDirect.Name(i.AType, i.ObjectId, command); SR.Id = i.ObjectId; - SR.Type = i.ObjectType; + SR.Type = i.AType; ReturnObject.SearchResults.Add(SR); } } @@ -581,16 +581,16 @@ namespace AyaNova.Biz { public long TranslationId { get; set; } public long ObjectId { get; set; } - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } public List Words { get; set; } - public SearchIndexProcessObjectParameters(long translationId, long objectID, AyaType objectType) + public SearchIndexProcessObjectParameters(long translationId, long objectID, AyaType aType) { Words = new List(); TranslationId = translationId; ObjectId = objectID; - ObjectType = objectType; + AType = aType; } //format used for getsummmary by biz objects @@ -599,7 +599,7 @@ namespace AyaNova.Biz Words = new List(); TranslationId = 0; ObjectId = 0; - ObjectType = 0; + AType = 0; } public SearchIndexProcessObjectParameters AddText(string s) @@ -663,11 +663,11 @@ namespace AyaNova.Biz await ProcessKeywordsAsync(searchIndexObjectParameters, false); } - public static async Task ProcessDeletedObjectKeywordsAsync(long objectID, AyaType objectType, AyContext ct) + public static async Task ProcessDeletedObjectKeywordsAsync(long objectID, AyaType aType, AyContext ct) { //Be careful in future, if you put ToString at the end of each object in the string interpolation //npgsql driver will assume it's a string and put quotes around it triggering an error that a string can't be compared to an int - await ct.Database.ExecuteSqlInterpolatedAsync($"delete from asearchkey where objectid={objectID} and objecttype={(int)objectType}"); + await ct.Database.ExecuteSqlInterpolatedAsync($"delete from asearchkey where objectid={objectID} and aType={(int)aType}"); //nothing to save here, it's a direct command already executed } @@ -678,15 +678,15 @@ namespace AyaNova.Biz private static async Task ProcessKeywordsAsync(SearchIndexProcessObjectParameters p, bool newRecord) { // #if (DEBUG) - // if (!p.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute))) - // throw new System.NotSupportedException($"Search::ProcessKeywords - Invalid type presented {p.ObjectType}"); + // if (!p.AType.HasAttribute(typeof(CoreBizObjectAttribute))) + // throw new System.NotSupportedException($"Search::ProcessKeywords - Invalid type presented {p.AType}"); // #endif List KeyWordList = await BreakAsync(p.TranslationId, p.Words); if (KeyWordList.Count == 0) return; //call stored procedure to do the work right at the server (fastest method by far) using (AyContext ct = ServiceProviderProvider.DBContext) - await ct.Database.ExecuteSqlInterpolatedAsync($"call aydosearchindex({KeyWordList},{p.ObjectId},{p.ObjectType},{!newRecord})"); + await ct.Database.ExecuteSqlInterpolatedAsync($"call aydosearchindex({KeyWordList},{p.ObjectId},{p.AType},{!newRecord})"); return; }//eoc #endregion diff --git a/server/AyaNova/biz/ServiceBankBiz.cs b/server/AyaNova/biz/ServiceBankBiz.cs index 4886979a..758125c2 100644 --- a/server/AyaNova/biz/ServiceBankBiz.cs +++ b/server/AyaNova/biz/ServiceBankBiz.cs @@ -45,12 +45,12 @@ namespace AyaNova.Biz using (var transaction = await ct.Database.BeginTransactionAsync()) { //get the last record - var LastEntry = await ct.ServiceBank.OrderByDescending(m => m.EntryDate).FirstOrDefaultAsync(m => m.ObjectId == newDtObject.ObjectId && m.ObjectType == newDtObject.ObjectType); + var LastEntry = await ct.ServiceBank.OrderByDescending(m => m.EntryDate).FirstOrDefaultAsync(m => m.ObjectId == newDtObject.ObjectId && m.AType == newDtObject.AType); ServiceBank newObject = new ServiceBank(); newObject.Name = newDtObject.Name; newObject.EntryDate = DateTime.UtcNow; newObject.ObjectId = newDtObject.ObjectId; - newObject.ObjectType = newDtObject.ObjectType; + newObject.AType = newDtObject.AType; newObject.SourceId = newDtObject.SourceId; newObject.SourceType = newDtObject.SourceType; newObject.Incidents = newDtObject.Incidents; @@ -126,10 +126,10 @@ namespace AyaNova.Biz // //////////////////////////////////////////////////////////////////////////////////////////////// // //GET LAST // // - // internal async Task GetLastForObjectAsync(AyaType objectType, long objectId) + // internal async Task GetLastForObjectAsync(AyaType aType, long objectId) // { - // var ret = await ct.ServiceBank.OrderByDescending(m => m.EntryDate).SingleOrDefaultAsync(m => m.ObjectId == objectId && m.ObjectType == objectType); + // var ret = await ct.ServiceBank.OrderByDescending(m => m.EntryDate).SingleOrDefaultAsync(m => m.ObjectId == objectId && m.AType == aType); // return ret; // } @@ -179,15 +179,15 @@ namespace AyaNova.Biz //Object exists? - if (!await BizObjectExistsInDatabase.ExistsAsync(proposedObj.ObjectType, proposedObj.ObjectId, ct)) + if (!await BizObjectExistsInDatabase.ExistsAsync(proposedObj.AType, proposedObj.ObjectId, ct)) { - AddError(ApiErrorCode.NOT_FOUND, "generalerror", $"Bankable source object specified doesn't exist [type:{proposedObj.ObjectType}, id:{proposedObj.ObjectId}]"); + AddError(ApiErrorCode.NOT_FOUND, "generalerror", $"Bankable source object specified doesn't exist [type:{proposedObj.AType}, id:{proposedObj.ObjectId}]"); return; } /* - "CONSTRAINT UNQ_ServiceBank UNIQUE (entrydate, objectid, objecttype, incidentsbalance, hoursbalance, currencybalance), " + - "CONSTRAINT UNQ_ServiceBank_Previous_values UNIQUE (lastentrydate, objectid, objecttype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance), " + - "CONSTRAINT fk_ServiceBank_self FOREIGN KEY (lastentrydate, objectid, objecttype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance) references aservicebank(entrydate, objectid, objecttype, incidentsbalance, hoursbalance, currencybalance), " + + "CONSTRAINT UNQ_ServiceBank UNIQUE (entrydate, objectid, aType, incidentsbalance, hoursbalance, currencybalance), " + + "CONSTRAINT UNQ_ServiceBank_Previous_values UNIQUE (lastentrydate, objectid, aType, lastincidentsbalance, lasthoursbalance, lastcurrencybalance), " + + "CONSTRAINT fk_ServiceBank_self FOREIGN KEY (lastentrydate, objectid, aType, lastincidentsbalance, lasthoursbalance, lastcurrencybalance) references aservicebank(entrydate, objectid, aType, incidentsbalance, hoursbalance, currencybalance), " + "CONSTRAINT CHK_Servicebank_Valid_IncidentBalance CHECK(incidentsbalance = COALESCE(lastincidentsbalance, 0) + incidents), " + "CONSTRAINT CHK_Servicebank_Valid_CurrencyBalance CHECK(currencybalance = COALESCE(lastcurrencybalance, 0) + currency), " + "CONSTRAINT CHK_Servicebank_Valid_HoursBalance CHECK(hoursbalance = COALESCE(lasthoursbalance, 0) + hours), " + @@ -323,7 +323,7 @@ namespace AyaNova.Biz var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ServiceBankDepleted).ToListAsync(); string SourceName = string.Empty; if (subs.Count > 0) - SourceName = BizObjectNameFetcherDirect.Name(o.ObjectType, o.ObjectId, ct); + SourceName = BizObjectNameFetcherDirect.Name(o.AType, o.ObjectId, ct); foreach (var sub in subs) { @@ -343,7 +343,7 @@ namespace AyaNova.Biz { EventType = NotifyEventType.ServiceBankDepleted, UserId = sub.UserId, - AyaType = o.ObjectType, + AyaType = o.AType, ObjectId = o.ObjectId, NotifySubscriptionId = sub.Id, Name = SourceName diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index b37b2ac2..cda1d96e 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -2575,7 +2575,7 @@ namespace AyaNova.Biz ICoreBizObjectModel o = null; //save a fetch if it's a delete if (job.SubType != JobSubType.Delete) - o = await GetWorkOrderGraphItem(job.ObjectType, id); + o = await GetWorkOrderGraphItem(job.AType, id); switch (job.SubType) { case JobSubType.TagAddAny: @@ -2587,7 +2587,7 @@ namespace AyaNova.Biz SaveIt = TagBiz.ProcessBatchTagOperation(o.Tags, (string)jobData["tag"], jobData.ContainsKey("toTag") ? (string)jobData["toTag"] : null, job.SubType); break; case JobSubType.Delete: - if (!await DeleteWorkOrderGraphItem(job.ObjectType, id)) + if (!await DeleteWorkOrderGraphItem(job.AType, id)) { await JobsBiz.LogJobAsync(job.GId, $"LT:Errors {GetErrorsAsString()} id {id}"); FailedObjectCount++; @@ -2598,7 +2598,7 @@ namespace AyaNova.Biz } if (SaveIt) { - o = await PutWorkOrderGraphItem(job.ObjectType, o); + o = await PutWorkOrderGraphItem(job.AType, o); if (o == null) { await JobsBiz.LogJobAsync(job.GId, $"LT:Errors {GetErrorsAsString()} id {id}"); diff --git a/server/AyaNova/generator/CoreJobNotify.cs b/server/AyaNova/generator/CoreJobNotify.cs index 801186c8..92178038 100644 --- a/server/AyaNova/generator/CoreJobNotify.cs +++ b/server/AyaNova/generator/CoreJobNotify.cs @@ -326,7 +326,7 @@ namespace AyaNova.Biz //Open object url //### NOTE: If this is required anywhere else, move it to a central BizUtils class in Biz folder callable from here and there - private static string OpenObjectUrlBuilder(AyaType otype, long id, NotifyEventType net) + private static string OpenObjectUrlBuilder(AyaType aType, long id, NotifyEventType net) { var ServerUrl = ServerGlobalOpsSettingsCache.Notify.AyaNovaServerURL; if (string.IsNullOrWhiteSpace(ServerUrl)) @@ -344,7 +344,7 @@ namespace AyaNova.Biz //Might not have a type or id in which case nothing directly to open - if (otype == AyaType.NoType || id == 0) + if (aType == AyaType.NoType || id == 0) { return ServerUrl; } @@ -353,11 +353,11 @@ namespace AyaNova.Biz { //goto event log for item // path: "/history/:ayatype/:recordid/:userlog?", - return $"{ServerUrl}/history/{(int)otype}/{id}"; + return $"{ServerUrl}/history/{(int)aType}/{id}"; } //default is to open the object in question directly - return $"{ServerUrl}/open/{(int)otype}/{id}"; + return $"{ServerUrl}/open/{(int)aType}/{id}"; } diff --git a/server/AyaNova/generator/CoreJobSweeper.cs b/server/AyaNova/generator/CoreJobSweeper.cs index 73444574..1d040c06 100644 --- a/server/AyaNova/generator/CoreJobSweeper.cs +++ b/server/AyaNova/generator/CoreJobSweeper.cs @@ -116,7 +116,7 @@ namespace AyaNova.Biz { //OPSMETRIC await JobsBiz.LogJobAsync(j.GId, "LT:JobFailed LT:TimedOut"); - log.LogError($"Job found job stuck in running status and set to failed: deadline={dtRunningDeadline.ToString()}, jobId={j.GId.ToString()}, jobname={j.Name}, jobtype={j.JobType.ToString()}, jobObjectType={j.ObjectType.ToString()}, jobObjectId={j.ObjectId.ToString()}"); + log.LogError($"Job found job stuck in running status and set to failed: deadline={dtRunningDeadline.ToString()}, jobId={j.GId.ToString()}, jobname={j.Name}, jobtype={j.JobType.ToString()}, jobAType={j.AType.ToString()}, jobObjectId={j.ObjectId.ToString()}"); await JobsBiz.UpdateJobStatusAsync(j.GId, JobStatus.Failed); } } diff --git a/server/AyaNova/models/DataListRequestBase.cs b/server/AyaNova/models/DataListRequestBase.cs index 41e63d73..5955a270 100644 --- a/server/AyaNova/models/DataListRequestBase.cs +++ b/server/AyaNova/models/DataListRequestBase.cs @@ -13,6 +13,6 @@ namespace AyaNova.Models REQUEST BASE: DataListKey, ClientCriteria, FilterId TABLEVERSION: Limit, Offset : base - REPORT/BULK OPS VERSION: ObjectType(ayatype),SelectedRowIds(long[]) : base + REPORT/BULK OPS VERSION: AType(ayatype),SelectedRowIds(long[]) : base */ } diff --git a/server/AyaNova/models/DataListSelectedRequest.cs b/server/AyaNova/models/DataListSelectedRequest.cs index a17f3a03..4b94b37d 100644 --- a/server/AyaNova/models/DataListSelectedRequest.cs +++ b/server/AyaNova/models/DataListSelectedRequest.cs @@ -5,7 +5,7 @@ namespace AyaNova.Models //handles posts from client public class DataListSelectedRequest : DataListRequestBase { - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } public long[] SelectedRowIds { get; set; } } diff --git a/server/AyaNova/models/FileAttachment.cs b/server/AyaNova/models/FileAttachment.cs index f02ce7e6..bb67d725 100644 --- a/server/AyaNova/models/FileAttachment.cs +++ b/server/AyaNova/models/FileAttachment.cs @@ -21,7 +21,7 @@ namespace AyaNova.Models [Required] public long AttachToObjectId { get; set; } [Required] - public AyaType AttachToObjectType { get; set; }//int + public AyaType AttachToAType { get; set; }//int [Required] public string StoredFileName { get; set; } [Required] diff --git a/server/AyaNova/models/OpsJob.cs b/server/AyaNova/models/OpsJob.cs index 638f46af..24e85986 100644 --- a/server/AyaNova/models/OpsJob.cs +++ b/server/AyaNova/models/OpsJob.cs @@ -30,7 +30,7 @@ namespace AyaNova.Models public JobType JobType { get; set; } public JobSubType SubType { get; set; } public long ObjectId { get; set; } - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } [Required] public JobStatus JobStatus { get; set; } @@ -50,7 +50,7 @@ namespace AyaNova.Models JobType = JobType.NotSet; SubType = JobSubType.NotSet; ObjectId = 0; - ObjectType = AyaType.NoType; + AType = AyaType.NoType; JobStatus = JobStatus.Sleeping; JobInfo = null; diff --git a/server/AyaNova/models/Report.cs b/server/AyaNova/models/Report.cs index 5438effa..4e3cbc6a 100644 --- a/server/AyaNova/models/Report.cs +++ b/server/AyaNova/models/Report.cs @@ -16,7 +16,7 @@ namespace AyaNova.Models public string Notes { get; set; } public AuthorizationRoles Roles { get; set; } [Required] - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } public string Template { get; set; } @@ -47,7 +47,7 @@ namespace AyaNova.Models public Report() { RenderType = ReportRenderType.PDF; - ObjectType = AyaType.NoType; + AType = AyaType.NoType; Roles = AuthorizationRoles.All; Active = true; //these are pdf option defaults as per PuppeteerSharp diff --git a/server/AyaNova/models/Review.cs b/server/AyaNova/models/Review.cs index df46331b..e505bb14 100644 --- a/server/AyaNova/models/Review.cs +++ b/server/AyaNova/models/Review.cs @@ -39,7 +39,7 @@ namespace AyaNova.Models [Required] public long ObjectId { get; set; } [Required] - public AyaType ObjectType { get; set; }//int + public AyaType AType { get; set; }//int [NotMapped] public bool OverDue diff --git a/server/AyaNova/models/SearchKey.cs b/server/AyaNova/models/SearchKey.cs index 80fe1c3a..9251d7a1 100644 --- a/server/AyaNova/models/SearchKey.cs +++ b/server/AyaNova/models/SearchKey.cs @@ -16,7 +16,7 @@ namespace AyaNova.Models [Required] public long ObjectId { get; set; } [Required] - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } diff --git a/server/AyaNova/models/ServiceBank.cs b/server/AyaNova/models/ServiceBank.cs index 42fdd3f5..60b934d8 100644 --- a/server/AyaNova/models/ServiceBank.cs +++ b/server/AyaNova/models/ServiceBank.cs @@ -24,7 +24,7 @@ namespace AyaNova.Models [Required] public long ObjectId { get; set; } [Required] - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } [Required] public long SourceId { get; set; } [Required] @@ -71,7 +71,7 @@ namespace AyaNova.Models [Required] public long ObjectId { get; set; } [Required] - public AyaType ObjectType { get; set; } + public AyaType AType { get; set; } [Required] public long SourceId { get; set; } [Required] diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt index 5c6e9e95..9a57451e 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE API use and meta data","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: Meta data and API usage

\n\t

See help documentation for details

\n\t\n\t
\n\t\t

ayServerMetaData

\n\t\t{{ ayJSON ayServerMetaData }}\n\t
\n\n\t
\n\t\t

ayClientMetaData

\n\t\t{{ ayJSON ayClientMetaData }}\n\t
\n\n\t
\n\t\t

ayReportMetaData

\n\t\t{{ ayJSON ayReportMetaData }}\n\t
\n\n\n\t
\n\t\t

myData

\n\t\t
(Fetched dynamically from API route enum-list/list/AyaType)
\n\t\t{{ ayJSON myData }}\n\t
\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ Name }}

\n\t\t
Notes: {{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n //Example of using API GET method to fetch data from API server and make it available to the report template\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n\n //Example API POST method to fetch data from api server\n let searchPostData={phrase: \"Fresh\"};\n reportData.myData.SearchResults=await ayPostToAPI(\"search\", searchPostData);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE API use and meta data","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: Meta data and API usage

\n\t

See help documentation for details

\n\t\n\t
\n\t\t

ayServerMetaData

\n\t\t{{ ayJSON ayServerMetaData }}\n\t
\n\n\t
\n\t\t

ayClientMetaData

\n\t\t{{ ayJSON ayClientMetaData }}\n\t
\n\n\t
\n\t\t

ayReportMetaData

\n\t\t{{ ayJSON ayReportMetaData }}\n\t
\n\n\n\t
\n\t\t

myData

\n\t\t
(Fetched dynamically from API route enum-list/list/AyaType)
\n\t\t{{ ayJSON myData }}\n\t
\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ Name }}

\n\t\t
Notes: {{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n //Example of using API GET method to fetch data from API server and make it available to the report template\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n\n //Example API POST method to fetch data from api server\n let searchPostData={phrase: \"Fresh\"};\n reportData.myData.SearchResults=await ayPostToAPI(\"search\", searchPostData);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Bar code helper.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Bar code helper.ayrt index fa51b45a..62041364 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Bar code helper.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Bar code helper.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE Bar code helper","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: Bar code helper

\n\t

See Report editor help documentation for details

\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
\n\t\tSerial as \"CODE-128\" BarCode:
\n\t\t{{ ayBC Serial '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}\n\t
\n\t
\n\t
\n\t\tSerial as \"QR\" Code:
\n\t\t{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":3}' }}\n\t
\n\t
\n\t
\n\t\tSample \"UPC-A\" Code (Serial wouldn't be a valid UPC code so hard coded here):
\n\t\t{{ ayBC \"712345678904\" '{ \"bcid\": \"upca\",\"includetext\":true, \"scale\":1}' }}\n\t
\n\t
\n\t
\n\t
\n\t{{/each}}\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE Bar code helper","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: Bar code helper

\n\t

See Report editor help documentation for details

\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
\n\t\tSerial as \"CODE-128\" BarCode:
\n\t\t{{ ayBC Serial '{ \"bcid\": \"code128\",\"includetext\":true, \"scale\":1}' }}\n\t
\n\t
\n\t
\n\t\tSerial as \"QR\" Code:
\n\t\t{{ ayBC Serial '{ \"bcid\": \"qrcode\",\"includetext\":true, \"scale\":3}' }}\n\t
\n\t
\n\t
\n\t\tSample \"UPC-A\" Code (Serial wouldn't be a valid UPC code so hard coded here):
\n\t\t{{ ayBC \"712345678904\" '{ \"bcid\": \"upca\",\"includetext\":true, \"scale\":1}' }}\n\t
\n\t
\n\t
\n\t
\n\t{{/each}}\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom date time format helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom date time format helpers.ayrt index c40fbfd9..2fb9e40e 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom date time format helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Custom date time format helpers.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE Custom date time format helpers","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: custom formatted date time helpers

\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t

Below are all the StartDate in various formats:

\n\t

Raw UTC / GMT AyaNova stored value from server

\n\t{{ StartDate }}
\n\t

Built in helpers

\n\tayDateTime helper: {{ ayDateTime StartDate}}
\n\tayDate helper: {{ ayDate StartDate}}
\n\tayTime helper: {{ ayTime StartDate}}
\n\t

Custom helpers in this report template

\n\tmyDateTime custom helper: {{ myDateTime StartDate}}
\n\tmyDate custom helper: {{ myDate StartDate}}
\n\tmyTime custom helper: {{ myTime StartDate}}
\t\n\tmyDateTimeAustralia custom helper: {{ myDateTimeAustralia StartDate}}
\n\tmyDateTimeArabic custom helper: {{ myDateTimeArabic StartDate}}
\n\tmyDateTimeFromParts custom helper: {{ myDateTimeFromParts StartDate}}
\n\t\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"","JsHelpers":"/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER\n//\nHandlebars.registerHelper('myDateTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date \n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\",\n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM TIME HELPER\n//\nHandlebars.registerHelper('myTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleTimeString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleTimeString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone \n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH AUSTRALIAN OPTIONS\n//\nHandlebars.registerHelper('myDateTimeAustralia', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"en-au\",//use English-Australia locale (Day / Month / Year is Australia default format)\n {\n timeZone: \"Australia/Sydney\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n timeZoneName: \"long\",//display the time zone used\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH Arabic OPTIONS\n//\nHandlebars.registerHelper('myDateTimeArabic', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"ar-EG\",//use Arabic locale \n {\n timeZone: \"Asia/Dubai\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n timeZoneName: \"short\",//display the time zone used\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('myDateTimeFromParts', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'UTC'\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n \n //return in some custom format\n return `DAY:${partWeekDay}-${partDay} YEAR: ${partYear}`;\n //return this instead to see the actual return array\n //return JSON.stringify(parts);\n});","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE Custom date time format helpers","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: custom formatted date time helpers

\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t

Below are all the StartDate in various formats:

\n\t

Raw UTC / GMT AyaNova stored value from server

\n\t{{ StartDate }}
\n\t

Built in helpers

\n\tayDateTime helper: {{ ayDateTime StartDate}}
\n\tayDate helper: {{ ayDate StartDate}}
\n\tayTime helper: {{ ayTime StartDate}}
\n\t

Custom helpers in this report template

\n\tmyDateTime custom helper: {{ myDateTime StartDate}}
\n\tmyDate custom helper: {{ myDate StartDate}}
\n\tmyTime custom helper: {{ myTime StartDate}}
\t\n\tmyDateTimeAustralia custom helper: {{ myDateTimeAustralia StartDate}}
\n\tmyDateTimeArabic custom helper: {{ myDateTimeArabic StartDate}}
\n\tmyDateTimeFromParts custom helper: {{ myDateTimeFromParts StartDate}}
\n\t\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"","JsHelpers":"/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER\n//\nHandlebars.registerHelper('myDateTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date \n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\",\n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE HELPER\n//\nHandlebars.registerHelper('myDate', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleDateString method to format the date\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString\n return parsedDate.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM TIME HELPER\n//\nHandlebars.registerHelper('myTime', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleTimeString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString\n return parsedDate.toLocaleTimeString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone \n timeStyle: \"long\",\n hour12: AYMETA.ayClientMetaData.Hour12 //Use User setting for 12/24 hour clock\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH AUSTRALIAN OPTIONS\n//\nHandlebars.registerHelper('myDateTimeAustralia', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"en-au\",//use English-Australia locale (Day / Month / Year is Australia default format)\n {\n timeZone: \"Australia/Sydney\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n timeZoneName: \"long\",//display the time zone used\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM DATE AND TIME HELPER WITH Arabic OPTIONS\n//\nHandlebars.registerHelper('myDateTimeArabic', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Use built in toLocaleString method to format the date and time\n //there are many options that change the displayed format documented here\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString \n return parsedDate.toLocaleString(\n \"ar-EG\",//use Arabic locale \n {\n timeZone: \"Asia/Dubai\",//use forced time zone, see \"tz database\" column for name in list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n timeZoneName: \"short\",//display the time zone used\n dateStyle: \"short\",\n timeStyle: \"long\"\n }\n );\n});\n/////////////////////////////////////////////////////////////////\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('myDateTimeFromParts', function (value) {\n if (!value) {\n return \"\";\n }\n\n //parse the date\n let parsedDate = new Date(value);\n //is it a valid date?\n if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {\n return \"not valid\";\n }\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'UTC'\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n \n //return in some custom format\n return `DAY:${partWeekDay}-${partDay} YEAR: ${partYear}`;\n //return this instead to see the actual return array\n //return JSON.stringify(parts);\n});","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Logo helper.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Logo helper.ayrt index 15263083..23c2a2ac 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Logo helper.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Logo helper.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE Logo helper","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: LOGO

\n\t

See Report editor help documentation for details

\n\t

Note: you must upload a logo via the Global Settings form in order to see them here

\n\n\t

Small logo

\n\t{{ ayLogo \"small\" }}\n\n\t

Medium logo

\n\t{{ ayLogo \"medium\" }}\n\n\t

Large logo

\n\t{{ ayLogo \"large\" }}\n\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
Notes: {{ Notes }}
\n\t{{/each}}\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE Logo helper","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: LOGO

\n\t

See Report editor help documentation for details

\n\t

Note: you must upload a logo via the Global Settings form in order to see them here

\n\n\t

Small logo

\n\t{{ ayLogo \"small\" }}\n\n\t

Medium logo

\n\t{{ ayLogo \"medium\" }}\n\n\t

Large logo

\n\t{{ ayLogo \"large\" }}\n\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
Notes: {{ Notes }}
\n\t{{/each}}\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PDF Options page number.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PDF Options page number.ayrt index 8c080817..754f66fd 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PDF Options page number.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE PDF Options page number.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE PDF Options page number","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
Notes: {{ Notes }}
\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"","JsHelpers":"","RenderType":0,"HeaderTemplate":"  Header: Page  of ","FooterTemplate":"  Footer: Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"40px","MarginOptionsLeft":"40px","MarginOptionsRight":"40px","MarginOptionsTop":"40px","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file +{"Name":"EXAMPLE PDF Options page number","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t{{#each ayReportData}}\n\t

{{ Name }}

\n\t
Notes: {{ Notes }}
\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"","JsHelpers":"","RenderType":0,"HeaderTemplate":"  Header: Page  of ","FooterTemplate":"  Footer: Page  of ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"40px","MarginOptionsLeft":"40px","MarginOptionsRight":"40px","MarginOptionsTop":"40px","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Translation helper.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Translation helper.ayrt index 02a38e8c..ddc8b880 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Translation helper.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE Translation helper.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE Translation helper","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\n\t

Example: Translation helper

\n\t

See Report editor help documentation for details

\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ayT 'WidgetName' }}: {{ Name }}

\n\t\t
{{ayT 'WidgetSerial' }}:{{ Serial }}
\n\t\t
{{ayT 'WidgetDollarAmount' }}:{{ DollarAmount }}
\n\t\t
{{ayT 'WidgetStartDate' }}:{{ StartDate }}
\n\t\t
{{ayT 'WidgetNotes' }}:{{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //Fetch translation keys required for report \n //Server will get the translations that match the current logged in user's language\n //Only translation keys pre-fetched here will be available for use with the ayT translation helper\n\n //NOTE: you *must* await the call to ayGetTranslations or they will not be present for the report template use\n\n await ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE Translation helper","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\n\t

Example: Translation helper

\n\t

See Report editor help documentation for details

\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ayT 'WidgetName' }}: {{ Name }}

\n\t\t
{{ayT 'WidgetSerial' }}:{{ Serial }}
\n\t\t
{{ayT 'WidgetDollarAmount' }}:{{ DollarAmount }}
\n\t\t
{{ayT 'WidgetStartDate' }}:{{ StartDate }}
\n\t\t
{{ayT 'WidgetNotes' }}:{{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //Fetch translation keys required for report \n //Server will get the translations that match the current logged in user's language\n //Only translation keys pre-fetched here will be available for use with the ayT translation helper\n\n //NOTE: you *must* await the call to ayGetTranslations or they will not be present for the report template use\n\n await ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE WIKI helper.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE WIKI helper.ayrt index dcb85b29..243f09ab 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE WIKI helper.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE WIKI helper.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE WIKI helper","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: WIKI / markdown field usage

\n\t

See help documentation for details

\n\n\t{{#each ayReportData}}\n\t

Object name:

\n\t{{ Name }}\n\t

Object WIKI:

\n\t{{ ayWiki Wiki }}\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE WIKI helper","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: WIKI / markdown field usage

\n\t

See help documentation for details

\n\n\t{{#each ayReportData}}\n\t

Object name:

\n\t{{ Name }}\n\t

Object WIKI:

\n\t{{ ayWiki Wiki }}\n\t{{/each}}\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom fields.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom fields.ayrt index 2b10340c..d7b1f35e 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom fields.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE custom fields.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE custom fields","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

See help documentation for details

\n\n\t
\n\t\t{{#each ayReportData}}\n\n\t\t

Non custom fields

\n\t\tName: {{ Name }}
\n\t\tDollarAmount as Number: {{ ayDecimal DollarAmount}}
\n\n\t\t

Custom fields

\n\t\t

Custom field items can be accessed via the main object's CustomFields property and then by dot notation for each of the 16 possible custom fields as .c1 to .c16 \n\t\tIf a custom field is unused it will return a blank for that item.\n\t\t(note, example assumes generated sample data and that c1 and c5 have data)

\n\t\tCustom c1 as DateTime: {{ ayDateTime CustomFields.c1}}
\n\t\tcustom c5 as Number: {{ ayDecimal CustomFields.c5}}
\t\n\t\t
\n\t\t{{/each}}\n\t
\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE custom fields","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

See help documentation for details

\n\n\t
\n\t\t{{#each ayReportData}}\n\n\t\t

Non custom fields

\n\t\tName: {{ Name }}
\n\t\tDollarAmount as Number: {{ ayDecimal DollarAmount}}
\n\n\t\t

Custom fields

\n\t\t

Custom field items can be accessed via the main object's CustomFields property and then by dot notation for each of the 16 possible custom fields as .c1 to .c16 \n\t\tIf a custom field is unused it will return a blank for that item.\n\t\t(note, example assumes generated sample data and that c1 and c5 have data)

\n\t\tCustom c1 as DateTime: {{ ayDateTime CustomFields.c1}}
\n\t\tcustom c5 as Number: {{ ayDecimal CustomFields.c5}}
\t\n\t\t
\n\t\t{{/each}}\n\t
\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE localization helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE localization helpers.ayrt index b86642f9..60ef9704 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE localization helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE localization helpers.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE localization helpers","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: Localization helpers

\n\t

See help documentation for details

\n\n\t
\n\t\t

Client locale settings used

\n\t\tBrowser TimeZone: {{ ayClientMetaData.TimeZoneName }}
\n\t\tBrowser LanguageName: {{ ayClientMetaData.LanguageName }}
\n\t\tHour12: {{ ayClientMetaData.Hour12 }}
\n\t\tCurrencyName: {{ ayClientMetaData.CurrencyName }}
\n\t
\n\t
\n\t\t{{#each ayReportData}}\n\t\t

Name: {{ Name }}

\n\t\tStartDate as DateTime: {{ ayDateTime StartDate}}
\n\t\tStartDate as Date : {{ ayDate StartDate}}
\n\t\tStartDate as Time: {{ ayTime StartDate}}
\n\t\tDollarAmount as Currency: {{ ayCurrency DollarAmount}}
\n\t\tDollarAmount as Number: {{ ayDecimal DollarAmount}}
\n\t\t
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE localization helpers","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: Localization helpers

\n\t

See help documentation for details

\n\n\t
\n\t\t

Client locale settings used

\n\t\tBrowser TimeZone: {{ ayClientMetaData.TimeZoneName }}
\n\t\tBrowser LanguageName: {{ ayClientMetaData.LanguageName }}
\n\t\tHour12: {{ ayClientMetaData.Hour12 }}
\n\t\tCurrencyName: {{ ayClientMetaData.CurrencyName }}
\n\t
\n\t
\n\t\t{{#each ayReportData}}\n\t\t

Name: {{ Name }}

\n\t\tStartDate as DateTime: {{ ayDateTime StartDate}}
\n\t\tStartDate as Date : {{ ayDate StartDate}}
\n\t\tStartDate as Time: {{ ayTime StartDate}}
\n\t\tDollarAmount as Currency: {{ ayCurrency DollarAmount}}
\n\t\tDollarAmount as Number: {{ ayDecimal DollarAmount}}
\n\t\t
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE modify data before rendering.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE modify data before rendering.ayrt index d2bd65a9..288b31f3 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE modify data before rendering.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE modify data before rendering.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE modify data before rendering","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t{{#each ayReportData}}\n\tName: {{ Name }}, DollarAmount: {{ ayCurrency DollarAmount }}, RunningTotal: {{ ayCurrency MyRunningTotal }}
\n\t{{/each}}\n\n\t

Total dollar amount: {{ ayCurrency MyTotalDollarAmount }}\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData) {\n //Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n //Declare a temporary variable to hold the running total\n let TotalDollarAmount = 0;\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (MyItem of reportData.ayReportData) {\n\n //make sure it has a value before attempting to add it to the running total\n if (MyItem.DollarAmount != null) {\n TotalDollarAmount += MyItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n MyItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n return reportData;\n}","JsHelpers":"","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE modify data before rendering","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t{{#each ayReportData}}\n\tName: {{ Name }}, DollarAmount: {{ ayCurrency DollarAmount }}, RunningTotal: {{ ayCurrency MyRunningTotal }}
\n\t{{/each}}\n\n\t

Total dollar amount: {{ ayCurrency MyTotalDollarAmount }}\n\n\n","Style":"","JsPrerender":"async function ayPrepareData(reportData) {\n //Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n //Declare a temporary variable to hold the running total\n let TotalDollarAmount = 0;\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (MyItem of reportData.ayReportData) {\n\n //make sure it has a value before attempting to add it to the running total\n if (MyItem.DollarAmount != null) {\n TotalDollarAmount += MyItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n MyItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n return reportData;\n}","JsHelpers":"","RenderType":0} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE Additional Today's Date Time Helpers.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE Additional Today's Date Time Helpers.ayrt index a43f74bf..63595986 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE Additional Today's Date Time Helpers.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE Additional Today's Date Time Helpers.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE Additional Today's Date Time Helpers","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t
\n\t\t

Additional custom time date helpers

\n\t

today's date using custom Helper todaysDate no formatting: {{ todaysDate}}

\n\t

today's date using custom Helper date.toLocaleDateString() : {{ todaysLocaleStringDate}}

\n\ttoday's date using custom Helper todaysget that users date.getFullYear etc: {{ todaysget}}

\n\t

today's date using custom Helper long format of ayClientMetaData: {{ todaysMonthDDYYYYDate}}

\n\t

today's date using custom Helper todaysDateYearFromParts formatter.formatToParts(parsedDate): {{ todaysDateYearFromParts}}

\n\t

all can be further customized to display short, long, etc format

\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n\n\nHandlebars.registerHelper('todaysDate', function() {\n var dt1=new Date();\n return dt1\n});// today's date with no formatting\n\nHandlebars.registerHelper('todaysLocaleStringDate', function() {\n var dt2=new Date();\n return dt2.toLocaleDateString() \n});// today's date displayed in the localedatestring\n\n\nHandlebars.registerHelper('todaysget', function() {\n var dt5 =new Date();\n var date = dt5.getFullYear()+'-'+(dt5.getMonth()+1)+'-'+dt5.getDate() + \" \" + +dt5.getHours() + \":\" + +dt5.getMinutes() ;\n return date\n});// today's date displayed \n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n\n\n\n\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('todaysDateYearFromParts', function () {\n\n //parse todays date\n let parsedDate = new Date();\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'long', //long to show the full name of month, short to show short name, numeric to show the month number\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'Canada/Pacific' //refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for appropriate TZ database name to use\n //OR use what is displayed in the output for your ayClientMetaData's TimeZoneName:\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n//identify here which of the above will use when returning\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partMonth = parts.find(({ type }) => type === 'month').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n let partHour = parts.find(({ type }) => type === 'hour').value;\n let partMin = parts.find(({ type }) => type === 'minute').value;\n let partdayPeriod = parts.find(({ type }) => type === 'dayPeriod').value;\n\n\n \n //return in some custom format\n return `${partWeekDay} ${partDay}, ${partMonth} ${partYear} - ${partHour}:${partMin} ${partdayPeriod}`;\n \n //return below instead to see array of the possible values for each type while initially figuring out what to customize to\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE Additional Today's Date Time Helpers","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t
\n\t\t

Additional custom time date helpers

\n\t

today's date using custom Helper todaysDate no formatting: {{ todaysDate}}

\n\t

today's date using custom Helper date.toLocaleDateString() : {{ todaysLocaleStringDate}}

\n\ttoday's date using custom Helper todaysget that users date.getFullYear etc: {{ todaysget}}

\n\t

today's date using custom Helper long format of ayClientMetaData: {{ todaysMonthDDYYYYDate}}

\n\t

today's date using custom Helper todaysDateYearFromParts formatter.formatToParts(parsedDate): {{ todaysDateYearFromParts}}

\n\t

all can be further customized to display short, long, etc format

\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n\n\nHandlebars.registerHelper('todaysDate', function() {\n var dt1=new Date();\n return dt1\n});// today's date with no formatting\n\nHandlebars.registerHelper('todaysLocaleStringDate', function() {\n var dt2=new Date();\n return dt2.toLocaleDateString() \n});// today's date displayed in the localedatestring\n\n\nHandlebars.registerHelper('todaysget', function() {\n var dt5 =new Date();\n var date = dt5.getFullYear()+'-'+(dt5.getMonth()+1)+'-'+dt5.getDate() + \" \" + +dt5.getHours() + \":\" + +dt5.getMinutes() ;\n return date\n});// today's date displayed \n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n\n\n\n\n//\n// CUSTOM FORMAT TO PARTS HELPER\n// this offers the most control over the return format\n// Locale aware conversion to parts that can be returned in any format\n//\nHandlebars.registerHelper('todaysDateYearFromParts', function () {\n\n //parse todays date\n let parsedDate = new Date();\n\n //Set formatter options\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts\n let formatter = new Intl.DateTimeFormat('en-us', {\n weekday: 'long',\n year: 'numeric',\n month: 'long', //long to show the full name of month, short to show short name, numeric to show the month number\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n hour12: true,\n timeZone: 'Canada/Pacific' //refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for appropriate TZ database name to use\n //OR use what is displayed in the output for your ayClientMetaData's TimeZoneName:\n });\n\n let parts = formatter.formatToParts(parsedDate);\n /*\n // parts example return value: \n [ \n { type: 'weekday', value: 'Monday' }, \n { type: 'literal', value: ', ' }, \n { type: 'month', value: '12' }, \n { type: 'literal', value: '/' }, \n { type: 'day', value: '17' }, \n { type: 'literal', value: '/' }, \n { type: 'year', value: '2012' }, \n { type: 'literal', value: ', ' }, \n { type: 'hour', value: '3' }, \n { type: 'literal', value: ':' }, \n { type: 'minute', value: '00' }, \n { type: 'literal', value: ':' }, \n { type: 'second', value: '42' }, \n { type: 'fractionalSecond', value: '000' },\n { type: 'literal', value: ' ' }, \n { type: 'dayPeriod', value: 'AM' } \n ]\n */\n//identify here which of the above will use when returning\n let partWeekDay = parts.find(({ type }) => type === 'weekday').value;\n let partDay = parts.find(({ type }) => type === 'day').value;\n let partMonth = parts.find(({ type }) => type === 'month').value;\n let partYear = parts.find(({ type }) => type === 'year').value;\n let partHour = parts.find(({ type }) => type === 'hour').value;\n let partMin = parts.find(({ type }) => type === 'minute').value;\n let partdayPeriod = parts.find(({ type }) => type === 'dayPeriod').value;\n\n\n \n //return in some custom format\n return `${partWeekDay} ${partDay}, ${partMonth} ${partYear} - ${partHour}:${partMin} ${partdayPeriod}`;\n \n //return below instead to see array of the possible values for each type while initially figuring out what to customize to\n //return JSON.stringify(parts);\n});","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE one object prints per page.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE one object prints per page.ayrt index 406db699..7ddd5ecf 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE one object prints per page.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE one object prints per page.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE one object prints per page","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\n\t

Example: Translation helper

\n\t

See Report editor help documentation for details

\n\t

this will show on the first page only as is HTML code BEFORE the #each aspect which is used for iteration

\n\t

if want this on its own page unto itself, wrap it also in a class that does a page-break

\n\n{{#each ayReportData}} \n\t
\t\t\n\t\t

{{ayT 'WidgetName' }}: {{ Name }}

\n\t\t
{{ayT 'WidgetSerial' }}:{{ Serial }}
\n\t\t
{{ayT 'WidgetDollarAmount' }}:{{ DollarAmount }}
\n\t\t
{{ayT 'WidgetStartDate' }}:{{ StartDate }}
\n\t\t
{{ayT 'WidgetNotes' }}:{{ Notes }}
\t\t\n\t
\n{{/each}}\n\n\n\n\n","Style":".example {\n color: blue;\n}\n\n\n.singlePage\n{\npage-break-after: always;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //Fetch translation keys required for report \n //Server will get the translations that match the current logged in user's language\n //Only translation keys pre-fetched here will be available for use with the ayT translation helper\n\n //NOTE: you *must* await the call to ayGetTranslations or they will not be present for the report template use\n\n await ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE one object prints per page","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\n\t

Example: Translation helper

\n\t

See Report editor help documentation for details

\n\t

this will show on the first page only as is HTML code BEFORE the #each aspect which is used for iteration

\n\t

if want this on its own page unto itself, wrap it also in a class that does a page-break

\n\n{{#each ayReportData}} \n\t
\t\t\n\t\t

{{ayT 'WidgetName' }}: {{ Name }}

\n\t\t
{{ayT 'WidgetSerial' }}:{{ Serial }}
\n\t\t
{{ayT 'WidgetDollarAmount' }}:{{ DollarAmount }}
\n\t\t
{{ayT 'WidgetStartDate' }}:{{ StartDate }}
\n\t\t
{{ayT 'WidgetNotes' }}:{{ Notes }}
\t\t\n\t
\n{{/each}}\n\n\n\n\n","Style":".example {\n color: blue;\n}\n\n\n.singlePage\n{\npage-break-after: always;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //Fetch translation keys required for report \n //Server will get the translations that match the current logged in user's language\n //Only translation keys pre-fetched here will be available for use with the ayT translation helper\n\n //NOTE: you *must* await the call to ayGetTranslations or they will not be present for the report template use\n\n await ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing IF ELSE inline html.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing IF ELSE inline html.ayrt index 2053d9ca..df6028a3 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing IF ELSE inline html.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing IF ELSE inline html.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE showing IF ELSE inline html","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

this is an examle report template that shows value of Count in red if has 0 or null, or shows green if has ANY value

\n\n\t
\n\t\t{{#each ayReportData}}\n\t\t

Name: {{ Name }}

\n\t\t{{#if Count}}

Count is: {{ Count }}

{{else}}

has 0 or null

{{/if}}\n\t\t
\t\t\n\t\t{{/each}}\n\t
\n\n\n","Style":".redFont {\r\n color: red;\r\n}\r\n\r\n.greenFont {\r\n color: green;\r\n}\r\n","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE showing IF ELSE inline html","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

this is an examle report template that shows value of Count in red if has 0 or null, or shows green if has ANY value

\n\n\t
\n\t\t{{#each ayReportData}}\n\t\t

Name: {{ Name }}

\n\t\t{{#if Count}}

Count is: {{ Count }}

{{else}}

has 0 or null

{{/if}}\n\t\t
\t\t\n\t\t{{/each}}\n\t
\n\n\n","Style":".redFont {\r\n color: red;\r\n}\r\n\r\n.greenFont {\r\n color: green;\r\n}\r\n","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing tag only if has specific tagword.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing tag only if has specific tagword.ayrt index 12ad01c6..4c895e7d 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing tag only if has specific tagword.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE showing tag only if has specific tagword.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE showing tag only if has specific tagword","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

See help documentation for details

\n\n\t
\n\t\t{{#each ayReportData}}\n\n\t\tName: {{ Name }}
\n\t\t\n\t\t

Tags:

\n\t\t

Displays first tag :::::{{ Tags.[0]}}

\n\t\t

Displays all tags for this object::::: {{ Tags}}

\n\t\t

Displays if has brown in its tags::::: {{ isInTag2 Tags}}

\n\t\t

Count: {{Count}}

\n\t\t\n\t\t\n\t\t
    \n\t\t\t {{#if CustomFields.c4}}
  • true custom fields c4 is true
  • {{else}}
  • custom fields c4 is false
  • {{/if}}\n\t\t\t
  • Actual Count value: {{Count}}
  • \n\t\t\t {{#if Count}}
  • renders in red font if 'Count' has any value
  • {{else}}
  • renders in green font if false, undefined, null, \"\", 0, or []
  • {{/if}}\n\t\t
\n\n\t\t

{{isInTag3 Tags}}

\n\t\t\n\t\t{{/each}}\n\t
\n\n\n","Style":".redMe {\r\n color: red;\r\n}\r\n\r\n.greenMe {\r\n color: green;\r\n}\r\n\r\n.redfont {\r\n color: red;\r\n}","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"\r\n\r\nHandlebars.registerHelper('isInTag', function (Tags) \r\n{\r\n for (var i=0; i\" + \"brownbrwnbrown is in here!!!!!!!!!!!!\" +\"

\");\r\n\t\t}\r\n }\r\n return 'some other text'; //if don't want to return any element at all, comment this else aspect out fully\r\n});\r\n","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE showing tag only if has specific tagword","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\t

Example: custom fields usage

\n\t

See help documentation for details

\n\n\t
\n\t\t{{#each ayReportData}}\n\n\t\tName: {{ Name }}
\n\t\t\n\t\t

Tags:

\n\t\t

Displays first tag :::::{{ Tags.[0]}}

\n\t\t

Displays all tags for this object::::: {{ Tags}}

\n\t\t

Displays if has brown in its tags::::: {{ isInTag2 Tags}}

\n\t\t

Count: {{Count}}

\n\t\t\n\t\t\n\t\t
    \n\t\t\t {{#if CustomFields.c4}}
  • true custom fields c4 is true
  • {{else}}
  • custom fields c4 is false
  • {{/if}}\n\t\t\t
  • Actual Count value: {{Count}}
  • \n\t\t\t {{#if Count}}
  • renders in red font if 'Count' has any value
  • {{else}}
  • renders in green font if false, undefined, null, \"\", 0, or []
  • {{/if}}\n\t\t
\n\n\t\t

{{isInTag3 Tags}}

\n\t\t\n\t\t{{/each}}\n\t
\n\n\n","Style":".redMe {\r\n color: red;\r\n}\r\n\r\n.greenMe {\r\n color: green;\r\n}\r\n\r\n.redfont {\r\n color: red;\r\n}","JsPrerender":"async function ayPrepareData(reportData){ \n return reportData;\n}","JsHelpers":"\r\n\r\nHandlebars.registerHelper('isInTag', function (Tags) \r\n{\r\n for (var i=0; i\" + \"brownbrwnbrown is in here!!!!!!!!!!!!\" +\"

\");\r\n\t\t}\r\n }\r\n return 'some other text'; //if don't want to return any element at all, comment this else aspect out fully\r\n});\r\n","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":0,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt footer last pg only.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt footer last pg only.ayrt index 2991f56f..49553f8f 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt footer last pg only.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt footer last pg only.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE widgets invoice rpt footer last pg only","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\n\n\n\t
\t\t\n\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\n \t\t \n \t\t\n \t\t\n \t\t\n \t\t\n \t\t \t\t\n\t\t\t\t\n\t\t\t \t{{/each}}\n\t\t\t\n\t\t
{{ ayLogo \"small\" }}PO#: A1A1G43Our Account #: 198453
Ordered Date: 2020-09-13
ETA Date: 2020-09-19
VENDOR:DELIVER TO:
vendorNameMy Company Name
vstaddress123 - 123 MyStreetname Ave
vstcity vststate vstpostalMy City, My State, My Postal
Contact: vcontact vphone vemailOrdered By: creator Phone: creatorphone
 
Our Part#:Serial#Price Per:Net:Tax A:Tax B:Line Total:
{{Name}}{{Serial}}{{ayCurrency DollarAmount}}xx.xxx.xxx.xx{{ayCurrency DollarAmount}}
\n\n\n \n \n\t\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \n
 
Net Total: $xxx.xx
 Tax A Total: $xx.xx
Direct all inquiries to My Company 1-888-555-5555Tax B Total:$xx.xx
Approval for off-specification goods must be obtained via a new purchase orderPO Total:{{ ayCurrency MyTotalDollarAmount }}
\n\n\t
\n \n\n\n\n\n","Style":"\ntable { \n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\nthead {\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\n}\ntfoot {\n page-break-inside: avoid;\n}\n\n.heading {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 11pt; \n} \n.fontsizeBig {\n font-size: 11pt;\n font-weight: bold ;\n\n}\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n} \n\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n\n//Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n let TotalDollarAmount = 0; //Declare a temporary variable to hold the running total\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (EachItem of reportData.ayReportData) { //EachItem is name i've give, reportData.ayReportData is set\n\n //make sure it has a value before attempting to add it to the running total\n if (EachItem.DollarAmount != null) { //EachItem is name I've given, DollarAmount is the \n TotalDollarAmount += EachItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n EachItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n\n\n//below gets your translations for the following field labels\nawait ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}\n","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\nHandlebars.registerHelper('words', function() {\n return \"stuff and text\"\n})\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n","RenderType":0,"HeaderTemplate":"  Todays date: \nPage  of   \n","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE widgets invoice rpt footer last pg only","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\n\n\n\t
\t\t\n\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\n \t\t \n \t\t\n \t\t\n \t\t\n \t\t\n \t\t \t\t\n\t\t\t\t\n\t\t\t \t{{/each}}\n\t\t\t\n\t\t
{{ ayLogo \"small\" }}PO#: A1A1G43Our Account #: 198453
Ordered Date: 2020-09-13
ETA Date: 2020-09-19
VENDOR:DELIVER TO:
vendorNameMy Company Name
vstaddress123 - 123 MyStreetname Ave
vstcity vststate vstpostalMy City, My State, My Postal
Contact: vcontact vphone vemailOrdered By: creator Phone: creatorphone
 
Our Part#:Serial#Price Per:Net:Tax A:Tax B:Line Total:
{{Name}}{{Serial}}{{ayCurrency DollarAmount}}xx.xxx.xxx.xx{{ayCurrency DollarAmount}}
\n\n\n \n \n\t\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \n
 
Net Total: $xxx.xx
 Tax A Total: $xx.xx
Direct all inquiries to My Company 1-888-555-5555Tax B Total:$xx.xx
Approval for off-specification goods must be obtained via a new purchase orderPO Total:{{ ayCurrency MyTotalDollarAmount }}
\n\n\t
\n \n\n\n\n\n","Style":"\ntable { \n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\nthead {\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\n}\ntfoot {\n page-break-inside: avoid;\n}\n\n.heading {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 11pt; \n} \n.fontsizeBig {\n font-size: 11pt;\n font-weight: bold ;\n\n}\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n} \n\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n\n//Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n let TotalDollarAmount = 0; //Declare a temporary variable to hold the running total\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (EachItem of reportData.ayReportData) { //EachItem is name i've give, reportData.ayReportData is set\n\n //make sure it has a value before attempting to add it to the running total\n if (EachItem.DollarAmount != null) { //EachItem is name I've given, DollarAmount is the \n TotalDollarAmount += EachItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n EachItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n\n\n//below gets your translations for the following field labels\nawait ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}\n","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\nHandlebars.registerHelper('words', function() {\n return \"stuff and text\"\n})\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n","RenderType":0,"HeaderTemplate":"  Todays date: \nPage  of   \n","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt head footer repeats.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt head footer repeats.ayrt index c9c23e3e..d2133f3b 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt head footer repeats.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/SAMPLE widgets invoice rpt head footer repeats.ayrt @@ -1 +1 @@ -{"Name":"SAMPLE widgets invoice rpt head footer repeats","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\n\n\n\t
\t\t\n\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\n \t\t \n \t\t\n \t\t\n \t\t\n \t\t\n \t\t \t\t\n\t\t\t\t\n\t\t\t \t{{/each}}\n\t\t\t\n\t\t
{{ ayLogo \"small\" }}PO#: A1A1G43Our Account #: 198453
Ordered Date: 2020-09-13
ETA Date: 2020-09-19
VENDOR:DELIVER TO:
vendorNameMy Company Name
vstaddress123 - 123 MyStreetname Ave
vstcity vststate vstpostalMy City, My State, My Postal
Contact: vcontact vphone vemailOrdered By: creator Phone: creatorphone
 
Our Part#:Serial#Price Per:Net:Tax A:Tax B:Line Total:
 
Net Total for all pages: $xxx.xx
 Tax A Total for all pages: $xx.xx
Direct all inquiries to My Company 1-888-555-5555Tax B Total for all pages:$xx.xx
Approval for off-specification goods must be obtained via a new purchase orderPO Total for all pages:{{ ayCurrency MyTotalDollarAmount }}
{{Name}}{{Serial}}{{ayCurrency DollarAmount}}xx.xxx.xxx.xx{{ayCurrency DollarAmount}}
\n\n\n\n\t
\n \n\n\n\n\n","Style":"\ntable { \n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\nthead {\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\n}\ntfoot {\n display: table-footer-group; /* so as to print the table-footer on all subsequent pages */\n page-break-inside: avoid;\n}\n\n.heading {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 11pt; \n} \n.fontsizeBig {\n font-size: 10pt;\n font-weight: bold ;\n\n}\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n} \n\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n\n//Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n let TotalDollarAmount = 0; //Declare a temporary variable to hold the running total\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (EachItem of reportData.ayReportData) { //EachItem is name i've give, reportData.ayReportData is set\n\n //make sure it has a value before attempting to add it to the running total\n if (EachItem.DollarAmount != null) { //EachItem is name I've given, DollarAmount is the \n TotalDollarAmount += EachItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n EachItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n\n\n//below gets your translations for the following field labels\nawait ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}\n","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\nHandlebars.registerHelper('words', function() {\n return \"stuff and text\"\n})\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n","RenderType":0,"HeaderTemplate":"    Todays date: \nPage  of     \n","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file +{"Name":"SAMPLE widgets invoice rpt head footer repeats","Active":true,"Notes":"","Roles":124927,"AType":2,"Template":"\n\n\n\n\n\n\t
\t\t\n\t\t\n\t\t\t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \n\t\t\t\n\t\t\t\t{{#each ayReportData}}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\n \t\t \n \t\t\n \t\t\n \t\t\n \t\t\n \t\t \t\t\n\t\t\t\t\n\t\t\t \t{{/each}}\n\t\t\t\n\t\t
{{ ayLogo \"small\" }}PO#: A1A1G43Our Account #: 198453
Ordered Date: 2020-09-13
ETA Date: 2020-09-19
VENDOR:DELIVER TO:
vendorNameMy Company Name
vstaddress123 - 123 MyStreetname Ave
vstcity vststate vstpostalMy City, My State, My Postal
Contact: vcontact vphone vemailOrdered By: creator Phone: creatorphone
 
Our Part#:Serial#Price Per:Net:Tax A:Tax B:Line Total:
 
Net Total for all pages: $xxx.xx
 Tax A Total for all pages: $xx.xx
Direct all inquiries to My Company 1-888-555-5555Tax B Total for all pages:$xx.xx
Approval for off-specification goods must be obtained via a new purchase orderPO Total for all pages:{{ ayCurrency MyTotalDollarAmount }}
{{Name}}{{Serial}}{{ayCurrency DollarAmount}}xx.xxx.xxx.xx{{ayCurrency DollarAmount}}
\n\n\n\n\t
\n \n\n\n\n\n","Style":"\ntable { \n font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;\n border-collapse: collapse;\n white-space: pre-wrap;\n font-size: 9pt;\n width: 100%;\n }\n\nthead {\n display: table-header-group; /* so as to print the table-header on all subsequent pages */\n}\ntfoot {\n display: table-footer-group; /* so as to print the table-footer on all subsequent pages */\n page-break-inside: avoid;\n}\n\n.heading {\n border-style: solid;\n border-width: 1pt;\n border-color: #e8e5e5; \n margin: 10pt;\n background-color: #e8e5e5;\n padding: 5pt; \n font-size: 11pt; \n} \n.fontsizeBig {\n font-size: 10pt;\n font-weight: bold ;\n\n}\n\n.rightlean {\n text-align: right;\n}\n.leftlean {\n text-align: left;\n}\n.centerlean {\n text-align: center;\n}\n\ntbody tr:nth-child(even) {\n background-color: lightgray; /* MUST checkmark Print background in PDF Options for this to show */\n} \n\n\n","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n\n//Example of both manipulating the reportData before rendering the report (by adding a running total field)\n //and adding a field to the overall data calculating the total dollar amount for all records\n\n let TotalDollarAmount = 0; //Declare a temporary variable to hold the running total\n\n //Iterate through all the records in the reportData\n //adding the dollar amount of each item to the TotalDollarAmount variable\n for (EachItem of reportData.ayReportData) { //EachItem is name i've give, reportData.ayReportData is set\n\n //make sure it has a value before attempting to add it to the running total\n if (EachItem.DollarAmount != null) { //EachItem is name I've given, DollarAmount is the \n TotalDollarAmount += EachItem.DollarAmount;\n }\n\n //add a new key to each record in the reportData object named \"MyRunningTotal\" with the running total so far\n EachItem.MyRunningTotal=TotalDollarAmount;\n }\n\n //Add the TotalDollarAmount variable to the reportData so it can be \n //accessed in the report template\n reportData.MyTotalDollarAmount=TotalDollarAmount;\n\n\n\n//below gets your translations for the following field labels\nawait ayGetTranslations([\n \"Widget\",\n \"WidgetName\",\n \"WidgetSerial\",\n \"WidgetDollarAmount\",\n \"WidgetCount\",\n \"WidgetStartDate\",\n \"WidgetEndDate\",\n \"WidgetNotes\",\n \"WidgetCustom1\",\n \"WidgetCustom2\",\n \"WidgetCustom3\",\n \"WidgetCustom4\",\n \"WidgetCustom5\",\n \"WidgetCustom6\",\n \"WidgetCustom7\",\n \"WidgetCustom8\",\n \"WidgetCustom9\",\n \"WidgetCustom10\",\n \"WidgetCustom11\",\n \"WidgetCustom12\",\n \"WidgetCustom13\",\n \"WidgetCustom14\",\n \"WidgetCustom15\",\n \"WidgetCustom16\",\n ]);\n\n return reportData;\n}\n","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})\nHandlebars.registerHelper('words', function() {\n return \"stuff and text\"\n})\n\n\nHandlebars.registerHelper('todaysMonthDDYYYYDate', function() {\n var dt3=new Date();\n return dt3.toLocaleDateString(\n AYMETA.ayClientMetaData.LanguageName,//use Client browser default Language, change this setting here to force an alternative language\n {\n timeZone: AYMETA.ayClientMetaData.TimeZoneName,//use Client browser's default TimeZone, change this setting here to force a specific time zone\n dateStyle: \"long\"\n }\n ) ;\n});// today's date displayed in MONTH DD, YYYY format\n\n","RenderType":0,"HeaderTemplate":"    Todays date: \nPage  of     \n","FooterTemplate":"  ","DisplayHeaderFooter":true,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":true,"Scale":1.0000} \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 8e009de7..f6800c4c 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -268,7 +268,7 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE TABLE aevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMP NOT NULL, userid BIGINT NOT NULL," + "ayid BIGINT NOT NULL, ayatype INTEGER NOT NULL, ayevent INTEGER NOT NULL, textra VARCHAR(255))"); //INDEX: Most selective first as there is more UNIQUE ID's than UNIQUE types - await ExecQueryAsync("CREATE INDEX idx_aevent_ayid_aytype ON aevent (ayid, ayatype);"); + await ExecQueryAsync("CREATE INDEX idx_aevent_ayid_aType ON aevent (ayid, ayatype);"); //TODO: this may be a very low used index, revisit it down the road await ExecQueryAsync("CREATE INDEX idx_aevent_userid ON aevent (userid);"); @@ -288,17 +288,17 @@ namespace AyaNova.Util //await ExecQueryAsync("CREATE UNIQUE INDEX asearchdictionary_word_idx ON asearchdictionary (word);"); //search key - await ExecQueryAsync("CREATE TABLE asearchkey (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, wordid BIGINT NOT NULL REFERENCES asearchdictionary (id), objectid BIGINT NOT NULL, objecttype INTEGER NOT NULL)"); + await ExecQueryAsync("CREATE TABLE asearchkey (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, wordid BIGINT NOT NULL REFERENCES asearchdictionary (id), objectid BIGINT NOT NULL, atype INTEGER NOT NULL)"); //INDEX: Most selective first as there is more UNIQUE ID's than UNIQUE types - //to take advantage of this always query with where objectid=xx and objecttype=yy order + //to take advantage of this always query with where objectid=xx and atype=yy order //Only delete would use this, but, likely not needed as it's not in a loop - //await ExecQueryAsync("CREATE INDEX asearchkey_typeid_idx ON asearchkey (objectid, objecttype );"); + //await ExecQueryAsync("CREATE INDEX asearchkey_typeid_idx ON asearchkey (objectid, atype );"); //This is what is needed during Searching - //search does a lot of hits on searchkey looking for the wordid and optionally objecttype - //In testing this did not pan out, in fact it was much faster to search both with and without a objecttype specified to simply have an index on wordid - // await ExecQueryAsync("CREATE INDEX asearchkey_wordid_otype_idx ON asearchkey (wordid, objecttype);"); + //search does a lot of hits on searchkey looking for the wordid and optionally atype + //In testing this did not pan out, in fact it was much faster to search both with and without a atype specified to simply have an index on wordid + // await ExecQueryAsync("CREATE INDEX asearchkey_wordid_otype_idx ON asearchkey (wordid, atype);"); await ExecQueryAsync("CREATE INDEX idx_asearchkey_wordid ON asearchkey (wordid);"); //Search indexing stored procedure @@ -306,7 +306,7 @@ namespace AyaNova.Util CREATE OR REPLACE PROCEDURE public.aydosearchindex( wordlist TEXT[], ayobjectid BIGINT, - ayobjecttype INTEGER, + ayatype INTEGER, cleanfirst boolean) LANGUAGE 'plpgsql' @@ -318,12 +318,12 @@ BEGIN RAISE EXCEPTION 'Bad object id --> %', ayobjectid; END IF; - IF ayobjecttype=0 THEN - RAISE EXCEPTION 'Bad object type --> %', ayobjecttype; + IF ayatype=0 THEN + RAISE EXCEPTION 'Bad object type --> %', ayatype; END IF; IF cleanfirst=true THEN - delete from asearchkey where objectid=ayobjectid and objecttype=ayobjecttype; + delete from asearchkey where objectid=ayobjectid and atype=ayatype; END IF; FOREACH s IN ARRAY wordlist @@ -331,9 +331,9 @@ BEGIN SELECT id INTO wordid FROM asearchdictionary WHERE word = s; IF wordid IS NULL THEN insert into asearchdictionary (word) values(s) on conflict (word) do update set word=excluded.word returning id into wordid; - insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype); + insert into asearchkey (wordid,objectid,atype) values(wordid,ayobjectid,ayatype); ELSE - insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype); + insert into asearchkey (wordid,objectid,atype) values(wordid,ayobjectid,ayatype); END IF; END LOOP; END; @@ -343,13 +343,13 @@ $BODY$; //Name fetcher function //CoreBizObject ADD here await ExecQueryAsync(@" -CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYOBJECTTYPE INTEGER) RETURNS TEXT AS $BODY$ +CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYATYPE INTEGER) RETURNS TEXT AS $BODY$ DECLARE aytable TEXT DEFAULT ''; aynamecolumn TEXT DEFAULT 'name'; returnstr TEXT DEFAULT ''; BEGIN - case ayobjecttype + case ayatype when 0 then return 'LT:NoType'; when 1 then return 'LT:Global'; when 2 then aytable = 'awidget'; @@ -496,7 +496,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); LogUpdateMessage(log); await ExecQueryAsync("CREATE TABLE afileattachment (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " - + "attachtoobjectid BIGINT NOT NULL, attachtoobjecttype INTEGER NOT NULL, " + + "attachtoobjectid BIGINT NOT NULL, attachtoatype INTEGER NOT NULL, " + "storedfilename TEXT NOT NULL, displayfilename TEXT NOT NULL, contenttype TEXT, lastmodified TIMESTAMP NOT NULL, notes TEXT, exists BOOL NOT NULL, size BIGINT NOT NULL)"); //index required for ops that need to check if file already in db (delete, count refs etc) @@ -505,7 +505,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //index for the common issue of checking if an object has an attachment and retrieving them //note always query (where clause) in this same order for best performance - await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtoobjecttype ON afileattachment (attachtoobjectid, attachtoobjecttype );"); + await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtoatype ON afileattachment (attachtoobjectid, attachtoatype );"); await SetSchemaLevelAsync(++currentSchema); } @@ -520,7 +520,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); LogUpdateMessage(log); await ExecQueryAsync("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, name TEXT NOT NULL, created TIMESTAMP NOT NULL, exclusive BOOL NOT NULL, " - + "startafter TIMESTAMP NOT NULL, jobtype INTEGER NOT NULL, subtype INTEGER, objectid BIGINT, objecttype INTEGER, jobstatus INTEGER NOT NULL, jobinfo TEXT)"); + + "startafter TIMESTAMP NOT NULL, jobtype INTEGER NOT NULL, subtype INTEGER, objectid BIGINT, atype INTEGER, jobstatus INTEGER NOT NULL, jobinfo TEXT)"); await ExecQueryAsync("CREATE TABLE aopsjoblog (gid uuid PRIMARY KEY, jobid uuid NOT NULL, created TIMESTAMP NOT NULL, statustext TEXT NOT NULL)"); await SetSchemaLevelAsync(++currentSchema); } @@ -619,9 +619,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE areview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " + "duedate TIMESTAMP NOT NULL, completeddate TIMESTAMP NULL, completionnotes TEXT, userid BIGINT NOT NULL REFERENCES auser(id), " - + "assignedbyuserid BIGINT NOT NULL REFERENCES auser(id), objecttype INTEGER NOT NULL, objectid BIGINT NOT NULL)"); + + "assignedbyuserid BIGINT NOT NULL REFERENCES auser(id), atype INTEGER NOT NULL, objectid BIGINT NOT NULL)"); - await ExecQueryAsync("CREATE INDEX idx_areview_objectid_objecttype ON areview (objectid, objecttype );"); + await ExecQueryAsync("CREATE INDEX idx_areview_objectid_atype ON areview (objectid, atype );"); await ExecQueryAsync("CREATE INDEX idx_areview_userid ON areview (userid);"); await ExecQueryAsync("CREATE INDEX idx_areview_duedate ON areview (duedate);"); await ExecQueryAsync("CREATE INDEX idx_areview_completeddate ON areview (completeddate);"); @@ -630,20 +630,20 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //SERVICE BANK //Note: I'm allowing negative balances so this code differs slightly from the example it was drawn from https://dba.stackexchange.com/a/19368 await ExecQueryAsync("CREATE TABLE aservicebank (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, " - + "entrydate TIMESTAMP NOT NULL, lastentrydate TIMESTAMP NULL, objecttype INTEGER NOT NULL, objectid BIGINT NOT NULL, sourcetype INTEGER NOT NULL, sourceid BIGINT NOT NULL, " + + "entrydate TIMESTAMP NOT NULL, lastentrydate TIMESTAMP NULL, atype INTEGER NOT NULL, objectid BIGINT NOT NULL, sourcetype INTEGER NOT NULL, sourceid BIGINT NOT NULL, " + "incidents DECIMAL(19,5) NOT NULL, incidentsbalance DECIMAL(19,5) NOT NULL, lastincidentsbalance DECIMAL(19,5) NULL, " + "currency DECIMAL(38,18) NOT NULL, currencybalance DECIMAL(38,18) NOT NULL, lastcurrencybalance DECIMAL(38,18) NULL, " + "hours DECIMAL(19,5) NOT NULL, hoursbalance DECIMAL(19,5) NOT NULL, lasthoursbalance DECIMAL(19,5) NULL, " - + "CONSTRAINT unq_servicebank UNIQUE (entrydate, objectid, objecttype, incidentsbalance, hoursbalance, currencybalance), " - + "CONSTRAINT unq_servicebank_previous_values UNIQUE (lastentrydate, objectid, objecttype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance), " - + "CONSTRAINT fk_servicebank_self FOREIGN KEY (lastentrydate, objectid, objecttype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance) REFERENCES aservicebank(entrydate, objectid, objecttype, incidentsbalance, hoursbalance, currencybalance), " + + "CONSTRAINT unq_servicebank UNIQUE (entrydate, objectid, atype, incidentsbalance, hoursbalance, currencybalance), " + + "CONSTRAINT unq_servicebank_previous_values UNIQUE (lastentrydate, objectid, atype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance), " + + "CONSTRAINT fk_servicebank_self FOREIGN KEY (lastentrydate, objectid, atype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance) REFERENCES aservicebank(entrydate, objectid, atype, incidentsbalance, hoursbalance, currencybalance), " + "CONSTRAINT chk_servicebank_valid_incidentbalance CHECK(incidentsbalance = COALESCE(lastincidentsbalance, 0) + incidents), " + "CONSTRAINT chk_servicebank_valid_currencybalance CHECK(currencybalance = COALESCE(lastcurrencybalance, 0) + currency), " + "CONSTRAINT chk_servicebank_valid_hoursbalance CHECK(hoursbalance = COALESCE(lasthoursbalance, 0) + hours), " + "CONSTRAINT chk_servicebank_valid_dates_sequence CHECK(lastentrydate < entrydate), " + "CONSTRAINT chk_servicebank_valid_previous_columns CHECK((lastentrydate IS NULL AND lastincidentsbalance IS NULL AND lastcurrencybalance IS NULL AND lasthoursbalance IS NULL) OR (lastentrydate IS NOT NULL AND lastincidentsbalance IS NOT NULL AND lastcurrencybalance IS NOT NULL AND lasthoursbalance IS NOT NULL)) " + " )"); - await ExecQueryAsync("CREATE INDEX idx_aservicebank_objectid_objecttype ON aservicebank (objectid, objecttype );"); + await ExecQueryAsync("CREATE INDEX idx_aservicebank_objectid_atype ON aservicebank (objectid, atype );"); //CONTRACT await ExecQueryAsync("CREATE TABLE acontract (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " @@ -1000,7 +1000,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); { LogUpdateMessage(log); await ExecQueryAsync("CREATE TABLE areport (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " - + "notes TEXT, roles INTEGER NOT NULL, objecttype INTEGER NOT NULL, template TEXT, style TEXT, jsprerender TEXT, jshelpers TEXT, rendertype INTEGER NOT NULL, " + + "notes TEXT, roles INTEGER NOT NULL, atype INTEGER NOT NULL, template TEXT, style TEXT, jsprerender TEXT, jshelpers TEXT, rendertype INTEGER NOT NULL, " + "headertemplate TEXT, footertemplate TEXT, displayheaderfooter BOOL, paperformat INTEGER NOT NULL, landscape BOOL, marginoptionsbottom TEXT, " + "marginoptionsleft TEXT, marginoptionsright TEXT, marginoptionstop TEXT, pageranges TEXT, prefercsspagesize BOOL, printbackground BOOL, scale DECIMAL(8,5) )"); await SetSchemaLevelAsync(++currentSchema); diff --git a/server/AyaNova/util/FileUtil.cs b/server/AyaNova/util/FileUtil.cs index a2c68c71..e75651a9 100644 --- a/server/AyaNova/util/FileUtil.cs +++ b/server/AyaNova/util/FileUtil.cs @@ -451,7 +451,7 @@ namespace AyaNova.Util Notes = notes, ContentType = contentType, AttachToObjectId = attachToObject.ObjectId, - AttachToObjectType = attachToObject.ObjectType, + AttachToAType = attachToObject.AType, LastModified = lastModified, Size = FileSize @@ -495,7 +495,7 @@ namespace AyaNova.Util // internal static async Task DeleteAttachmentsForObjectAsync(AyaType ayaType, long ayaId, AyContext ct) { - var deleteList = await ct.FileAttachment.Where(z => z.AttachToObjectId == ayaId && z.AttachToObjectType == ayaType).ToListAsync(); + var deleteList = await ct.FileAttachment.Where(z => z.AttachToObjectId == ayaId && z.AttachToAType == ayaType).ToListAsync(); foreach (var d in deleteList) { await DeleteFileAttachmentAsync(d, ct);