source: branches/features/purchaseOrders/grails-app/domain/PurchaseOrderNumber.groovy @ 895

Last change on this file since 895 was 895, checked in by gav, 13 years ago

Add constraints to PurchaseOrderNumber.value property.

File size: 419 bytes
RevLine 
[892]1class PurchaseOrderNumber {
[891]2
3    PurchaseOrder purchaseOrder
4
[892]5    String value
6
[891]7    static transients = ['description']
8
9    static constraints = {
[895]10        value(unique:true, blank:false, maxSize:25)
[891]11        purchaseOrder(nullable:true)
12    }
13
14    String getDescription() {
[892]15        if (!purchaseOrder)
16            return "${value} - new"
17        else
[891]18            return "${value} for ${purchaseOrder.supplier}"
19    }
20}
Note: See TracBrowser for help on using the repository browser.