diff --git a/src/core_modules/capture-core-utils/validators/form/orgUnit.validator.js b/src/core_modules/capture-core-utils/validators/form/orgUnit.validator.js index 1dfe53b0ae..43b9a8d83e 100644 --- a/src/core_modules/capture-core-utils/validators/form/orgUnit.validator.js +++ b/src/core_modules/capture-core-utils/validators/form/orgUnit.validator.js @@ -9,11 +9,11 @@ type OrgUnitValue = { id: string, - displayName: string, + name: string, path: string, } export const isValidOrgUnit = (value: OrgUnitValue) => { - const valid = !!(value && value.id && value.displayName); + const valid = !!(value && value.id && value.name); return valid; }; diff --git a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js index 7946993a79..6c252f087b 100644 --- a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js +++ b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js @@ -13,7 +13,7 @@ const getStyles = () => ({ type OrgUnitValue = { id: string, - displayName: string, + name: string, path: string, } @@ -44,7 +44,7 @@ class SingleOrgUnitSelectFieldPlain extends React.Component { const { classes } = this.props; return (
- {selectedOrgUnit.displayName} + {selectedOrgUnit.name}
); } @@ -52,7 +52,7 @@ class SingleOrgUnitSelectFieldPlain extends React.Component { onSelectOrgUnit = (orgUnit: Object) => { this.props.onBlur({ id: orgUnit.id, - displayName: orgUnit.displayName, + name: orgUnit.displayName, path: orgUnit.path, }); } diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js index 7be6a4a07b..31317b08e5 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js @@ -15,7 +15,7 @@ import { } from '../../../NewRelationship/TeiRelationship/SearchResults/TeiRelationshipSearchResults.component'; import { ResultsPageSizeContext } from '../../../shared-contexts'; import { RegisterTei } from '../RegisterTei'; -import { useOrganisationUnit } from '../../../../../dataQueries'; +import { useCoreOrgUnit } from '../../../../../metadataRetrieval/coreOrgUnit'; export const TrackedEntityRelationshipsWrapper = ({ trackedEntityTypeId, @@ -29,7 +29,7 @@ export const TrackedEntityRelationshipsWrapper = ({ }: Props) => { const dispatch = useDispatch(); const { relationshipTypes, isError } = useTEIRelationshipsWidgetMetadata(); - const { orgUnit: initialOrgUnit } = useOrganisationUnit(orgUnitId, 'id,displayName,code'); + const { orgUnit: initialOrgUnit } = useCoreOrgUnit(orgUnitId); const onSelectFindMode = ({ findMode, relationshipConstraint }: OnSelectFindModeProps) => { dispatch(selectFindMode({