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

UIQM-709: LCCN duplication: Update the bib request query to include only the non-suppressed record in the search results. #743

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* [UIQM-698](https://issues.folio.org/browse/UIQM-698) Validate 006/007 field lengths.
* [UIQM-704](https://issues.folio.org/browse/UIQM-704) Linked fields - combine split fields before sending for validation.
* [UIQM-708](https://issues.folio.org/browse/UIQM-708) Change 007 Microforms type to allow 4 characters in RRR/RR field.
* [UIQM-709](https://issues.folio.org/browse/UIQM-709) LCCN duplication: Update the bib request query to include only the non-suppressed record in the search results.

## [8.0.1] (https://github.com/folio-org/ui-quick-marc/tree/v8.0.1) (2024-04-18)

Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useValidation/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ export const validateLccnDuplication = async ({
query: `(${lccnQuery})${idQuery}`,
};

if (marcType === MARC_TYPES.BIB) {
searchParams.query += ' not (staffSuppress=="true" and discoverySuppress=="true")';
}

const requests = {
[MARC_TYPES.BIB]: () => ky.get('search/instances', { searchParams }),
[MARC_TYPES.AUTHORITY]: () => ky.get('search/authorities', { searchParams }),
Expand Down
28 changes: 28 additions & 0 deletions src/hooks/useValidation/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,5 +781,33 @@ describe('validators', () => {
expect(rule.message).toHaveBeenCalled();
});
});

it('should call the bib record with the `staffSuppress` and `discoverySuppress` parameters', async () => {
const marcRecords = [{
tag: LEADER_TAG,
content: bibLeader,
}, {
tag: '010',
content: '$a test',
}];
const ky = {
get: jest.fn().mockResolvedValue({}),
};

await validators.validateLccnDuplication({
ky,
marcRecords,
marcType: MARC_TYPES.BIB,
action: QUICK_MARC_ACTIONS.EDIT,
duplicateLccnCheckingEnabled: true,
instanceId: 'instanceId-1',
}, rule);

expect(ky.get).toHaveBeenCalledWith('search/instances', {
searchParams: expect.objectContaining({
query: expect.stringContaining(' not (staffSuppress=="true" and discoverySuppress=="true")'),
}),
});
});
});
});
Loading