Changeset 177 for trunk/grails-app/controllers
- Timestamp:
- Nov 2, 2009, 1:17:03 PM (15 years ago)
- Location:
- trunk/grails-app/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryMovementDetailedController.groovy
r175 r177 2 2 3 3 class InventoryMovementDetailedController extends BaseController { 4 5 def inventoryMovementService 4 6 5 7 def index = { redirect(action:list,params:params) } … … 24 26 25 27 def delete = { 26 def inventoryMovementInstance = InventoryMovement.get( params.id ) 27 if(inventoryMovementInstance) { 28 try { 29 def taskId = inventoryMovementInstance.task?.id 30 inventoryMovementInstance.delete(flush:true) 31 flash.message = "InventoryMovement ${params.id} deleted" 32 redirect(controller:"taskDetailed", action:"show", id:taskId) 33 } 34 catch(org.springframework.dao.DataIntegrityViolationException e) { 35 flash.message = "InventoryMovement ${params.id} could not be deleted" 36 redirect(action:show,id:params.id) 37 } 28 def result = inventoryMovementService.reverseMove(params) 29 30 if(!result.error) { 31 flash.message = "InventoryMovement ${params.id} deleted" 32 redirect(controller:"taskDetailed", action:"show", id:result.taskId) 38 33 } 39 34 else { 40 flash.message = "InventoryMovement not found with id ${params.id}" 41 redirect(action:list) 35 if(result.inventoryMovementInstance) { 36 render(view:'show',model:[inventoryMovementInstance:result.inventoryMovementInstance]) 37 } 38 else { 39 flash.message = "Could not delete inventory movement." 40 redirect(controller:"taskDetailed", action:"search", id:result.taskId) 41 } 42 42 } 43 43 } … … 54 54 55 55 def save = { 56 def inventoryMovementInstance = new InventoryMovement(params) 57 if(!inventoryMovementInstance.hasErrors() && inventoryMovementInstance.save()) { 58 flash.message = "Inventory Movement for ${inventoryMovementInstance.inventoryItem.name} created." 59 redirect(controller:"taskDetailed", action:"show", id: params.task.id) 56 def result = inventoryMovementService.move(params) 57 58 if(!result.error) { 59 flash.message = "Inventory Movement for ${result.inventoryMovementInstance.inventoryItem.name} created." 60 redirect(controller:"taskDetailed", action:"show", id: result.taskId) 60 61 } 61 62 else { 62 render(view:'create',model:[inventoryMovementInstance:inventoryMovementInstance]) 63 if(result.inventoryMovementInstance) { 64 render(view:'create',model:[inventoryMovementInstance:result.inventoryMovementInstance]) 65 } 66 else { 67 flash.message = "Could not create inventory movement." 68 redirect(controller:"taskDetailed", action:"search", id:result.taskId) 69 } 70 63 71 } 64 72 } 73 65 74 } -
trunk/grails-app/controllers/InventoryMovementTypeController.groovy
r116 r177 27 27 if(inventoryMovementTypeInstance) { 28 28 try { 29 inventoryMovementTypeInstance.delete( )29 inventoryMovementTypeInstance.delete(flush:true) 30 30 flash.message = "InventoryMovementType ${params.id} deleted" 31 31 redirect(action:list) … … 77 77 else { 78 78 flash.message = "InventoryMovementType not found with id ${params.id}" 79 redirect(action: edit,id:params.id)79 redirect(action:list) 80 80 } 81 81 }
Note: See TracChangeset
for help on using the changeset viewer.