source: main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/interfaces.py @ 12699

Last change on this file since 12699 was 9266, checked in by Henrik Bettermann, 12 years ago

Repair and optimize AccessCodeProcessor?. AC states and transitions can now be imported in create and update mode.

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1## $Id: interfaces.py 9266 2012-10-02 06:43:52Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Interfaces of access code related components.
19"""
20from zope import schema
21from zope.interface import Interface
22from waeup.kofa.interfaces import IKofaObject
23from waeup.kofa.interfaces import MessageFactory as _
24
25class IAccessCode(IKofaObject):
26    """An access code.
27    """
28    batch_serial = schema.Int(
29        title = _(u'Serial number inside batch'),
30        )
31    batch_prefix = schema.TextLine(
32        title = _(u'Prefix inside batch'),
33        )
34    batch_num = schema.Int(
35        title = _(u'Batch number'),
36        )
37    random_num = schema.TextLine(
38        title = _(u'Random part of access code'),
39        )
40    cost = schema.Float(
41        title = _(u'Cost of access code'),
42        )
43    state = schema.TextLine(
44        title = _(u'Workflow state'),
45        required = False,
46        )
47    representation = schema.TextLine(
48        title = _(u'Complete title of access code'),
49        )
50    owner = schema.TextLine(
51        title = _(u'Purchaser'),
52        required = False,
53        )
54    history = schema.Text(
55        title = _(u'The history of access code as lines'),
56        default = u'',
57        readonly = True,
58        required = False,
59       )
60
61class IAccessCodeBatch(Interface):
62    """A factory for batches of access codes.
63    """
64    creation_date = schema.Datetime(
65        title = _(u'Creation date'),
66        )
67    creator = schema.TextLine(
68        title = _(u'Batch creator'),
69        )
70    prefix = schema.TextLine(
71        title = _(u'Batch prefix'),
72        )
73    num = schema.Int(
74        title = _(u'Batch number (1-3 digits)'),
75        min = 0, max = 999,
76        )
77    entry_num = schema.Int(
78        title = _(u'Number of access codes'),
79        default = 1000, min = 0,
80        )
81    cost = schema.Float(
82        title = _(u'Cost of access code'),
83        default = 0.0, min = 0.0,
84        )
85    disabled_num = schema.Int(
86        title = _(u'Number of disabled access codes inside the batch'),
87        default = 0,
88        readonly = True,
89        )
90    used_num = schema.Int(
91        title = _(u'Number of used access codes inside the batch'),
92        default = 0,
93        readonly = True,
94        )
95
96class IAccessCodeBatchContainer(IKofaObject):
97    """A container for access code batches.
98    """
99
100    def addBatch(batch):
101        """Add a batch.
102        """
Note: See TracBrowser for help on using the repository browser.