Index: CHANGELOG.md =================================================================== diff -u -N -r05a4460ac17295a03a19ca00b760aad8fc1f2db5 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- CHANGELOG.md (.../CHANGELOG.md) (revision 05a4460ac17295a03a19ca00b760aad8fc1f2db5) +++ CHANGELOG.md (.../CHANGELOG.md) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -1,3 +1,9 @@ +2.1.1 / WIP +================== + +Improvements: +* [OLMIS-7430](https://openlmis.atlassian.net/browse/OLMIS-7430): Add logic to filter all inactive and active items on physical inventory and stock on hand pages + 2.1.0 / 2021-10-28 ================== Index: src/stock-card-summary-list/stock-card-summary-list.controller.js =================================================================== diff -u -N -r5f03d718bc2f11da660f6432f0bae9f5ad19bfd7 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-card-summary-list/stock-card-summary-list.controller.js (.../stock-card-summary-list.controller.js) (revision 5f03d718bc2f11da660f6432f0bae9f5ad19bfd7) +++ src/stock-card-summary-list/stock-card-summary-list.controller.js (.../stock-card-summary-list.controller.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -30,17 +30,18 @@ controller.$inject = [ 'loadingModalService', '$state', '$stateParams', 'StockCardSummaryRepositoryImpl', 'stockCardSummaries', - 'offlineService', '$scope' + 'offlineService', '$scope', 'STOCKCARD_STATUS', 'messageService' ]; function controller(loadingModalService, $state, $stateParams, StockCardSummaryRepositoryImpl, stockCardSummaries, - offlineService, $scope) { + offlineService, $scope, STOCKCARD_STATUS, messageService) { var vm = this; vm.$onInit = onInit; vm.loadStockCardSummaries = loadStockCardSummaries; vm.viewSingleCard = viewSingleCard; vm.print = print; + vm.search = search; vm.offline = offlineService.isOffline; vm.goToPendingOfflineEventsPage = goToPendingOfflineEventsPage; @@ -67,6 +68,43 @@ vm.displayStockCardSummaries = undefined; /** + * @ngdoc property + * @propertyOf stock-card-summary-list.controller:StockCardSummaryListController + * @name stockCardStatus + * @type {String} + * + * @description + * Holds stack cards status. + */ + vm.stockCardStatus = $stateParams.active; + + /** + * @ngdoc property + * @propertyOf stock-card-summary-list.controller:StockCardSummaryListController + * @name stockCardStatuses + * @type {Object} + * + * @description + * Holds list of Stock Card statuses. + */ + vm.stockCardStatuses = STOCKCARD_STATUS; + + /** + * @ngdoc method + * @methodOf stock-card-summary-list.controller:StockCardSummaryListController + * @name getStockCardStatusDisplay + * + * @description + * Returns Stock Card status display. + * + * @param {String} status Stock Card status + * @return {String} Stock Card status display name + */ + vm.getStockCardStatusDisplay = function(status) { + return messageService.get(STOCKCARD_STATUS.$getDisplayName(status)); + }; + + /** * @ngdoc method * @methodOf stock-card-summary-list.controller:StockCardSummaryListController * @name getStockSummaries @@ -138,6 +176,27 @@ /** * @ngdoc method * @methodOf stock-card-summary-list.controller:StockCardSummaryListController + * @name search + * + * @description + * It searches from the total line items with given stockCardStatus. + * If stockCardStatus are empty then all line items will be shown. + */ + function search() { + var stateParams = angular.copy($stateParams); + + stateParams.facility = vm.facility.id; + stateParams.program = vm.program.id; + stateParams.supervised = vm.isSupervised; + stateParams.active = vm.stockCardStatus; + $state.go('openlmis.stockmanagement.stockCardSummaries', stateParams, { + reload: true + }); + } + + /** + * @ngdoc method + * @methodOf stock-card-summary-list.controller:StockCardSummaryListController * @name goToPendingOfflineEventsPage * * @description @@ -146,5 +205,6 @@ function goToPendingOfflineEventsPage() { $state.go('openlmis.pendingOfflineEvents'); } + } })(); Index: src/stock-card-summary-list/stock-card-summary-list.html =================================================================== diff -u -N -r5f03d718bc2f11da660f6432f0bae9f5ad19bfd7 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-card-summary-list/stock-card-summary-list.html (.../stock-card-summary-list.html) (revision 5f03d718bc2f11da660f6432f0bae9f5ad19bfd7) +++ src/stock-card-summary-list/stock-card-summary-list.html (.../stock-card-summary-list.html) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -20,6 +20,15 @@
+
+
+ + + +
+
+ @@ -51,6 +58,7 @@ + @@ -81,8 +89,12 @@ reasons="vm.reasons" ng-change="vm.checkUnaccountedStockAdjustments(lineItem)" /> - + +
Index: src/stock-card-summary-list/stock-card-summary-list.routes.js =================================================================== diff -u -N -rd5e3c65eb1f69267d98b64ddb27f70008c031340 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-card-summary-list/stock-card-summary-list.routes.js (.../stock-card-summary-list.routes.js) (revision d5e3c65eb1f69267d98b64ddb27f70008c031340) +++ src/stock-card-summary-list/stock-card-summary-list.routes.js (.../stock-card-summary-list.routes.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -26,7 +26,7 @@ function routes($stateProvider, STOCKMANAGEMENT_RIGHTS) { $stateProvider.state('openlmis.stockmanagement.stockCardSummaries', { isOffline: true, - url: '/stockCardSummaries?facility&program&supervised&page&size', + url: '/stockCardSummaries?facility&program&supervised&page&size&active', label: 'stockCardSummaryList.stockOnHand', priority: 1, showInNavigation: true, Index: src/stock-card-summary/stock-card-summary-repository-impl.js =================================================================== diff -u -N -rb792f9e1a86a892f3b5dd4463d5bfd5c5fb27065 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-card-summary/stock-card-summary-repository-impl.js (.../stock-card-summary-repository-impl.js) (revision b792f9e1a86a892f3b5dd4463d5bfd5c5fb27065) +++ src/stock-card-summary/stock-card-summary-repository-impl.js (.../stock-card-summary-repository-impl.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -120,13 +120,13 @@ lotPage = responses[1]; return combineResponses(stockCardSummariesPage, orderablePage.content, - lotPage.content); + lotPage.content, params); }); }); }); } - function combineResponses(stockCardSummariesPage, orderables, lots) { + function combineResponses(stockCardSummariesPage, orderables, lots, params) { stockCardSummariesPage.content.forEach(function(summary) { summary.orderable = getObjectForReference(orderables, summary.orderable); @@ -140,7 +140,12 @@ } }); }); + if (params.active) { + stockCardSummariesPage.content = filterStockCardSummariesByActiveParam(stockCardSummariesPage.content, + params.active); + } + return stockCardSummariesPage; } @@ -190,5 +195,19 @@ return items; }, []); } + + function filterStockCardSummariesByActiveParam(stockCardSummariesPage, active) { + return _.filter(stockCardSummariesPage, function(summary) { + summary.canFulfillForMe = _.filter(summary.canFulfillForMe, function(item) { + if (item.active === true && active === 'ACTIVE') { + return item; + } + if (summary.active === false && active === 'INACTIVE') { + return item; + } + }); + return summary; + }, []); + } } })(); Index: src/stock-physical-inventory-draft/messages_en.json =================================================================== diff -u -N -r195ebb7e3a95859748b5cf91e924f034cddd1f75 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory-draft/messages_en.json (.../messages_en.json) (revision 195ebb7e3a95859748b5cf91e924f034cddd1f75) +++ src/stock-physical-inventory-draft/messages_en.json (.../messages_en.json) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -25,10 +25,14 @@ "stockPhysicalInventoryDraft.submitInvalid": "Physical inventory has invalid line items", "stockPhysicalInventoryDraft.VVMStatus": "VVM Status", "stockPhysicalInventoryDraft.selectStatus": "Select Status", + "stockPhysicalInventoryDraft.status": "Status of item", + "stockPhysicalInventoryDraft.statusActive": "Active", + "stockPhysicalInventoryDraft.statusInactive": "Inactive", "stockPhysicalInventoryDraft.reasons": "Reasons", "stockPhysicalInventoryDraft.lineItemHasUnaccountedValues": "${num} unaccounted quantities", "stockPhysicalInventoryDraft.printModal.label": "Print this physical inventory?", "stockPhysicalInventoryDraft.printModal.yes": "Print", "stockPhysicalInventoryDraft.printModal.no": "No", + "stockPhysicalInventoryDraft.hide": "Hide", "stockPhysicalInventoryDraft.unaccountedQuantity": "Unaccounted Quantity" } Index: src/stock-physical-inventory-draft/physical-inventory-draft.controller.js =================================================================== diff -u -N -r5c9a22934e360e1b8aa5aad0982fbf6548ecdcf5 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory-draft/physical-inventory-draft.controller.js (.../physical-inventory-draft.controller.js) (revision 5c9a22934e360e1b8aa5aad0982fbf6548ecdcf5) +++ src/stock-physical-inventory-draft/physical-inventory-draft.controller.js (.../physical-inventory-draft.controller.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -34,7 +34,7 @@ 'displayLineItemsGroup', 'confirmService', 'physicalInventoryService', 'MAX_INTEGER_VALUE', 'VVM_STATUS', 'reasons', 'stockReasonsCalculations', 'loadingModalService', '$window', 'stockmanagementUrlFactory', 'accessTokenFactory', 'orderableGroupService', '$filter', '$q', - 'offlineService', 'localStorageFactory', 'physicalInventoryDraftCacheService']; + 'offlineService', 'localStorageFactory', 'physicalInventoryDraftCacheService', 'STOCKCARD_STATUS']; function controller($scope, $state, $stateParams, addProductsModalService, messageService, physicalInventoryFactory, notificationService, alertService, @@ -43,7 +43,7 @@ reasons, stockReasonsCalculations, loadingModalService, $window, stockmanagementUrlFactory, accessTokenFactory, orderableGroupService, $filter, $q, offlineService, localStorageFactory, - physicalInventoryDraftCacheService) { + physicalInventoryDraftCacheService, STOCKCARD_STATUS) { var vm = this; @@ -107,6 +107,28 @@ /** * @ngdoc property * @propertyOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController + * @name stockCardStatus + * @type {String} + * + * @description + * Holds stack cards status. + */ + vm.stockCardStatus = $stateParams.active; + + /** + * @ngdoc property + * @propertyOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController + * @name stockCardStatuses + * @type {Object} + * + * @description + * Holds list of Stock Card statuses. + */ + vm.stockCardStatuses = STOCKCARD_STATUS; + + /** + * @ngdoc property + * @propertyOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController * @name vvmStatuses * @type {Object} * @@ -186,6 +208,21 @@ }; /** + * @ngdoc method + * @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController + * @name getStockCardStatusDisplay + * + * @description + * Returns Stock Card status display. + * + * @param {String} status Stock Card status + * @return {String} Stock Card status display name + */ + vm.getStockCardStatusDisplay = function(status) { + return messageService.get(STOCKCARD_STATUS.$getDisplayName(status)); + }; + + /** * @ngdoc method * @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController * @name addProducts @@ -248,12 +285,13 @@ * @name search * * @description - * It searches from the total line items with given keyword. If keyword is empty then all line - * items will be shown. + * It searches from the total line items with given keyword and/or stockCardStatus. + * If keyword and stockCardStatus are empty then all line items will be shown. */ vm.search = function() { $stateParams.page = 0; $stateParams.keyword = vm.keyword; + $stateParams.active = vm.stockCardStatus, $stateParams.program = vm.program; $stateParams.facility = vm.facility; $stateParams.noReload = true; Index: src/stock-physical-inventory-draft/physical-inventory-draft.html =================================================================== diff -u -N -r3a1e9baa85902ef1905174e93b8e56624566299a -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory-draft/physical-inventory-draft.html (.../physical-inventory-draft.html) (revision 3a1e9baa85902ef1905174e93b8e56624566299a) +++ src/stock-physical-inventory-draft/physical-inventory-draft.html (.../physical-inventory-draft.html) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -3,10 +3,16 @@
-
- - - + +
+ + + + + +
{{'stockPhysicalInventoryDraft.VVMStatus' | message}}
{{'stockPhysicalInventoryDraft.reasons' | message}} {{'stockPhysicalInventoryDraft.unaccountedQuantity' | message}}
{{lineItems.length > 1 ? '' : lineItem.orderable.productCode}} {{lineItem.unaccountedQuantity}} + +
Index: src/stock-physical-inventory-draft/physical-inventory-draft.routes.js =================================================================== diff -u -N -r195ebb7e3a95859748b5cf91e924f034cddd1f75 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory-draft/physical-inventory-draft.routes.js (.../physical-inventory-draft.routes.js) (revision 195ebb7e3a95859748b5cf91e924f034cddd1f75) +++ src/stock-physical-inventory-draft/physical-inventory-draft.routes.js (.../physical-inventory-draft.routes.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -25,7 +25,7 @@ function routes($stateProvider, STOCKMANAGEMENT_RIGHTS) { $stateProvider.state('openlmis.stockmanagement.physicalInventory.draft', { - url: '/:id?keyword&page&size', + url: '/:id?keyword&active&page&size', isOffline: true, views: { '@openlmis': { @@ -74,7 +74,8 @@ }; return paginationService.registerList(validator, $stateParams, function() { - var searchResult = physicalInventoryService.search($stateParams.keyword, draft.lineItems); + var searchResult = physicalInventoryService.search($stateParams.keyword, + draft.lineItems, $stateParams.active); var lineItems = $filter('orderBy')(searchResult, 'orderable.productCode'); var groups = _.chain(lineItems).filter(function(item) { Index: src/stock-physical-inventory-draft/stockcard-statuses.constant.js =================================================================== diff -u -N --- src/stock-physical-inventory-draft/stockcard-statuses.constant.js (revision 0) +++ src/stock-physical-inventory-draft/stockcard-statuses.constant.js (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -0,0 +1,60 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc object + * @name stock-constants.STOCKCARD_STATUS + * + * @description + * This is constant for VVM statuses. + */ + angular + .module('stock-constants') + .constant('STOCKCARD_STATUS', status()); + + function status() { + var STOCKCARD_STATUS = { + ACTIVE: 'ACTIVE', + INACTIVE: 'INACTIVE', + $getDisplayName: getDisplayName + }; + return STOCKCARD_STATUS; + + /** + * @ngdoc method + * @methodOf stock-constants.STOCKCARD_STATUS + * @name getDisplayName + * + * @description + * Returns display name key for given StockCard status. + * + * @param {String} status StockCard status + * @return {String} StockCard status display name message key + */ + function getDisplayName(status) { + var displayName; + if (status === STOCKCARD_STATUS.ACTIVE) { + displayName = 'stockPhysicalInventoryDraft.statusActive'; + } else if (status === STOCKCARD_STATUS.INACTIVE) { + displayName = 'stockPhysicalInventoryDraft.statusInactive'; + } + return displayName; + } + } +})(); Index: src/stock-physical-inventory-draft/stockcard-statuses.constant.spec.js =================================================================== diff -u -N --- src/stock-physical-inventory-draft/stockcard-statuses.constant.spec.js (revision 0) +++ src/stock-physical-inventory-draft/stockcard-statuses.constant.spec.js (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -0,0 +1,39 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +describe('STOCKCARD_STATUS', function() { + + var STOCKCARD_STATUS; + + beforeEach(function() { + module('stock-constants'); + + inject(function($injector) { + STOCKCARD_STATUS = $injector.get('STOCKCARD_STATUS'); + }); + }); + + describe('getDisplayName', function() { + it('should get display name for ACTIVE status', function() { + expect(STOCKCARD_STATUS.$getDisplayName(STOCKCARD_STATUS.ACTIVE)) + .toBe('stockPhysicalInventoryDraft.statusActive'); + }); + + it('should get display name for INACTIVE status', function() { + expect(STOCKCARD_STATUS.$getDisplayName(STOCKCARD_STATUS.INACTIVE)) + .toBe('stockPhysicalInventoryDraft.statusInactive'); + }); + }); +}); Index: src/stock-physical-inventory/physical-inventory.factory.js =================================================================== diff -u -N -r195ebb7e3a95859748b5cf91e924f034cddd1f75 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory/physical-inventory.factory.js (.../physical-inventory.factory.js) (revision 195ebb7e3a95859748b5cf91e924f034cddd1f75) +++ src/stock-physical-inventory/physical-inventory.factory.js (.../physical-inventory.factory.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -134,6 +134,7 @@ if (draft.length === 0) { angular.forEach(summaries, function(summary) { draftToReturn.lineItems.push({ + active: summary.active, stockOnHand: summary.stockOnHand, lot: summary.lot, orderable: summary.orderable, @@ -224,14 +225,14 @@ angular.forEach(summaries, function(summary) { draftToReturn.lineItems.push({ + active: summary.active, stockOnHand: summary.stockOnHand, lot: summary.lot, orderable: summary.orderable, quantity: quantities[identityOf(summary)], vvmStatus: extraData[identityOf(summary)] ? extraData[identityOf(summary)].vvmStatus : null, stockAdjustments: getStockAdjustments(physicalInventory.lineItems, summary, physicalInventory.$modified) - }); }); } Index: src/stock-physical-inventory/physical-inventory.factory.spec.js =================================================================== diff -u -N -r5a0769bd03716dd9d38c76e051bb8edf1c9e02f5 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory/physical-inventory.factory.spec.js (.../physical-inventory.factory.spec.js) (revision 5a0769bd03716dd9d38c76e051bb8edf1c9e02f5) +++ src/stock-physical-inventory/physical-inventory.factory.spec.js (.../physical-inventory.factory.spec.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -55,7 +55,8 @@ id: 'orderable-1', code: 'orderable-code-1', name: 'orderable-name-1' - } + }, + active: true }, { stockOnHand: 2, @@ -67,7 +68,8 @@ id: 'orderable-2', code: 'orderable-code-2', name: 'orderable-name-2' - } + }, + active: true } ] } Index: src/stock-physical-inventory/physical-inventory.service.js =================================================================== diff -u -N -r195ebb7e3a95859748b5cf91e924f034cddd1f75 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory/physical-inventory.service.js (.../physical-inventory.service.js) (revision 195ebb7e3a95859748b5cf91e924f034cddd1f75) +++ src/stock-physical-inventory/physical-inventory.service.js (.../physical-inventory.service.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -30,11 +30,13 @@ service.$inject = [ '$resource', 'stockmanagementUrlFactory', '$filter', 'messageService', 'openlmisDateFilter', - 'productNameFilter', 'stockEventFactory', 'physicalInventoryDraftCacheService', 'offlineService' + 'productNameFilter', 'stockEventFactory', 'physicalInventoryDraftCacheService', 'offlineService', + 'STOCKCARD_STATUS' ]; function service($resource, stockmanagementUrlFactory, $filter, messageService, openlmisDateFilter, - productNameFilter, stockEventFactory, physicalInventoryDraftCacheService, offlineService) { + productNameFilter, stockEventFactory, physicalInventoryDraftCacheService, offlineService, + STOCKCARD_STATUS) { var resource = $resource(stockmanagementUrlFactory('/api/physicalInventories'), {}, { get: { @@ -137,9 +139,10 @@ * * @param {String} keyword keyword * @param {Array} lineItems all line items + * @param {boolean} active is active stock card * @return {Array} result search result */ - function search(keyword, lineItems) { + function search(keyword, lineItems, active) { var result = lineItems; var hasLot = _.any(lineItems, function(item) { return item.lot; @@ -164,6 +167,14 @@ }); }); } + if (!_.isEmpty(active)) { + result = _.filter(result, function(item) { + var translatedActive = getBooleanValueFromStockCardStatus(active); + if (translatedActive === item.active) { + return item; + } + }); + } return result; } @@ -224,6 +235,15 @@ }); } + function getBooleanValueFromStockCardStatus(stockCardStatus) { + if (stockCardStatus === STOCKCARD_STATUS.ACTIVE) { + return true; + } else if (stockCardStatus === STOCKCARD_STATUS.INACTIVE) { + return false; + } + return undefined; + } + function getLot(item, hasLot) { return item.lot ? item.lot.lotCode : Index: src/stock-physical-inventory/physical-inventory.service.spec.js =================================================================== diff -u -N -r5a0769bd03716dd9d38c76e051bb8edf1c9e02f5 -rd9b3afa0e7de8d58f012b3e9817dc246fbfefb66 --- src/stock-physical-inventory/physical-inventory.service.spec.js (.../physical-inventory.service.spec.js) (revision 5a0769bd03716dd9d38c76e051bb8edf1c9e02f5) +++ src/stock-physical-inventory/physical-inventory.service.spec.js (.../physical-inventory.service.spec.js) (revision d9b3afa0e7de8d58f012b3e9817dc246fbfefb66) @@ -163,46 +163,46 @@ }); describe('search', function() { - it('should get all line items when keyword is empty', function() { - expect(this.physicalInventoryService.search('', this.physicalInventoryLineItems)) + it('should get all line items when keyword and active is empty', function() { + expect(this.physicalInventoryService.search('', this.physicalInventoryLineItems, null)) .toEqual(this.physicalInventoryLineItems); }); it('should search by productCode', function() { - expect(this.physicalInventoryService.search('c2', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('c2', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[1], this.physicalInventoryLineItems[2]]); }); it('should search by productFullName', function() { - expect(this.physicalInventoryService.search('Streptococcus', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('Streptococcus', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[0]]); }); it('should search by stockOnHand', function() { - expect(this.physicalInventoryService.search('233', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('233', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[0]]); }); it('should search by quantity', function() { - expect(this.physicalInventoryService.search('4', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('4', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[1]]); }); it('should search by lotCode', function() { - expect(this.physicalInventoryService.search('L1', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('L1', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[2]]); }); it('should get all line items without lot info', function() { spyOn(this.messageService, 'get'); this.messageService.get.andReturn('No lot defined'); - expect(this.physicalInventoryService.search('No lot defined', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('No lot defined', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[0], this.physicalInventoryLineItems[1]]); }); it('should search by expirationDate', function() { - expect(this.physicalInventoryService.search('02/05/2017', this.physicalInventoryLineItems)) + expect(this.physicalInventoryService.search('02/05/2017', this.physicalInventoryLineItems, null)) .toEqual([this.physicalInventoryLineItems[2]]); }); });