Changeset 964
- Timestamp:
- Jul 19, 2012, 1:35:38 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/i18n/messages.properties
r874 r964 323 323 inventoryItemPurchase.delete.failure.received.exists=Could not delete, items have been received. 324 324 inventoryItemPurchase.delete.failure.payment.approved=Could not delete, payment has been approved. 325 inventoryItemPurchase.delete.failure.reverse.move=Could not delete, associated movement could not be reversed, insufficient items in stock perhaps? 325 326 inventoryItemPurchase.operation.not.permitted.on.inactive.or.obsolete.item=This operation is not permitted on an inactive or obsolete inventory item. 326 327 inventoryItemPurchase.costCodes.not.found=No cost codes found, a person needs to be assigned to a purchasing group that has cost codes. -
trunk/grails-app/services/InventoryMovementService.groovy
r631 r964 9 9 InventoryMovement.withTransaction { status -> 10 10 def result = [:] 11 params = params ?: [:] 11 12 12 13 def fail = { Map m -> … … 20 21 result.inventoryMovementInstance = InventoryMovement.lock(params.id) 21 22 22 23 if(!result.inventoryMovementInstance) 23 24 fail(code:"default.not.found") 24 25 -
trunk/grails-app/services/InventoryPurchaseService.groovy
r717 r964 194 194 } 195 195 196 def movementResult = inventoryMovementService.reverseMove(inventoryMovements[0]) 197 if(movementResult.error) 198 return fail(code:"inventoryMovement.quantity.insufficientItemsInStock") 196 if(inventoryMovements[0]) { 197 def movementResult = inventoryMovementService.reverseMove(inventoryMovements[0]) 198 if(movementResult.error) 199 return fail(code:"inventoryItemPurchase.delete.failure.reverse.move") 200 } 199 201 200 202 InventoryItemPurchase.withCriteria { … … 213 215 // Deletion of received already requires payment approved to be deleted. 214 216 if(purchaseTypeId == 1) { 217 215 218 def calcQuantities = calcQuantities(result.inventoryItemPurchaseInstance) 216 219 if(calcQuantities.totalReceived > 0) 220 return fail(code:"inventoryItemPurchase.delete.failure.received.exists") 221 222 // Cover the case of 0 ordered and received. 223 // Only possible to have Received Complete (3L) in this case and not B/order (2L). 224 def receivedExists = InventoryItemPurchase.withCriteria { 225 eq("inventoryItem", result.inventoryItemPurchaseInstance.inventoryItem) 226 eq("purchaseOrderNumber", result.inventoryItemPurchaseInstance.purchaseOrderNumber) 227 inventoryItemPurchaseType { 228 eq("id", 3L) // Received Complete. 229 } 230 } 231 232 if(receivedExists) 217 233 return fail(code:"inventoryItemPurchase.delete.failure.received.exists") 218 234 }
Note: See TracChangeset
for help on using the changeset viewer.