Changeset 595 for trunk/grails-app/controllers
- Timestamp:
- Jun 11, 2010, 11:44:49 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemPurchaseDetailedController.groovy
r594 r595 75 75 } 76 76 else { 77 params.sort = " purchaseOrderNumber"78 params.order = " desc"77 params.sort = "id" 78 params.order = "asc" 79 79 } 80 80 81 81 if(isFilterApplied) { 82 82 // filterPane: 83 params.sort = params.sort ?: "id"84 params.order = params.order ?: "desc"85 83 //if(params.sort == "attentionFlag") // See ticket #64 in Trac. 86 84 //params.sort = "id" … … 175 173 def show = { 176 174 def inventoryItemPurchaseInstance = InventoryItemPurchase.read( params.id ) 175 params.returnTo = params.returnTo ?: 'inventoryItem' 177 176 178 177 if(!inventoryItemPurchaseInstance) { … … 188 187 if(!result.error) { 189 188 flash.message = g.message(code: "default.delete.success", args: ["InventoryItemPurchase", params.id]) 190 redirect(controller: 'inventoryItemDetailed', 191 action: 'show', 192 id: result.inventoryItemId, 193 params: [showTab: "showPurchasingTab"]) 189 if(params.returnTo == 'inventoryItem') { 190 redirect(controller: 'inventoryItemDetailed', 191 action: 'show', 192 id: result.inventoryItemId, 193 params: [showTab: "showPurchasingTab"]) 194 } 195 else { 196 redirect(action: 'search') 197 } 194 198 return 195 199 } … … 207 211 def edit = { 208 212 def result = inventoryPurchaseService.edit(params) 213 params.returnTo = params.returnTo ?: 'inventoryItem' 209 214 210 215 if(!result.error) … … 236 241 def inventoryItemPurchaseInstance = new InventoryItemPurchase() 237 242 inventoryItemPurchaseInstance.properties = params 243 params.returnTo = params.returnTo ?: 'inventoryItem' 238 244 239 245 if(!inventoryItemPurchaseInstance.inventoryItem) { … … 251 257 if(!result.error) { 252 258 flash.message = g.message(code: "default.create.success", args: ["Inventory Purchase", '']) 253 redirect(controller: 'inventoryItemDetailed', 254 action: 'show', 255 id: result.inventoryItemId, 256 params: [showTab: "showPurchasingTab"]) 259 if(params.returnTo == 'inventoryItem') { 260 redirect(controller: 'inventoryItemDetailed', 261 action: 'show', 262 id: result.inventoryItemId, 263 params: [showTab: "showPurchasingTab"]) 264 } 265 else { 266 redirect(action: 'search') 267 } 257 268 return 258 269 } … … 271 282 272 283 inventoryItemPurchaseInstance.properties = params 284 params.returnTo = params.returnTo ?: 'inventoryItem' 273 285 def calcQuantities = inventoryPurchaseService.calcQuantities(inventoryItemPurchaseInstance) 274 286 inventoryItemPurchaseInstance.quantity = calcQuantities.thisOrderRemaining … … 282 294 if(!result.error) { 283 295 flash.message = g.message(code: "default.create.success", args: ["Inventory Purchase", '']) 284 redirect(controller: 'inventoryItemDetailed', 285 action: 'show', 286 id: result.inventoryItemId, 287 params: [showTab: "showPurchasingTab"]) 296 if(params.returnTo == 'inventoryItem') { 297 redirect(controller: 'inventoryItemDetailed', 298 action: 'show', 299 id: result.inventoryItemId, 300 params: [showTab: "showPurchasingTab"]) 301 } 302 else { 303 redirect(action: 'search') 304 } 288 305 return 289 306 } … … 311 328 312 329 inventoryItemPurchaseInstance.properties = params 330 params.returnTo = params.returnTo ?: 'inventoryItem' 313 331 return ['inventoryItemPurchaseInstance':inventoryItemPurchaseInstance, 314 332 'orderId': inventoryItemPurchaseInstance.id] … … 320 338 if(!result.error) { 321 339 flash.message = g.message(code: "default.create.success", args: ["Inventory Purchase", '']) 322 redirect(controller: 'inventoryItemDetailed', 323 action: 'show', 324 id: result.inventoryItemId, 325 params: [showTab: "showPurchasingTab"]) 340 if(params.returnTo == 'inventoryItem') { 341 redirect(controller: 'inventoryItemDetailed', 342 action: 'show', 343 id: result.inventoryItemId, 344 params: [showTab: "showPurchasingTab"]) 345 } 346 else { 347 redirect(action: 'search') 348 } 326 349 return 327 350 }
Note: See TracChangeset
for help on using the changeset viewer.