From 02d4ceae9eed1c884591d063e35f619e78a24467 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 17 Jun 2025 16:47:38 +0200 Subject: [PATCH 1/4] frontside: hide shelf link if patron cant access location --- .../DocumentItems/DocumentItemBody.js | 77 +++++++++++-------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js b/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js index 99c86c386..186275cd7 100644 --- a/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js +++ b/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js @@ -34,46 +34,55 @@ export default class DocumentItemBody extends Component { identifiersToDisplayInFrontside, } = this.props; - return items.map((item) => ( - - - {item.barcode} - - - {shelfLink !== null - ? shelfLink(item, documentDetails) - : _get(item, 'shelf')} - + return items.map((item) => { + const showShelfLink = item.internal_location.accessible_by_patrons; - {identifiersToDisplayInFrontside.map((identifier) => ( + return ( + - { - item.identifiers?.find((entry) => { - return entry.scheme === identifier.key; - })?.value - } + {item.barcode} + + + {showShelfLink + ? shelfLink !== null + ? shelfLink(item, documentDetails) + : _get(item, 'shelf') + : 'Available on Request'} - ))} - {this.statusLabel(item)} - - {getDisplayVal('ITEMS.mediums', item.medium)} - - - {getDisplayVal( - 'ITEMS.circulationRestrictions', - item.circulation_restriction - )} - - - )); + {identifiersToDisplayInFrontside.map((identifier) => ( + + { + item.identifiers?.find((entry) => { + return entry.scheme === identifier.key; + })?.value + } + + ))} + + {this.statusLabel(item)} + + {getDisplayVal('ITEMS.mediums', item.medium)} + + + {getDisplayVal( + 'ITEMS.circulationRestrictions', + item.circulation_restriction + )} + + + ); + }); } } From 57d1ac81daca05fee51f4b97524c70f9745b0ac4 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 17 Jun 2025 16:47:38 +0200 Subject: [PATCH 2/4] backoffice: added input for internal location field accessible_by_patrons --- .../Location/InternalLocationEditor/schema.js | 5 +++++ .../Location/InternalLocationEditor/uiSchema.js | 11 +++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js b/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js index 8c8d226c4..b42d02abd 100644 --- a/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js +++ b/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js @@ -22,6 +22,11 @@ export const schema = () => { type: 'string', title: 'Physical location', }, + accessible_by_patrons: { + type: 'boolean', + title: 'Is this location accessible by patrons?', + default: true, + }, }, }; return _merge(_schema, invenioConfig.INTERNAL_LOCATIONS.editorSchema); diff --git a/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js b/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js index f569e7f0b..61f8af29c 100644 --- a/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js +++ b/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js @@ -10,14 +10,9 @@ export const uiSchema = (title) => { 'ui:widget': 'textarea', }, 'custom:grid': [ - { - name: 8, - location_pid: 8, - }, - { - physical_location: 8, - notes: 8, - }, + { name: 8, location_pid: 8 }, + { physical_location: 8, notes: 8 }, + { accessible_by_patrons: 8 }, ], 'custom:root': { 'custom:formTitle': title, From 82d8bad9d272b413f2a998577be0fbf426ad6272 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 17 Jun 2025 17:42:59 +0200 Subject: [PATCH 3/4] backoffice: add list column for internal location field accessible_by_patrons --- .../InternalLocationList/InternalLocationList.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js b/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js index 43d6d8987..e1849a3de 100644 --- a/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js +++ b/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js @@ -66,6 +66,14 @@ export default class InternalLocationList extends Component { { title: 'Name', field: 'metadata.name' }, { title: 'Physical location', field: 'metadata.physical_location' }, { title: 'Location e-mail', field: 'metadata.location.email' }, + { + title: 'Accessible by patrons', + field: 'metadata.accessible_by_patrons', + formatter: ({ row }) => + row.metadata.accessible_by_patrons ? ( + + ) : null, + }, { title: 'Actions', field: '', formatter: this.rowActions }, ]; From e03f711d5204a0dc7e145d36d891305c6a6648e4 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 25 Jun 2025 16:02:01 +0200 Subject: [PATCH 4/4] tests: add field accessible_by_patrons to internal location test data --- src/testData/internal_locations.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/testData/internal_locations.json b/src/testData/internal_locations.json index 781274b75..229097e4a 100644 --- a/src/testData/internal_locations.json +++ b/src/testData/internal_locations.json @@ -2,16 +2,19 @@ { "pid": "ilocid-1", "location_pid": "locid-1", - "name": "Internal Library 1" + "name": "Internal Library 1", + "accessible_by_patrons": true }, { "pid": "ilocid-2", "location_pid": "locid-1", - "name": "Internal Library 2" + "name": "Internal Library 2", + "accessible_by_patrons": true }, { "pid": "ilocid-3", "location_pid": "locid-1", - "name": "Unused Internal Library" + "name": "Unused Internal Library", + "accessible_by_patrons": true } ]