Changeset 720 for trunk/grails-app/services/InventoryItemService.groovy
- Timestamp:
- Nov 25, 2010, 9:08:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/InventoryItemService.groovy
r636 r720 13 13 def sessionFactory 14 14 def propertyInstanceMap = org.codehaus.groovy.grails.plugins.DomainClassGrailsPlugin.PROPERTY_INSTANCE_MAP 15 16 /**17 * Prepare a sorted list of possible alternateItems.18 */19 def getPossibleAlternateItems(inventoryItemInstance) {20 def criteria = inventoryItemInstance.createCriteria()21 def possibleAlternateItems = criteria {22 and {23 eq('isActive', true)24 notEqual('id', inventoryItemInstance.id)25 }26 }.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }27 }28 15 29 16 /** … … 129 116 return fail(code:"inventoryMovement.still.associated") 130 117 131 result.inventoryItemInstance.removeReverseAlternateItems()132 133 118 try { 134 119 result.inventoryItemInstance.delete(flush:true) … … 181 166 } 182 167 183 def previousAlternateItems = new ArrayList(result.inventoryItemInstance.alternateItems)184 185 168 result.inventoryItemInstance.properties = params 186 169 187 170 if(result.inventoryItemInstance.hasErrors() || !result.inventoryItemInstance.save()) 188 171 return fail(code:"default.update.failure") 189 190 result.inventoryItemInstance.removeReverseAlternateItems(previousAlternateItems)191 result.inventoryItemInstance.addReverseAlternateItems()192 172 193 173 // Success.
Note: See TracChangeset
for help on using the changeset viewer.