Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Core/Resgrid.Services/LimitsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ async Task<DepartmentLimits> getCurrentPlanForDepartmentAsync()
return limits;
}
}
else if (plan == null || plan.PlanId == 1)
else if ((!String.IsNullOrWhiteSpace(Config.SystemBehaviorConfig.BillingApiBaseUrl) && !String.IsNullOrWhiteSpace(Config.ApiConfig.BackendInternalApikey)) && plan.PlanId == 1)
{
limits.PersonnelLimit = plan.GetLimitForTypeAsInt(PlanLimitTypes.Personnel);
limits.UnitsLimit = plan.GetLimitForTypeAsInt(PlanLimitTypes.Units);

return limits;
}
else if (plan == null)
{
limits.PersonnelLimit = 10;
limits.UnitsLimit = 10;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public async Task<IEnumerable<ScheduledTask>> GetAllActiveTasksForTypesAsync(Lis
var knownDepartments = await db.QueryAsync<ScheduledTask>(@"SELECT st.*, d.departmentid as departmentid, d.timezone as departmenttimezone
FROM scheduledtasks st
INNER JOIN departments d ON d.departmentid = st.departmentid
WHERE st.departmentid > 0 AND st.active = 1 AND st.tasktype = any (@types)", new { types = types });
WHERE st.departmentid > 0 AND st.active = true AND st.tasktype = any (@types)", new { types = types });

var unknownDepartments = await db.QueryAsync<ScheduledTask>(@"SELECT st.*, d.departmentid as departmentid, d.timezone as departmenttimezone
FROM scheduledtasks st
INNER JOIN departmentmembers dm ON dm.userid = st.userid
INNER JOIN departments d ON d.departmentid = dm.departmentid
WHERE st.departmentid = 0 AND st.active = 1 AND st.tasktype = any (@types)", new { types = types });
WHERE st.departmentid = 0 AND st.active = true AND st.tasktype = any (@types)", new { types = types });

return knownDepartments.Concat(unknownDepartments);
}
Expand Down
4 changes: 2 additions & 2 deletions Web/Resgrid.Web/Areas/User/Controllers/PersonnelController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public async Task<IActionResult> AddPerson(AddPersonModel model, IFormCollection

if (ModelState.IsValid)
{
var user = new IdentityUser { UserName = model.Username, Email = model.Email, SecurityStamp = Guid.NewGuid().ToString() };
var user = new IdentityUser { UserName = model.Username, Email = model.Email, SecurityStamp = Guid.NewGuid().ToString().ToUpper() };
var result = await _userManager.CreateAsync(user, model.NewPassword);
if (result.Succeeded)
{
Expand Down Expand Up @@ -529,7 +529,7 @@ public async Task<IActionResult> AddPerson(AddPersonModel model, IFormCollection
if (roles.Any())
await _personnelRolesService.SetRolesForUserAsync(DepartmentId, user.UserId, roles, cancellationToken);
}

_userProfileService.ClearAllUserProfilesFromCache(DepartmentId);
_departmentsService.InvalidateDepartmentUsersInCache(DepartmentId);
_departmentsService.InvalidatePersonnelNamesInCache(DepartmentId);
Expand Down
Loading