- Timestamp:
- Mar 25, 2010, 3:37:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r441 r453 232 232 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 233 233 redirect(action:search) 234 return235 234 } 236 235 … … 344 343 if(!result.error) { 345 344 flash.message = "Inventory Movement for ${result.inventoryMovementInstance.inventoryItem.name.encodeAsHTML()} created." 346 redirect(controller:"taskDetailed", action:"show", id: result.taskId) 347 } 348 else { 349 if(result.inventoryMovementInstance) { 350 def p = [:] 351 p.id = result.inventoryMovementInstance.inventoryItem?.id 352 def r = inventoryItemService.show(p) 353 354 def model = [ inventoryItemInstance: r.inventoryItemInstance, 355 inventoryMovementList: r.inventoryMovementList, 356 inventoryMovementListTotal: r.inventoryMovementListTotal, 357 inventoryMovementListMax: r.inventoryMovementListMax, 358 showTab: r.showTab] 359 360 model.inventoryMovementInstance = result.inventoryMovementInstance 361 362 render(view: 'show', model: model) 363 } 364 else { 365 flash.message = "Could not create inventory movement." 366 redirect(action:"search") 367 } 368 369 } 370 } 371 372 } 345 session.inventoryMovementTaskId = null 346 redirect(controller: "taskDetailed", 347 action: "show", 348 id: result.taskId, 349 params: [showTab: "showInventoryTab"]) 350 // Success. 351 return 352 } 353 354 // Prepare data for the show view. 355 def p = [:] 356 p.id = result.inventoryMovementInstance.inventoryItem?.id 357 def r = inventoryItemService.show(p) 358 359 // Render show view if data was successfully prepared. 360 if(!r.error) { 361 def model = [ inventoryItemInstance: r.inventoryItemInstance, 362 inventoryMovementList: r.inventoryMovementList, 363 inventoryMovementListTotal: r.inventoryMovementListTotal, 364 inventoryMovementListMax: r.inventoryMovementListMax, 365 inventoryItemPurchases: r.inventoryItemPurchases, 366 inventoryItemPurchasesTotal: r.inventoryItemPurchasesTotal, 367 showTab: r.showTab] 368 369 model.inventoryMovementInstance = result.inventoryMovementInstance // This will pass in the errors. 370 371 render(view: 'show', model: model) 372 return 373 } 374 375 // Could not prepare data for show view so doing the next best thing. 376 flash.errorMessage = g.message(code: r.error.code, args: r.error.args) 377 redirect(action:search) 378 379 } // useInventoryItem 380 381 /** 382 * Clear the use inventory item form in the show view. 383 * Accomplished by clearing the session variable and ajax. 384 */ 385 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser']) 386 def clearUseInventoryItem = { 387 session.inventoryMovementTaskId = null 388 render '' 389 } 390 391 } // end of class
Note: See TracChangeset
for help on using the changeset viewer.