Skip to content

Commit

Permalink
Merge pull request #1111 from folio-org/UIREQ-1036
Browse files Browse the repository at this point in the history
UIREQ-1036: Update requests error messages
  • Loading branch information
Dmitriy-Litvinenko authored Oct 10, 2023
2 parents e5015c5 + a597c78 commit e1b703f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* Create Jest/RTL test for RequestsFilters.js. Refs UIREQ-937.
* Add "itemId" parameter to "allowed-service-points" endpoint. Refs UIREQ-1030.
* Use current optional dependencies. Refs UIREQ-1031.
* Update Requests error messages. Refs UIREQ-1036.

## [8.0.2](https://github.com/folio-org/ui-requests/tree/v8.0.2) (2023-03-29)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v8.0.1...v8.0.2)
Expand Down
18 changes: 18 additions & 0 deletions src/routes/RequestsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,30 @@ export const REQUEST_ERROR_MESSAGE_CODE = {
REQUEST_NOT_ALLOWED_FOR_PATRON_TITLE_COMBINATION: 'REQUEST_NOT_ALLOWED_FOR_PATRON_TITLE_COMBINATION',
SERVICE_POINT_IS_NOT_PICKUP_LOCATION: 'SERVICE_POINT_IS_NOT_PICKUP_LOCATION',
REQUEST_PICKUP_SERVICE_POINT_IS_NOT_ALLOWED: 'REQUEST_PICKUP_SERVICE_POINT_IS_NOT_ALLOWED',
REQUEST_LEVEL_IS_NOT_ALLOWED: 'REQUEST_LEVEL_IS_NOT_ALLOWED',
FULFILLMENT_PREFERENCE_IS_NOT_ALLOWED: 'FULFILLMENT_PREFERENCE_IS_NOT_ALLOWED',
REQUESTER_ALREADY_HAS_LOAN_FOR_ONE_OF_INSTANCES_ITEMS: 'REQUESTER_ALREADY_HAS_LOAN_FOR_ONE_OF_INSTANCES_ITEMS',
REQUESTER_ALREADY_HAS_THIS_ITEM_ON_LOAN: 'REQUESTER_ALREADY_HAS_THIS_ITEM_ON_LOAN',
CANNOT_CREATE_PAGE_TLR_WITHOUT_ITEM_ID: 'CANNOT_CREATE_PAGE_TLR_WITHOUT_ITEM_ID',
HOLD_AND_RECALL_TLR_NOT_ALLOWED_PAGEABLE_AVAILABLE_ITEM_FOUND: 'HOLD_AND_RECALL_TLR_NOT_ALLOWED_PAGEABLE_AVAILABLE_ITEM_FOUND',
USER_CANNOT_BE_PROXY_FOR_THEMSELVES: 'USER_CANNOT_BE_PROXY_FOR_THEMSELVES',
ITEM_ALREADY_REQUESTED: 'ITEM_ALREADY_REQUESTED',
HOLD_SHELF_REQUESTS_REQUIRE_PICKUP_SERVICE_POINT: 'HOLD_SHELF_REQUESTS_REQUIRE_PICKUP_SERVICE_POINT',
};

export const REQUEST_ERROR_MESSAGE_TRANSLATION_KEYS = {
[REQUEST_ERROR_MESSAGE_CODE.REQUEST_NOT_ALLOWED_FOR_PATRON_TITLE_COMBINATION]: 'ui-requests.errors.requestNotAllowedForPatronTitleCombination',
[REQUEST_ERROR_MESSAGE_CODE.SERVICE_POINT_IS_NOT_PICKUP_LOCATION]: 'ui-requests.errors.servicePointIsNotPickupLocation',
[REQUEST_ERROR_MESSAGE_CODE.REQUEST_PICKUP_SERVICE_POINT_IS_NOT_ALLOWED]: 'ui-requests.errors.requestPickupServicePointIsNotAllowed',
[REQUEST_ERROR_MESSAGE_CODE.REQUEST_LEVEL_IS_NOT_ALLOWED]: 'ui-requests.errors.requestLevelIsNotAllowed',
[REQUEST_ERROR_MESSAGE_CODE.FULFILLMENT_PREFERENCE_IS_NOT_ALLOWED]: 'ui-requests.errors.fulfillmentPreferenceIsNotAllowed',
[REQUEST_ERROR_MESSAGE_CODE.REQUESTER_ALREADY_HAS_LOAN_FOR_ONE_OF_INSTANCES_ITEMS]: 'ui-requests.errors.requesterAlreadyHasLoanForOneOfInstancesItems',
[REQUEST_ERROR_MESSAGE_CODE.REQUESTER_ALREADY_HAS_THIS_ITEM_ON_LOAN]: 'ui-requests.errors.requesterAlreadyHasThisItemOnLoan',
[REQUEST_ERROR_MESSAGE_CODE.CANNOT_CREATE_PAGE_TLR_WITHOUT_ITEM_ID]: 'ui-requests.errors.cannotCreatePageTlrWithoutItemId',
[REQUEST_ERROR_MESSAGE_CODE.HOLD_AND_RECALL_TLR_NOT_ALLOWED_PAGEABLE_AVAILABLE_ITEM_FOUND]: 'ui-requests.errors.holdAndRecallTlrNotAllowedPageableAvailableItemFound',
[REQUEST_ERROR_MESSAGE_CODE.USER_CANNOT_BE_PROXY_FOR_THEMSELVES]: 'ui-requests.errors.userCannotBeProxyForThemselves',
[REQUEST_ERROR_MESSAGE_CODE.ITEM_ALREADY_REQUESTED]: 'ui-requests.errors.itemAlreadyRequested',
[REQUEST_ERROR_MESSAGE_CODE.HOLD_SHELF_REQUESTS_REQUIRE_PICKUP_SERVICE_POINT]: 'ui-requests.errors.holdShelfRequestsRequirePickupServicePoint',
};

export const getRequestErrorMessage = (error, intl) => {
Expand Down
9 changes: 9 additions & 0 deletions translations/ui-requests/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@
"errors.requestNotAllowedForPatronTitleCombination": "Hold requests are not allowed for this patron and title combination",
"errors.servicePointIsNotPickupLocation": "Service point is not a Pickup location",
"errors.requestPickupServicePointIsNotAllowed": "One or more Pickup locations are no longer available",
"errors.requestLevelIsNotAllowed": "Request level must be one of the following: \"Item\", \"Title\"",
"errors.fulfillmentPreferenceIsNotAllowed": "Fulfillment preference must be one of the following: Hold Shelf, Delivery",
"errors.requesterAlreadyHasLoanForOneOfInstancesItems": "This requester already has a loan for one of the instance's items",
"errors.requesterAlreadyHasThisItemOnLoan": "This requester already has this item on loan",
"errors.cannotCreatePageTlrWithoutItemId": "Cannot create a title level page request for this instance ID with no item ID",
"errors.holdAndRecallTlrNotAllowedPageableAvailableItemFound": "Hold/Recall title level request not allowed: pageable available item found for instance",
"errors.userCannotBeProxyForThemselves": "User cannot be proxy for themselves",
"errors.itemAlreadyRequested": "Not allowed to move title level page request to the same item",
"errors.holdShelfRequestsRequirePickupServicePoint": "Hold shelf fulfillment requests require a Pickup service point",

"actions.label": "Actions",
"actions.edit": "Edit",
Expand Down

0 comments on commit e1b703f

Please sign in to comment.