Changeset 633 for trunk/grails-app/domain
- Timestamp:
- Jul 19, 2010, 8:47:38 AM (14 years ago)
- Location:
- trunk/grails-app/domain
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/CostCode.groovy
r441 r633 1 1 class CostCode { 2 3 PurchasingGroup purchasingGroup 4 2 5 String name 3 6 String description = "" … … 7 10 8 11 static constraints = { 9 name(maxSize:50,unique:true,blank:false) 12 name(blank:false, maxSize:50, validator: {val, obj -> 13 // Name must be unique for a purchasingGroup. 14 def list = CostCode.withCriteria { 15 eq('purchasingGroup', obj.purchasingGroup) 16 eq('name', obj.name) 17 if(obj.id) 18 notEqual('id', obj.id) 19 } 20 if(list.size() > 0) 21 return 'not.unique.for.purchasing.group' 22 // Success. 23 return true 24 }) 10 25 description(maxSize:100) 11 26 } 12 27 13 28 String toString() { 14 "${this.name} "29 "${this.name}.${this.purchasingGroup}" 15 30 } 31 16 32 } -
trunk/grails-app/domain/Person.groovy
r402 r633 7 7 tasks: Task, 8 8 contacts: Contact, 9 addresses: Address] 9 addresses: Address, 10 purchasingGroups: PurchasingGroup] 10 11 11 12 static belongsTo = [Authority] … … 68 69 } 69 70 71 // This additional setter is used to convert the checkBoxList string or string array 72 // of ids selected to the corresponding domain objects. 73 public void setPurchasingGroupsFromCheckBoxList(ids) { 74 def idList = [] 75 if(ids instanceof String) { 76 if(ids.isInteger()) 77 idList << ids.toInteger() 78 } 79 else { 80 ids.each() { 81 if(it.isInteger()) 82 idList << it.toInteger() 83 } 84 } 85 this.purchasingGroups = idList.collect { PurchasingGroup.get( it ) } 86 } 87 70 88 } // end class
Note: See TracChangeset
for help on using the changeset viewer.