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

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

Add constraints to PurchaseOrderNumber.value property.

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