From 5ef9a9bc47a936f70d495e41153b820b93a2d1cf Mon Sep 17 00:00:00 2001 From: DominikNoga Date: Thu, 1 Aug 2024 15:12:38 +0200 Subject: [PATCH] OAM-286: Fixed unpack view --- .../adjustment-creation.controller.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/stock-adjustment-creation/adjustment-creation.controller.js b/src/stock-adjustment-creation/adjustment-creation.controller.js index e4bd4ec..555bca3 100644 --- a/src/stock-adjustment-creation/adjustment-creation.controller.js +++ b/src/stock-adjustment-creation/adjustment-creation.controller.js @@ -722,7 +722,7 @@ return lotPromises; } - function confirmSubmit() { + function onSubmit() { loadingModalService.open(); var addedLineItems = angular.copy(vm.addedLineItems); generateKitConstituentLineItem(addedLineItems); @@ -763,6 +763,16 @@ }); } + function confirmSubmit() { + try { + onSubmit(); + } catch (error) { + loadingModalService.close(); + console.error(error.message); + alertService.error('openlmisStateChangeError.internalApplicationError.message'); + } + } + function getLineItemsByDestinationMap(addedLineItems) { var addedLineItemsMap = {}; addedLineItems.forEach(function(lineItem) { @@ -1207,6 +1217,9 @@ // AO-804: Display product prices on Stock Issues, Adjustments and Receives Page function getProductPrice(lineItem) { + if (!lineItem.orderable.programs) { + return undefined; + } var programOrderable = lineItem.orderable.programs.find(function(programOrderable) { return programOrderable.programId === program.id; }); @@ -1251,7 +1264,7 @@ function getProductsWithPriceChanged(products) { return products.filter(function(product) { - return product.price !== getProductPrice(product); + return product.price && product.price !== getProductPrice(product); }); }