Changeset 224 for trunk/grails-app


Ignore:
Timestamp:
Dec 8, 2009, 3:19:23 AM (15 years ago)
Author:
gav
Message:

List the inventory movements for an inventoryItem.

Location:
trunk/grails-app
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/InventoryMovementDetailedController.groovy

    r205 r224  
    2323        }
    2424        else { return [ inventoryMovementInstance : inventoryMovementInstance ] }
     25    }
     26
     27    /**
     28    * List the inventory movements for an InventoryItem.
     29    * @param params.id The id of an existing inventory item.
     30    */
     31    def listInventoryMovements = {
     32        def inventoryItemInstance = InventoryItem.get(params.id)
     33
     34        if(!inventoryItemInstance) {
     35            flash.message = "Inventory item not found with id ${params.id}"
     36            redirect(controller:'inventoryItemDetailed', action: 'search')
     37        }
     38
     39        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     40        def inventoryMovementList = InventoryMovement.findAllByInventoryItem(inventoryItemInstance, params)
     41        def inventoryMovementListTotal = InventoryMovement.countByInventoryItem(inventoryItemInstance)
     42
     43        [ inventoryMovementList: inventoryMovementList,
     44            inventoryMovementListTotal:  inventoryMovementListTotal,
     45            inventoryItemInstance: inventoryItemInstance]
    2546    }
    2647
Note: See TracChangeset for help on using the changeset viewer.