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

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

Allow empty AC batches.

File size: 2.1 KB
RevLine 
[5068]1"""Interfaces of access code related components.
2"""
3from zope import schema
4from zope.interface import Interface
[5081]5from waeup.sirp.interfaces import IWAeUPObject
[5068]6
[5081]7class IAccessCode(IWAeUPObject):
[5068]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',
[5085]24        default = 0.0, min = 0.0,
[5068]25        )
[6470]26    state = schema.TextLine(
27        title = u'Workflow state',
[6450]28        )
[5098]29    representation = schema.TextLine(
30        title = u'Complete title of access code',
31        )
[6927]32    owner = schema.TextLine(
33        title = u'Purchaser',
34        )
[6423]35    history = schema.Text(
36        title = u'The history of access code as lines',
37        default = u'',
38        readonly = True,
39       )
[6413]40
[5068]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        )
[6415]50    prefix = schema.TextLine(
[5085]51        title = u'Batch prefix',
[5068]52        )
[6415]53    num = schema.Int(
[5085]54        title = u'Batch number (1-3 digits)',
55        min = 0, max = 999,
[5068]56        )
[5085]57    entry_num = schema.Int(
58        title = u'Number of access codes',
[6931]59        default = 1000, min = 0,
[5085]60        )
61    cost = schema.Float(
62        title = u'Cost of access code',
63        default = 0.0, min = 0.0,
64        )
[6425]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        )
[5081]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.