Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tion into deployment

# Conflicts:
#	src/test/java/api/loans/ReminderFeeTests.java
  • Loading branch information
nielserik committed Apr 19, 2024
2 parents 20984d0 + 16718b2 commit 21489f6
Show file tree
Hide file tree
Showing 63 changed files with 1,003 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.REF }}
submodules: recursive
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare folio-tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-schema-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare folio-tools
Expand Down
52 changes: 52 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
## 24.2.1 2024-03-29

* Fix item details not fully populated when response contains more than 50 loans (CIRC-2059)

## 24.2.0 2024-03-21

* Update `feesfines` interface version to 19.0 (CIRC-1914)
* Logging in `org.folio.circulation.domain` package (CIRC-1813)
* Logging in circulation domain: D-L (CIRC-1909)
* Logging in circulation domain: M-U (CIRC-1910)
* Logging in circulation resources: O-T (CIRC-1896)
* Check-in/check-out for virtual item (CIRC-1907)
* Revert CIRC-1793 - remove support for token `loan.additionalInfo` in patron notices (CIRC-1942)
* Partial revert of CIRC-1527: bring back the correct delay for scheduled Aged To Lost Fee charging job (CIRC-1947)
* User primary address Country token fetches the Country code in the patron notices (CIRC-1931)
* Add support for Actual Cost Records properties lost in deserialization (CIRC-1769)
* Search-slips endpoint skeleton (CIRC-1932)
* Drools 7.74.1, xstream 1.4.20 (CIRC-1954)
* Fix Hold Shelf Expiration to respect Closed Library Dates (CIRC-1893)
* Add missing permission set for allowed service points endpoint (CIRC-1953)
* Upgrade to RMB 35.1.1, Vert.x 4.4.6, Log4j 2.20.0, mod-pubsub-client 2.11.2 (CIRC-1962)
* Fix test `OverduePeriodCalculatorServiceTest#getOpeningDayDurationTest`
* Request delivery staff slip: Requester country token information displayed wrong `stripes-components.countries` (CIRC-1955)
* Add field `loan.additionalInfo` to notice context (CIRC-1946)
* Asynchronously publish the ITEM_CHECKED_OUT event and ignore the result (CIRC-1950)
* Handle circulation rules update events (CIRC-1958)
* Skip account creation for reminders without a fee (CIRC-1970)
* Fix returning same error code for different error messages (CIRC-1961)
* Do not refresh circulation rules cache on GET and PUT `/circulation/rules` (CIRC-1977)
* Print `pendingLibraryCode` in DCB CheckIn Slips (CIRC-1981)
* The option to print picks slips doesn't activate (CIRC-1994)
* Reminders schedule around closed days (CIRC-1920)
* Use query-based endpoint for to fetch items by barcode (CIRC-1999)
* Pass tenant's timezone in the payload while creating circ log entries (CIRC-2006)
* Set `reminderFee` as loan action (CIRC-1984)
* Implementation for Search Slips API (CIRC-1933)
* Reschedule reminders on renewal (CIRC-1968)
* Unit tests for DCB changes (CIRC-1988)
* Optionally refuse renewal of items with reminders (CIRC-1923)
* Fix incorrect information in the Circulation log for the user barcode for In-house use (CIRC-1985)
* Returning DCB title in response if the item is a virtual item (CIRC-2029)
* Update reminder scheduler to handle printed notices (CIRC-1925)
* Combine items with related records during pagination process (CIRC-2018)
* Upgrade the Actions used by API-related GitHub Workflows (FOLIO-3944)
* Fix patron information in circulation log for check-ins that are not tied to a loan or request (CIRC-2045)
* Add new `displaySummarry` field to the Item schema (CIRC-2036)
* Do not send "Aged to lost" notice for closed loan (CIRC-1965)
* Reschedule reminder notices on recall (CIRC-2030)
* Reschedule reminder notices on due date change (CIRC-2005)
* Upgrade RMB to v35.2.0 (CIRC-2048)
* Support circulationItem for edge-patron requests for DCB Integration (CIRC-1966)

## 24.0.0 2023-10-11

* Fix NPE when user without barcode tries to check out an item that is already requested (CIRC-1550)
Expand Down
8 changes: 6 additions & 2 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,9 @@
"manualblocks.collection.get",
"pubsub.publish.post",
"automated-patron-blocks.collection.get",
"circulation-storage.loans-history.collection.get"
"circulation-storage.loans-history.collection.get",
"overdue-fines-policies.item.get",
"overdue-fines-policies.collection.get"
],
"visible": false
},
Expand Down Expand Up @@ -2291,7 +2293,9 @@
"pubsub.publish.post",
"configuration.entries.collection.get",
"patron-notice.post",
"circulation-storage.loans-history.collection.get"
"circulation-storage.loans-history.collection.get",
"overdue-fines-policies.item.get",
"overdue-fines-policies.collection.get"
],
"visible": false
},
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>mod-circulation</artifactId>
<groupId>org.folio</groupId>
<version>24.1.0-SNAPSHOT</version>
<version>24.2.2-SNAPSHOT</version>
<licenses>
<license>
<name>Apache License 2.0</name>
Expand All @@ -25,13 +25,13 @@
<properties>
<antlr4.version>4.11.1</antlr4.version>
<drools.version>7.74.1.Final</drools.version>
<rmb.version>35.1.1</rmb.version>
<vertx.version>4.4.6</vertx.version>
<log4j2.version>2.20.0</log4j2.version>
<rmb.version>35.2.0</rmb.version>
<vertx.version>4.5.5</vertx.version>
<log4j2.version>2.23.1</log4j2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<lombok.version>1.18.28</lombok.version>
<spring.version>5.3.24</spring.version>
<spring.version>6.1.5</spring.version>
<maven.site.plugin.version>3.9.1</maven.site.plugin.version>
</properties>

Expand Down
4 changes: 4 additions & 0 deletions ramls/check-in-by-barcode-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
"description": "Volume is intended for monographs when a multipart monograph (e.g. a biography of George Bernard Shaw in three volumes).",
"type": "string"
},
"displaySummary": {
"description": "Display summary about the item",
"type": "string"
},
"inTransitDestinationServicePointId": {
"description": "Service point an item is intended to be transited to (should only be present when in transit)",
"type": "string",
Expand Down
4 changes: 4 additions & 0 deletions ramls/items-in-transit.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"description": "The volume of the item",
"type": "string"
},
"displaySummary": {
"description": "Display summary about the item",
"type": "string"
},
"yearCaption": {
"description": "The year caption of the item",
"type": "array",
Expand Down
4 changes: 4 additions & 0 deletions ramls/loan.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
"type": "string",
"readonly": true
},
"displaySummary": {
"description": "Display summary about the item",
"type": "string"
},
"callNumberComponents": {
"description": "Elements of a full call number",
"$ref": "schema/call-number-components.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static class ActualCostRecordItem {
private final String volume;
private final String enumeration;
private final String chronology;
private final String displaySummary;
private final String copyNumber;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/folio/circulation/domain/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public String getChronology() {
return description.getChronology();
}

public String getDisplaySummary() {
return description.getDisplaySummary();
}

public String getNumberOfPieces() {
return description.getNumberOfPieces();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Value
public class ItemDescription {
public static ItemDescription unknown() {
return new ItemDescription(null, null, null, null, null, null, null, List.of());
return new ItemDescription(null, null, null, null, null, null, null, null, List.of());
}

String barcode;
Expand All @@ -19,5 +19,6 @@ public static ItemDescription unknown() {
String chronology;
String numberOfPieces;
String descriptionOfPieces;
String displaySummary;
@NonNull Collection<String> yearCaption;
}
2 changes: 2 additions & 0 deletions src/main/java/org/folio/circulation/domain/Loan.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ public Loan overrideRenewal(ZonedDateTime dueDate, String basedUponLoanPolicyId,
changeDueDate(dueDate);
incrementRenewalCount();
changeActionComment(actionComment);
resetReminders();

return this;
}
Expand Down Expand Up @@ -743,6 +744,7 @@ public FeeAmount getRemainingFeeFineAmount() {
public void closeLoanAsLostAndPaid() {
log.debug("closeLoanAsLostAndPaid:: ");
closeLoan(CLOSED_LOAN);
changeReturnDate(ClockUtil.getZonedDateTime());
changeItemStatusForItemAndLoan(ItemStatus.LOST_AND_PAID);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package org.folio.circulation.domain;

import static java.util.Objects.isNull;
import static org.folio.circulation.domain.representations.LoanProperties.BORROWER;
import static org.folio.circulation.domain.representations.LoanProperties.LOAN_POLICY;
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.*;
import static org.folio.circulation.support.json.JsonPropertyWriter.write;

import java.lang.invoke.MethodHandles;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.folio.circulation.domain.policy.Policy;
import org.folio.circulation.domain.policy.RemindersPolicy;
import org.folio.circulation.domain.representations.ItemSummaryRepresentation;
import org.folio.circulation.domain.representations.LoanProperties;
import org.folio.circulation.resources.context.RenewalContext;
Expand Down Expand Up @@ -59,6 +56,13 @@ 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);
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/org/folio/circulation/domain/MultipleRecords.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static java.util.stream.Stream.concat;
import static org.folio.circulation.support.json.JsonObjectArrayPropertyFetcher.mapToList;
import static org.folio.circulation.support.results.Result.succeeded;
import static org.folio.circulation.support.utils.LogUtil.mapAsString;
import static org.folio.circulation.support.utils.LogUtil.multipleRecordsAsString;

import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -79,6 +80,19 @@ public <R> MultipleRecords<T> combineRecords(MultipleRecords<R> otherRecords,
.firstOrElse(defaultOtherRecord)));
}

/**
* Avoids looping through the elements of otherRecords
*/
public <R> MultipleRecords<T> combineRecords(Map<String, R> otherRecordsMap,
Function<T, String> keyMapper, BiFunction<T, R, T> combiner, R defaultOtherRecord) {

log.debug("combineRecords:: parameters otherRecordsMap: {}",
() -> mapAsString(otherRecordsMap));

return mapRecords(mainRecord -> combiner.apply(mainRecord,
otherRecordsMap.getOrDefault(keyMapper.apply(mainRecord), defaultOtherRecord)));
}

public T firstOrNull() {
return firstOrElse(null);
}
Expand Down Expand Up @@ -137,7 +151,6 @@ public MultipleRecords<T> filter(Predicate<T> predicate) {
.collect(Collectors.toList());

final int numberOfFilteredOutRecords = totalRecords - filteredRecords.size();
log.info("filter:: totalRecords: {}", totalRecords);
return new MultipleRecords<>(filteredRecords, totalRecords - numberOfFilteredOutRecords);
}

Expand All @@ -155,6 +168,10 @@ public Collection<T> getRecords() {
return records;
}

public Map<String, T> getRecordsMap(Function<T, String> keyMapper) {
return records.stream().collect(Collectors.toMap(keyMapper, identity()));
}

public Integer getTotalRecords() {
return totalRecords;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private static void addItemProperties(JsonObject request, Item item) {
}
write(itemSummary, "volume", item.getVolume());
write(itemSummary, "chronology", item.getChronology());
write(itemSummary, "displaySummary", item.getDisplaySummary());

ItemStatus status = item.getStatus();
if (status != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ private static JsonObject createItemContext(Item item) {
.put("loanType", item.getLoanTypeName())
.put("copy", copyNumber)
.put("numberOfPieces", item.getNumberOfPieces())
.put("displaySummary", item.getDisplaySummary())
.put("descriptionOfPieces", item.getDescriptionOfPieces());

Location location = item.getLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ private boolean agedToLostNoticeIsNotRelevant(ScheduledNoticeContext context) {
ScheduledNotice notice = context.getNotice();
List<String> logMessages = new ArrayList<>();

if (!isRecurringAfterNotice(notice)) {
return false;
}

if (loan.hasItemWithAnyStatus(DECLARED_LOST, CLAIMED_RETURNED)) {
logMessages.add(
String.format("Recurring notice for item in status \"%s\"", loan.getItemStatus()));
Expand All @@ -201,10 +197,6 @@ private boolean agedToLostNoticeIsNotRelevant(ScheduledNoticeContext context) {
return true;
}

private static boolean isRecurringAfterNotice(ScheduledNotice notice) {
return notice.getConfiguration().isRecurring() && notice.getConfiguration().hasAfterTiming();
}

private static boolean nextRecurringNoticeIsNotRelevant(ScheduledNotice notice, Loan loan) {
ScheduledNoticeConfig noticeConfig = notice.getConfiguration();

Expand Down
Loading

0 comments on commit 21489f6

Please sign in to comment.