Changeset 175 for trunk/grails-app/controllers
- Timestamp:
- Oct 29, 2009, 8:30:58 PM (15 years ago)
- Location:
- trunk/grails-app/controllers
- Files:
-
- 1 added
- 2 deleted
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemController.groovy
r116 r175 27 27 if(inventoryItemInstance) { 28 28 try { 29 inventoryItemInstance.delete( )29 inventoryItemInstance.delete(flush:true) 30 30 flash.message = "InventoryItem ${params.id} deleted" 31 31 redirect(action:list) … … 77 77 else { 78 78 flash.message = "InventoryItem not found with id ${params.id}" 79 redirect(action: edit,id:params.id)79 redirect(action:list) 80 80 } 81 81 } -
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r156 r175 48 48 if(inventoryItemInstance) { 49 49 try { 50 inventoryItemInstance.delete( )50 inventoryItemInstance.delete(flush:true) 51 51 flash.message = "InventoryItem ${params.id} deleted" 52 52 redirect(action:search) … … 103 103 else { 104 104 flash.message = "InventoryItem not found with id ${params.id}" 105 redirect(action: edit,id:params.id)105 redirect(action:search) 106 106 } 107 107 } -
trunk/grails-app/controllers/InventoryLocationController.groovy
r162 r175 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class StoreLocationController extends BaseAppAdminController {3 class InventoryLocationController extends BaseAppAdminController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ storeLocationInstanceList: StoreLocation.list( params ), storeLocationInstanceTotal: StoreLocation.count() ]12 [ inventoryLocationInstanceList: InventoryLocation.list( params ), inventoryLocationInstanceTotal: InventoryLocation.count() ] 13 13 } 14 14 15 15 def show = { 16 def storeLocationInstance = StoreLocation.get( params.id )16 def inventoryLocationInstance = InventoryLocation.get( params.id ) 17 17 18 if(! storeLocationInstance) {19 flash.message = " StoreLocation not found with id ${params.id}"18 if(!inventoryLocationInstance) { 19 flash.message = "InventoryLocation not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ storeLocationInstance : storeLocationInstance ] }22 else { return [ inventoryLocationInstance : inventoryLocationInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def storeLocationInstance = StoreLocation.get( params.id )27 if( storeLocationInstance) {26 def inventoryLocationInstance = InventoryLocation.get( params.id ) 27 if(inventoryLocationInstance) { 28 28 try { 29 storeLocationInstance.delete()30 flash.message = " StoreLocation ${params.id} deleted"29 inventoryLocationInstance.delete(flush:true) 30 flash.message = "InventoryLocation ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = " StoreLocation ${params.id} could not be deleted"34 flash.message = "InventoryLocation ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = " StoreLocation not found with id ${params.id}"39 flash.message = "InventoryLocation not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def storeLocationInstance = StoreLocation.get( params.id )45 def inventoryLocationInstance = InventoryLocation.get( params.id ) 46 46 47 if(! storeLocationInstance) {48 flash.message = " StoreLocation not found with id ${params.id}"47 if(!inventoryLocationInstance) { 48 flash.message = "InventoryLocation not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ storeLocationInstance : storeLocationInstance ]52 return [ inventoryLocationInstance : inventoryLocationInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def storeLocationInstance = StoreLocation.get( params.id )58 if( storeLocationInstance) {57 def inventoryLocationInstance = InventoryLocation.get( params.id ) 58 if(inventoryLocationInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if( storeLocationInstance.version > version) {61 if(inventoryLocationInstance.version > version) { 62 62 63 storeLocationInstance.errors.rejectValue("version", "storeLocation.optimistic.locking.failure", "Another user has updated this StoreLocation while you were editing.")64 render(view:'edit',model:[ storeLocationInstance:storeLocationInstance])63 inventoryLocationInstance.errors.rejectValue("version", "inventoryLocation.optimistic.locking.failure", "Another user has updated this InventoryLocation while you were editing.") 64 render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) 65 65 return 66 66 } 67 67 } 68 storeLocationInstance.properties = params69 if(! storeLocationInstance.hasErrors() && storeLocationInstance.save()) {70 flash.message = " StoreLocation ${params.id} updated"71 redirect(action:show,id: storeLocationInstance.id)68 inventoryLocationInstance.properties = params 69 if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { 70 flash.message = "InventoryLocation ${params.id} updated" 71 redirect(action:show,id:inventoryLocationInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[ storeLocationInstance:storeLocationInstance])74 render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = " StoreLocation not found with id ${params.id}"79 redirect(action: edit,id:params.id)78 flash.message = "InventoryLocation not found with id ${params.id}" 79 redirect(action:list) 80 80 } 81 81 } 82 82 83 83 def create = { 84 def storeLocationInstance = new StoreLocation()85 storeLocationInstance.properties = params86 return [' storeLocationInstance':storeLocationInstance]84 def inventoryLocationInstance = new InventoryLocation() 85 inventoryLocationInstance.properties = params 86 return ['inventoryLocationInstance':inventoryLocationInstance] 87 87 } 88 88 89 89 def save = { 90 def storeLocationInstance = new StoreLocation(params)91 if(! storeLocationInstance.hasErrors() && storeLocationInstance.save()) {92 flash.message = " StoreLocation ${storeLocationInstance.id} created"93 redirect(action:show,id: storeLocationInstance.id)90 def inventoryLocationInstance = new InventoryLocation(params) 91 if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { 92 flash.message = "InventoryLocation ${inventoryLocationInstance.id} created" 93 redirect(action:show,id:inventoryLocationInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[ storeLocationInstance:storeLocationInstance])96 render(view:'create',model:[inventoryLocationInstance:inventoryLocationInstance]) 97 97 } 98 98 } -
trunk/grails-app/controllers/InventoryLocationDetailedController.groovy
r162 r175 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class StoreLocationDetailedController extends BaseController {3 class InventoryLocationDetailedController extends BaseController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ storeLocationInstanceList: StoreLocation.list( params ), storeLocationInstanceTotal: StoreLocation.count() ]12 [ inventoryLocationInstanceList: InventoryLocation.list( params ), inventoryLocationInstanceTotal: InventoryLocation.count() ] 13 13 } 14 14 15 15 def show = { 16 def storeLocationInstance = StoreLocation.get( params.id )16 def inventoryLocationInstance = InventoryLocation.get( params.id ) 17 17 18 if(! storeLocationInstance) {19 flash.message = " StoreLocation not found with id ${params.id}"18 if(!inventoryLocationInstance) { 19 flash.message = "InventoryLocation not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ storeLocationInstance : storeLocationInstance ] }22 else { return [ inventoryLocationInstance : inventoryLocationInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def storeLocationInstance = StoreLocation.get( params.id )27 if( storeLocationInstance) {26 def inventoryLocationInstance = InventoryLocation.get( params.id ) 27 if(inventoryLocationInstance) { 28 28 try { 29 storeLocationInstance.delete()30 flash.message = " StoreLocation ${params.id} deleted"29 inventoryLocationInstance.delete(flush:true) 30 flash.message = "InventoryLocation ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = " StoreLocation ${params.id} could not be deleted"34 flash.message = "InventoryLocation ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = " StoreLocation not found with id ${params.id}"39 flash.message = "InventoryLocation not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def storeLocationInstance = StoreLocation.get( params.id )45 def inventoryLocationInstance = InventoryLocation.get( params.id ) 46 46 47 if(! storeLocationInstance) {48 flash.message = " StoreLocation not found with id ${params.id}"47 if(!inventoryLocationInstance) { 48 flash.message = "InventoryLocation not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ storeLocationInstance : storeLocationInstance ]52 return [ inventoryLocationInstance : inventoryLocationInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def storeLocationInstance = StoreLocation.get( params.id )58 if( storeLocationInstance) {57 def inventoryLocationInstance = InventoryLocation.get( params.id ) 58 if(inventoryLocationInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if( storeLocationInstance.version > version) {61 if(inventoryLocationInstance.version > version) { 62 62 63 storeLocationInstance.errors.rejectValue("version", "storeLocation.optimistic.locking.failure", "Another user has updated this StoreLocation while you were editing.")64 render(view:'edit',model:[ storeLocationInstance:storeLocationInstance])63 inventoryLocationInstance.errors.rejectValue("version", "inventoryLocation.optimistic.locking.failure", "Another user has updated this InventoryLocation while you were editing.") 64 render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) 65 65 return 66 66 } 67 67 } 68 storeLocationInstance.properties = params69 if(! storeLocationInstance.hasErrors() && storeLocationInstance.save()) {70 flash.message = " StoreLocation ${params.id} updated"71 redirect(action:show,id: storeLocationInstance.id)68 inventoryLocationInstance.properties = params 69 if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { 70 flash.message = "InventoryLocation ${params.id} updated" 71 redirect(action:show,id:inventoryLocationInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[ storeLocationInstance:storeLocationInstance])74 render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = " StoreLocation not found with id ${params.id}"79 redirect(action: edit,id:params.id)78 flash.message = "InventoryLocation not found with id ${params.id}" 79 redirect(action:list) 80 80 } 81 81 } 82 82 83 83 def create = { 84 def storeLocationInstance = new StoreLocation()85 storeLocationInstance.properties = params86 return [' storeLocationInstance':storeLocationInstance]84 def inventoryLocationInstance = new InventoryLocation() 85 inventoryLocationInstance.properties = params 86 return ['inventoryLocationInstance':inventoryLocationInstance] 87 87 } 88 88 89 89 def save = { 90 def storeLocationInstance = new StoreLocation(params)91 if(! storeLocationInstance.hasErrors() && storeLocationInstance.save()) {92 flash.message = " StoreLocation ${storeLocationInstance.id} created"93 redirect(action:show,id: storeLocationInstance.id)90 def inventoryLocationInstance = new InventoryLocation(params) 91 if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { 92 flash.message = "InventoryLocation ${inventoryLocationInstance.id} created" 93 redirect(action:show,id:inventoryLocationInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[ storeLocationInstance:storeLocationInstance])96 render(view:'create',model:[inventoryLocationInstance:inventoryLocationInstance]) 97 97 } 98 98 } -
trunk/grails-app/controllers/InventoryMovementController.groovy
r116 r175 27 27 if(inventoryMovementInstance) { 28 28 try { 29 inventoryMovementInstance.delete( )29 inventoryMovementInstance.delete(flush:true) 30 30 flash.message = "InventoryMovement ${params.id} deleted" 31 31 redirect(action:list) … … 77 77 else { 78 78 flash.message = "InventoryMovement not found with id ${params.id}" 79 redirect(action: edit,id:params.id)79 redirect(action:list) 80 80 } 81 81 } -
trunk/grails-app/controllers/InventoryStoreController.groovy
r116 r175 27 27 if(inventoryStoreInstance) { 28 28 try { 29 inventoryStoreInstance.delete( )29 inventoryStoreInstance.delete(flush:true) 30 30 flash.message = "InventoryStore ${params.id} deleted" 31 31 redirect(action:list) … … 77 77 else { 78 78 flash.message = "InventoryStore not found with id ${params.id}" 79 redirect(action: edit,id:params.id)79 redirect(action:list) 80 80 } 81 81 } -
trunk/grails-app/controllers/TaskDetailedController.groovy
r169 r175 182 182 183 183 def subTaskInstanceList = Task.findAllByParentTask(taskInstance, params) 184 def subTaskInstanceTotal = Task.countByParentTask(taskInstance) 184 def subTaskInstanceTotal = Task.countByParentTask(taskInstance) 185 185 def showTaskTab = new String("true") 186 187 def inventoryMovementList = InventoryMovement.findAllByTask(taskInstance, [max:100, sort:"id", order:"desc", offset:0]) 186 188 187 189 def taskProcedureInstance = TaskProcedure.get(taskInstance.taskProcedure?.id) … … 190 192 taskProcedureExits = false 191 193 } 192 // else { 193 params.order = "asc" 194 params.sort = "procedureStepNumber" 195 def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params) 196 // } 197 194 195 params.order = "asc" 196 params.sort = "procedureStepNumber" 197 def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params) 198 198 199 def taskRecurringScheduleInstance = TaskRecurringSchedule.get(taskInstance.taskRecurringSchedule?.id) 199 200 def taskRecurringScheduleExits= new Boolean("true") 200 201 if(!taskRecurringScheduleInstance) { 201 202 taskRecurringScheduleExits = false 202 203 } … … 213 214 maintenanceActionList: maintenanceActionList, 214 215 taskRecurringScheduleInstance: taskRecurringScheduleInstance, 215 taskRecurringScheduleExits: taskRecurringScheduleExits] 216 taskRecurringScheduleExits: taskRecurringScheduleExits, 217 inventoryMovementList: inventoryMovementList] 216 218 } 217 219 }
Note: See TracChangeset
for help on using the changeset viewer.