From af6986a4d7511272ecb688bf9977073fcf4f9481 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 7 Apr 2015 13:00:54 -0400 Subject: [PATCH] Removed adjust purchases option and added Return To Vendor Resolves #85, #84 --- app/inventory/adjust/controller.js | 7 +++---- app/inventory/adjust/template.hbs | 2 -- app/inventory/edit/controller.js | 33 ++++++++++++------------------ 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/app/inventory/adjust/controller.js b/app/inventory/adjust/controller.js index 8210b8cf4c..c4052b9117 100644 --- a/app/inventory/adjust/controller.js +++ b/app/inventory/adjust/controller.js @@ -2,10 +2,6 @@ import AbstractEditController from 'hospitalrun/controllers/abstract-edit-contro import Ember from "ember"; export default AbstractEditController.extend({ needs: 'inventory', - - adjustmentItemSet: function() { - this.set('adjustPurchases', true); - }.observes('adjustmentItem'), adjustmentTypes: [{ name: 'Add', @@ -13,6 +9,9 @@ export default AbstractEditController.extend({ }, { name: 'Remove', type: 'Adjustment (Remove)' + }, { + name: 'Return To Vendor', + type: 'Return To Vendor' }, { name: 'Write Off', type: 'Write Off' diff --git a/app/inventory/adjust/template.hbs b/app/inventory/adjust/template.hbs index 0c94fdad29..bca247201b 100644 --- a/app/inventory/adjust/template.hbs +++ b/app/inventory/adjust/template.hbs @@ -22,6 +22,4 @@
{{date-picker property="dateCompleted" label="Adjustment Date" class="col-sm-4"}}
- {{em-checkbox label="Adjust Purchases" property="adjustPurchases"}} - {{/em-form}} \ No newline at end of file diff --git a/app/inventory/edit/controller.js b/app/inventory/edit/controller.js index bbef2fdeb1..efc9f503f1 100644 --- a/app/inventory/edit/controller.js +++ b/app/inventory/edit/controller.js @@ -90,12 +90,11 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi actions: { adjustItems: function(inventoryLocation) { - var adjustPurchases = inventoryLocation.get('adjustPurchases'), - adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity')), + var adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity')), inventoryItem = this.get('model'), transactionType = inventoryLocation.get('transactionType'), request = this.get('store').createRecord('inv-request', { - adjustPurchases: adjustPurchases, + adjustPurchases: true, dateCompleted: inventoryLocation.get('dateCompleted'), inventoryItem: inventoryItem, quantity: adjustmentQuantity, @@ -104,21 +103,16 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi deliveryAisle: inventoryLocation.get('aisleLocation'), deliveryLocation: inventoryLocation.get('location') }); - request.set('inventoryLocations',[inventoryLocation]); - if (adjustPurchases) { - var increment = false; - if (transactionType === 'Adjustment (Add)') { - increment = true; - } - request.set('markAsConsumed',true); - //Make sure inventory item is resolved first. - request.get('inventoryItem').then(function() { - this.send('fulfillRequest', request, true, increment, true); - }.bind(this)); - } else { - this.adjustLocation(inventoryItem, inventoryLocation); - this._saveRequest(request); - } + request.set('inventoryLocations',[inventoryLocation]); + var increment = false; + if (transactionType === 'Adjustment (Add)') { + increment = true; + } + request.set('markAsConsumed',true); + //Make sure inventory item is resolved first. + request.get('inventoryItem').then(function() { + this.send('fulfillRequest', request, true, increment, true); + }.bind(this)); }, deletePurchase: function(purchase, deleteFromLocation, expire) { @@ -141,8 +135,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }, showAdjustment: function(inventoryLocation) { - inventoryLocation.setProperties({ - adjustPurchases: true, + inventoryLocation.setProperties({ dateCompleted: new Date(), adjustmentItem: this.get('model'), adjustmentQuantity: '',