Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow information to be unspecified if reason is provided and box is … #192

Merged
merged 2 commits into from
Aug 28, 2024
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
37 changes: 27 additions & 10 deletions btr-api/src/btr_api/schemas/btr-bods/btr-bods-person.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,34 @@
"email": {
"type": "string",
"format": "email"
},
"missingInfoReason": {
"description": "An explanation for why certain details are omitted. required if things other than name are omitted",
"anyOf": [
{ "type": "string", "minLength": 1 },
{ "type": "null" }
]
}
},
"required": [
"statementID",
"statementType",
"personType",
"isComponent",
"publicationDetails",
"hasTaxNumber",
"email",
"nationalities",
"names"
"oneOf": [
{
"required": [
"statementID",
"statementType",
"personType",
"isComponent",
"publicationDetails",
"hasTaxNumber",
"email",
"nationalities",
"names"
]
},
{
"required": [
"names",
"missingInfoReason"
]
}
]
}
18 changes: 16 additions & 2 deletions btr-web/btr-main-app/components/person-info/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
{{ item.email }}
</div>
</div>
<div v-if="item.address" class="flex">
<div v-if="showAddress" class="flex">
<div>
<UIcon class="text-[20px]" name="i-mdi-email-outline" />
</div>
<BcrosAddressDisplay class="ml-1" :address="item.address" />
</div>
<div v-if="item.phoneNumber" class="flex">
<div v-if="item.phoneNumber && item.phoneNumber.number" class="flex">
<div>
<UIcon class="text-[20px]" name="i-mdi-phone" />
</div>
Expand Down Expand Up @@ -75,6 +75,20 @@ if (prop.item.isTaxResident !== undefined) {
: t('summaryTable.body.taxResidency.other')
}
const displayPhoneNumber = (num: string) => num.replace(/(\s{3})(\s{3})(\s{4})/, '($1) $2-$3')

const showAddress = computed(() => {
if (!prop.item.address) {
return false
}
let rv = prop.item.address.country && (prop.item.address.country.alpha_2 || prop.item.address.country.name)
rv = rv || prop.item.address.city
rv = rv || prop.item.address.line1
rv = rv || prop.item.address.locationDescription
rv = rv || prop.item.address.postalCode
rv = rv || prop.item.address.region
return rv
})

</script>

<style lang="scss" scoped>
Expand Down
13 changes: 12 additions & 1 deletion btr-web/btr-main-app/services/file-significant-individual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,20 @@ const getPersonAndOwnershipAndControlStatements = (sif: SignificantIndividualFil

const convertToBtrBodsForSubmit = (sif: SignificantIndividualFilingI): BtrFilingI => {
const businessDetails = getCurrentBusinessAsBtrBodsEntityI()

const { ownershipOrControlStatements, personStatements } = getPersonAndOwnershipAndControlStatements(sif)

// note that the api will receive empty strings and then fail validation
// as empty string is not null and not allowed on those fields.
// therefore this removes the empty strings to avoid that problem
for (const personS of personStatements) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fix for some UI situation ?
Why are we deleting keys from objects that are empty ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the api actually, because if the UI passes along '' many of the keys fail

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to add a comment here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment added

const k = Object.keys(personS)
for (let i = 0; i < k.length; i++) {
if ((typeof personS[k[i]] === 'string') && (personS[k[i]] === '')) {
delete personS[k[i]]
}
}
}

return {
noSignificantIndividualsExist: sif.noSignificantIndividualsExist,
businessIdentifier: sif.businessIdentifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export const getSIsFromBtrBodsSubmission = (submission: BtrFilingI): SiSchemaTyp
const oocs = _findOwnershipOrControlStatement(submission, person.statementID)
if (person && oocs) {
const si = _getSi(person, oocs, businessIdentifier)
if (si.effectiveDates.filter(date => !date.endDate).length === 0) {
const fullInfo = !si.couldNotProvideMissingInfo
if ((fullInfo) && (si.effectiveDates.filter(date => !date.endDate).length === 0)) {
// set previously ceased SIs to historical
si.ui.actions ??= []
si.ui.actions.push(FilingActionE.HISTORICAL)
Expand Down
Loading