source: main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/interfaces.py @ 7055

Last change on this file since 7055 was 6931, checked in by Henrik Bettermann, 13 years ago

Allow empty AC batches.

File size: 2.1 KB
Line 
1"""Interfaces of access code related components.
2"""
3from zope import schema
4from zope.interface import Interface
5from waeup.sirp.interfaces import IWAeUPObject
6
7class IAccessCode(IWAeUPObject):
8    """An access code.
9    """
10    batch_serial = schema.Int(
11        title = u'Serial number inside batch',
12        )
13    batch_prefix = schema.TextLine(
14        title = u'Prefix inside batch',
15        )
16    batch_num = schema.Int(
17        title = u'Batch number',
18        )
19    random_num = schema.TextLine(
20        title = u'Random part of access code.',
21        )
22    cost = schema.Float(
23        title = u'Cost of access code',
24        default = 0.0, min = 0.0,
25        )
26    state = schema.TextLine(
27        title = u'Workflow state',
28        )
29    representation = schema.TextLine(
30        title = u'Complete title of access code',
31        )
32    owner = schema.TextLine(
33        title = u'Purchaser',
34        )
35    history = schema.Text(
36        title = u'The history of access code as lines',
37        default = u'',
38        readonly = True,
39       )
40
41class IAccessCodeBatch(Interface):
42    """A factory for batches of access codes.
43    """
44    creation_date = schema.Date(
45        title = u'Creation date',
46        )
47    creator = schema.TextLine(
48        title = u'Batch creator',
49        )
50    prefix = schema.TextLine(
51        title = u'Batch prefix',
52        )
53    num = schema.Int(
54        title = u'Batch number (1-3 digits)',
55        min = 0, max = 999,
56        )
57    entry_num = schema.Int(
58        title = u'Number of access codes',
59        default = 1000, min = 0,
60        )
61    cost = schema.Float(
62        title = u'Cost of access code',
63        default = 0.0, min = 0.0,
64        )
65    disabled_num = schema.Int(
66        title = u'Number of disabled access codes inside the batch',
67        default = 0,
68        readonly = True,
69        )
70    used_num = schema.Int(
71        title = u'Number of used access codes inside the batch',
72        default = 0,
73        readonly = True,
74        )
75
76class IAccessCodeBatchContainer(IWAeUPObject):
77    """A container for access code batches.
78    """
79
80    def addBatch(batch):
81        """Add a batch.
82        """
Note: See TracBrowser for help on using the repository browser.