Ignore:
Timestamp:
24 Oct 2012, 21:31:48 (12 years ago)
Author:
Henrik Bettermann
Message:

Make payment categories more easily customizable.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/payments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py

    r9243 r9405  
    1818from zope.interface import Attribute
    1919from zope import schema
     20from waeup.kofa.university.vocabularies import ContextualDictSourceFactoryBase
    2021from waeup.kofa.interfaces import (
    2122    IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab)
     
    2829    )
    2930
    30 payment_categories = SimpleKofaVocabulary(
    31     (_('School Fee'),'schoolfee'),
    32     (_('Acceptance Fee'),'clearance'),
    33     (_('Bed Allocation Fee'),'bed_allocation'),
    34     (_('Hostel Maintenance Fee'),'hostel_maintenance'),
    35     (_('Transfer Fee'),'transfer'),
    36     (_('Gown Hire Fee'),'gown'),
    37     (_('Application Fee'), 'application'),
    38     )
     31class PaymentCategorySource(ContextualDictSourceFactoryBase):
     32    """A application category source delivers all special handling categories
     33    provided for accommodation booking.
     34    """
     35    #: name of dict to deliver from kofa utils.
     36    DICT_NAME = 'PAYMENT_CATEGORIES'
    3937
    4038class IPaymentsContainer(IKofaObject):
     
    5250        title = _(u'Payment Category'),
    5351        default = u'schoolfee',
    54         vocabulary = payment_categories,
     52        source = PaymentCategorySource(),
    5553        required = True,
    5654        )
  • main/waeup.kofa/trunk/src/waeup/kofa/payments/payment.py

    r9149 r9405  
    2828from waeup.kofa.payments.interfaces import (
    2929    IPayment, ISCPayment, IOnlinePayment,
    30     payment_states, payment_categories)
     30    payment_states)
    3131from waeup.kofa.utils.helpers import attrs_to_fields, get_current_principal
    3232
     
    5050    @property
    5151    def category(self):
    52         return payment_categories.getTermByToken(self.p_category).title
     52        utils = getUtility(IKofaUtils)
     53        return utils.PAYMENT_CATEGORIES[self.p_category]
    5354
    5455# not used
Note: See TracChangeset for help on using the changeset viewer.