diff --git a/backend/src/components/sdc/sdc.js b/backend/src/components/sdc/sdc.js
index 0b44f81b..091f1bb6 100644
--- a/backend/src/components/sdc/sdc.js
+++ b/backend/src/components/sdc/sdc.js
@@ -565,12 +565,20 @@ async function updateStudentPEN(req, res) {
payload.updateUser = utils.getUser(req).idir_username;
payload.enrolledProgramCodes = null;
payload.penMatchResult = null;
-
+ if (payload?.numberOfCourses) {
+ payload.numberOfCourses = stripNumberFormattingNumberOfCourses(payload.numberOfCourses);
+ }
const data = await postData(`${config.get('sdc:schoolCollectionStudentURL')}/update-pen/type/${req.params.penCode}`, payload);
return res.status(HttpStatus.OK).json(data);
} catch (e) {
logApiError(e, 'Error updating student PEN');
- return errorResponse(res);
+ if (e.status === 400 && e.data.message === 'SdcSchoolCollectionStudent was not saved to the database because it would create a provincial duplicate.') {
+ return res.status(HttpStatus.CONFLICT).json({
+ status: HttpStatus.CONFLICT,
+ message: 'Student was not saved because it would create provincial a duplicate.'
+ });
+ }
+ return handleExceptionResponse(e, res);
}
}
diff --git a/frontend/src/components/data-collection/PenMatchStudentDetails.vue b/frontend/src/components/data-collection/PenMatchStudentDetails.vue
index c836c466..34830d50 100644
--- a/frontend/src/components/data-collection/PenMatchStudentDetails.vue
+++ b/frontend/src/components/data-collection/PenMatchStudentDetails.vue
@@ -81,7 +81,7 @@
:loading="isIssuingNewPen"
:disabled="studentDetails?.penMatchResult === 'NEW' || studentDetails?.penMatchResult === 'MATCH'"
text="Issue new PEN"
- @click-action="issueNewPen"
+ @click-action="togglePENRequestDialog"
/>
+
+
+
+
+
diff --git a/frontend/src/utils/common.js b/frontend/src/utils/common.js
index f628840d..ff40d60f 100644
--- a/frontend/src/utils/common.js
+++ b/frontend/src/utils/common.js
@@ -99,6 +99,24 @@ export function getDemogValidationResults(student) {
});
}
+export function constructPenMatchObjectFromSdcStudent(student) {
+ return {
+ pen: student.studentPen,
+ localID: student.localID,
+ surname: student.legalLastName,
+ givenName: student.legalFirstName,
+ middleName: student.legalMiddleNames,
+ usualSurname: student.usualLastName,
+ usualGiven: student.usualFirstName,
+ usualMiddleName: student.usualMiddleNames,
+ dob: student.dob,
+ sex: student.gender,
+ enrolledGradeCode: student.enrolledGradeCode,
+ postal: student.postalCode,
+ mincode: student.mincode
+ };
+}
+
/**
* this function will only return the below structure
String possibleMatchID;