Changeset 423 for trunk/grails-app/controllers
- Timestamp:
- Mar 2, 2010, 5:22:14 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r408 r423 7 7 def filterService 8 8 def exportService 9 def inventoryCsvService 9 10 def inventoryItemService 10 11 def inventoryMovementService … … 30 31 } 31 32 forward(action: 'search', params: params) 33 } 34 35 /** 36 * Disaply the import view. 37 */ 38 def importInventory = { 39 } 40 41 /** 42 * Handle the import save. 43 */ 44 def importInventorySave = { 45 def result = inventoryCsvService.importInventory(request) 46 47 if(!result.error) { 48 flash.message = g.message(code: "inventory.import.success") 49 redirect(action:search) 50 return 51 } 52 53 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 54 redirect(action: importInventory) 55 } 56 57 /** 58 * Export a csv template. 59 * NOTE: IE has a 'validating' bug in dev mode that causes the export to take a long time! 60 * This does not appear to be a problem once deployed to Tomcat. 61 */ 62 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser']) 63 def exportInventoryTemplate = { 64 response.contentType = ConfigurationHolder.config.grails.mime.types["csv"] 65 response.setHeader("Content-disposition", "attachment; filename=InventoryTemplate.csv") 66 def s = inventoryCsvService.buildInventoryTemplate() 67 render s 68 } 69 70 /** 71 * Export a csv test file. 72 */ 73 def exportInventoryExample = { 74 response.contentType = ConfigurationHolder.config.grails.mime.types["csv"] 75 response.setHeader("Content-disposition", "attachment; filename=InventoryExample.csv") 76 def s = inventoryCsvService.buildInventoryExample() 77 render s 78 } 79 80 /** 81 * Export the entire inventory as a csv file. 82 */ 83 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser']) 84 def exportInventory = { 85 86 def inventoryItemList = InventoryItem.list() 87 88 response.contentType = ConfigurationHolder.config.grails.mime.types["csv"] 89 response.setHeader("Content-disposition", "attachment; filename=Inventory.csv") 90 def s = inventoryCsvService.buildInventory(inventoryItemList) 91 render s 32 92 } 33 93
Note: See TracChangeset
for help on using the changeset viewer.