Skip to content

Commit 332b079

Browse files
authored
Merge pull request #3326 from TechnologyEnhancedLearning/Develop/Fix/TD-5797-CCentre-EmailId-Doesn't-Reflect
TD-5797-The CentreEmail and RegistrationEmail fields in the SQL query have been corrected.
2 parents 0508cdb + 602a065 commit 332b079

File tree

7 files changed

+77
-70
lines changed

7 files changed

+77
-70
lines changed

DigitalLearningSolutions.Data/DataServices/CentresDataService.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void UpdateCentreDetailsForSuperAdmin(
8484
string centreName,
8585
int centreTypeId,
8686
int regionId,
87-
string? centreEmail,
87+
string? registrationEmail,
8888
string? ipPrefix,
8989
bool showOnMap
9090
);
@@ -180,7 +180,7 @@ ORDER BY CentreName"
180180
c.ContactSurname,
181181
c.ContactEmail,
182182
c.ContactTelephone,
183-
c.AutoRegisterManagerEmail AS CentreEmail,
183+
c.AutoRegisterManagerEmail AS RegistrationEmail,
184184
c.ShowOnMap,
185185
c.CMSAdministrators AS CmsAdministratorSpots,
186186
c.CMSManagers AS CmsManagerSpots,
@@ -192,7 +192,8 @@ ORDER BY CentreName"
192192
c.ServerSpaceBytes,
193193
cty.CentreType,
194194
c.CandidateByteLimit,
195-
c.ContractReviewDate
195+
c.ContractReviewDate,
196+
c.pwEmail as CentreEmail
196197
FROM Centres AS c
197198
INNER JOIN Regions AS r ON r.RegionID = c.RegionID
198199
INNER JOIN ContractTypes AS ct ON ct.ContractTypeID = c.ContractTypeId
@@ -232,7 +233,7 @@ FROM Centres AS c
232233
c.ContactEmail,
233234
c.ContactTelephone,
234235
c.pwTelephone AS CentreTelephone,
235-
c.AutoRegisterManagerEmail AS CentreEmail,
236+
c.AutoRegisterManagerEmail AS RegistrationEmail,
236237
c.pwPostCode AS CentrePostcode,
237238
c.ShowOnMap,
238239
c.Long AS Longitude,
@@ -253,7 +254,7 @@ FROM Centres AS c
253254
c.ServerSpaceBytes,
254255
c.CentreTypeID,
255256
ctp.CentreType,
256-
c.pwEmail as RegistrationEmail
257+
c.pwEmail as CentreEmail
257258
FROM Centres AS c
258259
INNER JOIN Regions AS r ON r.RegionID = c.RegionID
259260
INNER JOIN ContractTypes AS ct ON ct.ContractTypeID = c.ContractTypeId
@@ -472,7 +473,7 @@ public void UpdateCentreDetailsForSuperAdmin(
472473
string centreName,
473474
int centreTypeId,
474475
int regionId,
475-
string? centreEmail,
476+
string? registrationEmail,
476477
string? ipPrefix,
477478
bool showOnMap
478479
)
@@ -482,7 +483,7 @@ bool showOnMap
482483
CentreName = @centreName,
483484
CentreTypeId = @centreTypeId,
484485
RegionId = @regionId,
485-
AutoRegisterManagerEmail = @centreEmail,
486+
AutoRegisterManagerEmail = @registrationEmail,
486487
IPPrefix = @ipPrefix,
487488
ShowOnMap = @showOnMap
488489
WHERE CentreId = @centreId",
@@ -491,7 +492,7 @@ bool showOnMap
491492
centreName,
492493
centreTypeId,
493494
regionId,
494-
centreEmail,
495+
registrationEmail,
495496
ipPrefix,
496497
showOnMap,
497498
centreId

DigitalLearningSolutions.Web.Tests/Controllers/SuperAdmin/CentresControllerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void EditCentreDetails_updates_centre_and_redirects_with_successful_save(
8383
CentreTypeId = 1,
8484
CentreType = "NHS Organisation",
8585
RegionName = "National",
86-
CentreEmail = "[email protected]",
86+
RegistrationEmail = "[email protected]",
8787
IpPrefix = "12.33.4",
8888
ShowOnMap = true,
8989
RegionId = 13
@@ -99,7 +99,7 @@ public void EditCentreDetails_updates_centre_and_redirects_with_successful_save(
9999
model.CentreName,
100100
model.CentreTypeId,
101101
model.RegionId,
102-
model.CentreEmail,
102+
model.RegistrationEmail,
103103
model.IpPrefix,
104104
model.ShowOnMap))
105105
.MustHaveHappenedOnceExactly();

DigitalLearningSolutions.Web/Controllers/SuperAdmin/Centres/CentresController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public IActionResult Index(
140140
{
141141
var baseUrl = config.GetAppRootPath();
142142
var supportEmail = this.configService.GetConfigValue("SupportEmail");
143-
baseUrl = baseUrl+"/RegisterAdmin?centreId={centreId}".Replace("{centreId}", item.Centre.CentreId.ToString());
143+
baseUrl = baseUrl + "/RegisterAdmin?centreId={centreId}".Replace("{centreId}", item.Centre.CentreId.ToString());
144144
Email welcomeEmail = this.passwordResetService.GenerateEmailInviteForCentreManager(centreEntity.Centre.CentreName, centreEntity.Centre.AutoRegisterManagerEmail, baseUrl, supportEmail);
145145
centreEntity.Centre.EmailInvite = "mailto:" + string.Join(",", welcomeEmail.To) + "?subject=" + welcomeEmail.Subject + "&body=" + welcomeEmail.Body.TextBody.Replace("&", "%26");
146146
}
@@ -295,7 +295,7 @@ public IActionResult EditCentreDetails(EditCentreDetailsSuperAdminViewModel mode
295295
model.CentreName.Trim(),
296296
model.CentreTypeId,
297297
model.RegionId,
298-
model.CentreEmail,
298+
model.RegistrationEmail,
299299
model.IpPrefix?.Trim(),
300300
model.ShowOnMap
301301
);

DigitalLearningSolutions.Web/Services/CentresService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void UpdateCentreDetailsForSuperAdmin(
5252
string centreName,
5353
int centreTypeId,
5454
int regionId,
55-
string? centreEmail,
55+
string? registrationEmail,
5656
string? ipPrefix,
5757
bool showOnMap
5858
);
@@ -227,9 +227,9 @@ public void UpdateCentreManagerDetails(int centreId, string firstName, string la
227227
return centresDataService.GetAllCentres(activeOnly);
228228
}
229229

230-
public void UpdateCentreDetailsForSuperAdmin(int centreId, string centreName, int centreTypeId, int regionId, string? centreEmail, string? ipPrefix, bool showOnMap)
230+
public void UpdateCentreDetailsForSuperAdmin(int centreId, string centreName, int centreTypeId, int regionId, string? registrationEmail, string? ipPrefix, bool showOnMap)
231231
{
232-
centresDataService.UpdateCentreDetailsForSuperAdmin(centreId, centreName, centreTypeId, regionId, centreEmail, ipPrefix, showOnMap);
232+
centresDataService.UpdateCentreDetailsForSuperAdmin(centreId, centreName, centreTypeId, regionId, registrationEmail, ipPrefix, showOnMap);
233233
}
234234

235235
public CentreSummaryForRoleLimits GetRoleLimitsForCentre(int centreId)

DigitalLearningSolutions.Web/ViewModels/SuperAdmin/Centres/EditCentreDetailsSuperAdminViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public EditCentreDetailsSuperAdminViewModel(Centre centre)
1919
IpPrefix = centre.IpPrefix?.Trim();
2020
ShowOnMap = centre.ShowOnMap;
2121
RegionId = centre.RegionId;
22+
RegistrationEmail = centre.RegistrationEmail;
2223
}
2324

2425
public int CentreId { get; set; }
@@ -37,5 +38,10 @@ public EditCentreDetailsSuperAdminViewModel(Centre centre)
3738
[RegularExpression(@"^[\d.,\s]+$", ErrorMessage = "IP Prefix can contain only digits, stops, commas and spaces")]
3839
public string? IpPrefix { get; set; }
3940
public bool ShowOnMap { get; set; }
41+
42+
[MaxLength(250, ErrorMessage = "Email must be 250 characters or fewer")]
43+
[EmailAddress(ErrorMessage = "Enter an email in the correct format, like [email protected]")]
44+
[NoWhitespace(ErrorMessage = "Email must not contain any whitespace characters")]
45+
public string? RegistrationEmail { get; set; }
4046
}
4147
}

DigitalLearningSolutions.Web/Views/SuperAdmin/Centres/EditCentreDetails.cshtml

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,70 +14,70 @@
1414
<div class="nhsuk-grid-column-full">
1515
@if (errorHasOccurred)
1616
{
17-
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.CentreName), nameof(Model.CentreEmail)})" />
17+
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.CentreName), nameof(Model.RegistrationEmail)})" />
1818
}
1919

2020
<h1 class="nhsuk-heading-xl">Edit centre details</h1>
2121
<form class="nhsuk-u-margin-bottom-3" method="post" novalidate asp-action="EditCentreDetails">
22-
@Html.HiddenFor(x=>x.CentreType)
23-
@Html.HiddenFor(x=>x.RegionName)
22+
@Html.HiddenFor(x => x.CentreType)
23+
@Html.HiddenFor(x => x.RegionName)
2424
<div class="nhsuk-grid-column-full">
25-
<vc:text-input asp-for="CentreName"
26-
label="Centre name"
27-
populate-with-current-value="true"
28-
type="text"
29-
spell-check="false"
30-
autocomplete="off"
31-
hint-text=""
32-
css-class="nhsuk-u-width-one-half"
33-
required="true" />
25+
<vc:text-input asp-for="CentreName"
26+
label="Centre name"
27+
populate-with-current-value="true"
28+
type="text"
29+
spell-check="false"
30+
autocomplete="off"
31+
hint-text=""
32+
css-class="nhsuk-u-width-one-half"
33+
required="true" />
3434

35-
<vc:select-list asp-for="@nameof(Model.CentreTypeId)"
36-
label="Centre type"
37-
value="@Model.CentreType.ToString()"
38-
hint-text=""
39-
required="true"
40-
css-class="nhsuk-u-width-one-half"
41-
default-option=""
42-
select-list-options="@ViewBag.CentreTypes" />
35+
<vc:select-list asp-for="@nameof(Model.CentreTypeId)"
36+
label="Centre type"
37+
value="@Model.CentreType.ToString()"
38+
hint-text=""
39+
required="true"
40+
css-class="nhsuk-u-width-one-half"
41+
default-option=""
42+
select-list-options="@ViewBag.CentreTypes" />
4343

44-
<vc:select-list asp-for="@nameof(Model.RegionId)"
45-
label="Region"
46-
value="@Model.RegionName.ToString()"
47-
hint-text=""
48-
required="true"
49-
css-class="nhsuk-u-width-one-half"
50-
default-option=""
51-
select-list-options="@ViewBag.Regions" />
44+
<vc:select-list asp-for="@nameof(Model.RegionId)"
45+
label="Region"
46+
value="@Model.RegionName.ToString()"
47+
hint-text=""
48+
required="true"
49+
css-class="nhsuk-u-width-one-half"
50+
default-option=""
51+
select-list-options="@ViewBag.Regions" />
5252

53-
<vc:text-input asp-for="CentreEmail"
54-
label="Registration email"
55-
populate-with-current-value="true"
56-
type="text"
57-
spell-check="false"
58-
autocomplete="off"
59-
hint-text=""
60-
css-class="nhsuk-u-width-one-half"
61-
required="false" />
53+
<vc:text-input asp-for="RegistrationEmail"
54+
label="Registration email"
55+
populate-with-current-value="true"
56+
type="text"
57+
spell-check="false"
58+
autocomplete="off"
59+
hint-text=""
60+
css-class="nhsuk-u-width-one-half"
61+
required="false" />
6262

63-
<vc:text-input asp-for="IpPrefix"
64-
label="IP prefix"
65-
populate-with-current-value="true"
66-
type="text"
67-
spell-check="false"
68-
autocomplete="off"
69-
hint-text=""
70-
css-class="nhsuk-u-width-one-half"
71-
required="false" />
63+
<vc:text-input asp-for="IpPrefix"
64+
label="IP prefix"
65+
populate-with-current-value="true"
66+
type="text"
67+
spell-check="false"
68+
autocomplete="off"
69+
hint-text=""
70+
css-class="nhsuk-u-width-one-half"
71+
required="false" />
7272

73-
<div class="nhsuk-checkboxes__item">
74-
<input class="nhsuk-checkboxes__input" id="ShowOnMap" name="ShowOnMap" asp-for="@Model.ShowOnMap" type="checkbox">
75-
<label class="nhsuk-label nhsuk-checkboxes__label" for="ShowOnMap">
76-
Show on find your centre
77-
</label>
78-
</div>
73+
<div class="nhsuk-checkboxes__item">
74+
<input class="nhsuk-checkboxes__input" id="ShowOnMap" name="ShowOnMap" asp-for="@Model.ShowOnMap" type="checkbox">
75+
<label class="nhsuk-label nhsuk-checkboxes__label" for="ShowOnMap">
76+
Show on find your centre
77+
</label>
7978
</div>
80-
79+
</div>
80+
8181
<button class="nhsuk-button nhsuk-u-margin-top-6" type="submit" value="save">Save</button>
8282
</form>
8383

DigitalLearningSolutions.Web/Views/SuperAdmin/Centres/ManageCentre.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<b>Registration email</b>
4747
</dt>
4848
<dd class="nhsuk-summary-list__value">
49-
@Model.CentreEmail
49+
@Model.RegistrationEmail
5050
</dd>
5151
</div>
5252

@@ -201,7 +201,7 @@
201201
<b>Contract review date</b>
202202
</dt>
203203
<dd class="nhsuk-summary-list__value">
204-
@string.Format("{0:dd/MM/yyyy}",@Model.ContractReviewDate)
204+
@string.Format("{0:dd/MM/yyyy}", @Model.ContractReviewDate)
205205
</dd>
206206
</div>
207207
</dl>

0 commit comments

Comments
 (0)