Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ecs-tlr-feature
Browse files Browse the repository at this point in the history
# Conflicts:
#	descriptors/ModuleDescriptor-template.json
  • Loading branch information
OleksandrVidinieiev committed Nov 7, 2024
2 parents 7115a63 + c4ccae9 commit 52f1120
Show file tree
Hide file tree
Showing 25 changed files with 652 additions and 48 deletions.
34 changes: 31 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
## 24.3.0

* [CIRC-2156](https://folio-org.atlassian.net/browse/CIRC-2156) Upgrade "holdings-storage" to 8.0
## 24.3.0 2024-10-31

* Support floating collections (CIRC-2136)
* Correct permissions change in MODCAL-136 (MODCAL-136)
* Upgrade to RMB v35.3.0 (CIRC-2163)
* Add TLR Hold requests handling to the print slips logic (CIRC-2134)
* Add support for interface instance-storage 11.0 (CIRC-2153)
* Upgrade the API version in the ModuleDescriptor-template.json (CIRC-2156)
* Delete obsolete notes permission (CIRC-2154)
* Extend the loan representation with additional fields required for Due date receipt (CIRC-2144)
* Revert CIRC-2100 PR and rework for PrintEventDetail pagination, searching, and sorting (CIRC-2148)
* Allow specifying item location when creating title-level requests (CIRC-2141)
* Bypass pickup SP check for Delivery requests (CIRC-2122)
* Fetch print details while fetching request details based on CQL query (CIRC-2100)
* Error message - after service point changes from `yes` to `no` as Pickup location (CIRC-1980)
* Implement POST API (CIRC-2099)
* Add test case on enableRequestPrintDetailsSetting (CIRC-2096)
* Create API wrapping settings CRUD (CIRC-2111)
* Update error response status and schema for request creation (CIRC-2104)
* Update interface holdings-storage to version 7.0 (CIRC-2095)
* Add isDcb flag value in the loan event for Check-out (CIRC-2084)
* Sort allowed service points by name (CIRC-2094)
* Fix Kafka configuration (CIRC-2037)
* Fix empty template token, `chargeDate`, in reminder notices (CIRC-2077)
* Support override of renewal block due to reminders (CIRC-2019)
* Keep due date when it is within recall return interval (CIRC-2043)
* Ignore `Loan related fee/fine closed` events when loan is already closed (CIRC-2066)
* Apply alternate loan period when multiple requests are in fulfillment in progress (CIRC-2026)
* Add missing permissions (CIRC-2070)
* Set returnDate for lost loans (CIRC-2044)
* Fix item details not fully populated when response contains more than 50 loans (CIRC-2059)

## 24.2.0 2024-03-21

Expand Down
26 changes: 18 additions & 8 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
"methods": ["POST"],
"pathPattern": "/circulation/loans/{id}/change-due-date",
"permissionsRequired": [
"circulation.loans.change-due-date.post"
"circulation.loans.change-due-date.post",
"configuration.entries.collection.get"
],
"modulePermissions": [
"modperms.circulation.loans.change-due-date.post"
Expand Down Expand Up @@ -1151,7 +1152,8 @@
"accounts.item.post",
"feefineactions.item.post",
"circulation-storage.loans-history.collection.get",
"calendar.endpoint.dates.get"
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get"
],
"schedule": {
"cron": "1 0 * * *",
Expand Down Expand Up @@ -1797,6 +1799,8 @@
"proxiesfor.collection.get",
"patron-notice.post",
"configuration.entries.collection.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"mod-settings.entries.item.get",
"mod-settings.entries.collection.get",
"mod-settings.global.read.circulation",
Expand All @@ -1811,7 +1815,8 @@
"displayName" : "module permissions for one op",
"description" : "to reduce X-Okapi-Token size",
"subPermissions": [
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"circulation-storage.loans.item.post",
"circulation-storage.loans.item.get",
"circulation-storage.loans.collection.get",
Expand Down Expand Up @@ -1909,7 +1914,8 @@
"accounts.refund.post",
"accounts.cancel.post",
"configuration.entries.collection.get",
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"actual-cost-record-storage.actual-cost-records.collection.get",
"actual-cost-record-storage.actual-cost-records.item.get",
"actual-cost-fee-fine-cancel.post",
Expand Down Expand Up @@ -1948,7 +1954,8 @@
"users.collection.get",
"addresstypes.collection.get",
"proxiesfor.collection.get",
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"configuration.entries.collection.get",
"mod-settings.entries.item.get",
"mod-settings.entries.collection.get",
Expand Down Expand Up @@ -2133,7 +2140,8 @@
"usergroups.item.get",
"proxiesfor.collection.get",
"patron-notice.post",
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"scheduled-notice-storage.scheduled-notices.collection.delete",
"scheduled-notice-storage.scheduled-notices.item.post",
"configuration.entries.collection.get",
Expand Down Expand Up @@ -2192,7 +2200,8 @@
"displayName": "module permissions for one op",
"description": "to reduce X-Okapi-Token size",
"subPermissions": [
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"circulation-storage.loan-policies.item.get",
"circulation-storage.loans.item.get",
"circulation-storage.loans.item.put",
Expand Down Expand Up @@ -2302,7 +2311,8 @@
"usergroups.item.get",
"proxiesfor.collection.get",
"patron-notice.post",
"calendar.endpoint.dates.get",
"calendar.endpoint.calendars.surroundingOpenings.get",
"calendar.endpoint.calendars.allOpenings.get",
"configuration.entries.collection.get",
"mod-settings.entries.item.get",
"mod-settings.entries.collection.get",
Expand Down
2 changes: 1 addition & 1 deletion 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.3.0-SNAPSHOT</version>
<version>24.4.0-SNAPSHOT</version>
<licenses>
<license>
<name>Apache License 2.0</name>
Expand Down
49 changes: 40 additions & 9 deletions src/main/java/org/folio/circulation/domain/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class Item {
@Getter
private final String shelvingOrder;
@NonNull private final Location permanentLocation;

@Getter
private final Location floatDestinationLocation;
private final ServicePoint inTransitDestinationServicePoint;

private boolean changed;
Expand All @@ -57,7 +60,7 @@ public static Item from(JsonObject representation) {
}
public Item(String id, JsonObject itemRepresentation, Location effectiveLocation,
LastCheckIn lastCheckIn, CallNumberComponents callNumberComponents,
String shelvingOrder, Location permanentLocation,
String shelvingOrder, Location permanentLocation, Location floatDestinationLocation,
ServicePoint inTransitDestinationServicePoint, boolean changed,
Holdings holdings, Instance instance, MaterialType materialType,
LoanType loanType, ItemDescription description) {
Expand All @@ -69,6 +72,7 @@ public Item(String id, JsonObject itemRepresentation, Location effectiveLocation
this.callNumberComponents = callNumberComponents;
this.shelvingOrder = shelvingOrder;
this.permanentLocation = permanentLocation;
this.floatDestinationLocation = floatDestinationLocation;
this.inTransitDestinationServicePoint = inTransitDestinationServicePoint;
this.changed = changed;
this.holdings = holdings;
Expand Down Expand Up @@ -348,59 +352,86 @@ public String getPermanentLocationId() {
return firstNonBlank(permanentLocation.getId(), holdings.getPermanentLocationId());
}

public String getFloatDestinationLocationId() {
return floatDestinationLocation != null ? floatDestinationLocation.getId() : null;
}

public boolean canFloatThroughCheckInServicePoint() {
return getLocation() != null
&& getLocation().isFloatingCollection()
&& getFloatDestinationLocation() != null
&& getFloatDestinationLocation().getId() != null;
}

public Item withLocation(Location newLocation) {
return new Item(this.id, this.itemRepresentation, newLocation,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, description);
}

public Item withMaterialType(@NonNull MaterialType materialType) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, materialType, this.loanType, this.description);
}

public Item withHoldings(@NonNull Holdings holdings) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withInstance(@NonNull Instance instance) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, instance, this.materialType, this.loanType, this.description);
}

public Item withLoanType(@NonNull LoanType loanType) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, loanType, this.description);
}

public Item withLastCheckIn(@NonNull LastCheckIn lastCheckIn) {
return new Item(this.id, this.itemRepresentation, this.location,
lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withPermanentLocation(Location permanentLocation) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
permanentLocation, this.inTransitDestinationServicePoint, this.changed,
permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withFloatDestinationLocation(Location floatDestinationLocation) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withInTransitDestinationServicePoint(ServicePoint servicePoint) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, servicePoint, this.changed, this.holdings,
this.permanentLocation, this.floatDestinationLocation,
servicePoint, this.changed, this.holdings,
this.instance, this.materialType, this.loanType, this.description);
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/folio/circulation/domain/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Location {
String discoveryDisplayName;
@NonNull Collection<UUID> servicePointIds;
UUID primaryServicePointId;
Boolean isFloatingCollection;
@NonNull Institution institution;
@NonNull Campus campus;
@NonNull Library library;
Expand All @@ -27,6 +28,7 @@ public static Location unknown() {

public static Location unknown(String id) {
return new Location(id, null, null, null, List.of(), null,
false,
Institution.unknown(null), Campus.unknown(null), Library.unknown(null),
ServicePoint.unknown());
}
Expand Down Expand Up @@ -85,23 +87,31 @@ public ServicePoint getPrimaryServicePoint() {
return primaryServicePoint;
}

public boolean isFloatingCollection() {
return isFloatingCollection;
}

public Location withInstitution(Institution institution) {
return new Location(id, name, code, discoveryDisplayName, servicePointIds, primaryServicePointId,
isFloatingCollection,
institution, campus, library, primaryServicePoint);
}

public Location withCampus(Campus campus) {
return new Location(id, name, code, discoveryDisplayName, servicePointIds, primaryServicePointId,
isFloatingCollection,
institution, campus, library, primaryServicePoint);
}

public Location withLibrary(Library library) {
return new Location(id, name, code, discoveryDisplayName, servicePointIds, primaryServicePointId,
isFloatingCollection,
institution, campus, library, primaryServicePoint);
}

public Location withPrimaryServicePoint(ServicePoint servicePoint) {
return new Location(id, name, code, discoveryDisplayName, servicePointIds, primaryServicePointId,
isFloatingCollection,
institution, campus, library, servicePoint);
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/folio/circulation/domain/UpdateItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ private Result<Item> changeItemOnCheckIn(Item item, Request request, UUID checkI
return changeItemWithOutstandingRequest(item, request, checkInServicePointId);
} else {
if(Optional.ofNullable(item.getLocation())
.map(location -> location.homeLocationIsServedBy(checkInServicePointId))
.map(location ->
location.homeLocationIsServedBy(checkInServicePointId)
|| (item.canFloatThroughCheckInServicePoint()))
.orElse(false)) {
return succeeded(item.available());
}
else {
} else {
return succeeded(item.inTransitToHome());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.folio.circulation.domain.FeeFineAction;
import org.folio.circulation.domain.Instance;
import org.folio.circulation.domain.Item;
import org.folio.circulation.domain.ItemStatus;
import org.folio.circulation.domain.Loan;
import org.folio.circulation.domain.Location;
import org.folio.circulation.domain.Request;
Expand Down Expand Up @@ -213,7 +214,8 @@ private static JsonObject createItemContext(Item item) {
.put("displaySummary", item.getDisplaySummary())
.put("descriptionOfPieces", item.getDescriptionOfPieces());

Location location = item.getLocation();
Location location = (item.canFloatThroughCheckInServicePoint() && item.isInStatus(ItemStatus.AVAILABLE)) ?
item.getFloatDestinationLocation() : item.getLocation();

if (location != null) {
log.info("createItemContext:: location is not null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.folio.circulation.domain.Item;
import org.folio.circulation.domain.ItemStatus;
import org.folio.circulation.domain.Location;
import org.folio.circulation.domain.ServicePoint;

Expand Down Expand Up @@ -79,7 +80,10 @@ public JsonObject createItemSummary(Item item) {

final Location location = item.getLocation();

if (location != null) {
if (item.canFloatThroughCheckInServicePoint() && item.isInStatus(ItemStatus.AVAILABLE)) {
itemSummary.put("location", new JsonObject()
.put("name", item.getFloatDestinationLocation().getName()));
} else if (location != null) {
log.info("createItemSummary:: location is not null");
itemSummary.put("location", new JsonObject()
.put("name", location.getName()));
Expand Down
Loading

0 comments on commit 52f1120

Please sign in to comment.