diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f54e2e3..c94d8918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Improvements: * [OLMIS-7954](https://openlmis.atlassian.net/browse/OLMIS-7954): Added fixes to improve performance on login page * [OLMIS-7991](https://openlmis.atlassian.net/browse/OLMIS-7991): Filtered out lots that not expired on Issue screeen +New functionalities that are backwards-compatible: +* [OLMIS-7987](https://openlmis.atlassian.net/browse/OLMIS-7987): Move Submit Requisitionless Orders functionalities from Angola to Core instance + Bug fixes: * [OLMIS-7748](https://openlmis.atlassian.net/browse/OLMIS-7748): Fix filtering 'includeInactive' on the Physical Inventory page diff --git a/src/stock-card-summary/stock-card-summary-repository-impl.js b/src/stock-card-summary/stock-card-summary-repository-impl.js index c9e73eea..d4f8a120 100644 --- a/src/stock-card-summary/stock-card-summary-repository-impl.js +++ b/src/stock-card-summary/stock-card-summary-repository-impl.js @@ -107,17 +107,24 @@ var lotIds = getLotIds(stockCardSummariesPage.content), orderableIds = getOrderableIds(stockCardSummariesPage.content); - return $q.all([ - orderableResource.query({ + var promisses = []; + + if (orderableIds.length > 0) { + promisses.push(orderableResource.query({ id: orderableIds - }), - lotService.query({ + })); + } + + if (lotIds.length > 0) { + promisses.push(lotService.query({ id: lotIds - }) - ]) + })); + } + + return $q.all(promisses) .then(function(responses) { - var orderablePage = responses[0], - lotPage = responses[1]; + var orderablePage = responses[0] || [], + lotPage = responses[1] || []; return combineResponses(stockCardSummariesPage, orderablePage.content, lotPage.content, params); @@ -145,7 +152,6 @@ stockCardSummariesPage.content, params.includeInactive === 'true' ); - } return stockCardSummariesPage; @@ -197,7 +203,6 @@ return items; }, []); } - /** * @param {StockCardSummary[]} stockCardSummariesPage * @param {Boolean} includeInactive @@ -207,7 +212,6 @@ if (includeInactive) { return stockCardSummariesPage; } - return _.filter(stockCardSummariesPage, function(summary) { summary.canFulfillForMe = _.filter(summary.canFulfillForMe, function(item) { return item.active === true; @@ -216,4 +220,4 @@ }, []); } } -})(); +})(); \ No newline at end of file