Changeset 423 for trunk/grails-app
- Timestamp:
- Mar 2, 2010, 5:22:14 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 added
- 2 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 -
trunk/grails-app/views/inventoryItemDetailed/search.gsp
r405 r423 55 55 <g:actionSubmit action="setSearchParamsMax" class="go" value="Update" /> 56 56 </span> 57 </td> 58 </tr> 59 60 <tr class="prop"> 61 <td valign="top" class="name"> 62 <label for="max">Inventory:</label> 63 </td> 64 <td valign="top" class="value"> 65 <g:link action="exportInventory"> 66 Export 67 </g:link> 68 / 69 <g:link action="exportInventoryTemplate"> 70 Template 71 </g:link> 72 / 73 <g:link action="exportInventoryExample"> 74 Example 75 </g:link> 76 / 77 <g:link action="importInventory"> 78 Import 79 </g:link> 57 80 </td> 58 81 </tr>
Note: See TracChangeset
for help on using the changeset viewer.