Changeset 633 for trunk/grails-app/services/InventoryPurchaseService.groovy
- Timestamp:
- Jul 19, 2010, 8:47:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/InventoryPurchaseService.groovy
r610 r633 89 89 } 90 90 91 /** 92 * Get costCodes by person and the purchasingGroups they have been assigned. 93 * @param person A Person, defaults to currentUser. 94 * @returns A list of CostCodes. 95 */ 96 def getCostCodesByPerson(person = authService.currentUser) { 97 if(person.purchasingGroups) { 98 CostCode.withCriteria { 99 eq('isActive', true) 100 or { 101 person.purchasingGroups.each() { purchasingGroup -> 102 eq('purchasingGroup', purchasingGroup) 103 } 104 } 105 }.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } // withCriteria 106 } 107 else 108 [] 109 } // getCostCodesByPerson 110 111 /** 112 * Check if a person is in a purchasing group. 113 * @param person A PurchasingGroup to check for. 114 * @param person A Person, defaults to currentUser. 115 * @returns True if person is in group. 116 */ 117 def isPersonInPurchasingGroup(purchasingGroup, person = authService.currentUser) { 118 for(pg in person.purchasingGroups) { 119 if(pg.id == purchasingGroup.id) 120 return true 121 } 122 } // isPersonInPurchasingGroup 123 91 124 def delete(params) { 92 125 InventoryItemPurchase.withTransaction { status ->
Note: See TracChangeset
for help on using the changeset viewer.