This commit is contained in:
2021-07-13 19:26:23 +00:00
parent d06986cf53
commit 3441508754
3 changed files with 47 additions and 11 deletions

2
.vscode/launch.json vendored
View File

@@ -54,7 +54,7 @@
"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_SEEDLEVEL": "large",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
},

View File

@@ -85,7 +85,7 @@ namespace AyaNova.Biz
{
get
{
//the "for sure can not view labor cost" user types
//the "for sure can not view labor/travel cost" user types
switch (CurrentUserType)
{
case UserType.Customer:
@@ -101,6 +101,26 @@ namespace AyaNova.Biz
}
}
internal bool UserCanViewLoanerCosts
{
get
{
//the "for sure can not view loaner cost" user types
switch (CurrentUserType)
{
case UserType.Customer:
case UserType.HeadOffice:
case UserType.ServiceContractor:
return false;
}
//Now check roles (same as rates as accessed via svc area)
return (CurrentUserRoles.HasFlag(AuthorizationRoles.Service)
|| CurrentUserRoles.HasFlag(AuthorizationRoles.ServiceRestricted)
|| CurrentUserRoles.HasFlag(AuthorizationRoles.BizAdmin)
|| CurrentUserRoles.HasFlag(AuthorizationRoles.Accounting));
}
}
// internal bool IsTechRestricted
// {
// get
@@ -280,17 +300,17 @@ namespace AyaNova.Biz
.ThenInclude(wi => wi.OutsideServices)
.SingleOrDefaultAsync(z => z.Id == id);
if (ret != null)
{
var stat = await GetCurrentWorkOrderStatusFromRelatedAsync(BizType, ret.Id);
ret.IsLockedAtServer = stat.Locked;
//todo: set isLocked from state
var stat = await GetCurrentWorkOrderStatusFromRelatedAsync(BizType, ret.Id);
ret.IsLockedAtServer = stat.Locked;
if (populateDisplayFields)
await WorkOrderPopulateVizFields(ret, false);
if (populateDisplayFields)
await WorkOrderPopulateVizFields(ret, false);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
}
return ret;
}
@@ -3385,6 +3405,11 @@ namespace AyaNova.Biz
}
}
o.LineTotalViz = o.NetViz + o.TaxAViz + o.TaxBViz;
//RESTRICTED COST FIELD??
if (!UserCanViewLoanerCosts)
o.Cost = 0;//cost already used in calcs and will not be updated on any update operation so this ensures the cost isn't sent over the wire
}
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -3407,7 +3432,12 @@ namespace AyaNova.Biz
{
//If it wasn't a complete part change there is no need to set pricing
if (newObj.LoanUnitId == oldObj.LoanUnitId && newObj.Rate == oldObj.Rate)
{
SnapshotPricing = false;
//maintain old cost as it can come from the client as zero when it shouldn't be or someone using the api and setting it directly
//but we will only allow the price *we* set at the server initially
newObj.Cost = oldObj.Cost;
}
}
//Pricing

View File

@@ -2141,11 +2141,17 @@ namespace AyaNova.Util
o.Tags = RandomTags();
o.RateHour = Fake.Random.Decimal(1, 25);
o.RateHourCost=o.RateHour/2;
o.RateHalfDay = o.RateHour * 4;
o.RateHalfDayCost=o.RateHalfDay/2;
o.RateDay = o.RateHour * 8;
o.RateDayCost=o.RateDay/2;
o.RateWeek = o.RateHour * 36.8m;
o.RateWeekCost=o.RateWeek/2;
o.RateMonth = o.RateHour * 21 * 8;
o.RateMonthCost=o.RateMonth/2;
o.RateYear = o.RateHour * 36.8m * 52;
o.RateYearCost=o.RateYear/2;
o.DefaultRate = Fake.Random.Enum<LoanUnitRateUnit>();