Changeset 122 for trunk/grails-app/controllers/EntryTypeController.groovy
- Timestamp:
- May 1, 2009, 3:27:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/EntryTypeController.groovy
r116 r122 9 9 10 10 def list = { 11 if(!params.max) params.max = 1012 [ entryTypeInstanceList: EntryType.list( params ) ]11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ entryTypeInstanceList: EntryType.list( params ), entryTypeInstanceTotal: EntryType.count() ] 13 13 } 14 14 … … 26 26 def entryTypeInstance = EntryType.get( params.id ) 27 27 if(entryTypeInstance) { 28 entryTypeInstance.delete() 29 flash.message = "EntryType ${params.id} deleted" 30 redirect(action:list) 28 try { 29 entryTypeInstance.delete() 30 flash.message = "EntryType ${params.id} deleted" 31 redirect(action:list) 32 } 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "EntryType ${params.id} could not be deleted" 35 redirect(action:show,id:params.id) 36 } 31 37 } 32 38 else { … … 51 57 def entryTypeInstance = EntryType.get( params.id ) 52 58 if(entryTypeInstance) { 59 if(params.version) { 60 def version = params.version.toLong() 61 if(entryTypeInstance.version > version) { 62 63 entryTypeInstance.errors.rejectValue("version", "entryType.optimistic.locking.failure", "Another user has updated this EntryType while you were editing.") 64 render(view:'edit',model:[entryTypeInstance:entryTypeInstance]) 65 return 66 } 67 } 53 68 entryTypeInstance.properties = params 54 69 if(!entryTypeInstance.hasErrors() && entryTypeInstance.save()) {
Note: See TracChangeset
for help on using the changeset viewer.