- Timestamp:
- Nov 2, 2009, 1:17:03 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 1 added
- 12 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 } -
trunk/grails-app/domain/InventoryMovement.groovy
r175 r177 8 8 Date date = new Date() 9 9 10 // static belongsTo = [ inventoryItem]10 // static belongsTo = [] 11 11 12 12 static constraints = { -
trunk/grails-app/domain/InventoryMovementType.groovy
r116 r177 2 2 String name 3 3 String description = "" 4 boolean incrementsInventory = false 4 5 boolean isActive = true 5 6 6 7 static hasMany = [inventoryMovements: InventoryMovement] 7 8 8 9 static contstraints = { 9 10 name(maxSize:50,unique:true,blank:false) 10 11 description(maxSize:100) 12 incrementsInventory() 13 isActive() 11 14 } 12 15 -
trunk/grails-app/i18n/messages.properties
r175 r177 46 46 task.associatedAssets=Associated Assets 47 47 task.associatedAssets.help=These assets are to be associated with this task, but costs will not be assigned. 48 49 inventoryMovement.quantity.insufficientItemsInStock=Could not complete operation, insufficient items in stock. 50 inventoryMovement.inventoryItem.notFound=Inventory Item not found. 48 51 49 52 default.doesnt.match.message=Property [{0}] of class [{1}] with value [{2}] does not match the required pattern [{3}] -
trunk/grails-app/services/CreateDataService.groovy
r175 r177 708 708 709 709 // InventoryMovementType #1 710 inventoryMovementTypeInstance = new InventoryMovementType(name: "Used") 710 inventoryMovementTypeInstance = new InventoryMovementType(name: "Used", 711 incrementsInventory: false) 711 712 saveAndTest(inventoryMovementTypeInstance) 712 713 713 714 // InventoryMovementType #2 714 inventoryMovementTypeInstance = new InventoryMovementType(name: "Repaired") 715 inventoryMovementTypeInstance = new InventoryMovementType(name: "Repaired", 716 incrementsInventory: true) 715 717 saveAndTest(inventoryMovementTypeInstance) 716 718 717 719 // InventoryMovementType #3 718 inventoryMovementTypeInstance = new InventoryMovementType(name: "Purchased") 720 inventoryMovementTypeInstance = new InventoryMovementType(name: "Purchase Received", 721 incrementsInventory: true) 722 saveAndTest(inventoryMovementTypeInstance) 723 724 // InventoryMovementType #4 725 inventoryMovementTypeInstance = new InventoryMovementType(name: "Correction Increase", 726 incrementsInventory: true) 727 saveAndTest(inventoryMovementTypeInstance) 728 729 // InventoryMovementType #5 730 inventoryMovementTypeInstance = new InventoryMovementType(name: "Correction Decrease", 731 incrementsInventory: false) 719 732 saveAndTest(inventoryMovementTypeInstance) 720 733 } -
trunk/grails-app/views/inventoryMovementDetailed/create.gsp
r175 r177 41 41 <td valign="top" class="value ${hasErrors(bean:inventoryMovementInstance,field:'quantity','errors')}"> 42 42 <input type="text" id="quantity" name="quantity" value="${fieldValue(bean:inventoryMovementInstance,field:'quantity')}"/> 43 ${inventoryMovementInstance.inventoryItem}44 43 </td> 45 44 </tr> … … 47 46 <tr class="prop"> 48 47 <td valign="top" class="name"> 49 <label for="inventoryMovementType"> InventoryMovement Type:</label>48 <label for="inventoryMovementType">Movement Type:</label> 50 49 </td> 51 50 <td valign="top" class="value ${hasErrors(bean:inventoryMovementInstance,field:'inventoryMovementType','errors')}"> -
trunk/grails-app/views/inventoryMovementDetailed/show.gsp
r175 r177 15 15 <div class="message">${flash.message}</div> 16 16 </g:if> 17 <g:hasErrors bean="${inventoryMovementInstance}"> 18 <div class="errors"> 19 <g:renderErrors bean="${inventoryMovementInstance}" as="list" /> 20 </div> 21 </g:hasErrors> 17 22 <div class="dialog"> 18 23 <table> -
trunk/grails-app/views/inventoryMovementType/create.gsp
r151 r177 5 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 6 6 <meta name="layout" content="main" /> 7 <title>Create InventoryMovementType</title> 7 <title>Create InventoryMovementType</title> 8 8 </head> 9 9 <body> 10 10 <div class="nav"> 11 <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>12 11 <span class="menuButton"><g:link class="list" action="list">InventoryMovementType List</g:link></span> 13 12 </div> … … 33 32 <td valign="top" class="value ${hasErrors(bean:inventoryMovementTypeInstance,field:'description','errors')}"> 34 33 <input type="text" id="description" name="description" value="${fieldValue(bean:inventoryMovementTypeInstance,field:'description')}"/> 34 </td> 35 </tr> 36 37 <tr class="prop"> 38 <td valign="top" class="name"> 39 <label for="incrementsInventory">Increments Inventory:</label> 40 </td> 41 <td valign="top" class="value ${hasErrors(bean:inventoryMovementTypeInstance,field:'incrementsInventory','errors')}"> 42 <g:checkBox name="incrementsInventory" value="${inventoryMovementTypeInstance?.incrementsInventory}" ></g:checkBox> 35 43 </td> 36 44 </tr> -
trunk/grails-app/views/inventoryMovementType/edit.gsp
r151 r177 9 9 <body> 10 10 <div class="nav"> 11 <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>12 11 <span class="menuButton"><g:link class="list" action="list">InventoryMovementType List</g:link></span> 13 12 <span class="menuButton"><g:link class="create" action="create">New InventoryMovementType</g:link></span> … … 36 35 <td valign="top" class="value ${hasErrors(bean:inventoryMovementTypeInstance,field:'description','errors')}"> 37 36 <input type="text" id="description" name="description" value="${fieldValue(bean:inventoryMovementTypeInstance,field:'description')}"/> 37 </td> 38 </tr> 39 40 <tr class="prop"> 41 <td valign="top" class="name"> 42 <label for="incrementsInventory">Increments Inventory:</label> 43 </td> 44 <td valign="top" class="value ${hasErrors(bean:inventoryMovementTypeInstance,field:'incrementsInventory','errors')}"> 45 <g:checkBox name="incrementsInventory" value="${inventoryMovementTypeInstance?.incrementsInventory}" ></g:checkBox> 38 46 </td> 39 47 </tr> -
trunk/grails-app/views/inventoryMovementType/list.gsp
r151 r177 9 9 <body> 10 10 <div class="nav"> 11 <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>12 11 <span class="menuButton"><g:link class="create" action="create">New InventoryMovementType</g:link></span> 13 12 </div> … … 26 25 <g:sortableColumn property="description" title="Description" /> 27 26 27 <g:sortableColumn property="incrementsInventory" title="Increments Inventory" /> 28 28 29 <g:sortableColumn property="isActive" title="Is Active" /> 29 30 … … 39 40 40 41 <td>${fieldValue(bean:inventoryMovementTypeInstance, field:'description')}</td> 42 43 <td>${fieldValue(bean:inventoryMovementTypeInstance, field:'incrementsInventory')}</td> 41 44 42 45 <td>${fieldValue(bean:inventoryMovementTypeInstance, field:'isActive')}</td> -
trunk/grails-app/views/inventoryMovementType/show.gsp
r151 r177 9 9 <body> 10 10 <div class="nav"> 11 <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>12 11 <span class="menuButton"><g:link class="list" action="list">InventoryMovementType List</g:link></span> 13 12 <span class="menuButton"><g:link class="create" action="create">New InventoryMovementType</g:link></span> … … 34 33 35 34 <td valign="top" class="value">${fieldValue(bean:inventoryMovementTypeInstance, field:'description')}</td> 35 36 </tr> 37 38 <tr class="prop"> 39 <td valign="top" class="name">Increments Inventory:</td> 40 41 <td valign="top" class="value">${fieldValue(bean:inventoryMovementTypeInstance, field:'incrementsInventory')}</td> 36 42 37 43 </tr>
Note: See TracChangeset
for help on using the changeset viewer.