This commit is contained in:
@@ -140,7 +140,6 @@ PMs now provide all the same sections as a service Work order with the sole exce
|
|||||||
### Contracts
|
### Contracts
|
||||||
Service contracts have been expanded with new features and more flexibility when applying (or not) to work orders. You can now select a discount off list price or a markup on cost for special contract pricing. In addition to the v7 general discount in a contract you can now select specific tags for parts or rates that, if those items have the tags selected, will be discounted / marked up the value selected. This gives a lot of flexibility in cases where a certain class or type of part for example should be included in discounts but not others. There are now also features for maximum response time that tie into notification and close by date features of work order automatically for contracts that include a response time commitment.
|
Service contracts have been expanded with new features and more flexibility when applying (or not) to work orders. You can now select a discount off list price or a markup on cost for special contract pricing. In addition to the v7 general discount in a contract you can now select specific tags for parts or rates that, if those items have the tags selected, will be discounted / marked up the value selected. This gives a lot of flexibility in cases where a certain class or type of part for example should be included in discounts but not others. There are now also features for maximum response time that tie into notification and close by date features of work order automatically for contracts that include a response time commitment.
|
||||||
|
|
||||||
|
|
||||||
### Localized text is now Translation
|
### Localized text is now Translation
|
||||||
Localized text has been renamed to Translation
|
Localized text has been renamed to Translation
|
||||||
|
|
||||||
|
|||||||
@@ -59,29 +59,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Duplicate CustomerServiceRequest
|
|
||||||
// /// (Wiki and Attachments are not duplicated)
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="id">Source object id</param>
|
|
||||||
// /// <param name="apiVersion">From route path</param>
|
|
||||||
// /// <returns>CustomerServiceRequest</returns>
|
|
||||||
// [HttpPost("duplicate/{id}")]
|
|
||||||
// public async Task<IActionResult> DuplicateCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion)
|
|
||||||
// {
|
|
||||||
// if (!serverState.IsOpen)
|
|
||||||
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
|
||||||
// CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
|
|
||||||
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
|
||||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
|
||||||
// if (!ModelState.IsValid)
|
|
||||||
// return BadRequest(new ApiErrorResponse(ModelState));
|
|
||||||
// CustomerServiceRequest o = await biz.DuplicateAsync(id);
|
|
||||||
// if (o == null)
|
|
||||||
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
|
||||||
// else
|
|
||||||
// return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get CustomerServiceRequest
|
/// Get CustomerServiceRequest
|
||||||
@@ -150,52 +128,53 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Reject CustomerServiceRequest
|
// /// Reject CustomerServiceRequest
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>CustomerServiceRequest</returns>
|
// /// <returns>CustomerServiceRequest</returns>
|
||||||
[HttpPost("reject/{id}")]
|
// [HttpPost("reject/{id}")]
|
||||||
public async Task<IActionResult> RejectCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> RejectCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
|
// CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
CustomerServiceRequest o = await biz.RejectAsync(id);
|
// CustomerServiceRequest o = await biz.RejectAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// Accept CustomerServiceRequest to new WorkOrder
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="id">Source CSR id</param>
|
||||||
|
// /// <param name="apiVersion">From route path</param>
|
||||||
|
// /// <returns>CustomerServiceRequest with WorkOrderItemId set</returns>
|
||||||
|
// [HttpPost("accept/{id}/{workorderid}")]
|
||||||
|
// public async Task<IActionResult> AcceptCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion)
|
||||||
|
// {
|
||||||
|
// if (!serverState.IsOpen)
|
||||||
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
// CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
|
||||||
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
// if (!ModelState.IsValid)
|
||||||
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
// CustomerServiceRequest o = await biz.AcceptAsync(id);
|
||||||
|
// if (o == null)
|
||||||
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
|
// else
|
||||||
|
// return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Accept CustomerServiceRequest
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">Source object id</param>
|
|
||||||
/// <param name="workorderid">Existing WorkOrder to accept to, 0 creates new workorder</param>
|
|
||||||
/// <param name="apiVersion">From route path</param>
|
|
||||||
/// <returns>CustomerServiceRequest with WorkOrderItemId set</returns>
|
|
||||||
[HttpPost("accept/{id}/{workorderid}")]
|
|
||||||
public async Task<IActionResult> AcceptCustomerServiceRequest([FromRoute] long id, [FromRoute] long workorderid, ApiVersion apiVersion)
|
|
||||||
{
|
|
||||||
if (!serverState.IsOpen)
|
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
|
||||||
CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
|
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
|
||||||
CustomerServiceRequest o = await biz.AcceptAsync(id, workorderid);
|
|
||||||
if (o == null)
|
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
|
||||||
else
|
|
||||||
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,39 +60,6 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// //DUPLICATE
|
|
||||||
// //
|
|
||||||
// internal async Task<CustomerServiceRequest> DuplicateAsync(long id)
|
|
||||||
// {
|
|
||||||
// CustomerServiceRequest dbObject = await GetAsync(id, false);
|
|
||||||
// if (dbObject == null)
|
|
||||||
// {
|
|
||||||
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// CustomerServiceRequest newObject = new CustomerServiceRequest();
|
|
||||||
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
|
||||||
// string newUniqueName = string.Empty;
|
|
||||||
// bool NotUnique = true;
|
|
||||||
// long l = 1;
|
|
||||||
// do
|
|
||||||
// {
|
|
||||||
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
|
||||||
// NotUnique = await ct.CustomerServiceRequest.AnyAsync(m => m.Name == newUniqueName);
|
|
||||||
// } while (NotUnique);
|
|
||||||
// newObject.Name = newUniqueName;
|
|
||||||
// newObject.Id = 0;
|
|
||||||
// newObject.Concurrency = 0;
|
|
||||||
// await ct.CustomerServiceRequest.AddAsync(newObject);
|
|
||||||
// await ct.SaveChangesAsync();
|
|
||||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
|
||||||
// await SearchIndexAsync(newObject, true);
|
|
||||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
|
||||||
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
|
||||||
// return newObject;
|
|
||||||
// }
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
//
|
//
|
||||||
@@ -175,43 +142,43 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//ACCEPT
|
// //ACCEPT
|
||||||
//
|
// //
|
||||||
internal async Task<CustomerServiceRequest> AcceptAsync(long csrId, long workorderId) //MIGRATE_OUTSTANDING waiting for workorder to be completed or at least have a customerid which it currently doesn't
|
// internal async Task<CustomerServiceRequest> AcceptAsync(long csrId, long workorderId) //MIGRATE_OUTSTANDING waiting for workorder to be completed or at least have a customerid which it currently doesn't
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(csrId, false);
|
// var dbObject = await GetAsync(csrId, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
throw new System.NotImplementedException("//MIGRATE_OUTSTANDING CustomerServiceRequestBiz::AcceptAsync - awaiting workorder completion ");
|
// throw new System.NotImplementedException("//MIGRATE_OUTSTANDING CustomerServiceRequestBiz::AcceptAsync - awaiting workorder completion ");
|
||||||
// WorkOrder w=null;
|
// // WorkOrder w=null;
|
||||||
//if (workorderId==0){WorkOrderBiz.GenerateWorkOrder()} //this is how it would work in theory
|
// //if (workorderId==0){WorkOrderBiz.GenerateWorkOrder()} //this is how it would work in theory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//REJECT
|
// //REJECT
|
||||||
//
|
// //
|
||||||
internal async Task<CustomerServiceRequest> RejectAsync(long csrId)
|
// internal async Task<CustomerServiceRequest> RejectAsync(long csrId)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(csrId, false);
|
// var dbObject = await GetAsync(csrId, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//Nothing to validate as it just came from the db and rejecting doesn't require validation
|
// //Nothing to validate as it just came from the db and rejecting doesn't require validation
|
||||||
dbObject.Status = CustomerServiceRequestStatus.Declined;
|
// dbObject.Status = CustomerServiceRequestStatus.Declined;
|
||||||
await PutAsync(dbObject);
|
// await PutAsync(dbObject);
|
||||||
return dbObject;
|
// return dbObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -495,7 +462,7 @@ namespace AyaNova.Biz
|
|||||||
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||||
{
|
{
|
||||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<CustomerServiceRequestBiz>();
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<CustomerServiceRequestBiz>();
|
||||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
@@ -507,8 +474,16 @@ namespace AyaNova.Biz
|
|||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
var o = (CustomerServiceRequest)proposedObj;
|
var o = (CustomerServiceRequest)proposedObj;
|
||||||
|
bool WasAccepted = false;
|
||||||
|
bool WasDeclined = false;
|
||||||
|
if (!isNew)
|
||||||
|
{
|
||||||
|
WasAccepted = ((CustomerServiceRequest)currentObj).Status == CustomerServiceRequestStatus.Accepted;
|
||||||
|
WasDeclined = ((CustomerServiceRequest)currentObj).Status == CustomerServiceRequestStatus.Declined;
|
||||||
|
}
|
||||||
|
|
||||||
//CSR ACCEPTED
|
//CSR ACCEPTED
|
||||||
|
if (!WasAccepted && o.Status == CustomerServiceRequestStatus.Accepted)//TAGS NOT RELEVANT
|
||||||
{
|
{
|
||||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRAccepted).ToListAsync();
|
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRAccepted).ToListAsync();
|
||||||
string SourceName = string.Empty;
|
string SourceName = string.Empty;
|
||||||
@@ -535,6 +510,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
//CSR REJECTED
|
//CSR REJECTED
|
||||||
|
if (!WasDeclined && o.Status == CustomerServiceRequestStatus.Declined)//TAGS NOT RELEVANT
|
||||||
{
|
{
|
||||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRRejected).ToListAsync();
|
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRRejected).ToListAsync();
|
||||||
string SourceName = string.Empty;
|
string SourceName = string.Empty;
|
||||||
|
|||||||
Reference in New Issue
Block a user