From 9c0f03b4fe668e61177d489435d7c1d7c1e6678a Mon Sep 17 00:00:00 2001 From: nielserik Date: Mon, 22 Apr 2024 18:59:57 +0200 Subject: [PATCH] CIRC-2019 Renewal by override, flag block on loan - For the client (UI) to know up-front to display override modal. (cherry picked from commit 94196ffdd291290f38d60ef63f6357751fada0bb) --- .../folio/circulation/domain/LoanRepresentation.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/folio/circulation/domain/LoanRepresentation.java b/src/main/java/org/folio/circulation/domain/LoanRepresentation.java index a1cd823d34..467dd334c4 100644 --- a/src/main/java/org/folio/circulation/domain/LoanRepresentation.java +++ b/src/main/java/org/folio/circulation/domain/LoanRepresentation.java @@ -6,6 +6,8 @@ import static org.folio.circulation.domain.representations.LoanProperties.LOST_ITEM_POLICY; import static org.folio.circulation.domain.representations.LoanProperties.OVERDUE_FINE_POLICY; import static org.folio.circulation.domain.representations.LoanProperties.PATRON_GROUP_ID_AT_CHECKOUT; +import static org.folio.circulation.domain.representations.LoanProperties.REMINDERS; + import static org.folio.circulation.support.json.JsonPropertyWriter.write; import java.lang.invoke.MethodHandles; @@ -59,6 +61,15 @@ public JsonObject extendedLoan(Loan loan) { extendedRepresentation.remove(BORROWER); } + if (loan.getOverdueFinePolicy().isReminderFeesPolicy() + && loan.getLastReminderFeeBilledNumber() != null) { + extendedRepresentation.getJsonObject(REMINDERS) + .put("renewalBlocked", + !loan.getOverdueFinePolicy() + .getRemindersPolicy().getAllowRenewalOfItemsWithReminderFees()); + } + + addPolicy(extendedRepresentation, loan.getLoanPolicy(), LOAN_POLICY); addPolicy(extendedRepresentation, loan.getOverdueFinePolicy(), OVERDUE_FINE_POLICY); addPolicy(extendedRepresentation, loan.getLostItemPolicy(), LOST_ITEM_POLICY);