Skip to content

Commit

Permalink
UICIRC-1077: Allow for override for reminder fees with renewal blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuklis committed Apr 19, 2024
1 parent 024b0c0 commit 7fb656a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const overridePossibleBlockName = [
OVERRIDE_BLOCKS_FIELDS.PATRON_BLOCK,
];

const isOverridableMessage = (error, data) => {
const isOverridableMessage = (error, loan, data) => {
const overridableBlockName = get(error, ['overridableBlock', 'name'], '');

if (overridePossibleBlockName.includes(overridableBlockName)) {
Expand All @@ -21,16 +21,22 @@ const isOverridableMessage = (error, data) => {
return true;
}

// allow for override for reminder fees with renewal blocked
// https://folio-org.atlassian.net/browse/UICIRC-1077
if (loan?.reminders?.renewalBlocked) {
return true;
}

return false;
};

export default (errors) => {
export default (errors, loan) => {
const data = {
overridable: false,
autoNewDueDate: true,
};

data.overridable = errors.every((error) => isOverridableMessage(error, data));

data.overridable = errors.every((error) => isOverridableMessage(error, loan, data));
data.overridable = true;
return data;
};
2 changes: 1 addition & 1 deletion src/components/Wrappers/withRenew.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const withRenew = WrappedComponent => class WithRenewComponent extends React.Com
renewFailure.push(loan);
errorMsg[loan.id] = {
...error,
...isOverridePossible(this.state.errors),
...isOverridePossible(this.state.errors, loan),
};
}
}
Expand Down

0 comments on commit 7fb656a

Please sign in to comment.