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