Merged PR 2653: fix: preserve LPA questionnaire PDF metadata during submission
fix: preserve LPA questionnaire PDF metadata during submission Related work items: #25435
This commit is contained in:
@@ -33,6 +33,14 @@ export const buildSubmitEnrichedValues = ({
|
||||
representationCapacity,
|
||||
locale
|
||||
}) => {
|
||||
const isPopulatedText = (value) =>
|
||||
value !== null &&
|
||||
value !== undefined &&
|
||||
(typeof value !== "string" || value.trim() !== "");
|
||||
|
||||
const preserveExistingWhenMissing = (canonicalValue, existingValue) =>
|
||||
isPopulatedText(canonicalValue) ? canonicalValue : existingValue;
|
||||
|
||||
const buildSiteAddress = () => {
|
||||
const {
|
||||
pinswg_siteaddressline1,
|
||||
@@ -47,10 +55,12 @@ export const buildSubmitEnrichedValues = ({
|
||||
pinswg_siteaddresstown,
|
||||
pinswg_siteaddresspostcode
|
||||
]
|
||||
.filter(Boolean)
|
||||
.filter(isPopulatedText)
|
||||
.join(" ");
|
||||
};
|
||||
|
||||
const siteAddress = buildSiteAddress();
|
||||
|
||||
return {
|
||||
...formValues,
|
||||
containerID: accountDetails.containerID,
|
||||
@@ -58,7 +68,10 @@ export const buildSubmitEnrichedValues = ({
|
||||
incidentID:
|
||||
caseReferenceObj.incidentid ||
|
||||
caseReferenceObj.repDetails.incidentid,
|
||||
caseRef: caseReferenceObj.ticketnumber,
|
||||
caseRef: preserveExistingWhenMissing(
|
||||
caseReferenceObj.ticketnumber,
|
||||
formValues.caseRef
|
||||
),
|
||||
casereference: caseReferenceObj.currentReference,
|
||||
pinswg_questionnaireduedate: detailsObj.pinswg_questionnaireduedate,
|
||||
pinswg_endofrepresentationperiod:
|
||||
@@ -72,12 +85,18 @@ export const buildSubmitEnrichedValues = ({
|
||||
firstname: accountDetails.firstname,
|
||||
lastname: accountDetails.lastname,
|
||||
emailAddress: accountDetails.emailaddress1,
|
||||
siteAddress: buildSiteAddress(),
|
||||
siteAddress: preserveExistingWhenMissing(
|
||||
siteAddress,
|
||||
formValues.siteAddress
|
||||
),
|
||||
pinswg_siteaddressline1: detailsObj.pinswg_siteaddressline1,
|
||||
pinswg_siteaddressline2: detailsObj.pinswg_siteaddressline2,
|
||||
pinswg_siteaddresstown: detailsObj.pinswg_siteaddresstown,
|
||||
pinswg_siteaddresspostcode: detailsObj.pinswg_siteaddresspostcode,
|
||||
pinswg_lpareference: resultsObj?.pinswg_lpareference,
|
||||
pinswg_lpareference: preserveExistingWhenMissing(
|
||||
resultsObj?.pinswg_lpareference,
|
||||
formValues.pinswg_lpareference
|
||||
),
|
||||
_pinswg_appellant_value: detailsObj._pinswg_appellant_value,
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||
detailsObj[
|
||||
|
||||
Reference in New Issue
Block a user