Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Update css for fix problem visibility Circulation rules. Refs UICIRC-1311.
* *BREAKING* Migration from mod-config and mod-settings to mod-circulation. Refs UICIRC-1247.
* Update permissions after migration to mod-circulation. Refs UICIRC-1324.
* Fixed an issue where the value containing the previously selected option was not reset. Refs UICIRC-1317.

## [11.0.4](https://github.com/folio-org/ui-circulation/tree/v11.0.4) (2024-12-10)
[Full Changelog](https://github.com/folio-org/ui-circulation/compare/v11.0.3...v11.0.4)
Expand Down
4 changes: 3 additions & 1 deletion src/settings/CheckoutSettings/CheckoutSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export const normalize = ({
.filter(([_key, value]) => value === true)
.map(([key]) => key);

const selectedCustomFieldPatronIdentifiers = customFieldIdentifiers.map(i => i.value);
const selectedCustomFieldPatronIdentifiers = useCustomFieldsAsIdentifiers
? customFieldIdentifiers.map(i => i.value)
: [];

const prefPatronIdentifier = [
...selectedDefaultPatronIdentifiers,
Expand Down
50 changes: 50 additions & 0 deletions src/settings/CheckoutSettings/CheckoutSettings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,54 @@ describe('normalize', () => {
wildcardLookupEnabled: false,
});
});

it('should not include custom field identifiers when useCustomFieldsAsIdentifiers is false', () => {
const input = {
audioAlertsEnabled: true,
audioTheme: 'modern',
checkoutTimeout: false,
checkoutTimeoutDuration: '5',
identifiers: {
barcode: true,
custom: [{ value: 'customFields.cf1' }, { value: 'customFields.cf2' }],
},
useCustomFieldsAsIdentifiers: false,
wildcardLookupEnabled: true,
};

expect(normalize(input)).toEqual({
audioAlertsEnabled: true,
audioTheme: 'modern',
checkoutTimeout: false,
checkoutTimeoutDuration: 5,
prefPatronIdentifier: 'barcode',
useCustomFieldsAsIdentifiers: false,
wildcardLookupEnabled: true,
});
});

it('should include custom field identifiers when useCustomFieldsAsIdentifiers is true', () => {
const input = {
audioAlertsEnabled: true,
audioTheme: 'modern',
checkoutTimeout: false,
checkoutTimeoutDuration: '5',
identifiers: {
barcode: true,
custom: [{ value: 'customFields.cf1' }, { value: 'customFields.cf2' }],
},
useCustomFieldsAsIdentifiers: true,
wildcardLookupEnabled: true,
};

expect(normalize(input)).toEqual({
audioAlertsEnabled: true,
audioTheme: 'modern',
checkoutTimeout: false,
checkoutTimeoutDuration: 5,
prefPatronIdentifier: 'barcode,customFields.cf1,customFields.cf2',
useCustomFieldsAsIdentifiers: true,
wildcardLookupEnabled: true,
});
});
});