Skip to content

Commit

Permalink
Merge branch 'master' into MODORDERS-937
Browse files Browse the repository at this point in the history
  • Loading branch information
azizbekxm authored Oct 25, 2023
2 parents f3b436b + 9b90aef commit 7aa98ac
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 9 deletions.
75 changes: 73 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
## 12.7.0 - Unreleased
* [MODORDERS-908](https://issues.folio.org/browse/MODORDERS-908) - Obtain organisations with pagination
## 12.8.0 - Unreleased

## 12.7.0 - Released (Poppy R2 2023)

This release focused on fixing several bugs in rollover and implement new feature relate to POL or other parts

[Full Changelog](https://github.com/folio-org/mod-orders/compare/v12.6.0...v12.7.0)

### Stories

* [MODORDERS-927](https://issues.folio.org/browse/MODORDERS-927) - Implement interception and update of invalid ISBNs during the POL update process
* [MODORDERS-912](https://issues.folio.org/browse/MODORDERS-912) - Add uniqueness check for retrieving transactions
* [MODORDERS-907](https://issues.folio.org/browse/MODORDERS-647) - Use new orders-storage endpoint to update order lines in batch during rollover
* [MODORDERS-905](https://issues.folio.org/browse/MODORDERS-905) - Persist rollover failures per poLine
* [MODORDERS-904](https://issues.folio.org/browse/MODORDERS-904) - Added filtering by fundDistribution encumbrance presence
* [MODORDERS-903](https://issues.folio.org/browse/MODORDERS-903) - Updated composite order conversion
* [MODORDERS-899](https://issues.folio.org/browse/MODORDERS-899) - Update to Java 17 mod-orders
* [MODORDERS-887](https://issues.folio.org/browse/MODORDERS-887) - Changing interface version
* [MODORDERS-882](https://issues.folio.org/browse/MODORDERS-882) - Update the error message displayed when importer is not a member of the specified acq unit
* [MODORDERS-881](https://issues.folio.org/browse/MODORDERS-881) - Populate locations and material type for POLs when multiple Holdings/Items were created
* [MODORDERS-879](https://issues.folio.org/browse/MODORDERS-879) - Prevent creating an order using 2 different fiscal years with clear error message
* [MODORDERS-878](https://issues.folio.org/browse/MODORDERS-878) - Adjust prefix and suffix for generated poNumber
* [MODORDERS-876](https://issues.folio.org/browse/MODORDERS-876) - Adjust material type and locations from existing holdings and item
* [MODORDERS-871](https://issues.folio.org/browse/MODORDERS-871) - Finding holdings record during import open P/E mix orderLine
* [MODORDERS-865](https://issues.folio.org/browse/MODORDERS-865) - Rewrite the orders rollover interaction in an asynchronous way
* [MODORDERS-860](https://issues.folio.org/browse/MODORDERS-860) - Adjust POL "create inventory" field override
* [MODORDERS-859](https://issues.folio.org/browse/MODORDERS-859) - Release encumbrance when orderStatus is set to CLOSED
* [MODORDERS-859](https://issues.folio.org/browse/MODORDERS-859) - Receiving: added permission for transaction summaries
* [MODORDERS-858](https://issues.folio.org/browse/MODORDERS-858) - Increase a memory to Snapshots
* [MODORDERS-855](https://issues.folio.org/browse/MODORDERS-855) - fixed vertx semaphores
* [MODORDERS-828](https://issues.folio.org/browse/MODORDERS-825) - Update dependent raml-util
* [MODORDERS-786](https://issues.folio.org/browse/MODORDERS-786) - Upgrade di-utils to v1.11.0
* [MODORDERS-405](https://issues.folio.org/browse/MODORDERS-405) - Composite orders web API updates budget objects with invalid date updated values
* [MODORDERS-316](https://issues.folio.org/browse/MODORDERS-316) - Using new proxy endpoints for ledger rollover errors
* [MODORDERS-307](https://issues.folio.org/browse/MODORDERS-307) - Update dependency
* [MODORDERS-162](https://issues.folio.org/browse/MODORDERS-162) - Updated models
* [MODFIN-323](https://issues.folio.org/browse/MODFIN-323) - Delete unnecessary code
* [UIOR-1102](https://issues.folio.org/browse/UIOR-1102) - Ability to edit Ongoing order information of Open orders

### Bug Fixes

* [MODORDERS-929](https://issues.folio.org/browse/MODORDERS-929) - An error appears after rollover when open order/order line having two fund distributions related to different ledgers
* [MODORDERS-928](https://issues.folio.org/browse/MODORDERS-928) - Can not delete acquisition methods with Order settings "All" permission
* [MODORDERS-920](https://issues.folio.org/browse/MODORDERS-920) - An error appears after rollover when open order/order line having two fund distributions related to different ledgers
* [MODORDERS-915](https://issues.folio.org/browse/MODORDERS-915) - NPE in OrderReEncumberService.java:245
* [MODORDERS-913](https://issues.folio.org/browse/MODORDERS-913) - Encumbrance became "Release" when changing fund distribution in order with related paid invoice having NOT checked "Release encumbrance" option
* [MODORDERS-914](https://issues.folio.org/browse/MODORDERS-914) - A user with order create permission can not add suffix and prefix to the order
* [MODORDERS-908](https://issues.folio.org/browse/MODORDERS-908) - Cannot load cache for mapping organizations when importing Orders (Orchid CSP 5 Clone)
* [MODORDERS-902](https://issues.folio.org/browse/MODORDERS-902) - Allow user to fully edit location details when receiving workflow = Independent order and receipt quantity.
* [MODORDERS-901](https://issues.folio.org/browse/MODORDERS-901) - zero division fix
* [MODORDERS-894](https://issues.folio.org/browse/MODORDERS-894) - Adding fund distribution line in the POL breaks the order record. Can no longer open.
* [MODORDERS-890](https://issues.folio.org/browse/MODORDERS-890) - When using POL "Change instance" the product ID can be made invalid blocking Invoice approve and pay
* [MODORDERS-865](https://issues.folio.org/browse/MODORDERS-514) - fixed permissions and request routing
* [MODORDERS-863](https://issues.folio.org/browse/MODORDERS-863) - Error after importing open orders for the second time
* [MODORDERS-862](https://issues.folio.org/browse/MODORDERS-859) - Fixed receiving more than 15 pieces
* [MODORDERS-855](https://issues.folio.org/browse/MODORDERS-859) - fixed Future usage
* [MODORDERS-514](https://issues.folio.org/browse/MODORDERS-514) - Closing a composite order can fail silently when lines are included
* [MODORDERS-494](https://issues.folio.org/browse/MODORDERS-494) - Unexpected jump in POL number on 2 line PO
* [FAT-4999](https://issues.folio.org/browse/FAT-4999) - Added missing permission for check-in
* [FAT-4863](https://issues.folio.org/browse/FAT-4863) - fixed orders chunk counting
* [FAT-4844](https://issues.folio.org/browse/FAT-4844) - updated permissions

### Tech debt

* [MODORDERS-750](https://issues.folio.org/browse/MODORDERS-750) - Introduce Caffeine Cache for inventory entry types
* [MODORDERS-865](https://issues.folio.org/browse/MODORDERS-865) - added missed permission
* [MODORDERS-850](https://issues.folio.org/browse/MODORDERS-850) - Refactor inventoryManager in order to support caching

### Dependencies

* Bump `java version` from `11` to `17`
* Bump `data-import-utils` from `1.9.0` to `1.11.0`
* Bump `data-import-processing-core` from `4.0.1` to `4.1.0`

## 12.6.0 Orchid R1 2023 - Released
This release focused on replacing FolioVertxCompletableFuture usage refactoring, edit fund distributions with related invoices and orders import features
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.folio</groupId>
<artifactId>mod-orders</artifactId>
<version>12.7.0-SNAPSHOT</version>
<version>12.8.0-SNAPSHOT</version>

<name>Orders Business Logic</name>
<description>Business logic to manage orders in FOLIO</description>
Expand Down Expand Up @@ -180,7 +180,7 @@
<dependency>
<groupId>org.folio</groupId>
<artifactId>data-import-processing-core</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.rworsnop</groupId>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/folio/helper/CheckinHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static java.util.stream.Collectors.toList;
import static org.folio.orders.utils.HelperUtils.collectResultsOnSuccess;
import static org.folio.rest.core.exceptions.ErrorCodes.ITEM_UPDATE_FAILED;
import static org.folio.service.inventory.InventoryManager.ITEM_ACCESSION_NUMBER;
import static org.folio.service.inventory.InventoryManager.ITEM_BARCODE;
import static org.folio.service.inventory.InventoryManager.ITEM_CHRONOLOGY;
import static org.folio.service.inventory.InventoryManager.ITEM_DISCOVERY_SUPPRESS;
Expand Down Expand Up @@ -358,6 +359,9 @@ private Future<Void> checkinItem(JsonObject itemRecord, CheckInPiece checkinPiec
if (StringUtils.isNotEmpty(checkinPiece.getBarcode())) {
itemRecord.put(ITEM_BARCODE, checkinPiece.getBarcode());
}
if (StringUtils.isNotEmpty(checkinPiece.getAccessionNumber())) {
itemRecord.put(ITEM_ACCESSION_NUMBER, checkinPiece.getAccessionNumber());
}
if (StringUtils.isNotEmpty(checkinPiece.getCallNumber())) {
itemRecord.put(ITEM_LEVEL_CALL_NUMBER, checkinPiece.getCallNumber());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class InventoryManager {
public static final String HOLDING_SOURCE = "sourceId";
public static final String ITEM_HOLDINGS_RECORD_ID = "holdingsRecordId";
public static final String ITEM_BARCODE = "barcode";
public static final String ITEM_ACCESSION_NUMBER = "accessionNumber";
public static final String ITEM_LEVEL_CALL_NUMBER = "itemLevelCallNumber";
public static final String ITEM_STATUS = "status";
public static final String ITEM_STATUS_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public Future<EncumbrancesProcessingHolder> manageInvoiceRelation(EncumbrancesPr
validateInvoiceLineStatuses(invoiceLines);

if (CollectionUtils.isNotEmpty(forCreate) && CollectionUtils.isNotEmpty(forDelete)) {
List<String> encumbranceForDeleteIds = forDelete.stream().map(Transaction::getId).distinct().collect(Collectors.toList());
List<String> encumbranceForDeleteIds = forDelete.stream().map(Transaction::getId).distinct().toList();
String currency = encumbrancesProcessingHolder.getEncumbrancesForCreate().stream()
.map(EncumbranceRelationsHolder::getCurrency).findFirst().orElseThrow();

copyAmountsAndRecalculateNewEncumbrance(forCreate, forDelete, currency);
copyAmountsAndRecalculateNewEncumbrance(forCreate, forDelete, invoiceLines, currency);
return removeEncumbranceReferenceFromTransactions(encumbranceForDeleteIds, requestContext)
.map(encumbrancesProcessingHolder);
} else {
Expand Down Expand Up @@ -109,18 +109,23 @@ private static org.folio.rest.acq.model.invoice.FundDistribution convertToInvoic
.withDistributionType(org.folio.rest.acq.model.invoice.FundDistribution.DistributionType.fromValue(fundDistribution.getDistributionType().value()));
}

private void copyAmountsAndRecalculateNewEncumbrance(List<Transaction> forCreate, List<Transaction> forDelete, String currency) {
private void copyAmountsAndRecalculateNewEncumbrance(List<Transaction> forCreate, List<Transaction> forDelete, List<InvoiceLine> invoiceLines, String currency) {
double amountExpended = forDelete.stream().map(encumbrance -> encumbrance.getEncumbrance().getAmountExpended())
.map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
double amountAwaitingPayment = forDelete.stream().map(encumbrance -> encumbrance.getEncumbrance().getAmountAwaitingPayment())
.map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
boolean isReleaseEncumbranceEnabled = filterInvoiceLinesByStatuses(invoiceLines, List.of(InvoiceLine.InvoiceLineStatus.PAID))
.stream()
.anyMatch(InvoiceLine::getReleaseEncumbrance);

forCreate.stream().findFirst().ifPresent(transaction -> {
Encumbrance encumbrance = transaction.getEncumbrance();
double encumbranceAmount = HelperUtils.calculateEncumbranceEffectiveAmount(encumbrance.getInitialAmountEncumbered(),
amountExpended, amountAwaitingPayment, Monetary.getCurrency(currency));
var encumbranceStatus = isReleaseEncumbranceEnabled && encumbranceAmount == 0d ?
Encumbrance.Status.RELEASED : Encumbrance.Status.UNRELEASED;
transaction.withAmount(encumbranceAmount).withEncumbrance(encumbrance.withAmountExpended(amountExpended)
.withAmountAwaitingPayment(amountAwaitingPayment).withStatus(encumbrance.getStatus()));
.withAmountAwaitingPayment(amountAwaitingPayment).withStatus(encumbranceStatus));
});
}

Expand Down

0 comments on commit 7aa98ac

Please sign in to comment.