Skip to content

Commit

Permalink
UICHKIN-398 - Hide 'new fee/fine' menu item for dcb user
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed Nov 22, 2023
1 parent 8760b10 commit c67d9cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 9.1.0 IN PROGRESS
* Also support `feesfines` interface version `19.0`. Refs UICHKIN-401.
* Hide fee/fine action menu items when requester is virtual user. Refs UICHKIN-398.

## [9.0.1] (https://github.com/folio-org/ui-checkin/tree/v9.0.1) (2023-10-23)
[Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.0.0...v9.0.1)
Expand Down
4 changes: 3 additions & 1 deletion src/CheckIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import CheckInFooter from './components/CheckInFooter';
import {
convertToSlipData,
getCheckinSettings,
isDcbUser,
} from './util';

import styles from './checkin.css';
Expand Down Expand Up @@ -308,6 +309,7 @@ class CheckIn extends React.Component {
const isCheckInNote = element => element.noteType === 'Check in';
const checkinNotePresent = get(loan.item, ['circulationNotes'], []).some(isCheckInNote);
const loanOpenRequest = loan?.staffSlipContext?.request ?? {};
const isVirtualUser = isDcbUser(loan?.borrower);

const trigger = ({ getTriggerProps, triggerRef }) => (
<IconButton
Expand Down Expand Up @@ -398,7 +400,7 @@ class CheckIn extends React.Component {
mutator={this.props.mutator}
/>
</IfPermission>
{loan.userId &&
{loan.userId && !isVirtualUser &&
<Button
role="menuitem"
buttonStyle="dropdownItem"
Expand Down
4 changes: 4 additions & 0 deletions src/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ export const cancelFeeClaimReturned = {
};

export const MAX_RECORDS = '1000';

export const DCB_USER = {
lastName: 'DcbSystem',
};
4 changes: 3 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
includes,
} from 'lodash';

import { statuses } from './consts';
import { DCB_USER, statuses } from './consts';

export const escapeValue = (val) => {
if (typeof val === 'string' && val.startsWith('<Barcode>') && val.endsWith('</Barcode>')) {
Expand Down Expand Up @@ -164,4 +164,6 @@ export function shouldConfirmStatusModalBeShown(item) {
], item?.status?.name);
}

export const isDcbUser = (user) => user?.lastName === DCB_USER.lastName;

export default {};

0 comments on commit c67d9cf

Please sign in to comment.